Skip to content

olli-ai/natsjwt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NATS JWT

Requirements / Installation

  • You need to have the nsc tool [https://github.com/nats-io/nsc] v2.5.0 installed on your machine as generating new user-seeds is not implemented in Python yet.
  • pip install https://github.com/rentouch/natsjwt/releases/download/0.1.0/natsjwt-0.1.0.tar.gz

Examples

Create a new user JWT

user_jwt = NJWT.new_user("user-name")
print(account_jwt.sing(b"SAAHUYE..."))

Do changes to an existing JWT

account_jwt = NJWT.from_account_jwt("eyJ0eXAiOiJ...")
account_jwt.revoke("UB5BZ7SZ...")
print(account_jwt.sing(b"SAAHUYEX..."))

More can be found in ./examples directory of this project.

Development of this package

Installation

  1. Make sure that you have poetry installed
  2. poetry install
  3. Set dev mode poetry run pip install -e .

Run the tests
poetry run pytest tests

Run examples
E.g. poetry run python examples/re-issue-account-jwt.py

Publishing to PyPI

  1. poetry build
  2. tbd

About

Generate / modify NATS JWT in Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%