@oxyhq/services 20.0.2 → 21.0.1

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.
Files changed (89) hide show
  1. package/lib/commonjs/index.js +13 -0
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/ui/components/OxyAccountDialog.js +50 -18
  4. package/lib/commonjs/ui/components/OxyAccountDialog.js.map +1 -1
  5. package/lib/commonjs/ui/context/OxyContext.js +69 -1
  6. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  7. package/lib/commonjs/ui/context/passkeyFlow.js +117 -0
  8. package/lib/commonjs/ui/context/passkeyFlow.js.map +1 -0
  9. package/lib/commonjs/ui/hooks/queries/queryKeys.js +18 -2
  10. package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
  11. package/lib/commonjs/ui/hooks/queries/useAuthMethods.js +49 -0
  12. package/lib/commonjs/ui/hooks/queries/useAuthMethods.js.map +1 -0
  13. package/lib/commonjs/ui/stores/authStore.js +5 -3
  14. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  15. package/lib/commonjs/webauthn/passkeyClient.js +39 -0
  16. package/lib/commonjs/webauthn/passkeyClient.js.map +1 -0
  17. package/lib/commonjs/webauthn/passkeyClient.native.js +34 -0
  18. package/lib/commonjs/webauthn/passkeyClient.native.js.map +1 -0
  19. package/lib/commonjs/webauthn/passkeyClient.web.js +57 -0
  20. package/lib/commonjs/webauthn/passkeyClient.web.js.map +1 -0
  21. package/lib/module/index.js +2 -1
  22. package/lib/module/index.js.map +1 -1
  23. package/lib/module/ui/components/OxyAccountDialog.js +51 -19
  24. package/lib/module/ui/components/OxyAccountDialog.js.map +1 -1
  25. package/lib/module/ui/context/OxyContext.js +69 -1
  26. package/lib/module/ui/context/OxyContext.js.map +1 -1
  27. package/lib/module/ui/context/passkeyFlow.js +110 -0
  28. package/lib/module/ui/context/passkeyFlow.js.map +1 -0
  29. package/lib/module/ui/hooks/queries/queryKeys.js +15 -0
  30. package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
  31. package/lib/module/ui/hooks/queries/useAuthMethods.js +45 -0
  32. package/lib/module/ui/hooks/queries/useAuthMethods.js.map +1 -0
  33. package/lib/module/ui/stores/authStore.js +6 -4
  34. package/lib/module/ui/stores/authStore.js.map +1 -1
  35. package/lib/module/webauthn/passkeyClient.js +33 -0
  36. package/lib/module/webauthn/passkeyClient.js.map +1 -0
  37. package/lib/module/webauthn/passkeyClient.native.js +28 -0
  38. package/lib/module/webauthn/passkeyClient.native.js.map +1 -0
  39. package/lib/module/webauthn/passkeyClient.web.js +52 -0
  40. package/lib/module/webauthn/passkeyClient.web.js.map +1 -0
  41. package/lib/typescript/commonjs/index.d.ts +2 -1
  42. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  43. package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts.map +1 -1
  44. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  45. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +26 -0
  46. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/ui/context/passkeyFlow.d.ts +85 -0
  48. package/lib/typescript/commonjs/ui/context/passkeyFlow.d.ts.map +1 -0
  49. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +9 -0
  50. package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/ui/hooks/queries/useAuthMethods.d.ts +212 -0
  52. package/lib/typescript/commonjs/ui/hooks/queries/useAuthMethods.d.ts.map +1 -0
  53. package/lib/typescript/commonjs/webauthn/passkeyClient.d.ts +20 -0
  54. package/lib/typescript/commonjs/webauthn/passkeyClient.d.ts.map +1 -0
  55. package/lib/typescript/commonjs/webauthn/passkeyClient.native.d.ts +15 -0
  56. package/lib/typescript/commonjs/webauthn/passkeyClient.native.d.ts.map +1 -0
  57. package/lib/typescript/commonjs/webauthn/passkeyClient.web.d.ts +36 -0
  58. package/lib/typescript/commonjs/webauthn/passkeyClient.web.d.ts.map +1 -0
  59. package/lib/typescript/module/index.d.ts +2 -1
  60. package/lib/typescript/module/index.d.ts.map +1 -1
  61. package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts.map +1 -1
  62. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  63. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +26 -0
  64. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
  65. package/lib/typescript/module/ui/context/passkeyFlow.d.ts +85 -0
  66. package/lib/typescript/module/ui/context/passkeyFlow.d.ts.map +1 -0
  67. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +9 -0
  68. package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  69. package/lib/typescript/module/ui/hooks/queries/useAuthMethods.d.ts +212 -0
  70. package/lib/typescript/module/ui/hooks/queries/useAuthMethods.d.ts.map +1 -0
  71. package/lib/typescript/module/webauthn/passkeyClient.d.ts +20 -0
  72. package/lib/typescript/module/webauthn/passkeyClient.d.ts.map +1 -0
  73. package/lib/typescript/module/webauthn/passkeyClient.native.d.ts +15 -0
  74. package/lib/typescript/module/webauthn/passkeyClient.native.d.ts.map +1 -0
  75. package/lib/typescript/module/webauthn/passkeyClient.web.d.ts +36 -0
  76. package/lib/typescript/module/webauthn/passkeyClient.web.d.ts.map +1 -0
  77. package/package.json +6 -5
  78. package/src/index.ts +2 -0
  79. package/src/ui/components/OxyAccountDialog.tsx +58 -14
  80. package/src/ui/context/OxyContext.tsx +76 -0
  81. package/src/ui/context/__tests__/passkeyFlow.test.ts +237 -0
  82. package/src/ui/context/oxyContextTypes.ts +21 -0
  83. package/src/ui/context/passkeyFlow.ts +146 -0
  84. package/src/ui/hooks/queries/queryKeys.ts +14 -0
  85. package/src/ui/hooks/queries/useAuthMethods.ts +45 -0
  86. package/src/ui/stores/authStore.ts +4 -4
  87. package/src/webauthn/passkeyClient.native.ts +26 -0
  88. package/src/webauthn/passkeyClient.ts +31 -0
  89. package/src/webauthn/passkeyClient.web.ts +56 -0
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Pure passkey (WebAuthn) sign-in / registration orchestration.
3
+ *
4
+ * Extracted from `OxyContext` so the fixed `options → ceremony → verify → commit`
5
+ * ordering is unit-testable with injected deps — the exact pattern
6
+ * `commitSessionFlow.ts` (`commitDeviceSetAndResolve`) uses. The context methods
7
+ * (`signInWithPasskey` / `registerWithPasskey` / `addPasskey`) are thin wrappers
8
+ * that supply the real deps: the core `webauthn*` methods, the platform ceremony
9
+ * client (`webauthn/passkeyClient`), and the internal `commitSession` funnel.
10
+ *
11
+ * All three GATE on `isSupported()` first (the platform client returns `false`
12
+ * off the web) so an unsupported surface fails loudly before touching a ceremony.
13
+ */
14
+
15
+ import type { LoginResult, LoginSessionResult } from '@oxyhq/contracts';
16
+ import type { CommitInput } from './oxyContextTypes';
17
+
18
+ /**
19
+ * The result of `OxyServices.webauthnRegisterVerify` — either the LINK branch
20
+ * (`{ success, message }`, bearer present, no session) or the SIGNUP branch (a
21
+ * full {@link LoginResult}, which carries a `sessionId` on its session arm).
22
+ */
23
+ export type PasskeyRegisterVerifyResult = { success: true; message: string } | LoginResult;
24
+
25
+ /** Thrown when a passkey flow is attempted on a surface that cannot run WebAuthn. */
26
+ export const PASSKEY_UNSUPPORTED_MESSAGE =
27
+ 'Passkeys are not available in this environment. Use another sign-in method.';
28
+
29
+ /** Project a session-arm login result onto the internal `commitSession` input. */
30
+ function toCommitInput(result: LoginSessionResult): CommitInput {
31
+ return {
32
+ sessionId: result.sessionId,
33
+ accessToken: result.accessToken,
34
+ deviceSecret: result.deviceSecret,
35
+ deviceId: result.deviceId,
36
+ expiresAt: result.expiresAt,
37
+ userId: result.user.id,
38
+ user: result.user,
39
+ };
40
+ }
41
+
42
+ /** Injected dependencies for {@link runPasskeyLogin}. */
43
+ export interface RunPasskeyLoginDeps {
44
+ isSupported: () => boolean;
45
+ getLoginOptions: () => Promise<unknown>;
46
+ runCeremony: (optionsJSON: unknown) => Promise<unknown>;
47
+ loginVerify: (
48
+ response: unknown,
49
+ envelope: { deviceName?: string; deviceFingerprint?: string; deviceId?: string },
50
+ ) => Promise<LoginResult>;
51
+ commit: (input: CommitInput) => Promise<void>;
52
+ deviceId?: string;
53
+ deviceName?: string;
54
+ deviceFingerprint?: string;
55
+ }
56
+
57
+ /**
58
+ * Usernameless (discoverable-credential) passkey SIGN-IN: request login options,
59
+ * run the authentication ceremony, verify, then commit the session. A passkey
60
+ * assertion is itself the strong factor, so a 2FA arm here is a protocol error.
61
+ */
62
+ export async function runPasskeyLogin(deps: RunPasskeyLoginDeps): Promise<void> {
63
+ if (!deps.isSupported()) {
64
+ throw new Error(PASSKEY_UNSUPPORTED_MESSAGE);
65
+ }
66
+ const options = await deps.getLoginOptions();
67
+ const response = await deps.runCeremony(options);
68
+ const result = await deps.loginVerify(response, {
69
+ deviceName: deps.deviceName,
70
+ deviceFingerprint: deps.deviceFingerprint,
71
+ deviceId: deps.deviceId,
72
+ });
73
+ if ('twoFactorRequired' in result) {
74
+ throw new Error('Passkey sign-in unexpectedly required a second factor.');
75
+ }
76
+ await deps.commit(toCommitInput(result));
77
+ }
78
+
79
+ /** Injected dependencies for {@link runPasskeyRegister}. */
80
+ export interface RunPasskeyRegisterDeps {
81
+ isSupported: () => boolean;
82
+ getRegisterOptions: (username: string) => Promise<unknown>;
83
+ runCeremony: (optionsJSON: unknown) => Promise<unknown>;
84
+ registerVerify: (
85
+ response: unknown,
86
+ envelope: { username: string; deviceName?: string },
87
+ ) => Promise<PasskeyRegisterVerifyResult>;
88
+ commit: (input: CommitInput) => Promise<void>;
89
+ username: string;
90
+ deviceName?: string;
91
+ }
92
+
93
+ /**
94
+ * Passkey SIGNUP: create a brand-new account whose first auth method is a
95
+ * passkey. The verify signup branch mints a session (a {@link LoginSessionResult}
96
+ * carrying `sessionId`), which is committed exactly like a password signup.
97
+ */
98
+ export async function runPasskeyRegister(deps: RunPasskeyRegisterDeps): Promise<void> {
99
+ if (!deps.isSupported()) {
100
+ throw new Error(PASSKEY_UNSUPPORTED_MESSAGE);
101
+ }
102
+ const options = await deps.getRegisterOptions(deps.username);
103
+ const response = await deps.runCeremony(options);
104
+ const result = await deps.registerVerify(response, {
105
+ username: deps.username,
106
+ deviceName: deps.deviceName,
107
+ });
108
+ // Only the signup session arm carries `sessionId`; the link branch
109
+ // (`{ success, message }`) and any 2FA arm do not.
110
+ if (!('sessionId' in result)) {
111
+ throw new Error('Passkey registration did not establish a session.');
112
+ }
113
+ await deps.commit(toCommitInput(result));
114
+ }
115
+
116
+ /** Injected dependencies for {@link runPasskeyAdd}. */
117
+ export interface RunPasskeyAddDeps {
118
+ isSupported: () => boolean;
119
+ getRegisterOptions: () => Promise<unknown>;
120
+ runCeremony: (optionsJSON: unknown) => Promise<unknown>;
121
+ registerVerify: (
122
+ response: unknown,
123
+ envelope: { deviceName?: string },
124
+ ) => Promise<PasskeyRegisterVerifyResult>;
125
+ onLinked: () => void;
126
+ deviceName?: string;
127
+ }
128
+
129
+ /**
130
+ * ADD a passkey to the already-signed-in account (bearer present). The verify
131
+ * link branch returns `{ success, message }` with NO session — so this never
132
+ * commits a session; it just fires `onLinked` (which invalidates the
133
+ * auth-methods query). A session arm here would be a server contract violation.
134
+ */
135
+ export async function runPasskeyAdd(deps: RunPasskeyAddDeps): Promise<void> {
136
+ if (!deps.isSupported()) {
137
+ throw new Error(PASSKEY_UNSUPPORTED_MESSAGE);
138
+ }
139
+ const options = await deps.getRegisterOptions();
140
+ const response = await deps.runCeremony(options);
141
+ const result = await deps.registerVerify(response, { deviceName: deps.deviceName });
142
+ if ('sessionId' in result) {
143
+ throw new Error('addPasskey unexpectedly minted a new session instead of linking.');
144
+ }
145
+ deps.onLinked();
146
+ }
@@ -71,6 +71,12 @@ export const queryKeys = {
71
71
  [...queryKeys.security.all, 'infinite', limit, eventType] as const,
72
72
  },
