mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Added new version of jwt-simple, now supports v 0.5.0
This commit is contained in:
12
jwt-simple/jwt-simple-0.2.0-tests.ts
Normal file
12
jwt-simple/jwt-simple-0.2.0-tests.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
/// <reference path='jwt-simple.d.ts' />
|
||||
|
||||
import jwt = require('jwt-simple');
|
||||
var payload = { foo: 'bar' };
|
||||
var secret:string = 'xxx';
|
||||
|
||||
// encode
|
||||
var token = jwt.encode(payload, secret);
|
||||
|
||||
// decode
|
||||
var decoded = jwt.decode(token, secret);
|
||||
console.log(decoded); //=> { foo: 'bar' }
|
||||
22
jwt-simple/jwt-simple-0.2.0.d.ts
vendored
Normal file
22
jwt-simple/jwt-simple-0.2.0.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Type definitions for jwt-simple v0.2.0
|
||||
// Project: https://github.com/hokaccha/node-jwt-simple
|
||||
// Definitions by: Ken Fukuyama <https://github.com/kenfdev>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
declare module "jwt-simple" {
|
||||
/**
|
||||
* Decode jwt
|
||||
* @param token
|
||||
* @param key
|
||||
* @param noVerify
|
||||
* @api public
|
||||
*/
|
||||
export function decode(token:any, key:string, noVerify?:boolean):any;
|
||||
/**
|
||||
* Encode jwt
|
||||
* @param payload
|
||||
* @param key
|
||||
* @param algorithm default is HS256
|
||||
* @api public
|
||||
*/
|
||||
export function encode(payload:any, key:string, algorithm?:string):string;
|
||||
}
|
||||
10
jwt-simple/jwt-simple.d.ts
vendored
10
jwt-simple/jwt-simple.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for jwt-simple v0.2.0
|
||||
// Type definitions for jwt-simple v0.5.0
|
||||
// Project: https://github.com/hokaccha/node-jwt-simple
|
||||
// Definitions by: Ken Fukuyama <https://github.com/kenfdev>
|
||||
// Definitions by: Gael Magnan <https://github.com/GaelMagnan>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
declare module "jwt-simple" {
|
||||
/**
|
||||
@@ -8,15 +8,17 @@ declare module "jwt-simple" {
|
||||
* @param token
|
||||
* @param key
|
||||
* @param noVerify
|
||||
* @param algorithm default is HS256
|
||||
* @api public
|
||||
*/
|
||||
export function decode(token:any, key:string, noVerify?:boolean):any;
|
||||
export function decode(token:any, key:string, noVerify?:boolean, algorithm?:string):any;
|
||||
/**
|
||||
* Encode jwt
|
||||
* @param payload
|
||||
* @param key
|
||||
* @param algorithm default is HS256
|
||||
* @param options
|
||||
* @api public
|
||||
*/
|
||||
export function encode(payload:any, key:string, algorithm?:string):string;
|
||||
export function encode(payload:any, key:string, algorithm?:string, options?:any):string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user