jsonwebtoken

JsonWebToken for Haxe
https://github.com/kevinresol/jsonwebtoken

To install, run:

haxelib install jsonwebtoken 2.0.2 

See using Haxelib in Haxelib documentation for more information.

README.md

jsonwebtoken Build Status

Use JsonWebToken in Haxe

Supported Algorithms
TargetHS256HS384HS512RS256RS384RS512Remarks
all sys targetsUsing openssl cli
NodeUsing Node std lib
PHPUsing PHP std lib
JavaUsing Java std lib
C#Using C# std lib
PythonUsing Python std lib
InterpUsing Haxe std lib
NekoUsing Haxe std lib
JSUsing 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');
});
Contributors
kevinresol
Version
2.0.2
Published
1 year ago
License
MIT

All libraries are free

Every month, more than thousand developers use haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on Github!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on Github