Methods
(async, static) setup(password) → {MFCHFSetup}
- Description:
- Setup an MFCHF hash with a password and 6-digit HOTP factor
- Source:
- Since:
- 0.1.0
Example
// Setup MFCHF-HOTP6 hash
const { hash, secret } = await mfchf.hotp6.setup('password123')
// Verify MFCHF-HOTP6 hash
const otp = parseInt(hotp({ secret, counter: 1 }))
const result = await mfchf.hotp6.verify(hash, 'password123', otp)
result.valid.should.be.true
Parameters:
Name | Type | Description |
---|---|---|
password |
string | The password to use |
Returns:
The resulting MFCHF hash and HOTP secret
- Type
- MFCHFSetup
(async, static) verify(hash, password, code) → {MFCHFVerify}
- Description:
- Verify an MFCHF hash with a password and 6-digit HOTP code
- Source:
- Since:
- 0.1.0
Example
// Setup MFCHF-HOTP6 hash
const { hash, secret } = await mfchf.hotp6.setup('password123')
// Verify MFCHF-HOTP6 hash
const otp = parseInt(hotp({ secret, counter: 1 }))
const result = await mfchf.hotp6.verify(hash, 'password123', otp)
result.valid.should.be.true
Parameters:
Name | Type | Description |
---|---|---|
hash |
string | The MFCHF hash to verify |
password |
string | The password to use |
code |
number | The HOTP code to use |
Returns:
The verification result
- Type
- MFCHFVerify