@oxyhq/core 10.2.0 → 11.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/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/boot/sessionColdBoot.js +3 -3
- package/dist/cjs/crypto/keyManager.js +68 -69
- package/dist/cjs/crypto/signatureService.js +2 -2
- package/dist/cjs/index.js +17 -20
- package/dist/cjs/logger/index.js +149 -0
- package/dist/cjs/mixins/OxyServices.assets.js +4 -4
- package/dist/cjs/mixins/OxyServices.auth.js +104 -2
- package/dist/cjs/mixins/OxyServices.language.js +3 -5
- package/dist/cjs/mixins/OxyServices.privacy.js +2 -4
- package/dist/cjs/mixins/OxyServices.security.js +7 -11
- package/dist/cjs/mixins/OxyServices.topics.js +25 -15
- package/dist/cjs/mixins/OxyServices.user.js +4 -4
- package/dist/cjs/mixins/OxyServices.utility.js +18 -18
- package/dist/cjs/session/SessionClient.js +17 -17
- package/dist/cjs/session/accountDialogController.js +12 -12
- package/dist/cjs/session/authStateStore.js +5 -5
- package/dist/cjs/session/refresh.js +4 -4
- package/dist/cjs/session/socketLoader.js +2 -2
- package/dist/cjs/utils/asyncUtils.js +2 -2
- package/dist/cjs/utils/avatarUtils.js +2 -1
- package/dist/cjs/utils/deviceManager.js +7 -5
- package/dist/cjs/utils/errorUtils.js +3 -3
- package/dist/cjs/utils/oauthPkce.js +3 -3
- package/dist/cjs/utils/requestUtils.js +1 -1
- package/dist/cjs/utils/webauthnOrigin.js +51 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/boot/sessionColdBoot.js +1 -1
- package/dist/esm/crypto/keyManager.js +1 -2
- package/dist/esm/crypto/signatureService.js +1 -1
- package/dist/esm/index.js +6 -3
- package/dist/esm/logger/index.js +140 -0
- package/dist/esm/mixins/OxyServices.assets.js +2 -2
- package/dist/esm/mixins/OxyServices.auth.js +103 -1
- package/dist/esm/mixins/OxyServices.language.js +3 -5
- package/dist/esm/mixins/OxyServices.privacy.js +2 -4
- package/dist/esm/mixins/OxyServices.security.js +7 -11
- package/dist/esm/mixins/OxyServices.topics.js +25 -15
- package/dist/esm/mixins/OxyServices.user.js +1 -1
- package/dist/esm/mixins/OxyServices.utility.js +1 -1
- package/dist/esm/session/SessionClient.js +1 -1
- package/dist/esm/session/accountDialogController.js +1 -1
- package/dist/esm/session/authStateStore.js +1 -1
- package/dist/esm/session/refresh.js +1 -1
- package/dist/esm/session/socketLoader.js +1 -1
- package/dist/esm/utils/asyncUtils.js +1 -1
- package/dist/esm/utils/avatarUtils.js +2 -1
- package/dist/esm/utils/deviceManager.js +7 -5
- package/dist/esm/utils/errorUtils.js +1 -1
- package/dist/esm/utils/oauthPkce.js +1 -1
- package/dist/esm/utils/requestUtils.js +1 -1
- package/dist/esm/utils/webauthnOrigin.js +48 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/logger/index.d.ts +104 -0
- package/dist/types/mixins/OxyServices.auth.d.ts +58 -0
- package/dist/types/mixins/OxyServices.topics.d.ts +3 -3
- package/dist/types/models/Topic.d.ts +10 -0
- package/dist/types/utils/requestUtils.d.ts +1 -1
- package/dist/types/utils/webauthnOrigin.d.ts +32 -0
- package/package.json +17 -2
- package/src/boot/sessionColdBoot.ts +1 -1
- package/src/crypto/keyManager.ts +1 -2
- package/src/crypto/signatureService.ts +1 -1
- package/src/index.ts +22 -19
- package/src/logger/__tests__/logger.test.ts +207 -0
- package/src/logger/index.ts +217 -0
- package/src/mixins/OxyServices.assets.ts +3 -3
- package/src/mixins/OxyServices.auth.ts +134 -1
- package/src/mixins/OxyServices.language.ts +3 -5
- package/src/mixins/OxyServices.privacy.ts +2 -4
- package/src/mixins/OxyServices.security.ts +7 -11
- package/src/mixins/OxyServices.topics.ts +47 -17
- package/src/mixins/OxyServices.user.ts +1 -1
- package/src/mixins/OxyServices.utility.ts +1 -1
- package/src/mixins/__tests__/discoveryErrorHandling.test.ts +1 -1
- package/src/mixins/__tests__/topics.test.ts +156 -0
- package/src/mixins/__tests__/webauthnAuth.test.ts +206 -0
- package/src/models/Topic.ts +11 -0
- package/src/session/SessionClient.ts +1 -1
- package/src/session/__tests__/SessionClient.diagnostics.test.ts +1 -1
- package/src/session/__tests__/accountDialogController.test.ts +1 -1
- package/src/session/accountDialogController.ts +1 -1
- package/src/session/authStateStore.ts +1 -1
- package/src/session/refresh.ts +1 -1
- package/src/session/socketLoader.ts +1 -1
- package/src/utils/__tests__/webauthnOrigin.test.ts +83 -0
- package/src/utils/asyncUtils.ts +1 -1
- package/src/utils/avatarUtils.ts +3 -1
- package/src/utils/deviceManager.ts +8 -5
- package/src/utils/errorUtils.ts +1 -1
- package/src/utils/oauthPkce.ts +1 -1
- package/src/utils/requestUtils.ts +1 -1
- package/src/utils/webauthnOrigin.ts +52 -0
- package/dist/cjs/shared/utils/debugUtils.js +0 -80
- package/dist/cjs/utils/loggerUtils.js +0 -126
- package/dist/esm/shared/utils/debugUtils.js +0 -72
- package/dist/esm/utils/loggerUtils.js +0 -115
- package/dist/types/shared/utils/debugUtils.d.ts +0 -48
- package/dist/types/utils/loggerUtils.d.ts +0 -48
- package/src/shared/utils/__tests__/debugUtils.test.ts +0 -55
- package/src/shared/utils/debugUtils.ts +0 -78
- package/src/utils/loggerUtils.ts +0 -153
|
@@ -154,7 +154,7 @@ exports.RequestQueue = RequestQueue;
|
|
|
154
154
|
* Simple logger with level support
|
|
155
155
|
*
|
|
156
156
|
* Lightweight logger for HTTP clients and utilities.
|
|
157
|
-
* For
|
|
157
|
+
* For structured, namespaced, level-gated logging, use `@oxyhq/core/logger`.
|
|
158
158
|
*
|
|
159
159
|
* @example
|
|
160
160
|
* ```typescript
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* WebAuthn relying-party origin guard (client side).
|
|
4
|
+
*
|
|
5
|
+
* The passkey ceremonies (`OxyServices.webauthn*`) are only meaningful when the
|
|
6
|
+
* page is served from a first-party Oxy web origin: a credential minted with
|
|
7
|
+
* `WEBAUTHN_RP_ID=oxy.so` can only be created/asserted from `oxy.so`, one of its
|
|
8
|
+
* subdomains, or a loopback dev server. This is the browser-side mirror of the
|
|
9
|
+
* server's `isOxyApexOrigin` (`packages/api/src/utils/origin.ts`), which forms
|
|
10
|
+
* the server's `expectedOrigin` allow-set — consumers use it to decide whether to
|
|
11
|
+
* even offer the passkey UI on the current page.
|
|
12
|
+
*
|
|
13
|
+
* It reads `globalThis.location` directly (no argument) because that is the only
|
|
14
|
+
* origin the browser will let a WebAuthn ceremony run against. On native / SSR /
|
|
15
|
+
* any environment without a DOM `location`, it returns `false` (there is no
|
|
16
|
+
* relying-party origin, so passkeys are not applicable).
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.isOxyRpOrigin = isOxyRpOrigin;
|
|
20
|
+
/**
|
|
21
|
+
* True iff the current page's host is a first-party Oxy relying-party origin:
|
|
22
|
+
* `oxy.so`, any `*.oxy.so` subdomain, or a loopback dev host
|
|
23
|
+
* (`localhost` / `127.0.0.1` / `[::1]`).
|
|
24
|
+
*
|
|
25
|
+
* Fails closed: no `location` (native/SSR), a non-string/empty hostname, or a
|
|
26
|
+
* host that merely ends in the literal `oxy.so` without the dot boundary
|
|
27
|
+
* (`evil-oxy.so`, `oxy.so.evil.com`) all return `false`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* isOxyRpOrigin() // true on https://accounts.oxy.so
|
|
31
|
+
* isOxyRpOrigin() // true on http://localhost:8081
|
|
32
|
+
* isOxyRpOrigin() // false on https://evil.com
|
|
33
|
+
* isOxyRpOrigin() // false in a React Native / SSR context (no location)
|
|
34
|
+
*/
|
|
35
|
+
function isOxyRpOrigin() {
|
|
36
|
+
// `globalThis.location` is typed `Location` by the DOM lib, but is genuinely
|
|
37
|
+
// `undefined` on native/SSR — widen to a nullable local so the guard is a real
|
|
38
|
+
// runtime check, not a type-level no-op.
|
|
39
|
+
const location = globalThis.location;
|
|
40
|
+
if (!location || typeof location.hostname !== 'string') {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
const hostname = location.hostname.toLowerCase();
|
|
44
|
+
if (hostname.length === 0) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
if (hostname === 'oxy.so' || hostname.endsWith('.oxy.so')) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '[::1]';
|
|
51
|
+
}
|