JWT authentication
A Wing library for working with JWT authentication.
Prerequisites
Installation
npm i @winglibs/jwt
Usage
bring util;
bring jwt;
test "will sign and verify" {
let id = util.nanoid();
let token = jwt.sign({ foo: id }, "shhhhh");
let decoded1 = jwt.verify(token, secret: "shhhhh");
}
License
This library is licensed under the MIT License.
API Reference
Table of Contents
- Classes
- Structs
Util (preflight class)
No description
Constructor
new(): Util
Properties
No properties
Methods
Signature | Description |
---|---|
static inflight decode(token: str, options: DecodeOptions?): Json | No description |
static inflight sign(data: Json, secret: str, options: SignOptions?): str | No description |
static inflight verify(token: str, options: VerifyOptions): Json | No description |
DecodeOptions (struct)
No description
Properties
Name | Type | Description |
---|---|---|
complete | bool? | No description |
SignOptions (struct)
No description
Properties
Name | Type | Description |
---|---|---|
algorithm | str? | No description |
audience |
| No description |
encoding | str? | No description |
expiresIn | duration? | No description |
issuer | str? | No description |
jwtid | str? | No description |
keyid | str? | No description |
notBefore | duration? | No description |
subject | str? | No description |
VerifyJwtOptions (struct)
No description
Properties
Name | Type | Description |
---|---|---|
algorithms |
| No description |
audience | str? | No description |
ignoreExpiration | bool? | No description |
ignoreNotBefore | bool? | No description |
issuer | str? | No description |
jwtid | str? | No description |
maxAge | str? | No description |
nonce | str? | No description |
subject | str? | No description |
VerifyOptions (struct)
No description
Properties
Name | Type | Description |
---|---|---|
jwksUri | str? | No description |
options | VerifyJwtOptions? | No description |
secret | str? | No description |