encode

Endodes token using provided Singer algorithm and already prepared payload.

If header is also provided it's checked for correct alg header field and added if not set.

Both header and payload are expected to be a valid json object serialized string.

  1. int encode(S signer, O output, P payload)
    int
    encode
    (
    S
    O
    P
    )
    (
    auto ref S signer
    ,
    auto ref O output
    ,)
    if ()
  2. int encode(S signer, O output, H header, P payload)

Return Value

Type: int

-1 on error, otherwise number of characters written to the output.

Meta