bug: fix build for older browsers

This commit is contained in:
2023-05-17 12:59:30 +01:00
parent 6e16e7b5fb
commit e0251ab389
18 changed files with 104 additions and 73 deletions

View File

@ -1,5 +1,4 @@
import { useIntl } from "react-intl";
import * as secp from "@noble/secp256k1";
import { EmailRegex, MnemonicRegex } from "Const";
import { LoginStore } from "Login";
@ -21,7 +20,7 @@ export default function useLoginHandler() {
throw new Error(insecureMsg);
}
const hexKey = bech32ToHex(key);
if (secp.utils.isValidPrivateKey(hexKey)) {
if (hexKey.length === 64) {
LoginStore.loginWithPrivateKey(hexKey);
} else {
throw new Error("INVALID PRIVATE KEY");
@ -39,7 +38,7 @@ export default function useLoginHandler() {
const ent = generateBip39Entropy(key);
const keyHex = entropyToPrivateKey(ent);
LoginStore.loginWithPrivateKey(keyHex);
} else if (secp.utils.isValidPrivateKey(key)) {
} else if (key.length === 64) {
if (!hasSubtleCrypto) {
throw new Error(insecureMsg);
}