2.0.2 • Published 7 months ago
@types/chai-jwt v2.0.2
Installation
npm install --save @types/chai-jwt
Summary
This package contains type definitions for chai-jwt (https://github.com/dafortune/chai-jwt#readme).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chai-jwt.
index.d.ts
// Type definitions for chai-jwt 2.0
// Project: https://github.com/dafortune/chai-jwt#readme
// Definitions by: Anatoly Pitikin <https://github.com/xapdkop>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/// <reference types="chai" />
declare global {
namespace Chai {
interface Assertion {
/**
* Asserts that the provided string has a valid format that can be parsed as JWT.
* _Does not check signature or the provided fields._
* If succeed, it changes the context to the decoded token.
*/
jwt: Assertion;
/**
* Asserts that the provided token is signed with the provided secret.
* @param secret - A string or buffer containing either the secret for HMAC algorithms, or the PEM encoded public key for RSA and ECDSA
*/
signedWith(secret: string | Buffer): Assertion;
/**
* Alias of `.property` for JWTs.
* Asserts that the provided token has a given claim.
* If value is provided it will also assert the claim value using strict equality.
*/
claim: Property;
}
}
}
/**
* A set of helpers for chai that allow you to make assertions on json web tokens.
* @example
* import chai = require('chai');
* import chaiJWT = require('chai-jwt');
*
* chai.use(chaiJWT);
*/
declare const chaiJWT: Chai.ChaiPlugin;
export = chaiJWT;
Additional Details
- Last updated: Fri, 24 Sep 2021 20:31:22 GMT
- Dependencies: @types/node, @types/chai
- Global values: none
Credits
These definitions were written by Anatoly Pitikin.