bothy-sdk
    Preparing search index...

    Class Secret

    A secret string (API token, invocation token) that never renders its value.

    String(secret), template literals, JSON.stringify and util.inspect all give [redacted]; Secret.reveal returns the value for the one place that must send it.

    const token = new Secret("example-token");
    `${token}`; // "[redacted]"
    token.reveal(); // "example-token"
    Index

    Constructors

    • Wraps a secret value.

      Parameters

      • value: string

        The secret text; must not be empty.

      Returns Secret

      TypeError when the value is empty.

    Methods

    • Compares two secrets in constant time with respect to their content.

      Parameters

      • other: Secret

        The other secret.

      Returns boolean

      Whether both hold the same value.

    • Returns the secret value; call it only where the value is sent.

      Returns string

      The secret text.

    • Returns [redacted], so a secret never lands in JSON output.

      Returns string

    • Returns [redacted].

      Returns string