-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
RaresAil
committed
May 28, 2023
1 parent
da9d291
commit faed690
Showing
1 changed file
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,34 @@ | ||
# yubico-otp-client | ||
An offline Client for Yubico OTP | ||
# @raresail/yubico-otp-client | ||
|
||
### An offline Client for Yubico OTP | ||
|
||
[![Node.js CI](https://github.com/RaresAil/yubico-otp-client/actions/workflows/node.js.yml/badge.svg)](https://github.com/RaresAil/yubico-otp-client/actions/workflows/node.js.yml) | ||
[![Yarn Audit CI](https://github.com/RaresAil/yubico-otp-client/actions/workflows/audit.yml/badge.svg)](https://github.com/RaresAil/yubico-otp-client/actions/workflows/audit.yml) | ||
[![CodeQL](https://github.com/RaresAil/yubico-otp-client/actions/workflows/codeql.yml/badge.svg)](https://github.com/RaresAil/yubico-otp-client/actions/workflows/codeql.yml) | ||
|
||
## Installation | ||
|
||
### Yarn | ||
|
||
```bash | ||
yarn add @raresail/yubico-otp-client | ||
``` | ||
|
||
### NPM | ||
|
||
```bash | ||
npm install @raresail/yubico-otp-client | ||
``` | ||
|
||
## Usage | ||
|
||
When making the setup for OTP you create a Public ID, a Private ID and a Secret Token. | ||
|
||
```ts | ||
import { Token } from '@raresail/yubico-otp-client'; | ||
|
||
const token = new Token('secret', 'private-id', 'public-id'); | ||
|
||
token.validateCode('code-0'); // return true or false | ||
token.validateCode('code-0'); // will return false if the same code or an older one is used | ||
``` |