jose.jws.sign

jose.jws

sign(payload, key, header) -> compact, err

Sign a payload in the compact serialization

The protected header carries alg from the key, kid from the key when the key has one and header does not, and every member of header as given: typ, nonce, url, jwk, kid. A header.alg that is not the key's is refused. Nothing else is added, so a header of one member encodes the same bytes every time. The payload is any string, empty included. Raises on a payload that is not a string or a key that is not a table.