auth
- Description:
- Authentication functions
- Source:
Methods
(async, static) VerifyISO97982PassUnilateralAuthSymmetric(challenge, identity, response, key) → {boolean}
- Description:
- Verify ISO 9798-2 2-Pass Unilateral Authentication
- Source:
- Since:
- 0.17.0
Example
// setup multi-factor derived key
const key = await mfkdf.setup.key([ await mfkdf.setup.factors.password('password') ])
// challenger: create random challenge
const challenge = crypto.randomBytes(32)
const identity = Buffer.from('Challenger')
// responder: generate response
const response = await key.ISO97982PassUnilateralAuthSymmetric(challenge, identity)
// verifier: verify response
const authKey = await key.ISO9798SymmetricKey()
const valid = await mfkdf.auth.VerifyISO97982PassUnilateralAuthSymmetric(challenge, identity, response, authKey) // -> true
Parameters:
Name | Type | Description |
---|---|---|
challenge |
Buffer | The nonce value provided by the challenger |
identity |
Buffer | The identity of the challenger |
response |
Buffer | The response of the responder |
key |
Buffer | The key used to authenticate |
Returns:
Whether the response is valid
- Type
- boolean
(async, static) VerifyISO97982PassUnilateralAuthAsymmetric(challenge, identity, response, key) → {boolean}
- Description:
- Verify ISO 9798-2 Public Key 2-Pass Unilateral Authentication
- Source:
- Since:
- 0.17.0
Example
// setup multi-factor derived key
const key = await mfkdf.setup.key([ await mfkdf.setup.factors.password('password') ])
// challenger: create random challenge
const challenge = crypto.randomBytes(32)
const identity = Buffer.from('Challenger')
// responder: generate response
const response = await key.ISO97982PassUnilateralAuthAsymmetric(challenge, identity)
// verifier: verify response
const authKey = await key.ISO9798AsymmetricKey()
const valid = await mfkdf.auth.VerifyISO97982PassUnilateralAuthAsymmetric(challenge, identity, response, authKey) // -> true
Parameters:
Name | Type | Description |
---|---|---|
challenge |
Buffer | The nonce value provided by the challenger |
identity |
Buffer | The identity of the challenger |
response |
Buffer | The response of the responder |
key |
Buffer | The key used to authenticate |
Returns:
Whether the response is valid
- Type
- boolean
(async, static) VerifyISO97982PassUnilateralAuthCCF(challenge, identity, response, key) → {boolean}
- Description:
- Verify ISO 9798-2 2-Pass Unilateral Authentication over CCF
- Source:
- Since:
- 0.17.0
Example
// setup multi-factor derived key
const key = await mfkdf.setup.key([ await mfkdf.setup.factors.password('password') ])
// challenger: create random challenge
const challenge = crypto.randomBytes(32)
const identity = Buffer.from('Challenger')
// responder: generate response
const response = await key.ISO97982PassUnilateralAuthCCF(challenge, identity)
// verifier: verify response
const authKey = await key.ISO9798CCFKey()
const valid = await mfkdf.auth.VerifyISO97982PassUnilateralAuthCCF(challenge, identity, response, authKey) // -> true
Parameters:
Name | Type | Description |
---|---|---|
challenge |
Buffer | The nonce value provided by the challenger |
identity |
Buffer | The identity of the challenger |
response |
Buffer | The response of the responder |
key |
Buffer | The key used to authenticate |
Returns:
Whether the response is valid
- Type
- boolean
(async, static) VerifyISO97981PassUnilateralAuthSymmetric(identity, response, key, windowopt) → {boolean}
- Description:
- Verify ISO 9798-2 1-Pass Unilateral Authentication
- Source:
- Since:
- 0.17.0
Example
// setup multi-factor derived key
const key = await mfkdf.setup.key([ await mfkdf.setup.factors.password('password') ])
const identity = Buffer.from('Challenger')
// responder: generate response
const response = await key.ISO97981PassUnilateralAuthSymmetric(identity)
// verifier: verify response
const authKey = await key.ISO9798SymmetricKey()
const valid = await mfkdf.auth.VerifyISO97981PassUnilateralAuthSymmetric(identity, response, authKey) // -> true
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
identity |
Buffer | The identity of the challenger | ||
response |
Buffer | The response of the responder | ||
key |
Buffer | The key used to authenticate | ||
window |
number |
<optional> |
5
|
The maximum time difference in seconds |
Returns:
Whether the response is valid
- Type
- boolean
(async, static) VerifyISO97981PassUnilateralAuthAsymmetric(identity, response, key, windowopt) → {boolean}
- Description:
- Verify ISO 9798-2 Public Key 1-Pass Unilateral Authentication
- Source:
- Since:
- 0.17.0
Example
// setup multi-factor derived key
const key = await mfkdf.setup.key([ await mfkdf.setup.factors.password('password') ])
const identity = Buffer.from('Challenger')
// responder: generate response
const response = await key.ISO97981PassUnilateralAuthAsymmetric(identity)
// verifier: verify response
const authKey = await key.ISO9798AsymmetricKey()
const valid = await mfkdf.auth.VerifyISO97981PassUnilateralAuthAsymmetric(identity, response, authKey) // -> true
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
identity |
Buffer | The identity of the challenger | ||
response |
Buffer | The response of the responder | ||
key |
Buffer | The key used to authenticate | ||
window |
number |
<optional> |
5
|
The maximum time difference in seconds |
Returns:
Whether the response is valid
- Type
- boolean
(async, static) VerifyISO97981PassUnilateralAuthCCF(identity, response, key, windowopt) → {boolean}
- Description:
- Verify ISO 9798-2 1-Pass Unilateral Authentication over CCF
- Source:
- Since:
- 0.17.0
Example
// setup multi-factor derived key
const key = await mfkdf.setup.key([ await mfkdf.setup.factors.password('password') ])
const identity = Buffer.from('Challenger')
// responder: generate response
const response = await key.ISO97981PassUnilateralAuthCCF(identity)
// verifier: verify response
const authKey = await key.ISO9798CCFKey()
const valid = await mfkdf.auth.VerifyISO97981PassUnilateralAuthCCF(identity, response, authKey) // -> true
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
identity |
Buffer | The identity of the challenger | ||
response |
Buffer | The response of the responder | ||
key |
Buffer | The key used to authenticate | ||
window |
number |
<optional> |
5
|
The maximum time difference in seconds |
Returns:
Whether the response is valid
- Type
- boolean