@oxyhq/services 21.0.0 → 22.0.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.
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/boot/runProviderColdBoot.js +12 -2
- package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAccountDialog.js +46 -19
- package/lib/commonjs/ui/components/OxyAccountDialog.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +2 -0
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +80 -59
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/passkeyFlow.js +118 -0
- package/lib/commonjs/ui/context/passkeyFlow.js.map +1 -0
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +18 -2
- package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAuthMethods.js +49 -0
- package/lib/commonjs/ui/hooks/queries/useAuthMethods.js.map +1 -0
- package/lib/commonjs/ui/utils/crossOriginRestore.js +26 -0
- package/lib/commonjs/ui/utils/crossOriginRestore.js.map +1 -1
- package/lib/commonjs/webauthn/passkeyClient.js +39 -0
- package/lib/commonjs/webauthn/passkeyClient.js.map +1 -0
- package/lib/commonjs/webauthn/passkeyClient.native.js +34 -0
- package/lib/commonjs/webauthn/passkeyClient.native.js.map +1 -0
- package/lib/commonjs/webauthn/passkeyClient.web.js +57 -0
- package/lib/commonjs/webauthn/passkeyClient.web.js.map +1 -0
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/boot/runProviderColdBoot.js +13 -3
- package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/module/ui/components/OxyAccountDialog.js +46 -19
- package/lib/module/ui/components/OxyAccountDialog.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +2 -0
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +80 -59
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/passkeyFlow.js +111 -0
- package/lib/module/ui/context/passkeyFlow.js.map +1 -0
- package/lib/module/ui/hooks/queries/queryKeys.js +15 -0
- package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAuthMethods.js +45 -0
- package/lib/module/ui/hooks/queries/useAuthMethods.js.map +1 -0
- package/lib/module/ui/utils/crossOriginRestore.js +26 -1
- package/lib/module/ui/utils/crossOriginRestore.js.map +1 -1
- package/lib/module/webauthn/passkeyClient.js +33 -0
- package/lib/module/webauthn/passkeyClient.js.map +1 -0
- package/lib/module/webauthn/passkeyClient.native.js +28 -0
- package/lib/module/webauthn/passkeyClient.native.js.map +1 -0
- package/lib/module/webauthn/passkeyClient.web.js +52 -0
- package/lib/module/webauthn/passkeyClient.web.js.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +3 -2
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts +6 -0
- package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +41 -20
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/passkeyFlow.d.ts +96 -0
- package/lib/typescript/commonjs/ui/context/passkeyFlow.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +2 -2
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +9 -0
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAuthMethods.d.ts +212 -0
- package/lib/typescript/commonjs/ui/hooks/queries/useAuthMethods.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/types/navigation.d.ts +8 -0
- package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/crossOriginRestore.d.ts +19 -0
- package/lib/typescript/commonjs/ui/utils/crossOriginRestore.d.ts.map +1 -1
- package/lib/typescript/commonjs/webauthn/passkeyClient.d.ts +20 -0
- package/lib/typescript/commonjs/webauthn/passkeyClient.d.ts.map +1 -0
- package/lib/typescript/commonjs/webauthn/passkeyClient.native.d.ts +15 -0
- package/lib/typescript/commonjs/webauthn/passkeyClient.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/webauthn/passkeyClient.web.d.ts +36 -0
- package/lib/typescript/commonjs/webauthn/passkeyClient.web.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +3 -2
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts +6 -0
- package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +41 -20
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/passkeyFlow.d.ts +96 -0
- package/lib/typescript/module/ui/context/passkeyFlow.d.ts.map +1 -0
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +2 -2
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +9 -0
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useAuthMethods.d.ts +212 -0
- package/lib/typescript/module/ui/hooks/queries/useAuthMethods.d.ts.map +1 -0
- package/lib/typescript/module/ui/types/navigation.d.ts +8 -0
- package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/crossOriginRestore.d.ts +19 -0
- package/lib/typescript/module/ui/utils/crossOriginRestore.d.ts.map +1 -1
- package/lib/typescript/module/webauthn/passkeyClient.d.ts +20 -0
- package/lib/typescript/module/webauthn/passkeyClient.d.ts.map +1 -0
- package/lib/typescript/module/webauthn/passkeyClient.native.d.ts +15 -0
- package/lib/typescript/module/webauthn/passkeyClient.native.d.ts.map +1 -0
- package/lib/typescript/module/webauthn/passkeyClient.web.d.ts +36 -0
- package/lib/typescript/module/webauthn/passkeyClient.web.d.ts.map +1 -0
- package/package.json +6 -5
- package/src/index.ts +3 -1
- package/src/ui/boot/runProviderColdBoot.ts +24 -1
- package/src/ui/components/OxyAccountDialog.tsx +57 -14
- package/src/ui/components/OxyProvider.tsx +2 -0
- package/src/ui/context/OxyContext.tsx +85 -63
- package/src/ui/context/__tests__/passkeyFlow.test.ts +244 -0
- package/src/ui/context/oxyContextTypes.ts +41 -19
- package/src/ui/context/passkeyFlow.ts +154 -0
- package/src/ui/hooks/queries/queryKeys.ts +14 -0
- package/src/ui/hooks/queries/useAuthMethods.ts +45 -0
- package/src/ui/types/navigation.ts +8 -0
- package/src/ui/utils/__tests__/crossOriginRestore.test.ts +143 -0
- package/src/ui/utils/crossOriginRestore.ts +34 -0
- package/src/webauthn/passkeyClient.native.ts +26 -0
- package/src/webauthn/passkeyClient.ts +31 -0
- package/src/webauthn/passkeyClient.web.ts +56 -0
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
import type { LoginResult } from '@oxyhq/contracts';
|
|
15
|
+
import type { CommitInput } from './oxyContextTypes.js';
|
|
16
|
+
/**
|
|
17
|
+
* The result of `OxyServices.webauthnRegisterVerify` — either the LINK branch
|
|
18
|
+
* (`{ success, message }`, bearer present, no session) or the SIGNUP branch (a
|
|
19
|
+
* full {@link LoginResult}, which carries a `sessionId` on its session arm).
|
|
20
|
+
*/
|
|
21
|
+
export type PasskeyRegisterVerifyResult = {
|
|
22
|
+
success: true;
|
|
23
|
+
message: string;
|
|
24
|
+
} | LoginResult;
|
|
25
|
+
/** Thrown when a passkey flow is attempted on a surface that cannot run WebAuthn. */
|
|
26
|
+
export declare const PASSKEY_UNSUPPORTED_MESSAGE = "Passkeys are not available in this environment. Use another sign-in method.";
|
|
27
|
+
/** Injected dependencies for {@link runPasskeyLogin}. */
|
|
28
|
+
export interface RunPasskeyLoginDeps {
|
|
29
|
+
isSupported: () => boolean;
|
|
30
|
+
getLoginOptions: (username?: string) => Promise<unknown>;
|
|
31
|
+
runCeremony: (optionsJSON: unknown) => Promise<unknown>;
|
|
32
|
+
loginVerify: (response: unknown, envelope: {
|
|
33
|
+
deviceName?: string;
|
|
34
|
+
deviceFingerprint?: string;
|
|
35
|
+
deviceId?: string;
|
|
36
|
+
}) => Promise<LoginResult>;
|
|
37
|
+
commit: (input: CommitInput) => Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* When present, scopes login options to that user's registered passkeys
|
|
40
|
+
* (username-first) — the path a NON-discoverable hardware key (e.g. a U2F
|
|
41
|
+
* security key) needs, since it can't be found by a usernameless ceremony.
|
|
42
|
+
* Omit for the discoverable / resident-credential path.
|
|
43
|
+
*/
|
|
44
|
+
username?: string;
|
|
45
|
+
deviceId?: string;
|
|
46
|
+
deviceName?: string;
|
|
47
|
+
deviceFingerprint?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Passkey SIGN-IN. With no `username` this is the usernameless
|
|
51
|
+
* (discoverable-credential) flow; with a `username` it is username-first —
|
|
52
|
+
* the server scopes `allowCredentials` to that user's passkeys so a
|
|
53
|
+
* non-discoverable hardware key (U2F/security key) can be selected. Either way:
|
|
54
|
+
* request login options, run the authentication ceremony, verify, then commit
|
|
55
|
+
* the session. A passkey assertion is itself the strong factor — sign-in always
|
|
56
|
+
* resolves to a completed session.
|
|
57
|
+
*/
|
|
58
|
+
export declare function runPasskeyLogin(deps: RunPasskeyLoginDeps): Promise<void>;
|
|
59
|
+
/** Injected dependencies for {@link runPasskeyRegister}. */
|
|
60
|
+
export interface RunPasskeyRegisterDeps {
|
|
61
|
+
isSupported: () => boolean;
|
|
62
|
+
getRegisterOptions: (username: string) => Promise<unknown>;
|
|
63
|
+
runCeremony: (optionsJSON: unknown) => Promise<unknown>;
|
|
64
|
+
registerVerify: (response: unknown, envelope: {
|
|
65
|
+
username: string;
|
|
66
|
+
deviceName?: string;
|
|
67
|
+
}) => Promise<PasskeyRegisterVerifyResult>;
|
|
68
|
+
commit: (input: CommitInput) => Promise<void>;
|
|
69
|
+
username: string;
|
|
70
|
+
deviceName?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Passkey SIGNUP: create a brand-new account whose first auth method is a
|
|
74
|
+
* passkey. The verify signup branch mints a session (a {@link LoginSessionResult}
|
|
75
|
+
* carrying `sessionId`), which is committed exactly like a password signup.
|
|
76
|
+
*/
|
|
77
|
+
export declare function runPasskeyRegister(deps: RunPasskeyRegisterDeps): Promise<void>;
|
|
78
|
+
/** Injected dependencies for {@link runPasskeyAdd}. */
|
|
79
|
+
export interface RunPasskeyAddDeps {
|
|
80
|
+
isSupported: () => boolean;
|
|
81
|
+
getRegisterOptions: () => Promise<unknown>;
|
|
82
|
+
runCeremony: (optionsJSON: unknown) => Promise<unknown>;
|
|
83
|
+
registerVerify: (response: unknown, envelope: {
|
|
84
|
+
deviceName?: string;
|
|
85
|
+
}) => Promise<PasskeyRegisterVerifyResult>;
|
|
86
|
+
onLinked: () => void;
|
|
87
|
+
deviceName?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* ADD a passkey to the already-signed-in account (bearer present). The verify
|
|
91
|
+
* link branch returns `{ success, message }` with NO session — so this never
|
|
92
|
+
* commits a session; it just fires `onLinked` (which invalidates the
|
|
93
|
+
* auth-methods query). A session arm here would be a server contract violation.
|
|
94
|
+
*/
|
|
95
|
+
export declare function runPasskeyAdd(deps: RunPasskeyAddDeps): Promise<void>;
|
|
96
|
+
//# sourceMappingURL=passkeyFlow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkeyFlow.d.ts","sourceRoot":"","sources":["../../../../../src/ui/context/passkeyFlow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAmB,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IAAE,OAAO,EAA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EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,KAChD,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC1C,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBpF;AAED,uDAAuD;AACvD,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,kBAAkB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,WAAW,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,cAAc,EAAE,CACd,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,KAC9B,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC1C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAW1E"}
|
|
@@ -32,14 +32,14 @@ export declare const useUpdateProfile: () => import("@tanstack/react-query").Use
|
|
|
32
32
|
id: import("zod").ZodOptional<import("zod").ZodString>;
|
|
33
33
|
}, "strip", import("zod").ZodTypeAny, {
|
|
34
34
|
url: string;
|
|
35
|
-
id?: string | undefined;
|
|
36
35
|
description?: string | undefined;
|
|
36
|
+
id?: string | undefined;
|
|
37
37
|
title?: string | undefined;
|
|
38
38
|
image?: string | undefined;
|
|
39
39
|
}, {
|
|
40
40
|
url: string;
|
|
41
|
-
id?: string | undefined;
|
|
42
41
|
description?: string | undefined;
|
|
42
|
+
id?: string | undefined;
|
|
43
43
|
title?: string | undefined;
|
|
44
44
|
image?: string | undefined;
|
|
45
45
|
}>, "many">>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccountMutations.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/mutations/useAccountMutations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,IAAI,EACJ,eAAe,EAChB,MAAM,aAAa,CAAC;AAerB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;aAqS4B,CAAC;YAEvD,CAAC;;aAEqC,CAAC;YAIxC,CAHA;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useAccountMutations.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/mutations/useAccountMutations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,IAAI,EACJ,eAAe,EAChB,MAAM,aAAa,CAAC;AAerB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;aAqS4B,CAAC;YAEvD,CAAC;;aAEqC,CAAC;YAIxC,CAHA;;;;;;;;;;;;;;;;;;;;;mBAkBQ,CAAC;UAAgC,CAAC;aAK1C,CAAC;aAC+B,CAAC;;;mBAEZ,CAAC;UAChB,CAAC;aAAoC,CAAA;aACvB,CAAA;;;;;;;;;EAxOrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;SAMQ,MAAM;WAAS,MAAM;WAAS,MAAM;WAAS,MAAM;;;EA4EtF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,UAAU,8BAA8B;IACtC,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAClC;;;;OAIG;IACH,WAAW,EAAE,IAAI,CAAC;CACnB;AAED;;;;;;;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,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CACxI;AAED,4EAA4E;AAC5E,UAAU,YAAY;IACpB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,eAAO,MAAM,gCAAgC;;EAmD5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;EA+CpC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,uFAoBjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;UAWd,gBAAgB;iBACT,SAAS,GAAG,QAAQ,GAAG,UAAU;eACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;iBACrB,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI;WAS5C,CAAC"}
|
|
@@ -51,6 +51,10 @@ export declare const queryKeys: {
|
|
|
51
51
|
readonly recent: (limit: number) => readonly ["security", "recent", number];
|
|
52
52
|
readonly infinite: (limit: number, eventType?: string) => readonly ["security", "infinite", number, string | undefined];
|
|
53
53
|
};
|
|
54
|
+
readonly authMethods: {
|
|
55
|
+
readonly all: readonly ["authMethods"];
|
|
56
|
+
readonly list: (userId?: string) => readonly ["authMethods", "list", string];
|
|
57
|
+
};
|
|
54
58
|
readonly storage: {
|
|
55
59
|
readonly all: readonly ["storage"];
|
|
56
60
|
readonly usage: (accountScope?: string) => readonly ["storage", "usage", string | undefined];
|
|
@@ -99,6 +103,11 @@ export declare const invalidateSecurityQueries: (queryClient: QueryClient) => vo
|
|
|
99
103
|
* Helper to invalidate all storage-usage queries
|
|
100
104
|
*/
|
|
101
105
|
export declare const invalidateStorageQueries: (queryClient: QueryClient) => void;
|
|
106
|
+
/**
|
|
107
|
+
* Helper to invalidate the user's linked auth-methods list (call after linking
|
|
108
|
+
* or removing a passkey / password / identity key).
|
|
109
|
+
*/
|
|
110
|
+
export declare const invalidateAuthMethodsQueries: (queryClient: QueryClient) => void;
|
|
102
111
|
/**
|
|
103
112
|
* Helper to invalidate all payments / wallet / subscription queries
|
|
104
113
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryKeys.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/queryKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,SAAS;;;;oCAKC,MAAM,EAAE;;qCAEP,MAAM;uCACJ,MAAM,GAAG,IAAI;;;;;;iCAWnB,MAAM,EAAE;;kCAEP,MAAM;sCACF,MAAM;;;;;iCAOX,MAAM;;qCAEF,MAAM;;oCAEP,MAAM;;;;;uCAOH,MAAM;;oCAET,MAAM;;;;qCAML,MAAM;;;;oCAMP,MAAM,WAAW,MAAM,cAAc,MAAM;iCAE9C,MAAM;mCAEJ,MAAM,cAAc,MAAM;;;;
|
|
1
|
+
{"version":3,"file":"queryKeys.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/queryKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,SAAS;;;;oCAKC,MAAM,EAAE;;qCAEP,MAAM;uCACJ,MAAM,GAAG,IAAI;;;;;;iCAWnB,MAAM,EAAE;;kCAEP,MAAM;sCACF,MAAM;;;;;iCAOX,MAAM;;qCAEF,MAAM;;oCAEP,MAAM;;;;;uCAOH,MAAM;;oCAET,MAAM;;;;qCAML,MAAM;;;;oCAMP,MAAM,WAAW,MAAM,cAAc,MAAM;iCAE9C,MAAM;mCAEJ,MAAM,cAAc,MAAM;;;;iCAO5B,MAAM;;;;wCAMC,MAAM;;;;;;;;kCAYZ,MAAM;;;;yCAMC,MAAM;oCAEX,MAAM;mCAEP,MAAM;8CAEK,MAAM,WAAW,MAAM,WAAW,MAAM;;CAU/D,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,aAAa,WAAW,KAAG,IAEnE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,aAAa,WAAW,KAAG,IAEhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,aAAa,WAAW,KAAG,IAEnE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,aAAa,WAAW,KAAG,IAElE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,aAAa,WAAW,KAAG,IAEnE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAAI,aAAa,WAAW,KAAG,IAEpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,GAAI,aAAa,WAAW,KAAG,IAEnE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GAAI,aAAa,WAAW,KAAG,IAEvE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,GAAI,aAAa,WAAW,KAAG,IAEpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B,GAAI,aAAa,WAAW,KAAG,IAEzE,CAAC"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import type { AuthMethodEntry, AuthMethodsResponse } from '@oxyhq/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* The current account's linked authentication methods (`GET /auth/methods`),
|
|
4
|
+
* plus convenience projections. Backs the security / account surfaces that let a
|
|
5
|
+
* user see and manage their passwords, identity key, social logins, and passkeys.
|
|
6
|
+
*
|
|
7
|
+
* `passkeys` is the `type === 'webauthn'` subset — one entry per registered
|
|
8
|
+
* credential. Invalidate via `queryKeys.authMethods.all` after linking a passkey
|
|
9
|
+
* (`useOxy().addPasskey()` does this) or removing one.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useAuthMethods: (options?: {
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
}) => {
|
|
14
|
+
/** Every linked auth method. Empty while loading. */
|
|
15
|
+
methods: readonly AuthMethodEntry[];
|
|
16
|
+
/** The registered passkeys (a `type === 'webauthn'` subset of `methods`). */
|
|
17
|
+
passkeys: AuthMethodEntry[];
|
|
18
|
+
/** The account's DID, or `null` while loading. */
|
|
19
|
+
did: string | null;
|
|
20
|
+
data: NoInfer<AuthMethodsResponse>;
|
|
21
|
+
error: Error;
|
|
22
|
+
isError: true;
|
|
23
|
+
isPending: false;
|
|
24
|
+
isLoading: false;
|
|
25
|
+
isLoadingError: false;
|
|
26
|
+
isRefetchError: true;
|
|
27
|
+
isSuccess: false;
|
|
28
|
+
isPlaceholderData: false;
|
|
29
|
+
status: "error";
|
|
30
|
+
dataUpdatedAt: number;
|
|
31
|
+
errorUpdatedAt: number;
|
|
32
|
+
failureCount: number;
|
|
33
|
+
failureReason: Error | null;
|
|
34
|
+
errorUpdateCount: number;
|
|
35
|
+
isFetched: boolean;
|
|
36
|
+
isFetchedAfterMount: boolean;
|
|
37
|
+
isFetching: boolean;
|
|
38
|
+
isInitialLoading: boolean;
|
|
39
|
+
isPaused: boolean;
|
|
40
|
+
isRefetching: boolean;
|
|
41
|
+
isStale: boolean;
|
|
42
|
+
isEnabled: boolean;
|
|
43
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<NoInfer<AuthMethodsResponse>, Error>>;
|
|
44
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
45
|
+
promise: Promise<NoInfer<AuthMethodsResponse>>;
|
|
46
|
+
} | {
|
|
47
|
+
/** Every linked auth method. Empty while loading. */
|
|
48
|
+
methods: readonly AuthMethodEntry[];
|
|
49
|
+
/** The registered passkeys (a `type === 'webauthn'` subset of `methods`). */
|
|
50
|
+
passkeys: AuthMethodEntry[];
|
|
51
|
+
/** The account's DID, or `null` while loading. */
|
|
52
|
+
did: string | null;
|
|
53
|
+
data: NoInfer<AuthMethodsResponse>;
|
|
54
|
+
error: null;
|
|
55
|
+
isError: false;
|
|
56
|
+
isPending: false;
|
|
57
|
+
isLoading: false;
|
|
58
|
+
isLoadingError: false;
|
|
59
|
+
isRefetchError: false;
|
|
60
|
+
isSuccess: true;
|
|
61
|
+
isPlaceholderData: false;
|
|
62
|
+
status: "success";
|
|
63
|
+
dataUpdatedAt: number;
|
|
64
|
+
errorUpdatedAt: number;
|
|
65
|
+
failureCount: number;
|
|
66
|
+
failureReason: Error | null;
|
|
67
|
+
errorUpdateCount: number;
|
|
68
|
+
isFetched: boolean;
|
|
69
|
+
isFetchedAfterMount: boolean;
|
|
70
|
+
isFetching: boolean;
|
|
71
|
+
isInitialLoading: boolean;
|
|
72
|
+
isPaused: boolean;
|
|
73
|
+
isRefetching: boolean;
|
|
74
|
+
isStale: boolean;
|
|
75
|
+
isEnabled: boolean;
|
|
76
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<NoInfer<AuthMethodsResponse>, Error>>;
|
|
77
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
78
|
+
promise: Promise<NoInfer<AuthMethodsResponse>>;
|
|
79
|
+
} | {
|
|
80
|
+
/** Every linked auth method. Empty while loading. */
|
|
81
|
+
methods: readonly AuthMethodEntry[];
|
|
82
|
+
/** The registered passkeys (a `type === 'webauthn'` subset of `methods`). */
|
|
83
|
+
passkeys: AuthMethodEntry[];
|
|
84
|
+
/** The account's DID, or `null` while loading. */
|
|
85
|
+
did: string | null;
|
|
86
|
+
data: undefined;
|
|
87
|
+
error: Error;
|
|
88
|
+
isError: true;
|
|
89
|
+
isPending: false;
|
|
90
|
+
isLoading: false;
|
|
91
|
+
isLoadingError: true;
|
|
92
|
+
isRefetchError: false;
|
|
93
|
+
isSuccess: false;
|
|
94
|
+
isPlaceholderData: false;
|
|
95
|
+
status: "error";
|
|
96
|
+
dataUpdatedAt: number;
|
|
97
|
+
errorUpdatedAt: number;
|
|
98
|
+
failureCount: number;
|
|
99
|
+
failureReason: Error | null;
|
|
100
|
+
errorUpdateCount: number;
|
|
101
|
+
isFetched: boolean;
|
|
102
|
+
isFetchedAfterMount: boolean;
|
|
103
|
+
isFetching: boolean;
|
|
104
|
+
isInitialLoading: boolean;
|
|
105
|
+
isPaused: boolean;
|
|
106
|
+
isRefetching: boolean;
|
|
107
|
+
isStale: boolean;
|
|
108
|
+
isEnabled: boolean;
|
|
109
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<NoInfer<AuthMethodsResponse>, Error>>;
|
|
110
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
111
|
+
promise: Promise<NoInfer<AuthMethodsResponse>>;
|
|
112
|
+
} | {
|
|
113
|
+
/** Every linked auth method. Empty while loading. */
|
|
114
|
+
methods: readonly AuthMethodEntry[];
|
|
115
|
+
/** The registered passkeys (a `type === 'webauthn'` subset of `methods`). */
|
|
116
|
+
passkeys: AuthMethodEntry[];
|
|
117
|
+
/** The account's DID, or `null` while loading. */
|
|
118
|
+
did: string | null;
|
|
119
|
+
data: undefined;
|
|
120
|
+
error: null;
|
|
121
|
+
isError: false;
|
|
122
|
+
isPending: true;
|
|
123
|
+
isLoading: true;
|
|
124
|
+
isLoadingError: false;
|
|
125
|
+
isRefetchError: false;
|
|
126
|
+
isSuccess: false;
|
|
127
|
+
isPlaceholderData: false;
|
|
128
|
+
status: "pending";
|
|
129
|
+
dataUpdatedAt: number;
|
|
130
|
+
errorUpdatedAt: number;
|
|
131
|
+
failureCount: number;
|
|
132
|
+
failureReason: Error | null;
|
|
133
|
+
errorUpdateCount: number;
|
|
134
|
+
isFetched: boolean;
|
|
135
|
+
isFetchedAfterMount: boolean;
|
|
136
|
+
isFetching: boolean;
|
|
137
|
+
isInitialLoading: boolean;
|
|
138
|
+
isPaused: boolean;
|
|
139
|
+
isRefetching: boolean;
|
|
140
|
+
isStale: boolean;
|
|
141
|
+
isEnabled: boolean;
|
|
142
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<NoInfer<AuthMethodsResponse>, Error>>;
|
|
143
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
144
|
+
promise: Promise<NoInfer<AuthMethodsResponse>>;
|
|
145
|
+
} | {
|
|
146
|
+
/** Every linked auth method. Empty while loading. */
|
|
147
|
+
methods: readonly AuthMethodEntry[];
|
|
148
|
+
/** The registered passkeys (a `type === 'webauthn'` subset of `methods`). */
|
|
149
|
+
passkeys: AuthMethodEntry[];
|
|
150
|
+
/** The account's DID, or `null` while loading. */
|
|
151
|
+
did: string | null;
|
|
152
|
+
data: undefined;
|
|
153
|
+
error: null;
|
|
154
|
+
isError: false;
|
|
155
|
+
isPending: true;
|
|
156
|
+
isLoadingError: false;
|
|
157
|
+
isRefetchError: false;
|
|
158
|
+
isSuccess: false;
|
|
159
|
+
isPlaceholderData: false;
|
|
160
|
+
status: "pending";
|
|
161
|
+
dataUpdatedAt: number;
|
|
162
|
+
errorUpdatedAt: number;
|
|
163
|
+
failureCount: number;
|
|
164
|
+
failureReason: Error | null;
|
|
165
|
+
errorUpdateCount: number;
|
|
166
|
+
isFetched: boolean;
|
|
167
|
+
isFetchedAfterMount: boolean;
|
|
168
|
+
isFetching: boolean;
|
|
169
|
+
isLoading: boolean;
|
|
170
|
+
isInitialLoading: boolean;
|
|
171
|
+
isPaused: boolean;
|
|
172
|
+
isRefetching: boolean;
|
|
173
|
+
isStale: boolean;
|
|
174
|
+
isEnabled: boolean;
|
|
175
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<NoInfer<AuthMethodsResponse>, Error>>;
|
|
176
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
177
|
+
promise: Promise<NoInfer<AuthMethodsResponse>>;
|
|
178
|
+
} | {
|
|
179
|
+
/** Every linked auth method. Empty while loading. */
|
|
180
|
+
methods: readonly AuthMethodEntry[];
|
|
181
|
+
/** The registered passkeys (a `type === 'webauthn'` subset of `methods`). */
|
|
182
|
+
passkeys: AuthMethodEntry[];
|
|
183
|
+
/** The account's DID, or `null` while loading. */
|
|
184
|
+
did: string | null;
|
|
185
|
+
data: NoInfer<AuthMethodsResponse>;
|
|
186
|
+
isError: false;
|
|
187
|
+
error: null;
|
|
188
|
+
isPending: false;
|
|
189
|
+
isLoading: false;
|
|
190
|
+
isLoadingError: false;
|
|
191
|
+
isRefetchError: false;
|
|
192
|
+
isSuccess: true;
|
|
193
|
+
isPlaceholderData: true;
|
|
194
|
+
status: "success";
|
|
195
|
+
dataUpdatedAt: number;
|
|
196
|
+
errorUpdatedAt: number;
|
|
197
|
+
failureCount: number;
|
|
198
|
+
failureReason: Error | null;
|
|
199
|
+
errorUpdateCount: number;
|
|
200
|
+
isFetched: boolean;
|
|
201
|
+
isFetchedAfterMount: boolean;
|
|
202
|
+
isFetching: boolean;
|
|
203
|
+
isInitialLoading: boolean;
|
|
204
|
+
isPaused: boolean;
|
|
205
|
+
isRefetching: boolean;
|
|
206
|
+
isStale: boolean;
|
|
207
|
+
isEnabled: boolean;
|
|
208
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<NoInfer<AuthMethodsResponse>, Error>>;
|
|
209
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
210
|
+
promise: Promise<NoInfer<AuthMethodsResponse>>;
|
|
211
|
+
};
|
|
212
|
+
//# sourceMappingURL=useAuthMethods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAuthMethods.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/useAuthMethods.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAO7E;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE;IAmB1D,qDAAqD;;IAErD,6EAA6E;;IAE7E,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAJlD,qDAAqD;;IAErD,6EAA6E;;IAE7E,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAJlD,qDAAqD;;IAErD,6EAA6E;;IAE7E,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAJlD,qDAAqD;;IAErD,6EAA6E;;IAE7E,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAJlD,qDAAqD;;IAErD,6EAA6E;;IAE7E,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAJlD,qDAAqD;;IAErD,6EAA6E;;IAE7E,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGrD,CAAC"}
|
|
@@ -41,6 +41,14 @@ export interface OxyProviderProps {
|
|
|
41
41
|
baseURL?: string;
|
|
42
42
|
authWebUrl?: string;
|
|
43
43
|
authRedirectUri?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Authorize endpoint override for silent cross-origin session restore
|
|
46
|
+
* (web cross-app SSO on cold boot). Defaults to the production Oxy IdP
|
|
47
|
+
* (`https://auth.oxy.so/authorize`) when unset. Set this from an env var
|
|
48
|
+
* (e.g. Vite `VITE_OXY_AUTHORIZE_URL`, Expo `EXPO_PUBLIC_OXY_AUTHORIZE_URL`)
|
|
49
|
+
* so a local/staging deployment targets its own IdP instead of production.
|
|
50
|
+
*/
|
|
51
|
+
authorizeBaseUrl?: string;
|
|
44
52
|
queryClient?: QueryClient;
|
|
45
53
|
/** Sync device credentials to auth.oxy.so after interactive sign-in. @default true */
|
|
46
54
|
hubSync?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../../../src/ui/types/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAsB,CAAC;AAItD,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAE5B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACxE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAG9C,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAGlC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAGjE,aAAa,CAAC,EAAE,SAAS,CAAC;IAG1B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAGnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,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AC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,sFAAsF;IACtF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;CACzC"}
|
|
@@ -5,11 +5,30 @@ export declare function isCrossOriginRestoreBlocked(): boolean;
|
|
|
5
5
|
export declare function markCrossOriginRestoreAttempted(): void;
|
|
6
6
|
/** Clear all cross-origin restore loop guards (call on sign-out). */
|
|
7
7
|
export declare function clearCrossOriginRestoreGuards(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Whether cold boot should attempt silent cross-origin OAuth restore for the
|
|
10
|
+
* given web origin.
|
|
11
|
+
*
|
|
12
|
+
* Mirrors the hub-sync WRITE gate (`syncHubAfterSignIn`): only OFFICIAL Oxy web
|
|
13
|
+
* origins participate in cross-app SSO — a random third-party / preview origin
|
|
14
|
+
* must never have its tab bounced to the IdP. Additionally, loopback / local-dev
|
|
15
|
+
* origins are EXCLUDED here even though {@link isOfficialWebOrigin} treats them
|
|
16
|
+
* as official: a developer's local app must never be redirected to a hosted IdP
|
|
17
|
+
* on cold boot (it signs in through the in-app dialog instead). The central IdP
|
|
18
|
+
* hub's own origin is excluded to avoid a wasteful self-hop.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isSilentRestoreEligibleOrigin(origin: string): boolean;
|
|
8
21
|
export interface SilentOAuthRestoreOptions {
|
|
9
22
|
oxyServices: OxyServices;
|
|
10
23
|
clientId: string;
|
|
11
24
|
redirectUri?: string;
|
|
12
25
|
scope?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Authorize endpoint override (env-configurable per deployment). Defaults to
|
|
28
|
+
* the production Oxy IdP when unset, so a local/staging app points silent
|
|
29
|
+
* restore at its OWN IdP instead of production `auth.oxy.so`.
|
|
30
|
+
*/
|
|
31
|
+
authorizeBaseUrl?: string;
|
|
13
32
|
}
|
|
14
33
|
/**
|
|
15
34
|
* Top-level redirect to auth.oxy.so/authorize with `prompt=none` for silent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossOriginRestore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/crossOriginRestore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"crossOriginRestore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/crossOriginRestore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAqB/C,8EAA8E;AAC9E,wBAAgB,2BAA2B,IAAI,OAAO,CAOrD;AAED,iFAAiF;AACjF,wBAAgB,+BAA+B,IAAI,IAAI,CAKtD;AAED,qEAAqE;AACrE,wBAAgB,6BAA6B,IAAI,IAAI,CAMpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIrE;AAED,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,OAAO,CAAC,CAiDlB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,gBAAgB,GAAG,kBAAkB,GAAG,IAAI,CAsBtF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
/** Always `false` off the web — there is no relying-party origin or WebAuthn API. */
|
|
15
|
+
export declare function isPasskeySupported(): boolean;
|
|
16
|
+
/** Not available off the web — throws. Guard with {@link isPasskeySupported} first. */
|
|
17
|
+
export declare function runRegistrationCeremony(_optionsJSON: unknown): Promise<unknown>;
|
|
18
|
+
/** Not available off the web — throws. Guard with {@link isPasskeySupported} first. */
|
|
19
|
+
export declare function runAuthenticationCeremony(_optionsJSON: unknown): Promise<unknown>;
|
|
20
|
+
//# sourceMappingURL=passkeyClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkeyClient.d.ts","sourceRoot":"","sources":["../../../../src/webauthn/passkeyClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,qFAAqF;AACrF,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED,uFAAuF;AACvF,wBAAsB,uBAAuB,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAErF;AAED,uFAAuF;AACvF,wBAAsB,yBAAyB,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAEvF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
/** Always `false` on native — there is no browser WebAuthn API. */
|
|
10
|
+
export declare function isPasskeySupported(): boolean;
|
|
11
|
+
/** Not available on native — throws. Guard with {@link isPasskeySupported} first. */
|
|
12
|
+
export declare function runRegistrationCeremony(_optionsJSON: unknown): Promise<unknown>;
|
|
13
|
+
/** Not available on native — throws. Guard with {@link isPasskeySupported} first. */
|
|
14
|
+
export declare function runAuthenticationCeremony(_optionsJSON: unknown): Promise<unknown>;
|
|
15
|
+
//# sourceMappingURL=passkeyClient.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkeyClient.native.d.ts","sourceRoot":"","sources":["../../../../src/webauthn/passkeyClient.native.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,mEAAmE;AACnE,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED,qFAAqF;AACrF,wBAAsB,uBAAuB,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAErF;AAED,qFAAqF;AACrF,wBAAsB,yBAAyB,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAEvF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
import { type RegistrationResponseJSON, type AuthenticationResponseJSON } from '@simplewebauthn/browser';
|
|
18
|
+
/**
|
|
19
|
+
* True iff this browser can run a WebAuthn ceremony (exposes the
|
|
20
|
+
* `PublicKeyCredential` global). Gate all passkey UI/entrypoints on this so an
|
|
21
|
+
* unsupported browser fails loudly rather than throwing mid-ceremony.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isPasskeySupported(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Run the WebAuthn REGISTRATION ceremony (`navigator.credentials.create`) from
|
|
26
|
+
* the server's opaque creation options, returning the opaque attestation
|
|
27
|
+
* response for `OxyServices.webauthnRegisterVerify`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function runRegistrationCeremony(optionsJSON: unknown): Promise<RegistrationResponseJSON>;
|
|
30
|
+
/**
|
|
31
|
+
* Run the WebAuthn AUTHENTICATION ceremony (`navigator.credentials.get`) from
|
|
32
|
+
* the server's opaque request options, returning the opaque assertion response
|
|
33
|
+
* for `OxyServices.webauthnLoginVerify`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function runAuthenticationCeremony(optionsJSON: unknown): Promise<AuthenticationResponseJSON>;
|
|
36
|
+
//# sourceMappingURL=passkeyClient.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"passkeyClient.web.d.ts","sourceRoot":"","sources":["../../../../src/webauthn/passkeyClient.web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,wBAAwB,CAAC,CAEnC;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,0BAA0B,CAAC,CAErC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/services",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "22.0.0",
|
|
4
4
|
"description": "OxyHQ Expo/React Native SDK — UI components, screens, and native features",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -126,15 +126,16 @@
|
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
|
-
"@oxyhq/contracts": "0.
|
|
130
|
-
"@oxyhq/core": "^
|
|
129
|
+
"@oxyhq/contracts": "0.15.0",
|
|
130
|
+
"@oxyhq/core": "^12.0.0",
|
|
131
|
+
"@simplewebauthn/browser": "^13.3.0",
|
|
131
132
|
"color": "^4.2.3"
|
|
132
133
|
},
|
|
133
134
|
"devDependencies": {
|
|
134
135
|
"@biomejs/biome": "^1.9.4",
|
|
135
136
|
"@commitlint/cli": "^17.6.5",
|
|
136
137
|
"@commitlint/config-conventional": "^17.6.5",
|
|
137
|
-
"@oxyhq/core": "
|
|
138
|
+
"@oxyhq/core": "12.0.0",
|
|
138
139
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
139
140
|
"@react-native-community/netinfo": "^11.4.1",
|
|
140
141
|
"@react-native/babel-preset": "^0.86.0",
|
|
@@ -175,7 +176,7 @@
|
|
|
175
176
|
"peerDependencies": {
|
|
176
177
|
"@expo/vector-icons": "^15.0.3",
|
|
177
178
|
"@oxyhq/bloom": ">=0.16.0",
|
|
178
|
-
"@oxyhq/core": "^
|
|
179
|
+
"@oxyhq/core": "^12.0.0",
|
|
179
180
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
180
181
|
"@react-native-community/netinfo": "^11.4.1",
|
|
181
182
|
"@tanstack/query-async-storage-persister": "^5.101",
|
package/src/index.ts
CHANGED
|
@@ -33,7 +33,7 @@ setPlatformOS(Platform.OS as PlatformOS);
|
|
|
33
33
|
// ---------------------------------------------------------------------------
|
|
34
34
|
export { default as OxyProvider } from './ui/components/OxyProvider';
|
|
35
35
|
export { useOxy } from './ui/context/OxyContext';
|
|
36
|
-
export type { OxyContextState
|
|
36
|
+
export type { OxyContextState } from './ui/context/OxyContext';
|
|
37
37
|
export { useAuth } from './ui/hooks/useAuth';
|
|
38
38
|
export type { AuthState, AuthActions, UseAuthReturn } from './ui/hooks/useAuth';
|
|
39
39
|
|
|
@@ -95,6 +95,7 @@ export {
|
|
|
95
95
|
useRecentSecurityActivity,
|
|
96
96
|
useInfiniteSecurityActivity,
|
|
97
97
|
} from './ui/hooks/queries/useSecurityQueries';
|
|
98
|
+
export { useAuthMethods } from './ui/hooks/queries/useAuthMethods';
|
|
98
99
|
export {
|
|
99
100
|
useUserSubscription,
|
|
100
101
|
useUserPayments,
|
|
@@ -166,6 +167,7 @@ export {
|
|
|
166
167
|
invalidateStorageQueries,
|
|
167
168
|
invalidatePaymentsQueries,
|
|
168
169
|
invalidateConnectedAppsQueries,
|
|
170
|
+
invalidateAuthMethodsQueries,
|
|
169
171
|
} from './ui/hooks/queries/queryKeys';
|
|
170
172
|
|
|
171
173
|
// Mutation status aggregator (for "Syncing..." indicators)
|