Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: SIWE sign message section #24997

Merged
merged 71 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
161814b
Changes in infor section of permit signature types
jpuri May 28, 2024
9ed12f0
update
jpuri May 28, 2024
df04719
update
jpuri May 28, 2024
fa6fc59
update
jpuri May 28, 2024
1ef304e
Changes in personal sign info section
jpuri May 28, 2024
8ee1401
update
jpuri May 28, 2024
344bd0b
merge
jpuri May 29, 2024
415a352
update
jpuri May 29, 2024
c3d5774
update
jpuri May 29, 2024
4e5c7fb
Merge branch 'develop' of github.com:MetaMask/metamask-extension into…
jpuri May 29, 2024
d1f85d9
Display simulation info for permit signatures
jpuri May 29, 2024
737d201
update
jpuri May 29, 2024
18fb2c2
merge
jpuri May 29, 2024
0be218d
update
jpuri May 29, 2024
d6164cf
update
jpuri May 29, 2024
4610e2a
Add simulation sectionfor SIWE personal signature requests
jpuri May 29, 2024
a662d24
Update
jpuri May 29, 2024
c224117
Update
jpuri May 29, 2024
11dc68b
update
jpuri May 30, 2024
dd2108e
merge
jpuri May 30, 2024
a43bcf9
merge
jpuri May 30, 2024
a75ad4a
Update
jpuri May 30, 2024
0d7bae3
update
jpuri May 30, 2024
9d17164
Merge branch 'permit_sign_info_section' into permit_signature_simulat…
legobeat May 31, 2024
1adebdd
update
jpuri May 31, 2024
e905920
update
jpuri May 31, 2024
1219e4f
Merge branch 'develop' into siwe_sign_simulation_section
jpuri May 31, 2024
24f81b8
Merge branch 'develop' of github.com:MetaMask/metamask-extension into…
jpuri May 31, 2024
22d2cb9
Merge branch 'develop' of github.com:MetaMask/metamask-extension into…
jpuri May 31, 2024
1f6feb1
update
jpuri May 31, 2024
80c2f99
Merge branch 'permit_sign_info_section' into permit_signature_simulat…
jpuri May 31, 2024
da9f628
Changes in message section for siwe signatures
jpuri Jun 1, 2024
5406eb2
Update
jpuri Jun 1, 2024
7a28886
Merge branch 'permit_signature_simulation_info' of github.com:MetaMas…
jpuri Jun 1, 2024
0b1e762
Merge branch 'develop' into siwe_sign_simulation_section
jpuri Jun 2, 2024
3f9ad93
Merge branch 'siwe_sign_simulation_section' of github.com:MetaMask/me…
jpuri Jun 2, 2024
9fbe0ae
Changes in message section of SIWE signature pages
jpuri Jun 2, 2024
11b1708
Update
jpuri Jun 2, 2024
097393e
Merge branch 'siwe_sign_simulation_section' into siwe_sign_message_se…
jpuri Jun 2, 2024
7de4c23
Update
jpuri Jun 2, 2024
888b48a
Update
jpuri Jun 2, 2024
63d8562
Update
jpuri Jun 2, 2024
ba8714d
Update
jpuri Jun 2, 2024
f7ddb08
Update
jpuri Jun 3, 2024
67e811b
update
jpuri Jun 3, 2024
8f2d4d2
update
jpuri Jun 3, 2024
8ebc9d8
update
jpuri Jun 3, 2024
2aaeac8
update
jpuri Jun 3, 2024
1009a28
update
jpuri Jun 3, 2024
4893854
update
jpuri Jun 3, 2024
3307e46
update
jpuri Jun 3, 2024
45b0e4c
update
jpuri Jun 4, 2024
2476635
merge
jpuri Jun 4, 2024
47a464f
update
jpuri Jun 4, 2024
0517896
merge
jpuri Jun 4, 2024
9c684da
update
jpuri Jun 4, 2024
07c4fcf
update
jpuri Jun 4, 2024
aa55330
Update
jpuri Jun 4, 2024
e68f9af
Update
jpuri Jun 6, 2024
851a3c4
Update
jpuri Jun 7, 2024
ef8d783
Merge branch 'develop' into siwe_sign_message_section
jpuri Jun 7, 2024
d7353d2
update
jpuri Jun 7, 2024
e5187fe
Merge branch 'siwe_sign_message_section' of github.com:MetaMask/metam…
jpuri Jun 7, 2024
de2aca0
Merge branch 'develop' into siwe_sign_message_section
jpuri Jun 7, 2024
42fbf95
update
jpuri Jun 12, 2024
f5ebfe1
Merge branch 'siwe_sign_message_section' of github.com:MetaMask/metam…
jpuri Jun 12, 2024
d511401
Merge branch 'develop' into siwe_sign_message_section
jpuri Jun 12, 2024
0642836
Merge branch 'develop' into siwe_sign_message_section
jpuri Jun 12, 2024
5b647ce
merge
jpuri Jun 13, 2024
e6344d6
update
jpuri Jun 13, 2024
9e42c01
Merge branch 'siwe_sign_message_section' of github.com:MetaMask/metam…
jpuri Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@
"@types/gulp-sourcemaps": "^0.0.35",
"@types/he": "^1",
"@types/jest": "^29.5.12",
"@types/luxon": "^3.4.2",
"@types/mocha": "^10.0.3",
"@types/node": "^20",
"@types/pify": "^5.0.1",
Expand Down
38 changes: 38 additions & 0 deletions test/data/confirmations/personal_sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,41 @@ export const signatureRequestSIWE = {
},
},
};

