Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
17 lines
570 B
Plaintext
17 lines
570 B
Plaintext
import subtleAlgorithm from './subtle_dsa.js';
|
|
import crypto from './webcrypto.js';
|
|
import checkKeyLength from './check_key_length.js';
|
|
import getVerifyKey from './get_sign_verify_key.js';
|
|
const verify = async (alg, key, signature, data) => {
|
|
const cryptoKey = await getVerifyKey(alg, key, 'verify');
|
|
checkKeyLength(alg, cryptoKey);
|
|
const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
|
|
try {
|
|
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
}
|
|
catch {
|
|
return false;
|
|
}
|
|
};
|
|
export default verify;
|