@types/firebase-token-generator
TypeScript icon, indicating that this package has built-in type declarations

2.0.33 • Public • Published

Installation

npm install --save @types/firebase-token-generator

Summary

This package contains type definitions for firebase-token-generator (https://github.com/firebase/firebase-token-generator-node).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/firebase-token-generator.

index.d.ts

interface TokenOptions {
    expires?: number | undefined;
    notBefore?: number | undefined;
    admin?: boolean | undefined;
    debug?: boolean | undefined;
    simulate?: boolean | undefined;
    iat?: number | undefined;
}

declare class FirebaseTokenGenerator {
    /**
     * Builds a new object that can generate Firebase authentication tokens.
     * @param { String } secret The secret for the Firebase being used (get yours from the Firebase Admin Console).
     */
    constructor(secret: string);

    /**
     * Creates a token that authenticates a client with arbitrary data "data", and the specified options.
     *
     * @param { any } data JSON data that will be passed to the Firebase Rules API once a client authenticates. Unless the
     *                "admin" flag is set, it must contain a "uid" key, and if it does it must be a string of length
     *                256 or less.
     * @param { TokenOptions } options The developer-supplied options for this token. Supported options are:
     *                a) "expires" -- A timestamp (as a number of seconds since the epoch) denoting a time after which
     *                          this token should no longer be valid.
     *                b) "notBefore" -- A timestamp (as a number of seconds since the epoch) denoting a time before
     *                          which this token should be rejected by the server.
     *                c) "admin" -- Set to true to bypass all security rules (use this for your trusted servers).
     *                d) "debug" -- Set to true to enable debug mode (so you can see the results of Rules API operations)
     *                e) "simulate" -- (internal-only for now) Set to true to neuter all API operations (listens / puts
     *                                 will run security rules but not actually write or return data)
     *                f) "iat" -- (Number) (internal-only, for testing) Set the issued at time for the generated token
     * @return {String} The authentication token
     */
    createToken(data: any, options?: TokenOptions): string;
}

declare module "firebase-token-generator" {
    export = FirebaseTokenGenerator;
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: none

Credits

These definitions were written by Hans Van den Keybus.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/firebase-token-generator

Weekly Downloads

526

Version

2.0.33

License

MIT

Unpacked Size

7.08 kB

Total Files

5

Last publish

Collaborators

  • types