mirror of
https://gitlab.com/timvisee/send.git
synced 2025-12-06 22:20:55 +03:00
load cryptofill.js async
This commit is contained in:
@@ -35,9 +35,22 @@ async function checkCrypto() {
|
||||
false,
|
||||
['deriveKey']
|
||||
);
|
||||
await crypto.subtle.generateKey(
|
||||
{
|
||||
name: 'ECDH',
|
||||
namedCurve: 'P-256'
|
||||
},
|
||||
true,
|
||||
['deriveBits']
|
||||
);
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
try {
|
||||
await import('./cryptofill');
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +75,7 @@ async function polyfillStreams() {
|
||||
}
|
||||
|
||||
export default async function capabilities() {
|
||||
const crypto = await checkCrypto();
|
||||
let crypto = await checkCrypto();
|
||||
const nativeStreams = checkStreams();
|
||||
let polyStreams = false;
|
||||
if (!nativeStreams) {
|
||||
@@ -72,7 +85,7 @@ export default async function capabilities() {
|
||||
try {
|
||||
account = account && !!localStorage;
|
||||
} catch (e) {
|
||||
// nevermind
|
||||
account = false;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user