Skip to content

kevinresol/jsonwebtoken

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

jsonwebtoken Build Status

Use JsonWebToken in Haxe

Supported Algorithms
Target HS256 HS384 HS512 RS256 RS384 RS512 Remarks
all sys targets Using openssl cli
Node Using Node std lib
PHP Using PHP std lib
Java Using Java std lib
C# Using C# std lib
Python Using Python std lib
Interp Using Haxe std lib
Neko Using Haxe std lib
JS Using Haxe std lib
C++ Using Haxe std lib
Supported Verifications
  • Issuer
  • Audience
  • Expiry

Install

haxelib install jsonwebtoken

Usage

Signing

var crypto = new NodeCrypto(); // pick a crypto from the jsonwebtoken.crypto package
var signer = new BasicSigner(HS256('secret'), crypto);
var payload:Claims = {iss: 'issuer'}
signer.sign(payload).handle(function(o) switch o {
	case Success(token): trace(token);
	case Failure(e): trace('Failed to sign: $e');
});

Verifying

var crypto = new NodeCrypto(); // pick a crypto from the jsonwebtoken.crypto package
var verifier = new BasicVerifier(HS256('secret'), crypto, {iss: 'issuer'});
var token = ...;
verifier.verify(token).handle(function(o) switch o {
	case Success(_): trace('verified');
	case Failure(e): trace('Invalid token: $e');
});

About

JsonWebToken for Haxe

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published