Skip to content

a Basic implementation of JWS which is one of the datastructures that stores a JWT token. It is customized to one of my pet projects, not generalized

Notifications You must be signed in to change notification settings

medkhabt/Jws-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Example :

// Don't add the private key directly in code! this is just an illustration example.
// Initialization of hmac with the private key
	jws.Init("dasfasdf")
// Generating a JWT token in a JWS structure with a 'iss':[id] and 'exp':cst. 
	token := jws.GenerateJWSToken(1)
// Verifies the signature of the token, return true if it's valid 
	if jws.VerifyJWSToken(token) {
// Get the id out of the token, it includes the verification too. 
		id, err := jws.GetIdFromJWS(token)
		if err != nil {
			fmt.Printf("error hmm interesting : [%s].\n", err)
		}
		fmt.Printf("verification successeded with id %d.\n", id)
	} else {
		fmt.Println("token not valid")
	}

About

a Basic implementation of JWS which is one of the datastructures that stores a JWT token. It is customized to one of my pet projects, not generalized

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages