@oxyhq/services 21.0.0 → 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.
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAccountDialog.js +48 -4
- package/lib/commonjs/ui/components/OxyAccountDialog.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +69 -1
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/passkeyFlow.js +117 -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/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/components/OxyAccountDialog.js +48 -4
- package/lib/module/ui/components/OxyAccountDialog.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +69 -1
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/passkeyFlow.js +110 -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/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 +2 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +26 -0
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/passkeyFlow.d.ts +85 -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/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 +2 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +26 -0
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/passkeyFlow.d.ts +85 -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/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 +4 -3
- package/src/index.ts +2 -0
- package/src/ui/components/OxyAccountDialog.tsx +57 -0
- package/src/ui/context/OxyContext.tsx +76 -0
- package/src/ui/context/__tests__/passkeyFlow.test.ts +237 -0
- package/src/ui/context/oxyContextTypes.ts +21 -0
- package/src/ui/context/passkeyFlow.ts +146 -0
- package/src/ui/hooks/queries/queryKeys.ts +14 -0
- package/src/ui/hooks/queries/useAuthMethods.ts +45 -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,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PASSKEY_UNSUPPORTED_MESSAGE = void 0;
|
|
7
|
+
exports.runPasskeyAdd = runPasskeyAdd;
|
|
8
|
+
exports.runPasskeyLogin = runPasskeyLogin;
|
|
9
|
+
exports.runPasskeyRegister = runPasskeyRegister;
|
|
10
|
+
/**
|
|
11
|
+
* Pure passkey (WebAuthn) sign-in / registration orchestration.
|
|
12
|
+
*
|
|
13
|
+
* Extracted from `OxyContext` so the fixed `options → ceremony → verify → commit`
|
|
14
|
+
* ordering is unit-testable with injected deps — the exact pattern
|
|
15
|
+
* `commitSessionFlow.ts` (`commitDeviceSetAndResolve`) uses. The context methods
|
|
16
|
+
* (`signInWithPasskey` / `registerWithPasskey` / `addPasskey`) are thin wrappers
|
|
17
|
+
* that supply the real deps: the core `webauthn*` methods, the platform ceremony
|
|
18
|
+
* client (`webauthn/passkeyClient`), and the internal `commitSession` funnel.
|
|
19
|
+
*
|
|
20
|
+
* All three GATE on `isSupported()` first (the platform client returns `false`
|
|
21
|
+
* off the web) so an unsupported surface fails loudly before touching a ceremony.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The result of `OxyServices.webauthnRegisterVerify` — either the LINK branch
|
|
26
|
+
* (`{ success, message }`, bearer present, no session) or the SIGNUP branch (a
|
|
27
|
+
* full {@link LoginResult}, which carries a `sessionId` on its session arm).
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** Thrown when a passkey flow is attempted on a surface that cannot run WebAuthn. */
|
|
31
|
+
const PASSKEY_UNSUPPORTED_MESSAGE = exports.PASSKEY_UNSUPPORTED_MESSAGE = 'Passkeys are not available in this environment. Use another sign-in method.';
|
|
32
|
+
|
|
33
|
+
/** Project a session-arm login result onto the internal `commitSession` input. */
|
|
34
|
+
function toCommitInput(result) {
|
|
35
|
+
return {
|
|
36
|
+
sessionId: result.sessionId,
|
|
37
|
+
accessToken: result.accessToken,
|
|
38
|
+
deviceSecret: result.deviceSecret,
|
|
39
|
+
deviceId: result.deviceId,
|
|
40
|
+
expiresAt: result.expiresAt,
|
|
41
|
+
userId: result.user.id,
|
|
42
|
+
user: result.user
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Injected dependencies for {@link runPasskeyLogin}. */
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Usernameless (discoverable-credential) passkey SIGN-IN: request login options,
|
|
50
|
+
* run the authentication ceremony, verify, then commit the session. A passkey
|
|
51
|
+
* assertion is itself the strong factor, so a 2FA arm here is a protocol error.
|
|
52
|
+
*/
|
|
53
|
+
async function runPasskeyLogin(deps) {
|
|
54
|
+
if (!deps.isSupported()) {
|
|
55
|
+
throw new Error(PASSKEY_UNSUPPORTED_MESSAGE);
|
|
56
|
+
}
|
|
57
|
+
const options = await deps.getLoginOptions();
|
|
58
|
+
const response = await deps.runCeremony(options);
|
|
59
|
+
const result = await deps.loginVerify(response, {
|
|
60
|
+
deviceName: deps.deviceName,
|
|
61
|
+
deviceFingerprint: deps.deviceFingerprint,
|
|
62
|
+
deviceId: deps.deviceId
|
|
63
|
+
});
|
|
64
|
+
if ('twoFactorRequired' in result) {
|
|
65
|
+
throw new Error('Passkey sign-in unexpectedly required a second factor.');
|
|
66
|
+
}
|
|
67
|
+
await deps.commit(toCommitInput(result));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Injected dependencies for {@link runPasskeyRegister}. */
|
|
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
|
+
async function runPasskeyRegister(deps) {
|
|
78
|
+
if (!deps.isSupported()) {
|
|
79
|
+
throw new Error(PASSKEY_UNSUPPORTED_MESSAGE);
|
|
80
|
+
}
|
|
81
|
+
const options = await deps.getRegisterOptions(deps.username);
|
|
82
|
+
const response = await deps.runCeremony(options);
|
|
83
|
+
const result = await deps.registerVerify(response, {
|
|
84
|
+
username: deps.username,
|
|
85
|
+
deviceName: deps.deviceName
|
|
86
|
+
});
|
|
87
|
+
// Only the signup session arm carries `sessionId`; the link branch
|
|
88
|
+
// (`{ success, message }`) and any 2FA arm do not.
|
|
89
|
+
if (!('sessionId' in result)) {
|
|
90
|
+
throw new Error('Passkey registration did not establish a session.');
|
|
91
|
+
}
|
|
92
|
+
await deps.commit(toCommitInput(result));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Injected dependencies for {@link runPasskeyAdd}. */
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* ADD a passkey to the already-signed-in account (bearer present). The verify
|
|
99
|
+
* link branch returns `{ success, message }` with NO session — so this never
|
|
100
|
+
* commits a session; it just fires `onLinked` (which invalidates the
|
|
101
|
+
* auth-methods query). A session arm here would be a server contract violation.
|
|
102
|
+
*/
|
|
103
|
+
async function runPasskeyAdd(deps) {
|
|
104
|
+
if (!deps.isSupported()) {
|
|
105
|
+
throw new Error(PASSKEY_UNSUPPORTED_MESSAGE);
|
|
106
|
+
}
|
|
107
|
+
const options = await deps.getRegisterOptions();
|
|
108
|
+
const response = await deps.runCeremony(options);
|
|
109
|
+
const result = await deps.registerVerify(response, {
|
|
110
|
+
deviceName: deps.deviceName
|
|
111
|
+
});
|
|
112
|
+
if ('sessionId' in result) {
|
|
113
|
+
throw new Error('addPasskey unexpectedly minted a new session instead of linking.');
|
|
114
|
+
}
|
|
115
|
+
deps.onLinked();
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=passkeyFlow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PASSKEY_UNSUPPORTED_MESSAGE","exports","toCommitInput","result","sessionId","accessToken","deviceSecret","deviceId","expiresAt","userId","user","id","runPasskeyLogin","deps","isSupported","Error","options","getLoginOptions","response","runCeremony","loginVerify","deviceName","deviceFingerprint","commit","runPasskeyRegister","getRegisterOptions","username","registerVerify","runPasskeyAdd","onLinked"],"sourceRoot":"../../../../src","sources":["ui/context/passkeyFlow.ts"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;;AAGA;AACO,MAAMA,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GACtC,6EAA6E;;AAE/E;AACA,SAASE,aAAaA,CAACC,MAA0B,EAAe;EAC9D,OAAO;IACLC,SAAS,EAAED,MAAM,CAACC,SAAS;IAC3BC,WAAW,EAAEF,MAAM,CAACE,WAAW;IAC/BC,YAAY,EAAEH,MAAM,CAACG,YAAY;IACjCC,QAAQ,EAAEJ,MAAM,CAACI,QAAQ;IACzBC,SAAS,EAAEL,MAAM,CAACK,SAAS;IAC3BC,MAAM,EAAEN,MAAM,CAACO,IAAI,CAACC,EAAE;IACtBD,IAAI,EAAEP,MAAM,CAACO;EACf,CAAC;AACH;;AAEA;;AAeA;AACA;AACA;AACA;AACA;AACO,eAAeE,eAAeA,CAACC,IAAyB,EAAiB;EAC9E,IAAI,CAACA,IAAI,CAACC,WAAW,CAAC,CAAC,EAAE;IACvB,MAAM,IAAIC,KAAK,CAACf,2BAA2B,CAAC;EAC9C;EACA,MAAMgB,OAAO,GAAG,MAAMH,IAAI,CAACI,eAAe,CAAC,CAAC;EAC5C,MAAMC,QAAQ,GAAG,MAAML,IAAI,CAACM,WAAW,CAACH,OAAO,CAAC;EAChD,MAAMb,MAAM,GAAG,MAAMU,IAAI,CAACO,WAAW,CAACF,QAAQ,EAAE;IAC9CG,UAAU,EAAER,IAAI,CAACQ,UAAU;IAC3BC,iBAAiB,EAAET,IAAI,CAACS,iBAAiB;IACzCf,QAAQ,EAAEM,IAAI,CAACN;EACjB,CAAC,CAAC;EACF,IAAI,mBAAmB,IAAIJ,MAAM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ER,IAAI,CAACQ;EAAW,CAAC,CAAC;EACnF,IAAI,WAAW,IAAIlB,MAAM,EAAE;IACzB,MAAM,IAAIY,KAAK,CAAC,kEAAkE,CAAC;EACrF;EACAF,IAAI,CAACgB,QAAQ,CAAC,CAAC;AACjB","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.queryKeys = exports.invalidateUserQueries = exports.invalidateStorageQueries = exports.invalidateSessionQueries = exports.invalidateSecurityQueries = exports.invalidatePrivacyQueries = exports.invalidatePaymentsQueries = exports.invalidateDeviceQueries = exports.invalidateConnectedAppsQueries = exports.invalidateAccountQueries = void 0;
|
|
6
|
+
exports.queryKeys = exports.invalidateUserQueries = exports.invalidateStorageQueries = exports.invalidateSessionQueries = exports.invalidateSecurityQueries = exports.invalidatePrivacyQueries = exports.invalidatePaymentsQueries = exports.invalidateDeviceQueries = exports.invalidateConnectedAppsQueries = exports.invalidateAuthMethodsQueries = exports.invalidateAccountQueries = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* Centralized query keys for TanStack Query
|
|
9
9
|
*
|
|
@@ -63,6 +63,11 @@ const queryKeys = exports.queryKeys = {
|
|
|
63
63
|
recent: limit => [...queryKeys.security.all, 'recent', limit],
|
|
64
64
|
infinite: (limit, eventType) => [...queryKeys.security.all, 'infinite', limit, eventType]
|
|
65
65
|
},
|
|
66
|
+
// Linked authentication methods (passwords, identity keys, passkeys, social)
|
|
67
|
+
authMethods: {
|
|
68
|
+
all: ['authMethods'],
|
|
69
|
+
list: userId => [...queryKeys.authMethods.all, 'list', userId || 'current']
|
|
70
|
+
},
|
|
66
71
|
// Storage usage queries
|
|
67
72
|
storage: {
|
|
68
73
|
all: ['storage'],
|
|
@@ -158,9 +163,20 @@ const invalidateStorageQueries = queryClient => {
|
|
|
158
163
|
};
|
|
159
164
|
|
|
160
165
|
/**
|
|
161
|
-
* Helper to invalidate
|
|
166
|
+
* Helper to invalidate the user's linked auth-methods list (call after linking
|
|
167
|
+
* or removing a passkey / password / identity key).
|
|
162
168
|
*/
|
|
163
169
|
exports.invalidateStorageQueries = invalidateStorageQueries;
|
|
170
|
+
const invalidateAuthMethodsQueries = queryClient => {
|
|
171
|
+
queryClient.invalidateQueries({
|
|
172
|
+
queryKey: queryKeys.authMethods.all
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Helper to invalidate all payments / wallet / subscription queries
|
|
178
|
+
*/
|
|
179
|
+
exports.invalidateAuthMethodsQueries = invalidateAuthMethodsQueries;
|
|
164
180
|
const invalidatePaymentsQueries = queryClient => {
|
|
165
181
|
queryClient.invalidateQueries({
|
|
166
182
|
queryKey: queryKeys.payments.all
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["queryKeys","exports","accounts","all","lists","list","sessionIds","details","detail","sessionId","current","settings","users","userIds","userId","profile","sessions","active","device","deviceId","devices","accountScope","privacy","security","activity","limit","offset","eventType","recent","infinite","storage","usage","connectedApps","follow","counts","payments","subscription","history","wallet","walletTransactions","invalidateAccountQueries","queryClient","invalidateQueries","queryKey","invalidateUserQueries","invalidateSessionQueries","invalidateDeviceQueries","invalidatePrivacyQueries","invalidateSecurityQueries","invalidateStorageQueries","invalidatePaymentsQueries","invalidateConnectedAppsQueries"],"sourceRoot":"../../../../../src","sources":["ui/hooks/queries/queryKeys.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAMA,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACvB;EACAE,QAAQ,EAAE;IACRC,GAAG,EAAE,CAAC,UAAU,CAAU;IAC1BC,KAAK,EAAEA,CAAA,KAAM,CAAC,GAAGJ,SAAS,CAACE,QAAQ,CAACC,GAAG,EAAE,MAAM,CAAU;IACzDE,IAAI,EAAGC,UAAoB,IAAK,CAAC,GAAGN,S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AACsB,OAAO,CAACnB,GAAG,EAAE,UAAU,EAAEW,MAAM,IAAI,SAAS;EAC3F,CAAC;EAED;EACAS,QAAQ,EAAE;IACRpB,GAAG,EAAE,CAAC,UAAU,CAAU;IAC1BqB,QAAQ,EAAEA,CAACC,KAAc,EAAEC,MAAe,EAAEC,SAAkB,KAC5D,CAAC,GAAG3B,SAAS,CAACuB,QAAQ,CAACpB,GAAG,EAAE,UAAU,EAAEsB,KAAK,EAAEC,MAAM,EAAEC,SAAS,CAAU;IAC5EC,MAAM,EAAGH,KAAa,IACpB,CAAC,GAAGzB,SAAS,CAACuB,QAAQ,CAACpB,GAAG,EAAE,QAAQ,EAAEsB,KAAK,CAAU;IACvDI,QAAQ,EAAEA,CAACJ,KAAa,EAAEE,SAAkB,KAC1C,CAAC,GAAG3B,SAAS,CAACuB,QAAQ,CAACpB,GAAG,EAAE,UAAU,EAAEsB,KAAK,EAAEE,SAAS;EAC5D,CAAC;EAED;EACAG,OAAO,EAAE;
|
|
1
|
+
{"version":3,"names":["queryKeys","exports","accounts","all","lists","list","sessionIds","details","detail","sessionId","current","settings","users","userIds","userId","profile","sessions","active","device","deviceId","devices","accountScope","privacy","security","activity","limit","offset","eventType","recent","infinite","authMethods","storage","usage","connectedApps","follow","counts","payments","subscription","history","wallet","walletTransactions","invalidateAccountQueries","queryClient","invalidateQueries","queryKey","invalidateUserQueries","invalidateSessionQueries","invalidateDeviceQueries","invalidatePrivacyQueries","invalidateSecurityQueries","invalidateStorageQueries","invalidateAuthMethodsQueries","invalidatePaymentsQueries","invalidateConnectedAppsQueries"],"sourceRoot":"../../../../../src","sources":["ui/hooks/queries/queryKeys.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAMA,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACvB;EACAE,QAAQ,EAAE;IACRC,GAAG,EAAE,CAAC,UAAU,CAAU;IAC1BC,KAAK,EAAEA,CAAA,KAAM,CAA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SAAS,CAAC8B,WAAW,CAAC3B;EAAI,CAAC,CAAC;AACxE,CAAC;;AAED;AACA;AACA;AAFAF,OAAA,CAAAkD,4BAAA,GAAAA,4BAAA;AAGO,MAAMC,yBAAyB,GAAIV,WAAwB,IAAW;EAC3EA,WAAW,CAACC,iBAAiB,CAAC;IAAEC,QAAQ,EAAE5C,SAAS,CAACoC,QAAQ,CAACjC;EAAI,CAAC,CAAC;AACrE,CAAC;;AAED;AACA;AACA;AAFAF,OAAA,CAAAmD,yBAAA,GAAAA,yBAAA;AAGO,MAAMC,8BAA8B,GAAIX,WAAwB,IAAW;EAChFA,WAAW,CAACC,iBAAiB,CAAC;IAAEC,QAAQ,EAAE5C,SAAS,CAACiC,aAAa,CAAC9B;EAAI,CAAC,CAAC;AAC1E,CAAC;AAACF,OAAA,CAAAoD,8BAAA,GAAAA,8BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAuthMethods = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
9
|
+
var _queryKeys = require("./queryKeys.js");
|
|
10
|
+
var _OxyContext = require("../../context/OxyContext.js");
|
|
11
|
+
/** Stable empty list so the derived selectors keep a stable reference while loading. */
|
|
12
|
+
const EMPTY_METHODS = Object.freeze([]);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The current account's linked authentication methods (`GET /auth/methods`),
|
|
16
|
+
* plus convenience projections. Backs the security / account surfaces that let a
|
|
17
|
+
* user see and manage their passwords, identity key, social logins, and passkeys.
|
|
18
|
+
*
|
|
19
|
+
* `passkeys` is the `type === 'webauthn'` subset — one entry per registered
|
|
20
|
+
* credential. Invalidate via `queryKeys.authMethods.all` after linking a passkey
|
|
21
|
+
* (`useOxy().addPasskey()` does this) or removing one.
|
|
22
|
+
*/
|
|
23
|
+
const useAuthMethods = options => {
|
|
24
|
+
const {
|
|
25
|
+
oxyServices,
|
|
26
|
+
activeSessionId
|
|
27
|
+
} = (0, _OxyContext.useOxy)();
|
|
28
|
+
const query = (0, _reactQuery.useQuery)({
|
|
29
|
+
queryKey: _queryKeys.queryKeys.authMethods.list(),
|
|
30
|
+
queryFn: () => oxyServices.listAuthMethods(),
|
|
31
|
+
enabled: options?.enabled !== false && !!activeSessionId,
|
|
32
|
+
staleTime: 5 * 60 * 1000,
|
|
33
|
+
// 5 minutes
|
|
34
|
+
gcTime: 10 * 60 * 1000 // 10 minutes
|
|
35
|
+
});
|
|
36
|
+
const methods = query.data?.methods ?? EMPTY_METHODS;
|
|
37
|
+
const passkeys = (0, _react.useMemo)(() => methods.filter(method => method.type === 'webauthn'), [methods]);
|
|
38
|
+
return {
|
|
39
|
+
...query,
|
|
40
|
+
/** Every linked auth method. Empty while loading. */
|
|
41
|
+
methods,
|
|
42
|
+
/** The registered passkeys (a `type === 'webauthn'` subset of `methods`). */
|
|
43
|
+
passkeys,
|
|
44
|
+
/** The account's DID, or `null` while loading. */
|
|
45
|
+
did: query.data?.did ?? null
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
exports.useAuthMethods = useAuthMethods;
|
|
49
|
+
//# sourceMappingURL=useAuthMethods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactQuery","_queryKeys","_OxyContext","EMPTY_METHODS","Object","freeze","useAuthMethods","options","oxyServices","activeSessionId","useOxy","query","useQuery","queryKey","queryKeys","authMethods","list","queryFn","listAuthMethods","enabled","staleTime","gcTime","methods","data","passkeys","useMemo","filter","method","type","did","exports"],"sourceRoot":"../../../../../src","sources":["ui/hooks/queries/useAuthMethods.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAEA;AACA,MAAMI,aAAyC,GAAGC,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,cAAc,GAAIC,OAA+B,IAAK;EACjE,MAAM;IAAEC,WAAW;IAAEC;EAAgB,CAAC,GAAG,IAAAC,kBAAM,EAAC,CAAC;EAEjD,MAAMC,KAAK,GAAG,IAAAC,oBAAQ,EAAsB;IAC1CC,QAAQ,EAAEC,oBAAS,CAACC,WAAW,CAACC,IAAI,CAAC,CAAC;IACtCC,OAAO,EAAEA,CAAA,KAAMT,WAAW,CAACU,eAAe,CAAC,CAAC;IAC5CC,OAAO,EAAEZ,OAAO,EAAEY,OAAO,KAAK,KAAK,IAAI,CAAC,CAACV,eAAe;IACxDW,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;IAAE;IAC1BC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAE;EAC1B,CAAC,CAAC;EAEF,MAAMC,OAAO,GAAGX,KAAK,CAACY,IAAI,EAAED,OAAO,IAAInB,aAAa;EACpD,MAAMqB,QAAQ,GAAG,IAAAC,cAAO,EACtB,MAAMH,OAAO,CAACI,MAAM,CAAEC,MAAM,IAAKA,MAAM,CAACC,IAAI,KAAK,UAAU,CAAC,EAC5D,CAACN,OAAO,CACV,CAAC;EAED,OAAO;IACL,GAAGX,KAAK;IACR;IACAW,OAAO;IACP;IACAE,QAAQ;IACR;IACAK,GAAG,EAAElB,KAAK,CAACY,IAAI,EAAEM,GAAG,IAAI;EAC1B,CAAC;AACH,CAAC;AAACC,OAAA,CAAAxB,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isPasskeySupported = isPasskeySupported;
|
|
7
|
+
exports.runAuthenticationCeremony = runAuthenticationCeremony;
|
|
8
|
+
exports.runRegistrationCeremony = runRegistrationCeremony;
|
|
9
|
+
/**
|
|
10
|
+
* Passkey / WebAuthn ceremony client — clean default (non-web) implementation.
|
|
11
|
+
*
|
|
12
|
+
* This is the base module TypeScript resolves for TYPES and any bundler that
|
|
13
|
+
* does not pick a platform variant. It intentionally imports NOTHING browser-
|
|
14
|
+
* specific (no `@simplewebauthn/browser`) so it stays safe for Metro, native
|
|
15
|
+
* builds, and SSR. The real ceremony lives in `passkeyClient.web.ts`; native
|
|
16
|
+
* passkeys are Commons' job, so there is no WebAuthn ceremony here.
|
|
17
|
+
*
|
|
18
|
+
* `isPasskeySupported()` returns `false` (no relying-party origin / no browser
|
|
19
|
+
* WebAuthn API), and the ceremony helpers throw a clear error so a caller that
|
|
20
|
+
* skipped the support gate fails loudly instead of silently.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const WEBAUTHN_WEB_ONLY_MESSAGE = 'WebAuthn is web-only; native uses Commons. Passkeys are not available on this platform.';
|
|
24
|
+
|
|
25
|
+
/** Always `false` off the web — there is no relying-party origin or WebAuthn API. */
|
|
26
|
+
function isPasskeySupported() {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Not available off the web — throws. Guard with {@link isPasskeySupported} first. */
|
|
31
|
+
async function runRegistrationCeremony(_optionsJSON) {
|
|
32
|
+
throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Not available off the web — throws. Guard with {@link isPasskeySupported} first. */
|
|
36
|
+
async function runAuthenticationCeremony(_optionsJSON) {
|
|
37
|
+
throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
|
|
38
|
+
}
|
|
39
|
+
//# 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;AACO,SAASC,kBAAkBA,CAAA,EAAY;EAC5C,OAAO,KAAK;AACd;;AAEA;AACO,eAAeC,uBAAuBA,CAACC,YAAqB,EAAoB;EACrF,MAAM,IAAIC,KAAK,CAACJ,yBAAyB,CAAC;AAC5C;;AAEA;AACO,eAAeK,yBAAyBA,CAACF,YAAqB,EAAoB;EACvF,MAAM,IAAIC,KAAK,CAACJ,yBAAyB,CAAC;AAC5C","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isPasskeySupported = isPasskeySupported;
|
|
7
|
+
exports.runAuthenticationCeremony = runAuthenticationCeremony;
|
|
8
|
+
exports.runRegistrationCeremony = runRegistrationCeremony;
|
|
9
|
+
/**
|
|
10
|
+
* Passkey / WebAuthn ceremony client — NATIVE implementation.
|
|
11
|
+
*
|
|
12
|
+
* React Native has no browser WebAuthn API, and Oxy's native passkey story is
|
|
13
|
+
* Commons (shared-keychain / QR handoff), NOT `navigator.credentials`. So this
|
|
14
|
+
* variant imports NOTHING browser-specific and mirrors the clean default:
|
|
15
|
+
* unsupported, and the ceremony helpers throw if a caller skipped the gate.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const WEBAUTHN_WEB_ONLY_MESSAGE = 'WebAuthn is web-only; native uses Commons. Passkeys are not available on this platform.';
|
|
19
|
+
|
|
20
|
+
/** Always `false` on native — there is no browser WebAuthn API. */
|
|
21
|
+
function isPasskeySupported() {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Not available on native — throws. Guard with {@link isPasskeySupported} first. */
|
|
26
|
+
async function runRegistrationCeremony(_optionsJSON) {
|
|
27
|
+
throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Not available on native — throws. Guard with {@link isPasskeySupported} first. */
|
|
31
|
+
async function runAuthenticationCeremony(_optionsJSON) {
|
|
32
|
+
throw new Error(WEBAUTHN_WEB_ONLY_MESSAGE);
|
|
33
|
+
}
|
|
34
|
+
//# 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;AACO,SAASC,kBAAkBA,CAAA,EAAY;EAC5C,OAAO,KAAK;AACd;;AAEA;AACO,eAAeC,uBAAuBA,CAACC,YAAqB,EAAoB;EACrF,MAAM,IAAIC,KAAK,CAACJ,yBAAyB,CAAC;AAC5C;;AAEA;AACO,eAAeK,yBAAyBA,CAACF,YAAqB,EAAoB;EACvF,MAAM,IAAIC,KAAK,CAACJ,yBAAyB,CAAC;AAC5C","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isPasskeySupported = isPasskeySupported;
|
|
7
|
+
exports.runAuthenticationCeremony = runAuthenticationCeremony;
|
|
8
|
+
exports.runRegistrationCeremony = runRegistrationCeremony;
|
|
9
|
+
var _browser = require("@simplewebauthn/browser");
|
|
10
|
+
/**
|
|
11
|
+
* Passkey / WebAuthn ceremony client — WEB implementation.
|
|
12
|
+
*
|
|
13
|
+
* The browser half of the passkey flow: it drives `navigator.credentials`
|
|
14
|
+
* through `@simplewebauthn/browser`, turning the OPAQUE options the server
|
|
15
|
+
* emitted (`OxyServices.webauthn{Register,Login}Options`) into the opaque
|
|
16
|
+
* response the matching `verify` endpoint consumes. Oxy never owns those wire
|
|
17
|
+
* shapes — `@simplewebauthn/browser` does — so options flow in as `unknown` and
|
|
18
|
+
* the single cast at this boundary hands them to the library's own types.
|
|
19
|
+
*
|
|
20
|
+
* This file is selected ONLY on web (react-native-web / Vite RNW): the sibling
|
|
21
|
+
* `passkeyClient.native.ts` + the clean default `passkeyClient.ts` deliberately
|
|
22
|
+
* do NOT import `@simplewebauthn/browser` (a browser-only dependency), per the
|
|
23
|
+
* platform-split rule. Native passkeys are Commons' job — there is no WebAuthn
|
|
24
|
+
* ceremony off the web.
|
|
25
|
+
*/
|
|
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
|
+
function isPasskeySupported() {
|
|
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
|
+
async function runRegistrationCeremony(optionsJSON) {
|
|
42
|
+
return (0, _browser.startRegistration)({
|
|
43
|
+
optionsJSON: optionsJSON
|
|
44
|
+
});
|
|
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
|
+
async function runAuthenticationCeremony(optionsJSON) {
|
|
53
|
+
return (0, _browser.startAuthentication)({
|
|
54
|
+
optionsJSON: optionsJSON
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=passkeyClient.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_browser","require","isPasskeySupported","window","PublicKeyCredential","runRegistrationCeremony","optionsJSON","startRegistration","runAuthenticationCeremony","startAuthentication"],"sourceRoot":"../../../src","sources":["webauthn/passkeyClient.web.ts"],"mappings":";;;;;;;;AAiBA,IAAAA,QAAA,GAAAC,OAAA;AAjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAAA,EAAY;EAC5C,OAAO,OAAOC,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,CAACC,mBAAmB,KAAK,WAAW;AAC3F;;AAEA;AACA;AACA;AACA;AACA;AACO,eAAeC,uBAAuBA,CAC3CC,WAAoB,EACe;EACnC,OAAO,IAAAC,0BAAiB,EAAC;IAAED,WAAW,EAAEA;EAAsD,CAAC,CAAC;AAClG;;AAEA;AACA;AACA;AACA;AACA;AACO,eAAeE,yBAAyBA,CAC7CF,WAAoB,EACiB;EACrC,OAAO,IAAAG,4BAAmB,EAAC;IAAEH,WAAW,EAAEA;EAAqD,CAAC,CAAC;AACnG","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -61,6 +61,7 @@ export { useStorage } from "./ui/hooks/useStorage.js";
|
|
|
61
61
|
export { useUserProfile, useUserProfiles, useCurrentUser, useUserById, useUserByUsername, useUsersBySessions, usePrivacySettings, useConnectedApps } from "./ui/hooks/queries/useAccountQueries.js";
|
|
62
62
|
export { useSessions, useSession, useDeviceSessions, useUserDevices, useSecurityInfo, useAccountStorageUsage } from "./ui/hooks/queries/useServicesQueries.js";
|
|
63
63
|
export { useSecurityActivity, useRecentSecurityActivity, useInfiniteSecurityActivity } from "./ui/hooks/queries/useSecurityQueries.js";
|
|
64
|
+
export { useAuthMethods } from "./ui/hooks/queries/useAuthMethods.js";
|
|
64
65
|
export { useUserSubscription, useUserPayments, useUserWallet, useUserWalletTransactions } from "./ui/hooks/queries/usePaymentQueries.js";
|
|
65
66
|
|
|
66
67
|
// Payment / wallet / subscription domain types
|
|
@@ -80,7 +81,7 @@ export { mutationKeys } from "./ui/hooks/mutations/mutationKeys.js";
|
|
|
80
81
|
// Consumers (Mention, Homiio, Alia, accounts) use these to invalidate cached
|
|
81
82
|
// data after writes that touch shared backend state. Keep nominal — no
|
|
82
83
|
// `export *` — and never drop a public symbol without a major version bump.
|
|
83
|
-
export { queryKeys, invalidateAccountQueries, invalidateUserQueries, invalidateSessionQueries, invalidateDeviceQueries, invalidatePrivacyQueries, invalidateSecurityQueries, invalidateStorageQueries, invalidatePaymentsQueries, invalidateConnectedAppsQueries } from "./ui/hooks/queries/queryKeys.js";
|
|
84
|
+
export { queryKeys, invalidateAccountQueries, invalidateUserQueries, invalidateSessionQueries, invalidateDeviceQueries, invalidatePrivacyQueries, invalidateSecurityQueries, invalidateStorageQueries, invalidatePaymentsQueries, invalidateConnectedAppsQueries, invalidateAuthMethodsQueries } from "./ui/hooks/queries/queryKeys.js";
|
|
84
85
|
|
|
85
86
|
// Mutation status aggregator (for "Syncing..." indicators)
|
|
86
87
|
export { useMutationStatus } from "./ui/hooks/useMutationStatus.js";
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["setPlatformOS","Platform","OS","default","OxyProvider","useOxy","useAuth","FontLoader","setupFonts","useAuthStore","useAccountStore","useAssetStore","useAssets","useAssetsStore","useAsset","useUploadProgress","useAssetLoading","useAssetErrors","useAssetsByApp","useAssetsByEntity","useAssetUsageCount","useIsAssetLinked","setOxyAssetInstance","useFileDownloadUrl","useFollow","useFollowerCounts","useStorage","useUserProfile","useUserProfiles","useCurrentUser","useUserById","useUserByUsername","useUsersBySessions","usePrivacySettings","useConnectedApps","useSessions","useSession","useDeviceSessions","useUserDevices","useSecurityInfo","useAccountStorageUsage","useSecurityActivity","useRecentSecurityActivity","useInfiniteSecurityActivity","useUserSubscription","useUserPayments","useUserWallet","useUserWalletTransactions","useUpdateProfile","useUploadAvatar","useUpdateAccountSettings","useUpdatePrivacySettings","useUpdateNotificationPreferences","useUpdateUserPreferences","useRevokeConnectedApp","useUploadFile","useSwitchSession","useLogoutSession","useLogoutAll","useUpdateDeviceName","useRemoveDevice","createProfileMutation","createGenericMutation","mutationKeys","queryKeys","invalidateAccountQueries","invalidateUserQueries","invalidateSessionQueries","invalidateDeviceQueries","invalidatePrivacyQueries","invalidateSecurityQueries","invalidateStorageQueries","invalidatePaymentsQueries","invalidateConnectedAppsQueries","useMutationStatus","useOnlineStatus","useOxyEvent","handleAuthError","isInvalidSessionError","isTimeoutOrNetworkError","extractErrorMessage","useFileFiltering","OXY_OAUTH_STATE_STORAGE_KEY","OXY_OAUTH_CODE_VERIFIER_STORAGE_KEY","OxySignInButton","OxyAuthPrompt","OxyOAuthCallback","OxyConsentScreen","RequireOxyAuth","FollowButton","OxyPayButton","LogoIcon","LogoText","ProfileButton","useSwitchableAccounts","ProfileScreen","ManageAccountScreen","NotificationsScreen","PreferencesScreen","ConnectedAppsScreen","CreateAccountScreen","AccountMembersScreen","AccountSettingsScreen","showBottomSheet","closeBottomSheet","openAccountDialog","closeAccountDialog","subscribeToAccountDialog"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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,wBAAwB,EACxBC,gCAAgC,EAChCC,wBAAwB,EACxBC,qBAAqB,EACrBC,aAAa,QACV,6CAA0C;AACjD,SACIC,gBAAgB,EAChBC,gBAAgB,EAChBC,YAAY,EACZC,mBAAmB,EACnBC,eAAe,QACZ,8CAA2C;AAClD,SACIC,qBAAqB,EACrBC,qBAAqB,QAClB,yCAAsC;AAM7C;AACA,SAASC,YAAY,QAAQ,sCAAmC;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA,SACIC,SAAS,EACTC,wBAAwB,EACxBC,qBAAqB,EACrBC,wBAAwB,EACxBC,uBAAuB,EACvBC,wBAAwB,EACxBC,yBAAyB,EACzBC,wBAAwB,EACxBC,yBAAyB,EACzBC,8BAA8B,
|
|
1
|
+
{"version":3,"names":["setPlatformOS","Platform","OS","default","OxyProvider","useOxy","useAuth","FontLoader","setupFonts","useAuthStore","useAccountStore","useAssetStore","useAssets","useAssetsStore","useAsset","useUploadProgress","useAssetLoading","useAssetErrors","useAssetsByApp","useAssetsByEntity","useAssetUsageCount","useIsAssetLinked","setOxyAssetInstance","useFileDownloadUrl","useFollow","useFollowerCounts","useStorage","useUserProfile","useUserProfiles","useCurrentUser","useUserById","useUserByUsername","useUsersBySessions","usePrivacySettings","useConnectedApps","useSessions","useSession","useDeviceSessions","useUserDevices","useSecurityInfo","useAccountStorageUsage","useSecurityActivity","useRecentSecurityActivity","useInfiniteSecurityActivity","useAuthMethods","useUserSubscription","useUserPayments","useUserWallet","useUserWalletTransactions","useUpdateProfile","useUploadAvatar","useUpdateAccountSettings","useUpdatePrivacySettings","useUpdateNotificationPreferences","useUpdateUserPreferences","useRevokeConnectedApp","useUploadFile","useSwitchSession","useLogoutSession","useLogoutAll","useUpdateDeviceName","useRemoveDevice","createProfileMutation","createGenericMutation","mutationKeys","queryKeys","invalidateAccountQueries","invalidateUserQueries","invalidateSessionQueries","invalidateDeviceQueries","invalidatePrivacyQueries","invalidateSecurityQueries","invalidateStorageQueries","invalidatePaymentsQueries","invalidateConnectedAppsQueries","invalidateAuthMethodsQueries","useMutationStatus","useOnlineStatus","useOxyEvent","handleAuthError","isInvalidSessionError","isTimeoutOrNetworkError","extractErrorMessage","useFileFiltering","OXY_OAUTH_STATE_STORAGE_KEY","OXY_OAUTH_CODE_VERIFIER_STORAGE_KEY","OxySignInButton","OxyAuthPrompt","OxyOAuthCallback","OxyConsentScreen","RequireOxyAuth","FollowButton","OxyPayButton","LogoIcon","LogoText","ProfileButton","useSwitchableAccounts","ProfileScreen","ManageAccountScreen","NotificationsScreen","PreferencesScreen","ConnectedAppsScreen","CreateAccountScreen","AccountMembersScreen","AccountSettingsScreen","showBottomSheet","closeBottomSheet","openAccountDialog","closeAccountDialog","subscribeToAccountDialog"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,SAASA,aAAa,QAAyB,aAAa;AAC5D,SAASC,QAAQ,QAAQ,cAAc;AACvCD,aAAa,CAACC,QAAQ,CAACC,EAAgB,CAAC;;AAExC;AACA;AACA;AACA,SAASC,OAAO,IAAIC,WAAW,QAAQ,gCAA6B;AACpE,SAASC,MAAM,QAAQ,4BAAyB;AAEhD,SAASC,OAAO,QAAQ,uBAAoB;AAG5C;AACA;AACA;AACA,SAASC,UAAU,EAAEC,UAAU,QAAQ,+BAA4B;;AAEnE;AACA;AACA;AACA,SAASC,YAAY,QAAQ,0BAAuB;AACpD,SAASC,eAAe,QAAQ,6BAA0B;AAC1D,SACIC,aAAa,EACbC,SAAS,IAAIC,cAAc,EAC3BC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfC,cAAc,EACdC,cAAc,EACdC,iBAAiB,EACjBC,kBAAkB,EAClBC,gBAAgB,QACb,2BAAwB;;AAE/B;AACA;AACA;AACA,SAAST,SAAS,EAAEU,mBAAmB,QAAQ,yBA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ACA;AACA,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,wBAAwB,QACnB,yCAAsC","ignoreList":[]}
|
|
@@ -49,9 +49,11 @@ import { Button } from '@oxyhq/bloom/button';
|
|
|
49
49
|
import { Dialog } from '@oxyhq/bloom/dialog';
|
|
50
50
|
import { Text } from '@oxyhq/bloom/typography';
|
|
51
51
|
import { useTheme, BloomColorScope, APP_COLOR_NAMES, APP_COLOR_PRESETS } from '@oxyhq/bloom/theme';
|
|
52
|
+
import { isOxyRpOrigin } from '@oxyhq/core';
|
|
52
53
|
import { useQueryClient } from '@tanstack/react-query';
|
|
53
54
|
import { useOxy } from "../context/OxyContext.js";
|
|
54
55
|
import { useI18n } from "../hooks/useI18n.js";
|
|
56
|
+
import { isWebBrowser } from "../utils/isWebBrowser.js";
|
|
55
57
|
import { LogoIcon } from "./logo/LogoIcon.js";
|
|
56
58
|
|
|
57
59
|
/** Diameter of a row avatar. */
|
|
@@ -89,7 +91,8 @@ const OxyAccountDialog = () => {
|
|
|
89
91
|
closeAccountDialog,
|
|
90
92
|
showBottomSheet,
|
|
91
93
|
logoutAll,
|
|
92
|
-
refreshAccounts
|
|
94
|
+
refreshAccounts,
|
|
95
|
+
signInWithPasskey
|
|
93
96
|
} = useOxy();
|
|
94
97
|
const theme = useTheme();
|
|
95
98
|
const {
|
|
@@ -97,6 +100,29 @@ const OxyAccountDialog = () => {
|
|
|
97
100
|
} = useI18n();
|
|
98
101
|
const queryClient = useQueryClient();
|
|
99
102
|
|
|
103
|
+
// Passkey sign-in is offered ONLY on a first-party Oxy web origin (a credential
|
|
104
|
+
// minted for `oxy.so` can only be asserted there or on a loopback dev host).
|
|
105
|
+
// Off the web / on a non-Oxy origin the button is hidden entirely (a hub popup
|
|
106
|
+
// for arbitrary web origins is a later phase). This is environment-static.
|
|
107
|
+
const passkeyAvailable = useMemo(() => isWebBrowser() && isOxyRpOrigin(), []);
|
|
108
|
+
const [passkeyPending, setPasskeyPending] = useState(false);
|
|
109
|
+
const [passkeyError, setPasskeyError] = useState(null);
|
|
110
|
+
const handleSignInWithPasskey = useCallback(async () => {
|
|
111
|
+
if (passkeyPending) return;
|
|
112
|
+
setPasskeyPending(true);
|
|
113
|
+
setPasskeyError(null);
|
|
114
|
+
try {
|
|
115
|
+
await signInWithPasskey();
|
|
116
|
+
closeAccountDialog();
|
|
117
|
+
} catch (error) {
|
|
118
|
+
// A cancelled/failed ceremony keeps the dialog open so the user can retry
|
|
119
|
+
// or fall back to another method — surface a concise message, never swallow.
|
|
120
|
+
setPasskeyError(error instanceof Error && error.message ? error.message : 'Passkey sign-in failed.');
|
|
121
|
+
} finally {
|
|
122
|
+
setPasskeyPending(false);
|
|
123
|
+
}
|
|
124
|
+
}, [passkeyPending, signInWithPasskey, closeAccountDialog]);
|
|
125
|
+
|
|
100
126
|
// Bind the headless controller. `getSnapshot` returns a stable reference
|
|
101
127
|
// between changes, so it is `useSyncExternalStore`-safe. Guard the no-provider
|
|
102
128
|
// loading state (`controller` is `null`) with an inert store.
|
|
@@ -187,7 +213,10 @@ const OxyAccountDialog = () => {
|
|
|
187
213
|
handlers: handlers,
|
|
188
214
|
onSignInWithOxy: () => void controller.signInWithOxy(),
|
|
189
215
|
onScanQr: () => void controller.showQr(),
|
|
190
|
-
onUsePassword: () => void controller.openPasswordAtOxyAuth()
|
|
216
|
+
onUsePassword: () => void controller.openPasswordAtOxyAuth(),
|
|
217
|
+
onSignInWithPasskey: passkeyAvailable ? () => void handleSignInWithPasskey() : undefined,
|
|
218
|
+
passkeyPending: passkeyPending,
|
|
219
|
+
passkeyError: passkeyError
|
|
191
220
|
})
|
|
192
221
|
})]
|
|
193
222
|
});
|
|
@@ -407,7 +436,10 @@ const SignInView = ({
|
|
|
407
436
|
handlers,
|
|
408
437
|
onSignInWithOxy,
|
|
409
438
|
onScanQr,
|
|
410
|
-
onUsePassword
|
|
439
|
+
onUsePassword,
|
|
440
|
+
onSignInWithPasskey,
|
|
441
|
+
passkeyPending,
|
|
442
|
+
passkeyError
|
|
411
443
|
}) => /*#__PURE__*/_jsxs(View, {
|
|
412
444
|
style: styles.signInBlock,
|
|
413
445
|
children: [snapshot.accounts.length > 0 ? /*#__PURE__*/_jsxs(View, {
|
|
@@ -427,7 +459,19 @@ const SignInView = ({
|
|
|
427
459
|
onPress: onSignInWithOxy,
|
|
428
460
|
style: styles.primaryButton,
|
|
429
461
|
children: "Sign in with Oxy"
|
|
430
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
462
|
+
}), onSignInWithPasskey ? /*#__PURE__*/_jsx(Button, {
|
|
463
|
+
variant: "secondary",
|
|
464
|
+
onPress: onSignInWithPasskey,
|
|
465
|
+
disabled: passkeyPending,
|
|
466
|
+
style: styles.secondaryButton,
|
|
467
|
+
testID: "passkey-signin-button",
|
|
468
|
+
children: passkeyPending ? t('accountSwitcher.passkeySigningIn') || 'Signing in…' : t('accountSwitcher.signInWithPasskey') || 'Sign in with a passkey'
|
|
469
|
+
}) : null, passkeyError ? /*#__PURE__*/_jsx(Text, {
|
|
470
|
+
style: [styles.errorText, {
|
|
471
|
+
color: theme.colors.error
|
|
472
|
+
}],
|
|
473
|
+
children: passkeyError
|
|
474
|
+
}) : null, /*#__PURE__*/_jsx(Button, {
|
|
431
475
|
variant: "secondary",
|
|
432
476
|
onPress: onScanQr,
|
|
433
477
|
style: styles.secondaryButton,
|