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

Fix sign message rendered message display #400

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
7 changes: 7 additions & 0 deletions packages/browser-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 1.1.11

### Fixed

- Sign message's rendered view displaying 'a' when deserialization failed.
- Sign message deserialization failing with new `deserializeTypeValue`.
shjortConcordium marked this conversation as resolved.
Show resolved Hide resolved

## 1.1.10

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { addToastAtom } from '@popup/state';
import ExternalRequestLayout from '@popup/page-layouts/ExternalRequestLayout';
import TabBar from '@popup/shared/TabBar';
import clsx from 'clsx';
import { stringify } from 'json-bigint';

type Props = {
onSubmit(signature: AccountTransactionSignature): void;
Expand Down Expand Up @@ -47,13 +48,13 @@ function BinaryDisplay({ message, url }: { message: MessageObject; url: string }

const parsedMessage = useMemo(() => {
try {
return JSON.stringify(
return stringify(
deserializeTypeValue(Buffer.from(message.data, 'hex'), Buffer.from(message.schema, 'base64')),
undefined,
2
);
} catch (e) {
return 'a';
return t('unableToDeserialize');
}
}, []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const t: typeof en = {
descriptionWithSchema:
'{{ dApp }} har sendt en rå besked og et schema til at oversætte den. Vi har oversat beskeden, men du burde kun underskrive hvis du stoler på {{ dApp }}',
deserializedDisplay: 'Oversat',
unableToDeserialize: 'Det var ikke muligt at oversætte beskeden',
rawDisplay: 'Rå',
sign: 'Signér',
reject: 'Afvis',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const t = {
descriptionWithSchema:
"{{ dApp }} has provided the raw message and a schema to render it. We've rendered the message but you should only sign it if you trust {{ dApp }}.",
deserializedDisplay: 'Rendered',
unableToDeserialize: 'Unable to render message',
rawDisplay: 'Raw',
sign: 'Sign',
reject: 'Reject',
Expand Down
Loading