mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2025-11-24 14:35:51 +00:00
Palemoon patch: treat 'SyntaxError' as 'NotSupportedError' on EdDSA WebCrypto operations
Fallback to JS code instead of throwing.
This commit is contained in:
parent
8e497f419b
commit
55de9c0dc4
@ -50,7 +50,11 @@ export async function generate(algo) {
|
|||||||
seed: b64ToUint8Array(privateKey.d, true)
|
seed: b64ToUint8Array(privateKey.d, true)
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.name !== 'NotSupportedError' && err.name !== 'OperationError') { // Temporary (hopefully) fix for WebKit on Linux
|
if (
|
||||||
|
err.name !== 'NotSupportedError' &&
|
||||||
|
err.name !== 'OperationError' && // Temporary (hopefully) fix for WebKit on Linux
|
||||||
|
err.name !== 'SyntaxError' // Temporary fix for Palemoon throwing 'SyntaxError'
|
||||||
|
) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
const seed = getRandomBytes(getPayloadSize(algo));
|
const seed = getRandomBytes(getPayloadSize(algo));
|
||||||
@ -102,7 +106,7 @@ export async function sign(algo, hashAlgo, message, publicKey, privateKey, hashe
|
|||||||
|
|
||||||
return { RS: signature };
|
return { RS: signature };
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.name !== 'NotSupportedError') {
|
if (err.name !== 'NotSupportedError' && err.name !== 'SyntaxError') { // Temporary fix for Palemoon throwing 'SyntaxError'
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
const secretKey = util.concatUint8Array([privateKey, publicKey]);
|
const secretKey = util.concatUint8Array([privateKey, publicKey]);
|
||||||
@ -148,7 +152,7 @@ export async function verify(algo, hashAlgo, { RS }, m, publicKey, hashed) {
|
|||||||
const verified = await webCrypto.verify('Ed25519', key, RS, hashed);
|
const verified = await webCrypto.verify('Ed25519', key, RS, hashed);
|
||||||
return verified;
|
return verified;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.name !== 'NotSupportedError') {
|
if (err.name !== 'NotSupportedError' && err.name !== 'SyntaxError') { // Temporary fix for Palemoon throwing 'SyntaxError'
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
return nobleEd25519Verify(RS, hashed, publicKey);
|
return nobleEd25519Verify(RS, hashed, publicKey);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user