@jokio/sdk 0.4.2 → 0.6.0

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.
@@ -1,3 +1,4 @@
1
+ import { type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/browser';
1
2
  import { StorageService } from './storage.service';
2
3
  type Options = {
3
4
  authUrl: string;
@@ -15,6 +16,32 @@ export declare class AuthService {
15
16
  }>;
16
17
  requestEmailLogin(email: string, returnUrl?: string): Promise<boolean>;
17
18
  completeEmailLogin(email: string, otpCode: string): Promise<UserAuthData>;
19
+ /**
20
+ * Fetch WebAuthn challenge options ahead of the user gesture
21
+ * (e.g. on page load or pointerdown). Pass the result to
22
+ * completePasskeyLogin() inside the click handler so
23
+ * navigator.credentials.get() runs while the user activation is
24
+ * still fresh — iOS Safari rejects it otherwise.
25
+ */
26
+ requestPasskeyChallenge(opts?: {
27
+ displayName?: string;
28
+ isRegistration?: boolean;
29
+ }): Promise<PasskeyChallenge>;
30
+ /**
31
+ * Prompt for the passkey and verify it. Call synchronously from
32
+ * the click handler with a challenge obtained earlier via
33
+ * requestPasskeyChallenge().
34
+ */
35
+ completePasskeyLogin(passkeyOpts: PasskeyChallenge, opts?: {
36
+ displayName?: string;
37
+ addAsAdditionalDevice?: boolean;
38
+ }): Promise<UserAuthData>;
39
+ /**
40
+ * Fetches the challenge and prompts for the passkey in one call.
41
+ * Note: on iOS Safari the fetch may consume the user activation,
42
+ * causing credentials.get() to be blocked. Prefer
43
+ * requestPasskeyChallenge() + completePasskeyLogin().
44
+ */
18
45
  requestPasskeyLogin(opts?: {
19
46
  displayName?: string;
20
47
  isRegistration?: boolean;
@@ -29,6 +56,7 @@ export declare class AuthService {
29
56
  authorization: string;
30
57
  } | undefined>;
31
58
  }
59
+ export type PasskeyChallenge = PublicKeyCredentialRequestOptionsJSON | PublicKeyCredentialCreationOptionsJSON;
32
60
  export type UserAuthData = {
33
61
  name: string;
34
62
  email: string;
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { CryptoService } from './crypto.service';
3
3
  import { NatsService } from './nats.service';
4
4
  import { StorageService } from './storage.service';
5
5
  import { EdgeTtsService } from './tts.service';
6
- export { type UserAuthData } from './auth.service';
6
+ export { type PasskeyChallenge, type UserAuthData, } from './auth.service';
7
7
  export { NatsService } from './nats.service';
8
8
  export { VoicevoxTtsService } from './voicevoxTts';
9
9
  type Config = {