@types/chai-jwt
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

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

/// <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

Credits

These definitions were written by Anatoly Pitikin.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/chai-jwt

Weekly Downloads

5,828

Version

2.0.2

License

MIT

Unpacked Size

5.29 kB

Total Files

5

Last publish

Collaborators

  • types