Skip to content

feat: [IEL-185] Fci flow with generated nonce#581

Open
soixdev91 wants to merge 1 commit intomasterfrom
IEL-185-Fci-nonce-expiration
Open

feat: [IEL-185] Fci flow with generated nonce#581
soixdev91 wants to merge 1 commit intomasterfrom
IEL-185-Fci-nonce-expiration

Conversation

@soixdev91
Copy link
Collaborator

Short description

This PR introduces nonce lifecycle handling for the FCI sign flow, allowing to test the IO app behaviour with expired nonce running it with local configuration.

List of changes proposed in this pull request

  • Updated GET /api/v1/sign/qtsp/clauses to generate and return a fresh nonce, storing its expiration.
  • Updated POST /api/v1/sign/signatures to validate qtsp_clauses.nonce and return an error (500) when nonce is not valid.
  • Extended FCI router tests to cover nonce validation.

How to test

Run the IO app with .env.local, then start the FCI signing flow (the dev-server config must include at least one fci.waitForSignatureCount). Stop at any step before final signing. After the nonce validity window (fci.response.nonceDuration) has expired, try to complete the signature: POST /api/v1/sign/signatures should return 500, and the app should show an error message with a button to restart the signing flow.

if (nonceValidationResult === "valid") {
return res.status(200).json(mockSignatureDetailView);
}
return res.sendStatus(500);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the error code, it would be helpful to have the error message. What do you think about using the error that also occurs in the app?

response: {
getFciResponseCode: 200
getFciResponseCode: 200,
nonceDuration: 300 // 5 minutes as production environment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, it's a bit complicated to calculate the duration using this method (even though there's a comment). Why didn't you just set the duration in seconds?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants