mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2025-03-30 15:08:32 +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)
|
||||
};
|
||||
} 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;
|
||||
}
|
||||
const seed = getRandomBytes(getPayloadSize(algo));
|
||||
@ -102,7 +106,7 @@ export async function sign(algo, hashAlgo, message, publicKey, privateKey, hashe
|
||||
|
||||
return { RS: signature };
|
||||
} catch (err) {
|
||||
if (err.name !== 'NotSupportedError') {
|
||||
if (err.name !== 'NotSupportedError' && err.name !== 'SyntaxError') { // Temporary fix for Palemoon throwing 'SyntaxError'
|
||||
throw err;
|
||||
}
|
||||
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);
|
||||
return verified;
|
||||
} catch (err) {
|
||||
if (err.name !== 'NotSupportedError') {
|
||||
if (err.name !== 'NotSupportedError' && err.name !== 'SyntaxError') { // Temporary fix for Palemoon throwing 'SyntaxError'
|
||||
throw err;
|
||||
}
|
||||
return nobleEd25519Verify(RS, hashed, publicKey);
|
||||
|
Loading…
x
Reference in New Issue
Block a user