Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@universal-packages/time-based-one-time-password

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@universal-packages/time-based-one-time-password - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

LICENSE.md

2

package.json
{
"name": "@universal-packages/time-based-one-time-password",
"version": "1.0.0",
"version": "1.0.1",
"description": "Time-based one-time password implementation",

@@ -5,0 +5,0 @@ "author": "David De Anda <david@universal-packages.com> (https://github.com/universal-packages)",

@@ -15,18 +15,9 @@ # Time-based one-time password

## generate()
## Global methods
#### generate(secret: string, [options])
Generates the current otp password for the current time.
```js
import { generate } from '@universal-packages/time-based-one-time-password'
#### Options
const password = generate('secret', options?)
console.log(password)
// > 123654
```
### Options
- **`algorithm`** `'sha1' | 'sha256' | 'sha512'` `default: sha1`

@@ -41,3 +32,3 @@ Algorithm to use when generating the hmac hash.

## verify()
#### **`verify(subject: string, secret: string, [options])`**

@@ -53,14 +44,4 @@ Verify if the given password is valid for the time window, in will verify the specified steps around the specified time window, basically:

```js
import { verify } from '@universal-packages/time-based-one-time-password'
#### Options
const isValid = verify('456789', 'secret', options?)
console.log(isValid)
// > true
```
### Options
Verify uses the same options as generate and additionally:

@@ -71,3 +52,3 @@

### Base32
## Base32

@@ -92,3 +73,3 @@ Some verificators require you to pass the secret in base32 format (for some reason), you can use packages like [Base32 Encode](https://www.npmjs.com/package/base32-encode), for example for the google authenticator you can do:

The development of this library in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.
The development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving this library.

@@ -95,0 +76,0 @@ - [Code of Conduct](./CODE_OF_CONDUCT.md)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc