Welcome to Python CWT

Python CWT is a CBOR Web Token (CWT) and CBOR Object Signing and Encryption (COSE) implementation compliant with:

It is designed to make users who already know about JSON Web Token (JWT) be able to use it in ease. Little knowledge of CBOR, COSE, and CWT is required to use it.

You can install Python CWT with pip:

$ pip install cwt

And then, you can use it as follows:

import cwt
from cwt import cose_key

key = cose_key.from_symmetric_key(alg="HMAC 256/256")
token = cwt.encode({"iss": "https://as.example", "sub": "dajiaji", "cti": "123"}, key)
decoded = cwt.decode(token, key)