nid-webauthn-emulator 0.2.9 → 0.2.11

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.
package/README.ja.md CHANGED
@@ -208,7 +208,7 @@ Vitest/Jest などで WebAuthn API を差し替えたい場合は、`src/test-ut
208
208
  ```TypeScript
209
209
  import { createPasskeysEmulator } from "nid-webauthn-emulator";
210
210
 
211
- const { interface: methods, addPasskey } = createPasskeysEmulator({
211
+ const { methods, addPasskey } = createPasskeysEmulator({
212
212
  origin: "http://localhost",
213
213
  rpId: "localhost",
214
214
  autofill: true, // false にすると isConditionalMediationAvailable が false を返す
@@ -220,12 +220,8 @@ params?.existingPasskeys?.forEach((passkey) => {
220
220
  });
221
221
 
222
222
  // 既存の実装を消し、エミュレータを差し込む
223
- const undefinedProperty = { value: undefined, configurable: true };
224
- Object.defineProperty(window, "PublicKeyCredential", undefinedProperty);
225
- Object.defineProperty(window.navigator, "credentials", undefinedProperty);
226
-
227
- vi.spyOn(window, "PublicKeyCredential", "get").mockReturnValue(methods.publicKeyCredentials);
228
- vi.spyOn(window.navigator, "credentials", "get").mockReturnValue(methods.credentialsContainer);
223
+ vi.stubGlobal("PublicKeyCredential", methods.publicKeyCredentials);
224
+ vi.stubGlobal("navigator", { credentials: methods.credentialsContainer });
229
225
  ```
230
226
 
231
227
  ## ライセンス
package/README.md CHANGED
@@ -217,7 +217,7 @@ If you want to swap out WebAuthn APIs in Vitest/Jest, you can mock `PublicKeyCre
217
217
  ```TypeScript
218
218
  import { createPasskeysEmulator } from "nid-webauthn-emulator";
219
219
 
220
- const { interface: methods, addPasskey } = createPasskeysEmulator({
220
+ const { methods, addPasskey } = createPasskeysEmulator({
221
221
  origin: "http://localhost",
222
222
  rpId: "localhost",
223
223
  autofill: true, // returns false from isConditionalMediationAvailable when set to false
@@ -229,12 +229,8 @@ params?.existingPasskeys?.forEach((passkey) => {
229
229
  });
230
230
 
231
231
  // remove existing implementations and inject the emulator
232
- const undefinedProperty = { value: undefined, configurable: true };
233
- Object.defineProperty(window, "PublicKeyCredential", undefinedProperty);
234
- Object.defineProperty(window.navigator, "credentials", undefinedProperty);
235
-
236
- vi.spyOn(window, "PublicKeyCredential", "get").mockReturnValue(methods.publicKeyCredentials);
237
- vi.spyOn(window.navigator, "credentials", "get").mockReturnValue(methods.credentialsContainer);
232
+ vi.stubGlobal("PublicKeyCredential", methods.publicKeyCredentials);
233
+ vi.stubGlobal("navigator", { credentials: methods.credentialsContainer });
238
234
  ```
239
235
 
240
236
  ## License
@@ -1,4 +1,4 @@
1
- import { type JsonWebKey, type KeyObject } from "node:crypto";
1
+ import { type KeyObject } from "node:crypto";
2
2
  /** @see https://www.w3.org/TR/webauthn/#sctn-encoded-credPubKey-examples */
3
3
  export declare abstract class CoseKey {
4
4
  kty: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nid-webauthn-emulator",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "keywords": [
5
5
  "test",
6
6
  "e2e",
@@ -12,22 +12,25 @@
12
12
  ],
13
13
  "author": "Nikkei Inc.",
14
14
  "license": "MIT",
15
+ "publishConfig": {
16
+ "provenance": true
17
+ },
15
18
  "main": "dist/src/index.js",
16
19
  "types": "dist/src/index.d.ts",
17
20
  "devDependencies": {
18
- "@biomejs/biome": "^2.3.8",
19
- "@jest/globals": "^30.2.0",
20
- "@simplewebauthn/server": "^13.2.2",
21
+ "@biomejs/biome": "^2.4.9",
22
+ "@jest/globals": "^30.3.0",
23
+ "@simplewebauthn/server": "^13.3.0",
21
24
  "@tsconfig/recommended": "^1.0.13",
22
- "@types/node": "^24.10.1",
23
- "jest": "^30.2.0",
24
- "ts-jest": "^29.4.5",
25
+ "@types/node": "^25.5.0",
26
+ "jest": "^30.3.0",
27
+ "ts-jest": "^29.4.6",
25
28
  "ts-node": "^10.9.2",
26
29
  "typescript": "^5.9.3"
27
30
  },
28
31
  "dependencies": {
29
- "cbor": "^10.0.11",
30
- "tldts": "^7.0.19"
32
+ "cbor": "^10.0.12",
33
+ "tldts": "^7.0.27"
31
34
  },
32
35
  "scripts": {
33
36
  "check": "biome check .",