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

Function callSubtleCryptoMethod

lib/internal/crypto/webcrypto.js:94–111  ·  view source on GitHub ↗
(fn, receiver, args)

Source from the content-addressed store, hash-verified

92// WebCrypto methods return promises, including for synchronous validation
93// failures. Keep that conversion in one place so method bodies stay readable.
94function callSubtleCryptoMethod(fn, receiver, args) {
95 try {
96 const result = ReflectApply(fn, receiver, args);
97 if (isPromise(result))
98 return result;
99 // PromiseResolve() performs thenable assimilation for object results.
100 // Shadow inherited then accessors while it resolves synchronous results.
101 const shouldCleanupResult = prepareWebCryptoResult(result);
102 try {
103 return PromiseResolve(result);
104 } finally {
105 if (shouldCleanupResult)
106 cleanupWebCryptoResult(result);
107 }
108 } catch (err) {
109 return PromiseReject(err);
110 }
111}
112
113const kArgumentContexts = [
114 '1st argument',

Callers 15

digestFunction · 0.85
generateKeyFunction · 0.85
deriveBitsFunction · 0.85
deriveKeyFunction · 0.85
exportKeyFunction · 0.85
importKeyFunction · 0.85
wrapKeyFunction · 0.85
unwrapKeyFunction · 0.85
signFunction · 0.85
verifyFunction · 0.85
encryptFunction · 0.85
decryptFunction · 0.85

Calls 2

prepareWebCryptoResultFunction · 0.85
cleanupWebCryptoResultFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…