Skip to content

AI translation

This page was translated from German with AI. If in doubt, the German original applies.

Signing with the SDK

Signing processes of the WebSigner via client.SignerApi.SigningProcesses.

The background in business terms is described in the guide Signing with the WebSigner.

In one call

SignAsync creates the process, submits it, gives you the link, and waits for the final state:

using System.Linq;
using Google.Protobuf;                 // ByteString
using Infotech.Signer.Sign.V1;         // DocumentInput, DocumentKind, SigningOptions, SigningProcessState
using Zedal.Sdk.Apis.Signer;           // DocumentResults

string processId = null;

var result = await client.SignerApi.SigningProcesses.SignAsync(
    new[]
    {
        new DocumentInput
        {
            DisplayName = "Lieferschein 4711",
            Kind = DocumentKind.Pdf,
            Content = ByteString.CopyFrom(pdf)
        }
    },
    new SigningOptions { Reason = "Übernahme bestätigt" },
    presentSigningUrl: url => ShowSigningLink(url),
    onSubmitted: process => processId = process.SigningProcessId,
    cancellationToken: cancellation);

foreach (var document in result.Results.Where(DocumentResults.IsUsable))
    Save(document.DisplayName, document.Content.ToByteArray());
  • Results is populated for COMPLETED and PARTIALLY_COMPLETED, otherwise empty. DocumentResults.IsUsable tells you for each document whether it is signed and the validation result does not reject it. result.Completed alone is not enough in the case of a partial success.
  • onSubmitted delivers the process ID before the wait begins. Keep it: the signing_url contains only a handover token, not the ID, and without the ID you cannot find a process again after an abort.
  • Waiting and canceling: The wait for the person runs without a time limit. A cancellationToken ends the call, regardless of whether it is currently creating, submitting, or waiting, and always arrives as OperationCanceledException. The process itself continues on the server; you can cancel it with CancelSigningProcess. An explicitly set time limit (ZedalCallContext.Default.WithTimeout(…)) also applies to the wait and ends with DeadlineExceeded.

In two steps

If you want to pass on the link and continue later, for example because a driver only signs at the pickup location, you separate submitting and retrieving:

var submitted = await client.SignerApi.SigningProcesses.SubmitAsync(documents);
Save(submitted.SigningProcessId);
SendToDriverApp(submitted.SigningUrl);

// later, for example in a background job
var process = await client.SignerApi.SigningProcesses.GetSigningProcess(processId);
if (process.State is SigningProcessState.Completed or SigningProcessState.PartiallyCompleted)
{
    var response = await client.SignerApi.SigningProcesses.GetResults(
        new GetResultsRequest { SigningProcessId = processId });
    // evaluate antwort.Results as above
}

GetResultsRequest lives in the namespace Infotech.Signer.Sign.V1.Api. Before a final state and during the visual review, GetResults responds with FAILED_PRECONDITION.

For an open connection, there is WatchSigningProcess: it reports every state change via a callback and ends with the first final state. If the stream breaks off, fall back to GetSigningProcess.