@universal-packages/time-based-one-time-password
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"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) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11595
15
77