export const SignatureRequestSIWEWithResources = {
id: '210ca3b0-1ccb-11ef-b096-89c4d726ebb5',
securityAlertResponse: {
reason: 'loading',
result_type: 'validation_in_progress',
securityAlertId: 'b826df20-2eda-41bf-becf-6a100141a8be',
},
status: 'unapproved',
time: 1716884423019,
type: 'personal_sign',
msgParams: {
from: '0x935e73edb9ff52e23bac7f7e049a1ecd06d05477',
data: '0x6d6574616d61736b2e6769746875622e696f2077616e747320796f7520746f207369676e20696e207769746820796f757220457468657265756d206163636f756e743a0a3078393335653733656462396666353265323362616337663765303433613165636430366430353437370a0a492061636365707420746865204d6574614d61736b205465726d73206f6620536572766963653a2068747470733a2f2f636f6d6d756e6974792e6d6574616d61736b2e696f2f746f730a0a5552493a2068747470733a2f2f6d6574616d61736b2e6769746875622e696f0a56657273696f6e3a20310a436861696e2049443a20310a4e6f6e63653a2033323839313735370a4973737565642041743a20323032312d30392d33305431363a32353a32342e3030305a',
signatureMethod: 'personal_sign',
origin: 'https://metamask.github.io',
siwe: {
isSIWEMessage: true,
parsedMessage: {
domain: 'metamask.github.io',
address: '0x935e73edb9ff52e23bac7f7e043a1ecd06d05477',
statement:
'I accept the MetaMask Terms of Service: https://community.metamask.io/tos',
uri: 'https://metamask.github.io',
version: '1',
chainId: 1,
nonce: '32891757',
issuedAt: '2021-09-30T16:25:24.000Z',
notBefore: '2022-03-17T12:45:13.610Z',
requestId: 'some_id',
resources: [
'ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu',
'https://example.com/my-web2-claim.json',
],
},
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import { SignatureRequestType } from '../../../../types/confirm';
import { isSIWESignatureRequest } from '../../../../utils';
import { AlertRow } from '../../../../../../components/app/confirm/info/row/alert-row/alert-row';
import { SIWESignInfo } from './siwe-sign';

const PersonalSignInfo: React.FC = () => {
const t = useI18nContext();
Expand All @@ -33,11 +34,11 @@ const PersonalSignInfo: React.FC = () => {
}

const { from } = currentConfirmation.msgParams;
const isSiweSigReq = isSIWESignatureRequest(currentConfirmation);
const isSIWE = isSIWESignatureRequest(currentConfirmation);

return (
<>
{isSiweSigReq && (
{isSIWE && (
<Box
backgroundColor={BackgroundColor.backgroundDefault}
borderRadius={BorderRadius.MD}
Expand Down Expand Up @@ -66,7 +67,7 @@ const PersonalSignInfo: React.FC = () => {
>
<ConfirmInfoRowUrl url={currentConfirmation.msgParams.origin} />
</AlertRow>
{isSiweSigReq && (
{isSIWE && (
<ConfirmInfoRow label={t('signingInWith')}>
<ConfirmInfoRowAddress address={from} />
</ConfirmInfoRow>
Expand All @@ -78,17 +79,21 @@ const PersonalSignInfo: React.FC = () => {
padding={2}
marginBottom={4}
>
<AlertRow
alertKey="message"
ownerId={currentConfirmation.id}
label={t('message')}
>
<ConfirmInfoRowText
text={sanitizeString(
hexToText(currentConfirmation.msgParams?.data),
)}
/>
</AlertRow>
{isSIWE ? (
<SIWESignInfo />
) : (
<AlertRow
alertKey="message"
ownerId={currentConfirmation.id}
label={t('message')}
>
<ConfirmInfoRowText
text={sanitizeString(
hexToText(currentConfirmation.msgParams?.data),
)}
/>
</AlertRow>
)}
</Box>
</>
);
Expand Down
Loading