73
73
 
74
+ // Linked authentication methods (passwords, identity keys, passkeys, social)
75
+ authMethods: {
76
+ all: ['authMethods'] as const,
77
+ list: (userId?: string) => [...queryKeys.authMethods.all, 'list', userId || 'current'] as const,
78
+ },
79
+
74
80
  // Storage usage queries
75
81
  storage: {
76
82
  all: ['storage'] as const,
@@ -159,6 +165,14 @@ export const invalidateStorageQueries = (queryClient: QueryClient): void => {
159
165
  queryClient.invalidateQueries({ queryKey: queryKeys.storage.all });
160
166
  };
161
167
 
168
+ /**
169
+ * Helper to invalidate the user's linked auth-methods list (call after linking
170
+ * or removing a passkey / password / identity key).
171
+ */
172
+ export const invalidateAuthMethodsQueries = (queryClient: QueryClient): void => {
173
+ queryClient.invalidateQueries({ queryKey: queryKeys.authMethods.all });
174
+ };
175
+
162
176
  /**
163
177
  * Helper to invalidate all payments / wallet / subscription queries
164
178
  */
@@ -0,0 +1,45 @@
1
+ import { useMemo } from 'react';
2
+ import { useQuery } from '@tanstack/react-query';
3
+ import type { AuthMethodEntry, AuthMethodsResponse } from '@oxyhq/contracts';
4
+ import { queryKeys } from './queryKeys';
5
+ import { useOxy } from '../../context/OxyContext';
6
+
7
+ /** Stable empty list so the derived selectors keep a stable reference while loading. */
8
+ const EMPTY_METHODS: readonly AuthMethodEntry[] = Object.freeze([]);
9
+
10
+ /**
11
+ * The current account's linked authentication methods (`GET /auth/methods`),
12
+ * plus convenience projections. Backs the security / account surfaces that let a
13
+ * user see and manage their passwords, identity key, social logins, and passkeys.
14
+ *
15
+ * `passkeys` is the `type === 'webauthn'` subset — one entry per registered
16
+ * credential. Invalidate via `queryKeys.authMethods.all` after linking a passkey
17
+ * (`useOxy().addPasskey()` does this) or removing one.
18
+ */
19
+ export const useAuthMethods = (options?: { enabled?: boolean }) => {
20
+ const { oxyServices, activeSessionId } = useOxy();
21
+
22
+ const query = useQuery<AuthMethodsResponse>({
23
+ queryKey: queryKeys.authMethods.list(),
24
+ queryFn: () => oxyServices.listAuthMethods(),
25
+ enabled: options?.enabled !== false && !!activeSessionId,
26
+ staleTime: 5 * 60 * 1000, // 5 minutes
27
+ gcTime: 10 * 60 * 1000, // 10 minutes
28
+ });
29
+
30
+ const methods = query.data?.methods ?? EMPTY_METHODS;
31
+ const passkeys = useMemo(
32
+ () => methods.filter((method) => method.type === 'webauthn'),
33
+ [methods],
34
+ );
35
+
36
+ return {
37
+ ...query,
38
+ /** Every linked auth method. Empty while loading. */
39
+ methods,
40
+ /** The registered passkeys (a `type === 'webauthn'` subset of `methods`). */
41
+ passkeys,
42
+ /** The account's DID, or `null` while loading. */
43
+ did: query.data?.did ?? null,
44
+ };
45
+ };
@@ -1,8 +1,8 @@
1
1
  import { create } from 'zustand';
2
- import { createDebugLogger, normalizeUserIdentity } from '@oxyhq/core';
2
+ import { createLogger, normalizeUserIdentity } from '@oxyhq/core';
3
3
  import type { User } from '@oxyhq/core';
4
4
 
5
- const debug = createDebugLogger('AuthStore');
5
+ const log = createLogger('AuthStore');
6
6
 
7
7
  export interface AuthState {
8
8
  user: User | null;
@@ -46,7 +46,7 @@ export const useAuthStore = create<AuthState>((set: (state: Partial<AuthState>)
46
46
 
47
47
  // Use cached data if available and not forcing refresh
48
48
  if (!forceRefresh && state.user && cacheValid) {
49
- debug.log('Using cached user data (age:', cacheAge, 'ms)');
49
+ log.info('Using cached user data', { cacheAge });
50
50
  return;
51
51
  }
52
52
 
@@ -56,7 +56,7 @@ export const useAuthStore = create<AuthState>((set: (state: Partial<AuthState>)
56
56
  set({ user, isLoading: false, isAuthenticated: true, lastUserFetch: now });
57
57
  } catch (error) {
58
58
  const errorMessage = error instanceof Error ? error.message : 'Failed to fetch user';
59
- debug.error('Error fetching user:', error);
59
+ log.error('Error fetching user', error);
60
60
  set({ error: errorMessage, isLoading: false });
61
61
  }
62
62
  },
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Passkey / WebAuthn ceremony client — NATIVE implementation.
3
+ *
4
+ * React Native has no browser WebAuthn API, and Oxy's native passkey story is
5
+ * Commons (shared-keychain / QR handoff), NOT `navigator.credentials`. So this
6
+ * variant imports NOTHING browser-specific and mirrors the clean default:
7
+ * unsupported, and the ceremony helpers throw if a caller skipped the gate.
8
+ */
9
+
10
+ const WEBAUTHN_WEB_ONLY_MESSAGE =
11
+ 'WebAuthn is web-only; native uses Commons. Passkeys are not available on this platform.';
12
+
13
+ /** Always `false` on native — there is no browser WebAuthn API. */
14
+ export function isPasskeySupported(): boolean {
15
+ return false;
16
+ }
17
+
18
+ /** Not available on native — throws. Guard with {@link isPasskeySupported} first. */
19
+ export async function runRegistrationCeremony(_optionsJSON: unknown): Promise<unknown> {
20
+ throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
21
+ }
22
+
23
+ /** Not available on native — throws. Guard with {@link isPasskeySupported} first. */
24
+ export async function runAuthenticationCeremony(_optionsJSON: unknown): Promise<unknown> {
25
+ throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
26
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Passkey / WebAuthn ceremony client — clean default (non-web) implementation.
3
+ *
4
+ * This is the base module TypeScript resolves for TYPES and any bundler that
5
+ * does not pick a platform variant. It intentionally imports NOTHING browser-
6
+ * specific (no `@simplewebauthn/browser`) so it stays safe for Metro, native
7
+ * builds, and SSR. The real ceremony lives in `passkeyClient.web.ts`; native
8
+ * passkeys are Commons' job, so there is no WebAuthn ceremony here.
9
+ *
10
+ * `isPasskeySupported()` returns `false` (no relying-party origin / no browser
11
+ * WebAuthn API), and the ceremony helpers throw a clear error so a caller that
12
+ * skipped the support gate fails loudly instead of silently.
13
+ */
14
+
15
+ const WEBAUTHN_WEB_ONLY_MESSAGE =
16
+ 'WebAuthn is web-only; native uses Commons. Passkeys are not available on this platform.';
17
+
18
+ /** Always `false` off the web — there is no relying-party origin or WebAuthn API. */
19
+ export function isPasskeySupported(): boolean {
20
+ return false;
21
+ }
22
+
23
+ /** Not available off the web — throws. Guard with {@link isPasskeySupported} first. */
24
+ export async function runRegistrationCeremony(_optionsJSON: unknown): Promise<unknown> {
25
+ throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
26
+ }
27
+
28
+ /** Not available off the web — throws. Guard with {@link isPasskeySupported} first. */
29
+ export async function runAuthenticationCeremony(_optionsJSON: unknown): Promise<unknown> {
30
+ throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
31
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Passkey / WebAuthn ceremony client — WEB implementation.
3
+ *
4
+ * The browser half of the passkey flow: it drives `navigator.credentials`
5
+ * through `@simplewebauthn/browser`, turning the OPAQUE options the server
6
+ * emitted (`OxyServices.webauthn{Register,Login}Options`) into the opaque
7
+ * response the matching `verify` endpoint consumes. Oxy never owns those wire
8
+ * shapes — `@simplewebauthn/browser` does — so options flow in as `unknown` and
9
+ * the single cast at this boundary hands them to the library's own types.
10
+ *
11
+ * This file is selected ONLY on web (react-native-web / Vite RNW): the sibling
12
+ * `passkeyClient.native.ts` + the clean default `passkeyClient.ts` deliberately
13
+ * do NOT import `@simplewebauthn/browser` (a browser-only dependency), per the
14
+ * platform-split rule. Native passkeys are Commons' job — there is no WebAuthn
15
+ * ceremony off the web.
16
+ */
17
+
18
+ import {
19
+ startRegistration,
20
+ startAuthentication,
21
+ type PublicKeyCredentialCreationOptionsJSON,
22
+ type PublicKeyCredentialRequestOptionsJSON,
23
+ type RegistrationResponseJSON,
24
+ type AuthenticationResponseJSON,
25
+ } from '@simplewebauthn/browser';
26
+
27
+ /**
28
+ * True iff this browser can run a WebAuthn ceremony (exposes the
29
+ * `PublicKeyCredential` global). Gate all passkey UI/entrypoints on this so an
30
+ * unsupported browser fails loudly rather than throwing mid-ceremony.
31
+ */
32
+ export function isPasskeySupported(): boolean {
33
+ return typeof window !== 'undefined' && typeof window.PublicKeyCredential !== 'undefined';
34
+ }
35
+
36
+ /**
37
+ * Run the WebAuthn REGISTRATION ceremony (`navigator.credentials.create`) from
38
+ * the server's opaque creation options, returning the opaque attestation
39
+ * response for `OxyServices.webauthnRegisterVerify`.
40
+ */
41
+ export async function runRegistrationCeremony(
42
+ optionsJSON: unknown,
43
+ ): Promise<RegistrationResponseJSON> {
44
+ return startRegistration({ optionsJSON: optionsJSON as PublicKeyCredentialCreationOptionsJSON });
45
+ }
46
+
47
+ /**
48
+ * Run the WebAuthn AUTHENTICATION ceremony (`navigator.credentials.get`) from
49
+ * the server's opaque request options, returning the opaque assertion response
50
+ * for `OxyServices.webauthnLoginVerify`.
51
+ */
52
+ export async function runAuthenticationCeremony(
53
+ optionsJSON: unknown,
54
+ ): Promise<AuthenticationResponseJSON> {
55
+ return startAuthentication({ optionsJSON: optionsJSON as PublicKeyCredentialRequestOptionsJSON });
56
+ }