MCPcopy Create free account
hub / github.com/nodejs/node / jwkData

Function jwkData

test/fixtures/wpt/WebCryptoAPI/import_export/symmetric_importKey.js:162–176  ·  view source on GitHub ↗
(keyData, algorithm)

Source from the content-addressed store, hash-verified

160
161 // Build minimal Jwk objects from raw key data and algorithm specifications
162 function jwkData(keyData, algorithm) {
163 var result = {
164 kty: "oct",
165 k: byteArrayToUnpaddedBase64(keyData)
166 };
167
168 if (algorithm.name.substring(0, 3) === "AES") {
169 result.alg = "A" + (8 * keyData.byteLength).toString() + algorithm.name.substring(4);
170 } else if (algorithm.name === "HMAC") {
171 result.alg = "HS" + algorithm.hash.substring(4);
172 } else if (algorithm.name.startsWith("KMAC")) {
173 result.alg = "K" + algorithm.name.substring(4);
174 }
175 return result;
176 }
177
178 // Convert method parameters to a string to uniquely name each test
179 function parameterString(format, data, algorithm, extractable, usages) {

Callers 1

runTestsFunction · 0.70

Calls 2

toStringMethod · 0.45

Tested by

no test coverage detected