nid-webauthn-emulator 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -353,7 +353,7 @@ function getAssertion(rpIdHash, clientDataHash, newSignCounter, credential, inte
353
353
  type: "pkcs8",
354
354
  key: credential.privateKey,
355
355
  });
356
- const signature = (0, node_crypto_1.sign)(null, new Uint8Array(payload), privateKey);
356
+ const signature = encode_utils_1.default.bufferSourceToUint8Array((0, node_crypto_1.sign)(null, new Uint8Array(payload), privateKey));
357
357
  return { authData: (0, webauthn_model_1.packAuthenticatorData)(authenticatorData), signature };
358
358
  }
359
359
  function makeCredential(aaguid, rpId, alg, transports, interactionResponse, user, statelessKey) {
@@ -34,6 +34,9 @@ function encodeCbor(data) {
34
34
  if (value instanceof Uint8Array || value instanceof ArrayBuffer) {
35
35
  return Buffer.from(value);
36
36
  }
37
+ if (value instanceof Buffer) {
38
+ return value;
39
+ }
37
40
  if (Array.isArray(value)) {
38
41
  return value.map((v) => encoder(v));
39
42
  }
@@ -143,7 +143,7 @@ class WebAuthnEmulator {
143
143
  };
144
144
  const authenticatorRequest = (0, ctap_model_1.packGetAssertionRequest)({
145
145
  rpId: rpId.value,
146
- clientDataHash: (0, node_crypto_1.createHash)("sha256").update(JSON.stringify(clientData)).digest(),
146
+ clientDataHash: encode_utils_1.default.bufferSourceToUint8Array((0, node_crypto_1.createHash)("sha256").update(JSON.stringify(clientData)).digest()),
147
147
  allowList: options.publicKey.allowCredentials,
148
148
  options: (0, webauthn_model_1.toFido2RequestOptions)(options.publicKey.userVerification),
149
149
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nid-webauthn-emulator",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "keywords": [
5
5
  "test",
6
6
  "e2e",