Skip to content

Commit c6b24f6

Browse files
authored
fix: Improve error message when crypto is not available (#10)
1 parent 44f7ddf commit c6b24f6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/utils/sha256.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// https://stackoverflow.com/a/48161723/54547
22
export async function sha256(message) {
3+
if (!crypto) {
4+
throw new Error('Cryptography API unavailable. Please use HTTPS.');
5+
}
6+
37
// encode as UTF-8
48
const messageBuffer = new TextEncoder().encode(message);
59

0 commit comments

Comments
 (0)