Page MenuHomePhabricator

[lib] Introduce `isValidSIWEStatementWithPublicKey(...)`
ClosedPublic

Authored by atul on Dec 31 2022, 2:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 1:30 PM
Unknown Object (File)
Tue, Oct 22, 5:15 PM
Unknown Object (File)
Tue, Oct 22, 12:21 PM
Unknown Object (File)
Tue, Oct 22, 12:21 PM
Unknown Object (File)
Tue, Oct 22, 12:21 PM
Unknown Object (File)
Tue, Oct 22, 12:28 AM
Unknown Object (File)
Oct 12 2024, 2:59 AM
Unknown Object (File)
Oct 3 2024, 10:23 AM
Subscribers
None

Details

Summary

Introduce isValidSIWEStatementWithPublicKey(...) to check if SIWE statement is valid statement that includes the Device IdPubKey as described in the whitepaper: https://blob.sh/a3d138.png


Depends on D6129

Test Plan

included a unit test (will include more later)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul published this revision for review.Dec 31 2022, 2:57 AM
atul added inline comments.
lib/utils/siwe-utils.js
53 ↗(On Diff #20479)

Yes, this is a long line that exceeds the 80 character width limit.

Saw that there are ways to split a regex across multiple lines on StackOverflow (https://stackoverflow.com/questions/12317049/how-to-split-a-long-regular-expression-into-multiple-lines-in-javascript), but the solutions didn't seem as clean and there were some "gotchas."

Open to any suggestions.

ashoat added inline comments.
lib/utils/siwe-utils.js
53 ↗(On Diff #20479)

Eh whatever. We do this in other places with JS RegExp literals in the codebase, like lib/shared/markdown.js

Can you update this to have a newline?

This revision is now accepted and ready to land.Jan 1 2023, 7:22 PM
lib/utils/siwe-utils.js
53 ↗(On Diff #20479)

SIWE spec prohibits newlines in statement field

This revision was landed with ongoing or failed builds.Jan 3 2023, 1:51 PM
This revision was automatically updated to reflect the committed changes.