Validating Cotter's Event Response
Cotter's Event Response includes the following information:
{
"ID": 1361, // Event ID
"CreatedAt": "2020-02-27T22:22:48.705212512Z",
"UpdatedAt": "2020-02-27T22:22:48.705212512Z",
"DeletedAt": null,
"client_user_id": "1014", // your client's User ID
"issuer": "afcabd98-745f-4b9e-98de-af968d9951d3", // your API Key
"event": "<EVENT NAME>",// requested event (LOGIN, or TRANSACTION, etc)
"ip": "192.168.232.2",
"location": "Unknown",
"timestamp": "1582842167",
"method": "TRUSTED_DEVICE", // auth method: TRUSTED_DEVICE (other choices are PIN / BIOMETRIC)
"new": false, // Is this a new pending event. More explanation below about Non-Trusted Device
"approved": true, // Is this event approved.
"signature": "oonMGCAxp3..." // Signature to make sure this event comes from Cotter's server
}First, make sure you check the following:
Check if the
client_user_idis correctCheck if the
timestampis fairly recentCheck if the
eventmatches the event name that you expectedCheck that the
issueris the same as yourAPI_KEY_IDCheck that
approvedis true
Verifying the Signature
The signature ensures that this token comes from Cotter's server:
Signature algorithm:
ed25519Cotter's Public Key:
qqOaiQGjGsxBMgI5rdAasaACRiJthOqadmefjY5mS/c=Signed Message:
Example
Libraries for ed25519 algorithm are available in Javascript, Golang, Python and other languages.
Last updated