Interface ICryptoHelper

Interface that should follow a class to implement a crypto helper.

It's useful because we have different implementations in browser and NodeJS.

Hierarchy

  • ICryptoHelper

Properties

generateCodeVerifier: (() => Promise<string>)

Type declaration

    • (): Promise<string>
    • Generate a cryptographic-safe value suitable for PKCE.

      Returns Promise<string>

      A code verifier to use for PKCE.

      See

      PKCE

getCodeChallenge: ((code, method) => Promise<string>)

Type declaration

    • (code, method): Promise<string>
    • Generate a code challenge from a code verifier for PKCE.

      Parameters

      • code: string

        The code verifier.

      • method: "plain" | "S256"

        The hashing method. Can either be plain or S256. For maximum security, prefer S256.

      Returns Promise<string>

      A code challenge to use for PKCE.

      See

      PKCE

getValidationHash: ((value) => Promise<string>)

Type declaration

    • (value): Promise<string>
    • Return the validation hash of a value.

      Useful to check the validity c_hash and at_hash claims.

      Parameters

      • value: string

        The value to hash.

      Returns Promise<string>

      The hashed value.

isValidHash: ((value, hash) => Promise<boolean>)

Type declaration

    • (value, hash): Promise<boolean>
    • Check if a hash corresponds to the provided value.

      Useful to check the validity c_hash and at_hash claims.

      Parameters

      • value: string

        The plain value to challenge.

      • hash: string

        The hash to compare with.

      Returns Promise<boolean>

      If the hash is valid.

Generated using TypeDoc