Page MenuHomePhabricator

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

Authored by atul on Dec 31 2022, 2:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Jun 21, 9:59 PM
Unknown Object (File)
Fri, Jun 21, 3:52 AM
Unknown Object (File)
Fri, Jun 21, 3:52 AM
Unknown Object (File)
Fri, Jun 21, 3:51 AM
Unknown Object (File)
Fri, Jun 21, 3:51 AM
Unknown Object (File)
May 24 2024, 8:32 AM
Unknown Object (File)
May 24 2024, 7:20 AM
Unknown Object (File)
May 24 2024, 7:20 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.