JSON Web Tokens

This module allows handling JSON Web Tokens from Zerynth programs.

encode(payload, key, algo=ES256)

Encode a JWT for target payload signed with key.

Currently only HS256 and ES256 encoding algorithms are supported (ES256 using prime256v1curve)

key must be an ECDSA private key in hex format for ES256 or a bytes/string for HS256 If a private key is, for example, stored as a pem file, the needed hex string can be extracted from the OCTET STRING field associated value obtained from

openssl asn1parse -in my_private.pem

command (since pem is a base64 encoded, plus header, DER).