Wallet Service
+ +
| signatureRequest |
| <-------------------------------------+ |
| |
| +---+ |
| | |
| |sign packet |
| | |
| <---+ |
| signedPacket |
| +-------------------------------------> |
| |
| +---+ |
| verify | |
| signedPacket| |
| | |
| +---> |
| |
| ok |
| <-------------------------------------+ |
| |
| |
| |
+ +
Read the login protocol specification here.
const nonceDB = new iden3.protocols.NonceDB();
- input
nonceDB
: NonceDB class objectorigin
: domain of the emitter of the requesttimeout
: unixtime format, valid until that date. We can use for example 2 minutes (2*60
seconds)
- output
signatureRequest
:Object
const signatureRequest = iden3.protocols.login.newRequestIdenAssert(nonceDB, origin, 2*60);
The nonce
of the signatureRequest
can be getted from:
const nonce = signatureRequest.body.data.challenge;
// nonce is the string containing the nonce value
We can add auxiliar data to the nonce
in the nonceDB
only one time:
const added = nodeDB.addAuxToNonce(nonce, auxdata);
// added is a bool confirming if the aux data had been added
- input
signatureRequest
: object generated in thenewRequestIdenAssert
functionuserAddr
: Eth Address of the user that signs the data packetethName
: name assigned to theuserAddr
proofOfEthName
:proofOfClaim
of theethName
kc
: iden3.KeyContainer objectksign
: KOperational authorized for theuserAddr
proofOfKSign
:proofOfClaim
of theksign
expirationTime
: unixtime format, signature will be valid until that date
- output
signedPacket
:String
const expirationTime = unixtime + (3600 * 60);
const signedPacket = iden3.protocols.login.signIdenAssertV01(signatureRequest, usrAddr, ethName, proofOfEthName, kc, ksign, proofOfKSign, expirationTime);
- input
nonceDB
: NonceDB class objectorigin
: domain of the emitter of the requestsignedPacket
: object generated in thesignIdenAssertV01
function
- output
nonce
: nonce object of the signedPacket, that has been just deleted from the nonceDB when the signedPacket is verified. If the verification fails, the nonce will beundefined
const verified = iden3.protocols.login.verifySignedPacket(nonceDB, origin, signedPacket);
See the login specification document for information about the protocol design.