Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kevinresol/jsonwebtoken
JsonWebToken for Haxe
https://github.com/kevinresol/jsonwebtoken
haxe jsonwebtoken jwt
Last synced: 29 days ago
JSON representation
JsonWebToken for Haxe
- Host: GitHub
- URL: https://github.com/kevinresol/jsonwebtoken
- Owner: kevinresol
- License: mit
- Created: 2016-04-02T13:47:58.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-12-14T07:43:37.000Z (about 3 years ago)
- Last Synced: 2024-10-19T02:04:23.124Z (3 months ago)
- Topics: haxe, jsonwebtoken, jwt
- Language: Haxe
- Homepage:
- Size: 65.4 KB
- Stars: 27
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# jsonwebtoken [![Build Status](https://travis-ci.org/kevinresol/jsonwebtoken.svg?branch=master)](https://travis-ci.org/kevinresol/jsonwebtoken)
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
```haxe
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
```haxe
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');
});
```