MCPcopy Create free account
hub / github.com/ampproject/amphtml / wrapCryptoOp

Function wrapCryptoOp

third_party/subscriptions-project/aes_gcm.js:86–96  ·  view source on GitHub ↗

* Converts IE11 CryptoOperation type to a Promise. * @param {Object} op * @return {!Promise}

(op)

Source from the content-addressed store, hash-verified

84 * @return {!Promise}
85 */
86function wrapCryptoOp(op) {
87 if (typeof op.then == 'function') {
88 return op;
89 }
90 return new Promise((resolve, reject) => {
91 op.oncomplete = (e) => {
92 resolve(op.result);
93 };
94 op.onerror = reject;
95 });
96}
97
98/**
99 * Interpret a byte array as a UTF-8 string.

Callers 2

decryptAesGcmImplFunction · 0.85
safeAesGcmImportKeyFunction · 0.85

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected