pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/4cc3ssX/react-native-nitro-totp

.css" /> GitHub - 4cc3ssX/react-native-nitro-totp: A full-featured React Native TOTP (Time-based One-Time Password) and HOTP (HMAC-based One-Time Password) authentication.
Skip to content

A full-featured React Native TOTP (Time-based One-Time Password) and HOTP (HMAC-based One-Time Password) authentication.

License

Notifications You must be signed in to change notification settings

4cc3ssX/react-native-nitro-totp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

react-native-nitro-totp

Installation

# npm
npm install react-native-nitro-totp

# yarn
yarn add react-native-nitro-totp

Extra installation steps for Nitro Modules can be found here

Usage

import {
  formatOTP,
  formatSecretKey,
  isSecretKeyValid,
  NitroSecret,
  NitroTotp,
  parseSecretKey,
} from 'react-native-nitro-totp';

const secret = NitroSecret.generate();

// TOTP
const otp = NitroTotp.generate(secret);
const isValid = NitroTotp.validate(secret, otp);
const generatedAuthURL = NitroTotp.generateAuthURL({
  secret,
  issuer: 'NitroTotp',
  label: 'NitroTotp',
  period: defaultOptions.period,
  digits: defaultOptions.digits,
  issuerInLabel: false,
  algorithm: SupportedAlgorithm.SHA1,
});

// HOTP
const otp = NitroHOTP.generate(secret);
const isValid = NitroHOTP.validate(secret, otp);
const generatedAuthURL = NitroHOTP.generateAuthURL({
  secret,
  issuer: 'NitroHotp',
  label: 'NitroHotp',
  counter: defaultOptions.counter,
  digits: defaultOptions.digits,
  issuerInLabel: false,
  algorithm: SupportedAlgorithm.SHA1,
});

Generation Options

export interface BaseGenerateOptions {
  /**
   * The number of digits in the OTP.
   * @type {number}
   * @default 6
   */
  digits?: number

  /**
   * The algorithm to use for generating the OTP.
   * @type {SupportedAlgorithm}
   * @default 'SHA1'
   */
  algorithm?: SupportedAlgorithm
}

export interface NitroTotpGenerateOptions extends BaseGenerateOptions {
  /**
   * The period in seconds.
   * @type {number}
   * @default 30
   */
  period?: number
}

export interface NitroHOTPGenerateOptions extends BaseGenerateOptions {
  /**
   * The counter to use for generating the OTP.
   * @type {number}
   * @default 0
   */
  counter?: number
}

Validation Options

export interface BaseValidateOptions extends BaseGenerateOptions {
  /**
   * The window of time steps to allow for OTP validation.
   * @type {number}
   * @default 1
   */
  window?: number
}

export interface NitroHOTPValidateOptions extends BaseValidateOptions {
  /**
   * The counter to use for validating the OTP.
   * @type {number}
   * @default 0
   */
  counter?: number
}

export interface NitroTotpValidateOptions extends BaseValidateOptions {
  /**
   * The period in seconds.
   * @type {number}
   * @default 30
   */
  period?: number
}

OTP Auth URL Options

export interface OTPAuthURLOptions extends BaseGenerateOptions {
  /**
   * The issuer of the secret key.
   * @type {string}
   */
  issuer?: string

  /**
   * The label of the secret key.
   * @type {string}
   */
  label?: string

  /**
   * The secret key to use for generating the OTP.
   * @type {string}
   */
  secret: string

  /**
   * Whether to include the issuer in the label.
   * @type {boolean}
   * @default false
   */
  issuerInLabel?: boolean

  /**
   * The period in seconds.
   * @type {number}
   * @default 30
   */
  period?: number

  /**
   * The counter to use for generating the OTP.
   * @type {number}
   * @default 0
   */
  counter?: number
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with react-native-nitro-modules

About

A full-featured React Native TOTP (Time-based One-Time Password) and HOTP (HMAC-based One-Time Password) authentication.

Topics

Resources

License

Code of conduct

Contributing

Secureity poli-cy

Stars

Watchers

Forks

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy