File

src/app/shared/token.ts

Description

TODO: Explain this model.

Extends

TOTP

Index

Properties

Constructor

constructor(token: HOTP | TOTP)

The Token object is an overlay to the OTPAuth.TOTP and OTPAuth.HOTP classes providing functional accessors and modifiers.

Initialize token with TOTP defaults. Override defaults by passing values as token.

Parameters :
Name Type Optional
token HOTP | TOTP No

Properties

validate
Default value : () => {...}

Nullify serverside functionality for token validation.

import { HOTP, Secret, TOTP } from 'otpauth';

/**
 * TODO: Explain this model.
 */
export class Token extends TOTP {
  /**
   * The Token object is an overlay to the
   * OTPAuth.TOTP and OTPAuth.HOTP classes providing
   * functional accessors and modifiers.
   *
   * Initialize token with TOTP defaults.
   * Override defaults by passing values as `token`.
   * @param token
   */
  constructor(token: HOTP | TOTP) {
    super();

    // Intialize OTP secret object.
    token.secret = new Secret(token.secret);

    // Initialize token with OTP defaults.
    Object.assign(this, token);
  }

  /**
   * Nullify serverside functionality for token
   * validation.
   *
   * @returns null
   */
  override validate = () => null;
}

results matching ""

    No results matching ""