Repository navigation
Support risk intelligence - #12
Conversation
| // TODO comment out this line when new SDK version is released and dependency is updated | ||
| replace github.com/friendlycaptcha/friendly-captcha-go => ../.. |
There was a problem hiding this comment.
This will be changed after merging this PR and bumping the github.com/friendlycaptcha/friendly-captcha-go version above. Otherwise the build would fail because of an unused dependency (github.com/guregu/null/v6)
| // This should never happen since /retrieve should always return | ||
| // risk intelligence data if the token is valid and request is successful. | ||
| // But it's good practice to handle it just in case. | ||
| data.Message = "Token was valid, but risk intelligence data was returned." |
There was a problem hiding this comment.
Maybe this message should be Token was valid, but risk intelligence data was not returned.?
|
|
||
| riEl?.addEventListener("frc:riskintelligence.complete", (ev) => { | ||
| hasTokenState = true; | ||
| setStatus(`complete\n token ready\n expiresAt: ${ev.detail.expiresAt.toISOString()}`); |
There was a problem hiding this comment.
Since we changed this from a Date to a number, this should now be ${new Date(ev.detail.expiresAt).toISOString()}
|
|
||
| // RiskIntelligenceRetrieveResponseData is the data field in a successful retrieve response. | ||
| type RiskIntelligenceRetrieveResponseData struct { | ||
| // EventID is a unique identifier for this risk intelligence retrieve call. |
There was a problem hiding this comment.
I think this comment should be updated to read that it's a unique identifier for the event that generated the risk intelligence data (the one originating from the browser)
(I.e. this won't change if you call it multiple times with the same risk intelligence token)
There was a problem hiding this comment.
Actually it is unique per a /retrieve call. IIRC it's the same as with /siteverify. The point of it is for us to be able to look into the data when requested so it doesn't really matter since we also save the token ID to the DB.
There was a problem hiding this comment.
(There is a separate TokenID that is unique per token, IIRC)
There was a problem hiding this comment.
Ah thank you for the explanation, I somehow was convinced for siteverify it was tied to the activate call, but I was wrong about that :)
This PR adds support for risk intelligence and adds an example demo integration.
Because the SDK hasn't been released yet testing requires you to serve the SDK from a local server and change it's path in the demo HTML)