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

Function importKeyImpl

lib/internal/crypto/webcrypto.js:993–1021  ·  view source on GitHub ↗
(
  format,
  keyData,
  algorithm,
  extractable,
  keyUsages)

Source from the content-addressed store, hash-verified

991}
992
993function importKeyImpl(
994 format,
995 keyData,
996 algorithm,
997 extractable,
998 keyUsages) {
999 const prefix = prepareSubtleMethod(this, 'importKey', arguments.length, 5);
1000 let i = 0;
1001 format = convertSubtleArgument(prefix, 'KeyFormat', format, i++);
1002 const type = format === 'jwk' ? 'JsonWebKey' : 'BufferSource';
1003 keyData = convertSubtleArgument(prefix, type, keyData, i++);
1004 algorithm = convertSubtleArgument(
1005 prefix, 'AlgorithmIdentifier', algorithm, i++);
1006 extractable = convertSubtleArgument(prefix, 'boolean', extractable, i++);
1007 const usages = convertSubtleArgument(
1008 prefix, 'sequence<KeyUsage>', keyUsages, i++);
1009
1010 const normalizedAlgorithm = normalizeAlgorithm(algorithm, 'importKey');
1011
1012 return FunctionPrototypeCall(
1013 importKeySync,
1014 this,
1015 format,
1016 keyData,
1017 normalizedAlgorithm,
1018 extractable,
1019 usages,
1020 );
1021}
1022
1023// subtle.wrapKey() is essentially a subtle.exportKey() followed
1024// by a subtle.encrypt().

Callers

nothing calls this directly

Calls 3

prepareSubtleMethodFunction · 0.85
convertSubtleArgumentFunction · 0.85
normalizeAlgorithmFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…