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

Function importKeySync

lib/internal/crypto/webcrypto.js:832–982  ·  view source on GitHub ↗
(format, keyData, algorithm, extractable, usages)

Source from the content-addressed store, hash-verified

830}
831
832function importKeySync(format, keyData, algorithm, extractable, usages) {
833 let result;
834 switch (algorithm.name) {
835 case 'RSASSA-PKCS1-v1_5':
836 // Fall through
837 case 'RSA-PSS':
838 // Fall through
839 case 'RSA-OAEP':
840 result = require('internal/crypto/rsa')
841 .rsaImportKey(
842 format,
843 keyData,
844 algorithm,
845 extractable,
846 usages);
847 break;
848 case 'ECDSA':
849 // Fall through
850 case 'ECDH':
851 format = aliasKeyFormat(format, 'raw-public');
852 result = require('internal/crypto/ec')
853 .ecImportKey(
854 format,
855 keyData,
856 algorithm,
857 extractable,
858 usages);
859 break;
860 case 'Ed25519':
861 // Fall through
862 case 'Ed448':
863 // Fall through
864 case 'X25519':
865 // Fall through
866 case 'X448':
867 format = aliasKeyFormat(format, 'raw-public');
868 result = require('internal/crypto/cfrg')
869 .cfrgImportKey(
870 format,
871 keyData,
872 algorithm,
873 extractable,
874 usages);
875 break;
876 case 'HMAC':
877 // Fall through
878 case 'KMAC128':
879 // Fall through
880 case 'KMAC256':
881 result = require('internal/crypto/mac')
882 .macImportKey(
883 format,
884 keyData,
885 algorithm,
886 extractable,
887 usages);
888 break;
889 case 'AES-CTR':

Callers

nothing calls this directly

Calls 6

aliasKeyFormatFunction · 0.85
importGenericSecretKeyFunction · 0.85
lazyDOMExceptionFunction · 0.85
getCryptoKeyTypeFunction · 0.85
getCryptoKeyUsagesMaskFunction · 0.85
requireFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…