Configuration
DurationToken validity period (30s is standard)
DigitsOTP length (6 digits recommended)
sha-1
Base32 encoded secret key (auto-generated if empty)
User identifier
Service name
Live Result
0
Generated Code
import { Secret, TOTP } from 'xotp';
const secret = Secret.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567');
const totp = new TOTP({
algorithm: 'sha1',
digits: 6,
duration: 30,
issuer: 'XOTP',
});
const token = totp.generate({ secret });
const keyUri = totp.keyUri({
secret,
account: 'Foo',
});
const secret = Secret.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567');
const totp = new TOTP({
algorithm: 'sha1',
digits: 6,
duration: 30,
issuer: 'XOTP',
});
const token = totp.generate({ secret });
const keyUri = totp.keyUri({
secret,
account: 'Foo',
});