Skip to content

Commit 949b10d

Browse files
committed
style: update error messages for unsupported versions
1 parent fca207d commit 949b10d

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,5 @@ node_modules/
7676
!.yarn/sdks
7777
!.yarn/versions
7878

79+
# ignore intellij local files
7980
.idea/

snap.manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/message-signing-snap.git"
88
},
99
"source": {
10-
"shasum": "WwjAlInXlGmhYmPE2iWLXj4UWwZecHhC0gIrwLqDLk0=",
10+
"shasum": "SOtH39orNYpHZta/W/BcM5Fbsdruu88WVrsQiy/R8u8=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

src/utils/ERC1024.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ describe('errors:', () => {
7575
'CyTDtSMUSxJ8wQ5Ht7fvko2frSuEEE9Srs5hZ/IODQ4=',
7676
);
7777
const encrypted = {
78-
version: 'ed25519-xsalsa20-poly1305',
78+
version: 'unsupported version',
7979
};
8080
expect(() => ERC1024.decrypt(encrypted as any, receiverSecret)).toThrow(
81-
'Encryption type/version not supported.',
81+
'Encryption type/version not supported (unsupported version).',
8282
);
8383
});
8484

src/utils/ERC1024.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const encrypt = (
4747
} as Eip1024EncryptedData;
4848
}
4949
default:
50-
throw new Error('Encryption type/version not supported');
50+
throw new Error(`Encryption type/version not supported ${version}`);
5151
}
5252
};
5353

@@ -88,7 +88,9 @@ const decrypt = (
8888
return bytesToUtf8(decryptedMessage);
8989
}
9090
default:
91-
throw new Error('Encryption type/version not supported.');
91+
throw new Error(
92+
`Encryption type/version not supported (${encryptedData.version}).`,
93+
);
9294
}
9395
};
9496

0 commit comments

Comments
 (0)