Skip to content

Commit

Permalink
address issue Sayfer.SAY-01
Browse files Browse the repository at this point in the history
Display a warning similar to native metamask’s one on Sign message popup
  • Loading branch information
Nick-1979 committed Feb 23, 2024
1 parent 11bd667 commit 1d4bda9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
7 changes: 6 additions & 1 deletion packages/snap/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,13 @@ describe('onRpcRequest', () => {
panel([
heading(`A signature request is received from ${origin}`),
divider(),
text('Data to sign:'),
text('Message to sign:'),
panel([copyable(signRawParams.raw.data), divider()]),
row(
'Warning:',
text(`**${'proceed only if you understand the message above!'}**`),
RowVariant.Warning,
),
])
);

Expand Down
17 changes: 15 additions & 2 deletions packages/snap/src/rpc/signRaw.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
/* eslint-disable jsdoc/require-jsdoc */
import { copyable, divider, heading, panel, text } from '@metamask/snaps-sdk';
import {
RowVariant,
copyable,
divider,
heading,
panel,
row,
text,
} from '@metamask/snaps-sdk';
import { SignerPayloadRaw, SignerResult } from '@polkadot/types/types';
import { isAscii, u8aToString, u8aUnwrapBytes } from '@polkadot/util';
import { getKeyPair } from '../util/getKeyPair';
Expand All @@ -12,8 +20,13 @@ const contentSignRaw = (origin: string, hexString: string) => {
return panel([
heading(`A signature request is received from ${origin}`),
divider(),
text('Data to sign:'),
text('Message to sign:'),
panel([copyable(data), divider()]),
row(
'Warning:',
text(`**${'proceed only if you understand the message above!'}**`),
RowVariant.Warning,
),
]);
};

Expand Down

0 comments on commit 1d4bda9

Please sign in to comment.