share common code: min-crypto-polyfill
Massimo Melina committed
Mar 7, 2022 at 16:51 UTC
85c2d644d87b777e3b1dc2fd1092359d90d1dbf4
4 files changed
+2
-21
admin/src/index.ts
+1
-1
@@ -3,7 +3,7 @@
3
import { createElement as h, StrictMode } from 'react'
4
import ReactDOM from 'react-dom';
5
import './index.css';
6
-import './min-crypto-polyfill'
6
+import '@hfs/shared/src/min-crypto-polyfill'
7
import App from './App';
8
//import reportWebVitals from './reportWebVitals';
9
frontend/src/index.ts
+1
-1
@@ -3,7 +3,7 @@
3
import { createElement as h, StrictMode } from 'react';
4
import ReactDOM from 'react-dom';
5
import './index.scss';
6
-import './min-crypto-polyfill'
6
+import '@hfs/shared/src/min-crypto-polyfill'
7
import App from './App';
8
//import reportWebVitals from './reportWebVitals';
9
frontend/src/min-crypto-polyfill.js
deleted
-19
@@ -1,19 +0,0 @@
1
-export {}
2
-// this is the minimum required for lib tssrp6a to work
3
-if (!window.crypto?.subtle) {
4
- console.debug('poly subtle')
5
-
6
- const subtle = {
7
- async digest(algo, buff) {
8
- if (algo !== 'SHA-512')
9
- return alert(algo + ' required but not supported')
10
- const lib = await import('js-sha512')
11
- const sha = lib.default.arrayBuffer
12
- return sha(buff)
13
- }
14
- }
15
- if (!window.crypto)
16
- window.crypto = { subtle }
17
- if (!crypto.subtle)
18
- crypto.subtle = subtle
19
-}