🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

pygo-jwt

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pygo-jwt

Encode and Decode RS256 JSON Web Tokens with Python and Go

0.0.9
PyPI
Maintainers
1

pygo-jwt

This project focuses on managing JSON Web Tokens signed with RS256. Inspired by pyjwt, this library provides core encode and decode functionality, utilizing the standard crypto package within Go instead of cryptography.

Example Usage for Python

pip install pygo-jwt
import pygo_jwt

private_jwk = pygo_jwt.new_jwk(size=2048)
private_pem = pygo_jwt.jwk_to_pem(private_jwk)

public_jwk = pygo_jwt.extract_public_jwk(private_jwk)
public_pem = pygo_jwt.extract_public_pem(private_pem)

payload = {'message': 'hello world', 'count': 4}
token = pygo_jwt.encode(payload=payload, key=private_pem, mode='pem')
token_data = pygo_jwt.decode(token=token, key=public_jwk, mode='jwk')

Example Usage for Go

go mod init main
go get github.com/rkhullar/python-libraries/pygo-jwt/pygo_jwt/go
package main

import (
	"fmt"
	lib "github.com/rkhullar/python-libraries/pygo-jwt/pygo_jwt/go/core"
)

func main() {
	private_jwk, _ := lib.NewJWK(2048, nil)
	private_pem, _ := lib.JWKToPEM(private_jwk)
	fmt.Println(private_jwk)
	fmt.Println(private_pem)
}

Keywords

python

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts