Socket
Socket
Sign inDemoInstall

@types/jsonwebtoken

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/jsonwebtoken - npm Package Compare versions

Comparing version 7.2.8 to 8.3.0

111

jsonwebtoken/index.d.ts

@@ -1,2 +0,2 @@

// Type definitions for jsonwebtoken 7.2.2
// Type definitions for jsonwebtoken 8.3
// Project: https://github.com/auth0/node-jsonwebtoken

@@ -6,3 +6,4 @@ // Definitions by: Maxime LUCE <https://github.com/SomaticIT>,

// Brice BERNARD <https://github.com/brikou>,
// Veli-Pekka Kestilä <https://github.com/vpk>
// Veli-Pekka Kestilä <https://github.com/vpk>,
// Daniel Parker <https://github.com/rlgod>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

@@ -47,5 +48,5 @@ // TypeScript Version: 2.2

keyid?: string;
/** @member {string} - expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d" */
/** expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d" */
expiresIn?: string | number;
/** @member {string} - expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d" */
/** expressed in seconds or a string describing a time span [zeit/ms](https://github.com/zeit/ms.js). Eg: 60, "2 days", "10h", "7d" */
notBefore?: string | number;

@@ -72,4 +73,4 @@ audience?: string | string[];

/**
*@deprecated
*@member {string} - Max age of token
* @deprecated
* Max age of token
*/

@@ -83,14 +84,31 @@ maxAge?: string;

}
export type VerifyErrors=JsonWebTokenError | NotBeforeError | TokenExpiredError;
export interface VerifyCallback {
(
err: VerifyErrors,
decoded: object | string,
): void;
}
export type VerifyErrors= JsonWebTokenError | NotBeforeError | TokenExpiredError;
export type VerifyCallback = (
err: VerifyErrors,
decoded: object | string,
) => void;
export interface SignCallback {
(err: Error, encoded: string): void;
export type SignCallback = (
err: Error, encoded: string
) => void;
export interface JwtHeader {
alg: string;
typ?: string;
kid?: string;
jku?: string;
x5u?: string;
x5t?: string;
}
export type SigningKeyCallback = (
err: any,
signingKey?: Secret,
) => void;
export type GetPublicKeyOrSecret = (
header: JwtHeader,
callback: SigningKeyCallback
) => void;
export type Secret = string | Buffer | { key: string; passphrase: string };

@@ -100,8 +118,8 @@

* Synchronously sign the given payload into a JSON Web Token string
* @param {String|Object|Buffer} payload - Payload to sign, could be an literal, buffer or string
* @param {String|Buffer} secretOrPrivateKey - Either the secret for HMAC algorithms, or the PEM encoded private key for RSA and ECDSA.
* @param {SignOptions} [options] - Options for the signature
* @returns {String} The JSON Web Token string
* payload - Payload to sign, could be an literal, buffer or string
* secretOrPrivateKey - Either the secret for HMAC algorithms, or the PEM encoded private key for RSA and ECDSA.
* [options] - Options for the signature
* returns - The JSON Web Token string
*/
export declare function sign(
export function sign(
payload: string | Buffer | object,

@@ -114,8 +132,8 @@ secretOrPrivateKey: Secret,

* Sign the given payload into a JSON Web Token string
* @param {String|Object|Buffer} payload - Payload to sign, could be an literal, buffer or string
* @param {String|Buffer} secretOrPrivateKey - Either the secret for HMAC algorithms, or the PEM encoded private key for RSA and ECDSA.
* @param {SignOptions} [options] - Options for the signature
* @param {Function} callback - Callback to get the encoded token on
* payload - Payload to sign, could be an literal, buffer or string
* secretOrPrivateKey - Either the secret for HMAC algorithms, or the PEM encoded private key for RSA and ECDSA.
* [options] - Options for the signature
* callback - Callback to get the encoded token on
*/
export declare function sign(
export function sign(
payload: string | Buffer | object,

@@ -125,3 +143,3 @@ secretOrPrivateKey: Secret,

): void;
export declare function sign(
export function sign(
payload: string | Buffer | object,

@@ -135,14 +153,10 @@ secretOrPrivateKey: Secret,

* Synchronously verify given token using a secret or a public key to get a decoded token
* @param {String} token - JWT string to verify
* @param {String|Buffer} secretOrPublicKey - Either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA.
* @param {VerifyOptions} [options] - Options for the verification
* @returns The decoded token.
* token - JWT string to verify
* secretOrPublicKey - Either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA.
* [options] - Options for the verification
* returns - The decoded token.
*/
export declare function verify(
export function verify(
token: string,
secretOrPublicKey: string | Buffer,
): object | string;
export declare function verify(
token: string,
secretOrPublicKey: string | Buffer,
options?: VerifyOptions,

@@ -153,15 +167,17 @@ ): object | string;

* Asynchronously verify given token using a secret or a public key to get a decoded token
* @param {String} token - JWT string to verify
* @param {String|Buffer} secretOrPublicKey - Either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA.
* @param {VerifyOptions} [options] - Options for the verification
* @param {Function} callback - Callback to get the decoded token on
* token - JWT string to verify
* secretOrPublicKey - A string or buffer containing either the secret for HMAC algorithms,
* or the PEM encoded public key for RSA and ECDSA. If jwt.verify is called asynchronous,
* secretOrPublicKey can be a function that should fetch the secret or public key
* [options] - Options for the verification
* callback - Callback to get the decoded token on
*/
export declare function verify(
export function verify(
token: string,
secretOrPublicKey: string | Buffer,
secretOrPublicKey: string | Buffer | GetPublicKeyOrSecret,
callback?: VerifyCallback,
): void;
export declare function verify(
export function verify(
token: string,
secretOrPublicKey: string | Buffer,
secretOrPublicKey: string | Buffer | GetPublicKeyOrSecret,
options?: VerifyOptions,

@@ -173,10 +189,9 @@ callback?: VerifyCallback,

* Returns the decoded payload without verifying if the signature is valid.
* @param {String} token - JWT string to decode
* @param {DecodeOptions} [options] - Options for decoding
* @returns {Object} The decoded Token
* token - JWT string to decode
* [options] - Options for decoding
* returns - The decoded Token
*/
export declare function decode(
export function decode(
token: string,
options?: DecodeOptions,
): null | { [key: string]: any } | string;
{
"name": "@types/jsonwebtoken",
"version": "7.2.8",
"version": "8.3.0",
"description": "TypeScript definitions for jsonwebtoken",

@@ -26,5 +26,11 @@ "license": "MIT",

"githubUsername": "vpk"
},
{
"name": "Daniel Parker",
"url": "https://github.com/rlgod",
"githubUsername": "rlgod"
}
],
"main": "",
"types": "",
"repository": {

@@ -38,4 +44,4 @@ "type": "git",

},
"typesPublisherContentHash": "0710df94f94d365010ab0eb15da715f26e2773f02ce1ac83c1c620e77bf71df9",
"typesPublisherContentHash": "0c6eebd46a6b5087408b4ad4afa03e49ed368589c17d6b6134f16a6942fab234",
"typeScriptVersion": "2.2"
}

@@ -11,3 +11,3 @@ # Installation

Additional Details
* Last updated: Mon, 02 Jul 2018 20:44:33 GMT
* Last updated: Thu, 01 Nov 2018 23:52:59 GMT
* Dependencies: node

@@ -17,2 +17,2 @@ * Global values: none

# Credits
These definitions were written by Maxime LUCE <https://github.com/SomaticIT>, Daniel Heim <https://github.com/danielheim>, Brice BERNARD <https://github.com/brikou>, Veli-Pekka Kestilä <https://github.com/vpk>.
These definitions were written by Maxime LUCE <https://github.com/SomaticIT>, Daniel Heim <https://github.com/danielheim>, Brice BERNARD <https://github.com/brikou>, Veli-Pekka Kestilä <https://github.com/vpk>, Daniel Parker <https://github.com/rlgod>.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc