@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,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { useQuery } from '@tanstack/react-query';
|
|
5
|
+
import { queryKeys } from "./queryKeys.js";
|
|
6
|
+
import { useOxy } from "../../context/OxyContext.js";
|
|
7
|
+
|
|
8
|
+
/** Stable empty list so the derived selectors keep a stable reference while loading. */
|
|
9
|
+
const EMPTY_METHODS = Object.freeze([]);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The current account's linked authentication methods (`GET /auth/methods`),
|
|
13
|
+
* plus convenience projections. Backs the security / account surfaces that let a
|
|
14
|
+
* user see and manage their passwords, identity key, social logins, and passkeys.
|
|
15
|
+
*
|
|
16
|
+
* `passkeys` is the `type === 'webauthn'` subset — one entry per registered
|
|
17
|
+
* credential. Invalidate via `queryKeys.authMethods.all` after linking a passkey
|
|
18
|
+
* (`useOxy().addPasskey()` does this) or removing one.
|
|
19
|
+
*/
|
|
20
|
+
export const useAuthMethods = options => {
|
|
21
|
+
const {
|
|
22
|
+
oxyServices,
|
|
23
|
+
activeSessionId
|
|
24
|
+
} = useOxy();
|
|
25
|
+
const query = useQuery({
|
|
26
|
+
queryKey: queryKeys.authMethods.list(),
|
|
27
|
+
queryFn: () => oxyServices.listAuthMethods(),
|
|
28
|
+
enabled: options?.enabled !== false && !!activeSessionId,
|
|
29
|
+
staleTime: 5 * 60 * 1000,
|
|
30
|
+
// 5 minutes
|
|
31
|
+
gcTime: 10 * 60 * 1000 // 10 minutes
|
|
32
|
+
});
|
|
33
|
+
const methods = query.data?.methods ?? EMPTY_METHODS;
|
|
34
|
+
const passkeys = useMemo(() => methods.filter(method => method.type === 'webauthn'), [methods]);
|
|
35
|
+
return {
|
|
36
|
+
...query,
|
|
37
|
+
/** Every linked auth method. Empty while loading. */
|
|
38
|
+
methods,
|
|
39
|
+
/** The registered passkeys (a `type === 'webauthn'` subset of `methods`). */
|
|
40
|
+
passkeys,
|
|
41
|
+
/** The account's DID, or `null` while loading. */
|
|
42
|
+
did: query.data?.did ?? null
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=useAuthMethods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","useQuery","queryKeys","useOxy","EMPTY_METHODS","Object","freeze","useAuthMethods","options","oxyServices","activeSessionId","query","queryKey","authMethods","list","queryFn","listAuthMethods","enabled","staleTime","gcTime","methods","data","passkeys","filter","method","type","did"],"sourceRoot":"../../../../../src","sources":["ui/hooks/queries/useAuthMethods.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,QAAQ,QAAQ,uBAAuB;AAEhD,SAASC,SAAS,QAAQ,gBAAa;AACvC,SAASC,MAAM,QAAQ,6BAA0B;;AAEjD;AACA,MAAMC,aAAyC,GAAGC,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAIC,OAA+B,IAAK;EACjE,MAAM;IAAEC,WAAW;IAAEC;EAAgB,CAAC,GAAGP,MAAM,CAAC,CAAC;EAEjD,MAAMQ,KAAK,GAAGV,QAAQ,CAAsB;IAC1CW,QAAQ,EAAEV,SAAS,CAACW,WAAW,CAACC,IAAI,CAAC,CAAC;IACtCC,OAAO,EAAEA,CAAA,KAAMN,WAAW,CAACO,eAAe,CAAC,CAAC;IAC5CC,OAAO,EAAET,OAAO,EAAES,OAAO,KAAK,KAAK,IAAI,CAAC,CAACP,eAAe;IACxDQ,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;IAAE;IAC1BC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAE;EAC1B,CAAC,CAAC;EAEF,MAAMC,OAAO,GAAGT,KAAK,CAACU,IAAI,EAAED,OAAO,IAAIhB,aAAa;EACpD,MAAMkB,QAAQ,GAAGtB,OAAO,CACtB,MAAMoB,OAAO,CAACG,MAAM,CAAEC,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAK,UAAU,CAAC,EAC5D,CAACL,OAAO,CACV,CAAC;EAED,OAAO;IACL,GAAGT,KAAK;IACR;IACAS,OAAO;IACP;IACAE,QAAQ;IACR;IACAI,GAAG,EAAEf,KAAK,CAACU,IAAI,EAAEK,GAAG,IAAI;EAC1B,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { buildOAuthAuthorizeUrl, generateOAuthState, generatePkcePair, OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY, OXY_SILENT_OAUTH_ATTEMPTED_KEY, persistOAuthHandshake, normalizeOAuthRedirectUri, logger } from '@oxyhq/core';
|
|
3
|
+
import { buildOAuthAuthorizeUrl, generateOAuthState, generatePkcePair, isIdpHubOrigin, isLoopbackOrigin, isOfficialWebOrigin, OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY, OXY_SILENT_OAUTH_ATTEMPTED_KEY, persistOAuthHandshake, normalizeOAuthRedirectUri, logger } from '@oxyhq/core';
|
|
4
4
|
import { isWebBrowser } from "./isWebBrowser.js";
|
|
5
5
|
import { redirectToAuthorize } from "../components/oauthNavigation.js";
|
|
6
6
|
function sessionStore() {
|
|
@@ -30,6 +30,24 @@ export function clearCrossOriginRestoreGuards() {
|
|
|
30
30
|
store.removeItem(key);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Whether cold boot should attempt silent cross-origin OAuth restore for the
|
|
36
|
+
* given web origin.
|
|
37
|
+
*
|
|
38
|
+
* Mirrors the hub-sync WRITE gate (`syncHubAfterSignIn`): only OFFICIAL Oxy web
|
|
39
|
+
* origins participate in cross-app SSO — a random third-party / preview origin
|
|
40
|
+
* must never have its tab bounced to the IdP. Additionally, loopback / local-dev
|
|
41
|
+
* origins are EXCLUDED here even though {@link isOfficialWebOrigin} treats them
|
|
42
|
+
* as official: a developer's local app must never be redirected to a hosted IdP
|
|
43
|
+
* on cold boot (it signs in through the in-app dialog instead). The central IdP
|
|
44
|
+
* hub's own origin is excluded to avoid a wasteful self-hop.
|
|
45
|
+
*/
|
|
46
|
+
export function isSilentRestoreEligibleOrigin(origin) {
|
|
47
|
+
if (isLoopbackOrigin(origin)) return false;
|
|
48
|
+
if (isIdpHubOrigin()) return false;
|
|
49
|
+
return isOfficialWebOrigin(origin);
|
|
50
|
+
}
|
|
33
51
|
/**
|
|
34
52
|
* Top-level redirect to auth.oxy.so/authorize with `prompt=none` for silent
|
|
35
53
|
* cross-origin session restore on all web apps (official + third-party).
|
|
@@ -38,6 +56,12 @@ export async function maybeStartSilentOAuthRestore(opts) {
|
|
|
38
56
|
if (!isWebBrowser()) return false;
|
|
39
57
|
const location = globalThis.location;
|
|
40
58
|
if (!location) return false;
|
|
59
|
+
|
|
60
|
+
// Defense-in-depth: never bounce a loopback / non-official / IdP-hub origin to
|
|
61
|
+
// a hosted authorize endpoint (the caller gates on this too).
|
|
62
|
+
if (!isSilentRestoreEligibleOrigin(location.origin)) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
41
65
|
if (isCrossOriginRestoreBlocked()) {
|
|
42
66
|
return false;
|
|
43
67
|
}
|
|
@@ -56,6 +80,7 @@ export async function maybeStartSilentOAuthRestore(opts) {
|
|
|
56
80
|
}
|
|
57
81
|
const redirectUri = normalizeOAuthRedirectUri(opts.redirectUri ?? location.origin);
|
|
58
82
|
const authorizeUrl = buildOAuthAuthorizeUrl({
|
|
83
|
+
authorizeBaseUrl: opts.authorizeBaseUrl,
|
|
59
84
|
clientId: opts.clientId,
|
|
60
85
|
redirectUri,
|
|
61
86
|
state,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["buildOAuthAuthorizeUrl","generateOAuthState","generatePkcePair","OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY","OXY_SILENT_OAUTH_ATTEMPTED_KEY","persistOAuthHandshake","normalizeOAuthRedirectUri","logger","isWebBrowser","redirectToAuthorize","sessionStore","globalThis","sessionStorage","isCrossOriginRestoreBlocked","store","Boolean","getItem","markCrossOriginRestoreAttempted","setItem","clearCrossOriginRestoreGuards","key","removeItem","maybeStartSilentOAuthRestore","opts","location","params","URLSearchParams","search","has","codeVerifier","codeChallenge","state","redirectUri","
|
|
1
|
+
{"version":3,"names":["buildOAuthAuthorizeUrl","generateOAuthState","generatePkcePair","isIdpHubOrigin","isLoopbackOrigin","isOfficialWebOrigin","OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY","OXY_SILENT_OAUTH_ATTEMPTED_KEY","persistOAuthHandshake","normalizeOAuthRedirectUri","logger","isWebBrowser","redirectToAuthorize","sessionStore","globalThis","sessionStorage","isCrossOriginRestoreBlocked","store","Boolean","getItem","markCrossOriginRestoreAttempted","setItem","clearCrossOriginRestoreGuards","key","removeItem","isSilentRestoreEligibleOrigin","origin","maybeStartSilentOAuthRestore","opts","location","params","URLSearchParams","search","has","codeVerifier","codeChallenge","state","redirectUri","authorizeUrl","authorizeBaseUrl","clientId","scope","prompt","error","warn","component","consumeSilentOAuthError","history","get","replaceState","url","URL","href","searchParams","delete","pathname","hash"],"sourceRoot":"../../../../src","sources":["ui/utils/crossOriginRestore.ts"],"mappings":";;AACA,SACEA,sBAAsB,EACtBC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,EACdC,gBAAgB,EAChBC,mBAAmB,EACnBC,sCAAsC,EACtCC,8BAA8B,EAC9BC,qBAAqB,EACrBC,yBAAyB,EACzBC,MAAM,QACD,aAAa;AACpB,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,mBAAmB,QAAQ,kCAA+B;AAEnE,SAASC,YAAYA,CAAA,EAAwB;EAC3C,OAAQC,UAAU,CAAkCC,cAAc;AACpE;;AA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ACtF,IAAI,CAACnC,YAAY,CAAC,CAAC,EAAE,OAAO,IAAI;EAChC,MAAMkB,QAAQ,GAAIf,UAAU,CAAgDe,QAAQ;EACpF,MAAMkB,OAAO,GAAIjC,UAAU,CAA2BiC,OAAO;EAC7D,IAAI,CAAClB,QAAQ,EAAE,OAAO,IAAI;EAE1B,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAACF,QAAQ,CAACG,MAAM,CAAC;EACnD,MAAMW,KAAK,GAAGb,MAAM,CAACkB,GAAG,CAAC,OAAO,CAAC;EACjC,IAAIL,KAAK,KAAK,gBAAgB,IAAIA,KAAK,KAAK,kBAAkB,EAAE;IAC9D,OAAO,IAAI;EACb;EAEAvB,+BAA+B,CAAC,CAAC;EAEjC,IAAI2B,OAAO,EAAEE,YAAY,EAAE;IACzB,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAACtB,QAAQ,CAACuB,IAAI,CAAC;IAClCF,GAAG,CAACG,YAAY,CAACC,MAAM,CAAC,OAAO,CAAC;IAChCJ,GAAG,CAACG,YAAY,CAACC,MAAM,CAAC,mBAAmB,CAAC;IAC5CJ,GAAG,CAACG,YAAY,CAACC,MAAM,CAAC,OAAO,CAAC;IAChCP,OAAO,CAACE,YAAY,CAACF,OAAO,CAACX,KAAK,EAAE,EAAE,EAAE,GAAGc,GAAG,CAACK,QAAQ,GAAGL,GAAG,CAAClB,MAAM,GAAGkB,GAAG,CAACM,IAAI,EAAE,CAAC;EACpF;EACA,OAAOb,KAAK;AACd","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Passkey / WebAuthn ceremony client — clean default (non-web) implementation.
|
|
5
|
+
*
|
|
6
|
+
* This is the base module TypeScript resolves for TYPES and any bundler that
|
|
7
|
+
* does not pick a platform variant. It intentionally imports NOTHING browser-
|
|
8
|
+
* specific (no `@simplewebauthn/browser`) so it stays safe for Metro, native
|
|
9
|
+
* builds, and SSR. The real ceremony lives in `passkeyClient.web.ts`; native
|
|
10
|
+
* passkeys are Commons' job, so there is no WebAuthn ceremony here.
|
|
11
|
+
*
|
|
12
|
+
* `isPasskeySupported()` returns `false` (no relying-party origin / no browser
|
|
13
|
+
* WebAuthn API), and the ceremony helpers throw a clear error so a caller that
|
|
14
|
+
* skipped the support gate fails loudly instead of silently.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const WEBAUTHN_WEB_ONLY_MESSAGE = 'WebAuthn is web-only; native uses Commons. Passkeys are not available on this platform.';
|
|
18
|
+
|
|
19
|
+
/** Always `false` off the web — there is no relying-party origin or WebAuthn API. */
|
|
20
|
+
export function isPasskeySupported() {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Not available off the web — throws. Guard with {@link isPasskeySupported} first. */
|
|
25
|
+
export async function runRegistrationCeremony(_optionsJSON) {
|
|
26
|
+
throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Not available off the web — throws. Guard with {@link isPasskeySupported} first. */
|
|
30
|
+
export async function runAuthenticationCeremony(_optionsJSON) {
|
|
31
|
+
throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=passkeyClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WEBAUTHN_WEB_ONLY_MESSAGE","isPasskeySupported","runRegistrationCeremony","_optionsJSON","Error","runAuthenticationCeremony"],"sourceRoot":"../../../src","sources":["webauthn/passkeyClient.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,yBAAyB,GAC7B,yFAAyF;;AAE3F;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAAY;EAC5C,OAAO,KAAK;AACd;;AAEA;AACA,OAAO,eAAeC,uBAAuBA,CAACC,YAAqB,EAAoB;EACrF,MAAM,IAAIC,KAAK,CAACJ,yBAAyB,CAAC;AAC5C;;AAEA;AACA,OAAO,eAAeK,yBAAyBA,CAACF,YAAqB,EAAoB;EACvF,MAAM,IAAIC,KAAK,CAACJ,yBAAyB,CAAC;AAC5C","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Passkey / WebAuthn ceremony client — NATIVE implementation.
|
|
5
|
+
*
|
|
6
|
+
* React Native has no browser WebAuthn API, and Oxy's native passkey story is
|
|
7
|
+
* Commons (shared-keychain / QR handoff), NOT `navigator.credentials`. So this
|
|
8
|
+
* variant imports NOTHING browser-specific and mirrors the clean default:
|
|
9
|
+
* unsupported, and the ceremony helpers throw if a caller skipped the gate.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const WEBAUTHN_WEB_ONLY_MESSAGE = 'WebAuthn is web-only; native uses Commons. Passkeys are not available on this platform.';
|
|
13
|
+
|
|
14
|
+
/** Always `false` on native — there is no browser WebAuthn API. */
|
|
15
|
+
export function isPasskeySupported() {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Not available on native — throws. Guard with {@link isPasskeySupported} first. */
|
|
20
|
+
export async function runRegistrationCeremony(_optionsJSON) {
|
|
21
|
+
throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Not available on native — throws. Guard with {@link isPasskeySupported} first. */
|
|
25
|
+
export async function runAuthenticationCeremony(_optionsJSON) {
|
|
26
|
+
throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=passkeyClient.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["WEBAUTHN_WEB_ONLY_MESSAGE","isPasskeySupported","runRegistrationCeremony","_optionsJSON","Error","runAuthenticationCeremony"],"sourceRoot":"../../../src","sources":["webauthn/passkeyClient.native.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,yBAAyB,GAC7B,yFAAyF;;AAE3F;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAAY;EAC5C,OAAO,KAAK;AACd;;AAEA;AACA,OAAO,eAAeC,uBAAuBA,CAACC,YAAqB,EAAoB;EACrF,MAAM,IAAIC,KAAK,CAACJ,yBAAyB,CAAC;AAC5C;;AAEA;AACA,OAAO,eAAeK,yBAAyBA,CAACF,YAAqB,EAAoB;EACvF,MAAM,IAAIC,KAAK,CAACJ,yBAAyB,CAAC;AAC5C","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Passkey / WebAuthn ceremony client — WEB implementation.
|
|
5
|
+
*
|
|
6
|
+
* The browser half of the passkey flow: it drives `navigator.credentials`
|
|
7
|
+
* through `@simplewebauthn/browser`, turning the OPAQUE options the server
|
|
8
|
+
* emitted (`OxyServices.webauthn{Register,Login}Options`) into the opaque
|
|
9
|
+
* response the matching `verify` endpoint consumes. Oxy never owns those wire
|
|
10
|
+
* shapes — `@simplewebauthn/browser` does — so options flow in as `unknown` and
|
|
11
|
+
* the single cast at this boundary hands them to the library's own types.
|
|
12
|
+
*
|
|
13
|
+
* This file is selected ONLY on web (react-native-web / Vite RNW): the sibling
|
|
14
|
+
* `passkeyClient.native.ts` + the clean default `passkeyClient.ts` deliberately
|
|
15
|
+
* do NOT import `@simplewebauthn/browser` (a browser-only dependency), per the
|
|
16
|
+
* platform-split rule. Native passkeys are Commons' job — there is no WebAuthn
|
|
17
|
+
* ceremony off the web.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { startRegistration, startAuthentication } from '@simplewebauthn/browser';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* True iff this browser can run a WebAuthn ceremony (exposes the
|
|
24
|
+
* `PublicKeyCredential` global). Gate all passkey UI/entrypoints on this so an
|
|
25
|
+
* unsupported browser fails loudly rather than throwing mid-ceremony.
|
|
26
|
+
*/
|
|
27
|
+
export function isPasskeySupported() {
|
|
28
|
+
return typeof window !== 'undefined' && typeof window.PublicKeyCredential !== 'undefined';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Run the WebAuthn REGISTRATION ceremony (`navigator.credentials.create`) from
|
|
33
|
+
* the server's opaque creation options, returning the opaque attestation
|
|
34
|
+
* response for `OxyServices.webauthnRegisterVerify`.
|
|
35
|
+
*/
|
|
36
|
+
export async function runRegistrationCeremony(optionsJSON) {
|
|
37
|
+
return startRegistration({
|
|
38
|
+
optionsJSON: optionsJSON
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Run the WebAuthn AUTHENTICATION ceremony (`navigator.credentials.get`) from
|
|
44
|
+
* the server's opaque request options, returning the opaque assertion response
|
|
45
|
+
* for `OxyServices.webauthnLoginVerify`.
|
|
46
|
+
*/
|
|
47
|
+
export async function runAuthenticationCeremony(optionsJSON) {
|
|
48
|
+
return startAuthentication({
|
|
49
|
+
optionsJSON: optionsJSON
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=passkeyClient.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["startRegistration","startAuthentication","isPasskeySupported","window","PublicKeyCredential","runRegistrationCeremony","optionsJSON","runAuthenticationCeremony"],"sourceRoot":"../../../src","sources":["webauthn/passkeyClient.web.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,iBAAiB,EACjBC,mBAAmB,QAKd,yBAAyB;;AAEhC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAAY;EAC5C,OAAO,OAAOC,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,CAACC,mBAAmB,KAAK,WAAW;AAC3F;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,uBAAuBA,CAC3CC,WAAoB,EACe;EACnC,OAAON,iBAAiB,CAAC;IAAEM,WAAW,EAAEA;EAAsD,CAAC,CAAC;AAClG;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,yBAAyBA,CAC7CD,WAAoB,EACiB;EACrC,OAAOL,mBAAmB,CAAC;IAAEK,WAAW,EAAEA;EAAqD,CAAC,CAAC;AACnG","ignoreList":[]}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
export { default as OxyProvider } from './ui/components/OxyProvider';
|
|
24
24
|
export { useOxy } from './ui/context/OxyContext';
|
|
25
|
-
export type { OxyContextState
|
|
25
|
+
export type { OxyContextState } from './ui/context/OxyContext';
|
|
26
26
|
export { useAuth } from './ui/hooks/useAuth';
|
|
27
27
|
export type { AuthState, AuthActions, UseAuthReturn } from './ui/hooks/useAuth';
|
|
28
28
|
export { FontLoader, setupFonts } from './ui/components/FontLoader';
|
|
@@ -37,6 +37,7 @@ export type { UseStorageOptions, UseStorageResult } from './ui/hooks/useStorage'
|
|
|
37
37
|
export { useUserProfile, useUserProfiles, useCurrentUser, useUserById, useUserByUsername, useUsersBySessions, usePrivacySettings, useConnectedApps, } from './ui/hooks/queries/useAccountQueries';
|
|
38
38
|
export { useSessions, useSession, useDeviceSessions, useUserDevices, useSecurityInfo, useAccountStorageUsage, } from './ui/hooks/queries/useServicesQueries';
|
|
39
39
|
export { useSecurityActivity, useRecentSecurityActivity, useInfiniteSecurityActivity, } from './ui/hooks/queries/useSecurityQueries';
|
|
40
|
+
export { useAuthMethods } from './ui/hooks/queries/useAuthMethods';
|
|
40
41
|
export { useUserSubscription, useUserPayments, useUserWallet, useUserWalletTransactions, } from './ui/hooks/queries/usePaymentQueries';
|
|
41
42
|
export type { Subscription, SubscriptionPlan, SubscriptionStatus, SubscriptionFeatures, Payment, Wallet, WalletTransaction, WalletTransactionType, WalletTransactionStatus, WalletPagination, WalletTransactionsResponse, } from './ui/hooks/queries/paymentTypes';
|
|
42
43
|
export { useUpdateProfile, useUploadAvatar, useUpdateAccountSettings, useUpdatePrivacySettings, useUpdateNotificationPreferences, useUpdateUserPreferences, useRevokeConnectedApp, useUploadFile, } from './ui/hooks/mutations/useAccountMutations';
|
|
@@ -44,7 +45,7 @@ export { useSwitchSession, useLogoutSession, useLogoutAll, useUpdateDeviceName,
|
|
|
44
45
|
export { createProfileMutation, createGenericMutation, } from './ui/hooks/mutations/mutationFactory';
|
|
45
46
|
export type { ProfileMutationConfig, GenericMutationConfig, } from './ui/hooks/mutations/mutationFactory';
|
|
46
47
|
export { mutationKeys } from './ui/hooks/mutations/mutationKeys';
|
|
47
|
-
export { queryKeys, invalidateAccountQueries, invalidateUserQueries, invalidateSessionQueries, invalidateDeviceQueries, invalidatePrivacyQueries, invalidateSecurityQueries, invalidateStorageQueries, invalidatePaymentsQueries, invalidateConnectedAppsQueries, } from './ui/hooks/queries/queryKeys';
|
|
48
|
+
export { queryKeys, invalidateAccountQueries, invalidateUserQueries, invalidateSessionQueries, invalidateDeviceQueries, invalidatePrivacyQueries, invalidateSecurityQueries, invalidateStorageQueries, invalidatePaymentsQueries, invalidateConnectedAppsQueries, invalidateAuthMethodsQueries, } from './ui/hooks/queries/queryKeys';
|
|
48
49
|
export { useMutationStatus } from './ui/hooks/useMutationStatus';
|
|
49
50
|
export type { MutationStatus } from './ui/hooks/useMutationStatus';
|
|
50
51
|
export { useOnlineStatus } from './ui/hooks/useOnlineStatus';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAYH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAA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clientId?: string;
|
|
10
10
|
authRedirectUri?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Authorize endpoint override for silent cross-origin restore. Defaults to
|
|
13
|
+
* the production Oxy IdP when unset; a local/staging deployment sets it so the
|
|
14
|
+
* silent-restore redirect targets its own IdP, never production.
|
|
15
|
+
*/
|
|
16
|
+
authorizeBaseUrl?: string;
|
|
11
17
|
sessionClient: SessionClient;
|
|
12
18
|
syncDeviceCredentialToHost: () => Promise<void>;
|
|
13
19
|
commitSession: (input: CommitInput, options: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runProviderColdBoot.d.ts","sourceRoot":"","sources":["../../../../../src/ui/boot/runProviderColdBoot.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"runProviderColdBoot.d.ts","sourceRoot":"","sources":["../../../../../src/ui/boot/runProviderColdBoot.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AASjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,iFAAiF;AACjF,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAEhD,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,cAAc,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,aAAa,CAAC;IAC7B,0BAA0B,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,aAAa,EAAE,CACb,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,KAC9C,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CA8HzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OxyAccountDialog.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/OxyAccountDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"OxyAccountDialog.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/OxyAccountDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgE/B;;;GAGG;AACH,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAwJ7B,CAAC;AA0fF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OxyProvider.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/OxyProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmE,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAIjH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAqE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"OxyProvider.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/OxyProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAmE,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAIjH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAqE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA2OrC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { OxyContextState, OxyContextProviderProps } from './oxyContextTypes';
|
|
3
|
-
export type { OxyContextState,
|
|
3
|
+
export type { OxyContextState, OxyContextProviderProps } from './oxyContextTypes';
|
|
4
4
|
export declare const OxyProvider: React.FC<OxyContextProviderProps>;
|
|
5
5
|
export declare const OxyContextProvider: React.FC<OxyContextProviderProps>;
|
|
6
6
|
export declare const useOxy: () => OxyContextState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OxyContext.d.ts","sourceRoot":"","sources":["../../../../../src/ui/context/OxyContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"OxyContext.d.ts","sourceRoot":"","sources":["../../../../../src/ui/context/OxyContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA0D/B,OAAO,KAAK,EACV,eAAe,EACf,uBAAuB,EAExB,MAAM,mBAAmB,CAAC;AAY3B,YAAY,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAIlF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAg5BzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,mCAAc,CAAC;AAmE9C,eAAO,MAAM,MAAM,QAAO,eAMzB,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { OxyServices, User, SessionLoginResponse, AccountNode, CreateAccountInput, ClientSession, AccountDialogController, AccountDialogView, ApiError, SessionClient } from '@oxyhq/core';
|
|
3
|
-
import type { SecurityAlert } from '@oxyhq/contracts';
|
|
4
3
|
import type { UseFollowHook } from '../hooks/useFollow.types';
|
|
5
4
|
import type { useLanguageManagement } from '../hooks/useLanguageManagement';
|
|
6
5
|
import type { RouteName } from '../navigation/routes';
|
|
@@ -37,18 +36,43 @@ export interface OxyContextState {
|
|
|
37
36
|
hasIdentity: () => Promise<boolean>;
|
|
38
37
|
getPublicKey: () => Promise<string | null>;
|
|
39
38
|
signIn: (publicKey: string, deviceName?: string) => Promise<User>;
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Sign in with a passkey (WebAuthn). With no `username` this is the
|
|
41
|
+
* usernameless / discoverable-credential flow: the browser prompts for any
|
|
42
|
+
* resident Oxy passkey. Pass `username` for the username-first flow — the
|
|
43
|
+
* server scopes `allowCredentials` to that user's passkeys so a
|
|
44
|
+
* NON-discoverable hardware key (e.g. a U2F/security key) can be used.
|
|
45
|
+
* WEB-ONLY — throws on native or an unsupported browser (native passkeys are
|
|
46
|
+
* Commons' job). On `useOxy()`, NOT re-exposed on `useAuth()`.
|
|
47
|
+
*/
|
|
48
|
+
signInWithPasskey: (opts?: {
|
|
49
|
+
username?: string;
|
|
41
50
|
deviceName?: string;
|
|
42
51
|
deviceFingerprint?: string;
|
|
43
|
-
}) => Promise<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
}) => Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Create a brand-new account whose first authentication method is a passkey.
|
|
55
|
+
* WEB-ONLY — throws on native or an unsupported browser.
|
|
56
|
+
*/
|
|
57
|
+
registerWithPasskey: (params: {
|
|
58
|
+
username: string;
|
|
59
|
+
deviceName?: string;
|
|
60
|
+
}) => Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Add a passkey to the already-signed-in account (bearer present). Does NOT
|
|
63
|
+
* commit a new session; refreshes the linked auth-methods list on success.
|
|
64
|
+
* WEB-ONLY — throws on native or an unsupported browser.
|
|
65
|
+
*/
|
|
66
|
+
addPasskey: (params?: {
|
|
48
67
|
deviceName?: string;
|
|
49
|
-
}) => Promise<
|
|
50
|
-
|
|
51
|
-
|
|
68
|
+
}) => Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Remove a passkey from the current account by its credential id
|
|
71
|
+
* (`AuthMethodEntry.credentialId`). Refreshes the linked auth-methods list on
|
|
72
|
+
* success. Works on any platform (it is a plain unlink, not a WebAuthn
|
|
73
|
+
* ceremony) but is only reachable from surfaces that list passkeys.
|
|
74
|
+
*/
|
|
75
|
+
removePasskey: (credentialId: string) => Promise<void>;
|
|
52
76
|
revokeSuspiciousSignIn: () => Promise<void>;
|
|
53
77
|
handleWebSession: (session: SessionLoginResponse) => Promise<void>;
|
|
54
78
|
logout: (targetSessionId?: string) => Promise<void>;
|
|
@@ -88,22 +112,19 @@ export interface OxyContextState {
|
|
|
88
112
|
refreshAccounts: () => Promise<void>;
|
|
89
113
|
createAccount: (data: CreateAccountInput) => Promise<AccountNode>;
|
|
90
114
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Result of {@link OxyContextState.signInWithPassword}.
|
|
93
|
-
*/
|
|
94
|
-
export type PasswordSignInResult = {
|
|
95
|
-
status: 'ok';
|
|
96
|
-
securityAlert?: SecurityAlert;
|
|
97
|
-
} | {
|
|
98
|
-
status: '2fa_required';
|
|
99
|
-
loginToken: string;
|
|
100
|
-
};
|
|
101
115
|
export interface OxyContextProviderProps {
|
|
102
116
|
children: ReactNode;
|
|
103
117
|
oxyServices?: OxyServices;
|
|
104
118
|
baseURL?: string;
|
|
105
119
|
authWebUrl?: string;
|
|
106
120
|
authRedirectUri?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Authorize endpoint override for silent cross-origin session restore
|
|
123
|
+
* (web cross-app SSO). Defaults to the production Oxy IdP when unset; a
|
|
124
|
+
* local/staging deployment points it at its own IdP so cold boot never
|
|
125
|
+
* bounces the tab to production `auth.oxy.so`.
|
|
126
|
+
*/
|
|
127
|
+
authorizeBaseUrl?: string;
|
|
107
128
|
storageKeyPrefix?: string;
|
|
108
129
|
clientId?: string;
|
|
109
130
|
/** Sync device credentials to auth.oxy.so after interactive sign-in. @default true */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oxyContextTypes.d.ts","sourceRoot":"","sources":["../../../../../src/ui/context/oxyContextTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAChM,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"oxyContextTypes.d.ts","sourceRoot":"","sources":["../../../../../src/ui/context/oxyContextTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAChM,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBA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;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;CACrC;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3D"}
|
|
@@ -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';
|
|
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,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,2BAA2B,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAAC;AAE3F,qFAAqF;AACrF,eAAO,MAAM,2BAA2B,gFACuC,CAAC;AAehF,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,eAAe,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD,WAAW,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,WAAW,EAAE,CACX,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,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AAO,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":"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