An implementation of the Yubico Validation Protocol.
- Verify Yubikey OTPs
-
Clone the repository.
npm install
-
Get client ID and secret from Yubico.
-
Create
.env
file with the following content:CLIENT_ID="CLIENT_ID" SECRET_KEY="SECRET_KEY" OTP="any_otp"
-
Run the tests.
npm test
import { Yubico } from 'yubico-js';
const yubico = new Yubico({
clientId: 'YOUR_CLIENT_ID',
secretKey: 'YOUR_SECRET_KEY',
});
// To verify otp
try {
yubico.verifyOtp(otpString);
} catch (e) {
console.log(e);
}