MCPcopy Index your code
hub / github.com/nodejs/node / decryptImpl

Function decryptImpl

lib/internal/crypto/webcrypto.js:1303–1326  ·  view source on GitHub ↗
(algorithm, key, data)

Source from the content-addressed store, hash-verified

1301}
1302
1303function decryptImpl(algorithm, key, data) {
1304 const prefix = prepareSubtleMethod(this, 'decrypt', arguments.length, 3);
1305 let i = 0;
1306 algorithm = convertSubtleArgument(
1307 prefix, 'AlgorithmIdentifier', algorithm, i++);
1308 key = convertSubtleArgument(prefix, 'CryptoKey', key, i++);
1309 data = convertSubtleArgument(prefix, 'BufferSource', data, i++);
1310
1311 const normalizedAlgorithm = normalizeAlgorithm(algorithm, 'decrypt');
1312
1313 if (normalizedAlgorithm.name !== getCryptoKeyAlgorithm(key).name)
1314 throw lazyDOMException('Key algorithm mismatch', 'InvalidAccessError');
1315
1316 if (!hasCryptoKeyUsage(key, 'decrypt'))
1317 throw lazyDOMException(
1318 'Unable to use this key to decrypt', 'InvalidAccessError');
1319
1320 return cipherOrWrap(
1321 kWebCryptoCipherDecrypt,
1322 normalizedAlgorithm,
1323 key,
1324 data,
1325 );
1326}
1327
1328// Implements https://wicg.github.io/webcrypto-modern-algos/#SubtleCrypto-method-getPublicKey
1329function getPublicKey(key, keyUsages) {

Callers

nothing calls this directly

Calls 7

prepareSubtleMethodFunction · 0.85
convertSubtleArgumentFunction · 0.85
getCryptoKeyAlgorithmFunction · 0.85
lazyDOMExceptionFunction · 0.85
hasCryptoKeyUsageFunction · 0.85
cipherOrWrapFunction · 0.85
normalizeAlgorithmFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…