@oxy.so/core 4.5.0-oxy-one.1 → 4.5.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/README.md +1 -1
- package/dist/cjs/HttpService.js +63 -19
- package/dist/cjs/api/accounts.js +10 -3
- package/dist/cjs/api/agency.js +3 -1
- package/dist/cjs/api/apps.js +15 -4
- package/dist/cjs/api/assets.js +39 -11
- package/dist/cjs/api/auth.js +28 -8
- package/dist/cjs/api/billing.js +24 -7
- package/dist/cjs/api/civic.js +14 -4
- package/dist/cjs/api/follows.js +9 -2
- package/dist/cjs/api/identity.js +31 -9
- package/dist/cjs/api/nodes.js +3 -1
- package/dist/cjs/api/privacy.js +8 -2
- package/dist/cjs/api/session.js +15 -4
- package/dist/cjs/api/store.js +15 -5
- package/dist/cjs/api/topics.js +10 -3
- package/dist/cjs/api/users.js +16 -4
- package/dist/cjs/boot/sessionColdBoot.js +40 -13
- package/dist/cjs/constants/version.js +6 -6
- package/dist/cjs/crypto/identityMarker.js +3 -1
- package/dist/cjs/crypto/identityProof.js +6 -1
- package/dist/cjs/crypto/keyManager.js +87 -32
- package/dist/cjs/crypto/recoveryPhrase.js +2 -2
- package/dist/cjs/crypto/signatureService.js +3 -4
- package/dist/cjs/i18n/index.js +16 -3
- package/dist/cjs/i18n/locales/ar-SA.js +366 -366
- package/dist/cjs/i18n/locales/ca-ES.js +366 -366
- package/dist/cjs/i18n/locales/de-DE.js +366 -366
- package/dist/cjs/i18n/locales/en-US.js +1994 -1994
- package/dist/cjs/i18n/locales/es-ES.js +1994 -1994
- package/dist/cjs/i18n/locales/fr-FR.js +366 -366
- package/dist/cjs/i18n/locales/it-IT.js +366 -366
- package/dist/cjs/i18n/locales/ja-JP.js +366 -366
- package/dist/cjs/i18n/locales/ko-KR.js +366 -366
- package/dist/cjs/i18n/locales/pt-PT.js +366 -366
- package/dist/cjs/i18n/locales/zh-CN.js +366 -366
- package/dist/cjs/inference/OxyInferenceClient.js +12 -18
- package/dist/cjs/models/interfaces.js +11 -11
- package/dist/cjs/server/OxyServer.js +86 -28
- package/dist/cjs/server/agentAccount.js +6 -2
- package/dist/cjs/server/aliaMachineCredential.js +39 -14
- package/dist/cjs/server/auth.js +5 -4
- package/dist/cjs/server/capabilityTicket.js +5 -5
- package/dist/cjs/server/index.js +2 -1
- package/dist/cjs/server/liveCapabilityTicket.js +4 -1
- package/dist/cjs/server/middleware.js +61 -42
- package/dist/cjs/server/namespaces.js +28 -7
- package/dist/cjs/server/requesterAssertion.js +36 -30
- package/dist/cjs/server/serviceTokenLifetime.js +7 -4
- package/dist/cjs/server/traffic.js +53 -14
- package/dist/cjs/server/trafficNodeHttp.js +33 -8
- package/dist/cjs/server/workloadIdentity.client.js +4 -0
- package/dist/cjs/server/workloadIdentity.js +28 -1
- package/dist/cjs/session/SessionClient.js +54 -17
- package/dist/cjs/session/accountDelegationAccess.js +4 -6
- package/dist/cjs/session/accountDialogController.js +1 -1
- package/dist/cjs/session/authStateStore.js +18 -9
- package/dist/cjs/session/identityPin.js +6 -2
- package/dist/cjs/session/refresh.js +81 -23
- package/dist/cjs/session/sharedDeviceCredential.js +28 -15
- package/dist/cjs/shared/utils/errorUtils.js +1 -1
- package/dist/cjs/shared/utils/networkUtils.js +1 -1
- package/dist/cjs/shared/utils/themeUtils.js +1 -1
- package/dist/cjs/utils/accountCacheSweep.js +3 -1
- package/dist/cjs/utils/accountUtils.js +1 -3
- package/dist/cjs/utils/asyncUtils.js +1 -1
- package/dist/cjs/utils/authHelpers.js +2 -1
- package/dist/cjs/utils/avatarUtils.js +4 -2
- package/dist/cjs/utils/cache.js +1 -1
- package/dist/cjs/utils/cacheKey.js +3 -1
- package/dist/cjs/utils/deviceManager.js +4 -4
- package/dist/cjs/utils/errorUtils.js +6 -4
- package/dist/cjs/utils/languageUtils.js +404 -57
- package/dist/cjs/utils/profileLinks.js +1 -3
- package/dist/cjs/utils/requestUtils.js +7 -1
- package/dist/cjs/utils/userIdentity.js +1 -1
- package/dist/cjs/utils/validationUtils.js +5 -6
- package/dist/esm/HttpService.js +64 -20
- package/dist/esm/api/accounts.js +11 -4
- package/dist/esm/api/agency.js +3 -1
- package/dist/esm/api/apps.js +15 -4
- package/dist/esm/api/assets.js +39 -11
- package/dist/esm/api/auth.js +28 -8
- package/dist/esm/api/billing.js +25 -8
- package/dist/esm/api/civic.js +14 -4
- package/dist/esm/api/follows.js +9 -2
- package/dist/esm/api/identity.js +31 -9
- package/dist/esm/api/nodes.js +3 -1
- package/dist/esm/api/privacy.js +8 -2
- package/dist/esm/api/session.js +15 -4
- package/dist/esm/api/store.js +15 -5
- package/dist/esm/api/topics.js +10 -3
- package/dist/esm/api/users.js +16 -4
- package/dist/esm/boot/sessionColdBoot.js +41 -14
- package/dist/esm/constants/version.js +6 -6
- package/dist/esm/crypto/identityMarker.js +3 -1
- package/dist/esm/crypto/identityProof.js +6 -1
- package/dist/esm/crypto/internal.js +1 -1
- package/dist/esm/crypto/keyManager.js +87 -32
- package/dist/esm/crypto/recoveryPhrase.js +2 -2
- package/dist/esm/crypto/signatureService.js +3 -4
- package/dist/esm/i18n/index.js +16 -3
- package/dist/esm/i18n/locales/ar-SA.js +366 -366
- package/dist/esm/i18n/locales/ca-ES.js +366 -366
- package/dist/esm/i18n/locales/de-DE.js +366 -366
- package/dist/esm/i18n/locales/en-US.js +1994 -1994
- package/dist/esm/i18n/locales/es-ES.js +1994 -1994
- package/dist/esm/i18n/locales/fr-FR.js +366 -366
- package/dist/esm/i18n/locales/it-IT.js +366 -366
- package/dist/esm/i18n/locales/ja-JP.js +366 -366
- package/dist/esm/i18n/locales/ko-KR.js +366 -366
- package/dist/esm/i18n/locales/pt-PT.js +366 -366
- package/dist/esm/i18n/locales/zh-CN.js +366 -366
- package/dist/esm/index.js +1 -1
- package/dist/esm/inference/OxyInferenceClient.js +13 -19
- package/dist/esm/models/interfaces.js +11 -11
- package/dist/esm/server/OxyServer.js +87 -29
- package/dist/esm/server/agentAccount.js +6 -2
- package/dist/esm/server/aliaMachineCredential.js +39 -14
- package/dist/esm/server/auth.js +6 -5
- package/dist/esm/server/capabilityTicket.js +6 -6
- package/dist/esm/server/index.js +5 -5
- package/dist/esm/server/liveCapabilityTicket.js +6 -3
- package/dist/esm/server/middleware.js +62 -43
- package/dist/esm/server/namespaces.js +31 -10
- package/dist/esm/server/requesterAssertion.js +36 -30
- package/dist/esm/server/serviceTokenLifetime.js +7 -4
- package/dist/esm/server/traffic.js +55 -16
- package/dist/esm/server/trafficNodeHttp.js +34 -9
- package/dist/esm/server/userInvalidation.js +1 -1
- package/dist/esm/server/workloadIdentity.client.js +3 -0
- package/dist/esm/server/workloadIdentity.js +27 -1
- package/dist/esm/session/SessionClient.js +54 -17
- package/dist/esm/session/accountDelegationAccess.js +5 -7
- package/dist/esm/session/accountDialogController.js +1 -1
- package/dist/esm/session/authStateStore.js +18 -9
- package/dist/esm/session/identityPin.js +6 -2
- package/dist/esm/session/refresh.js +82 -24
- package/dist/esm/session/sharedDeviceCredential.js +28 -15
- package/dist/esm/shared/utils/errorUtils.js +1 -1
- package/dist/esm/shared/utils/networkUtils.js +1 -1
- package/dist/esm/shared/utils/themeUtils.js +1 -1
- package/dist/esm/utils/accountCacheSweep.js +3 -1
- package/dist/esm/utils/accountUtils.js +1 -3
- package/dist/esm/utils/asyncUtils.js +1 -1
- package/dist/esm/utils/authHelpers.js +2 -1
- package/dist/esm/utils/avatarUtils.js +4 -2
- package/dist/esm/utils/cache.js +1 -1
- package/dist/esm/utils/cacheKey.js +3 -1
- package/dist/esm/utils/deviceManager.js +4 -4
- package/dist/esm/utils/errorUtils.js +6 -4
- package/dist/esm/utils/languageUtils.js +404 -57
- package/dist/esm/utils/profileLinks.js +1 -3
- package/dist/esm/utils/requestUtils.js +7 -1
- package/dist/esm/utils/userIdentity.js +1 -1
- package/dist/esm/utils/validationUtils.js +5 -6
- package/dist/types/HttpService.d.ts +1 -1
- package/dist/types/api/accounts.d.ts +1 -1
- package/dist/types/api/apps.d.ts +4 -4
- package/dist/types/crypto/internal.d.ts +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/server/index.d.ts +6 -6
- package/dist/types/server/workloadIdentity.client.d.ts +5 -1
- package/dist/types/server/workloadIdentity.d.ts +26 -0
- package/dist/types/session/accountDelegationAccess.d.ts +1 -1
- package/dist/types/session/index.d.ts +1 -1
- package/dist/types/utils/userIdentity.d.ts +1 -1
- package/dist/types/utils/validationUtils.d.ts +4 -5
- package/package.json +2 -3
- package/src/HttpService.ts +183 -53
- package/src/OxyServices.errors.ts +7 -3
- package/src/OxyServices.ts +6 -2
- package/src/api/accounts.ts +76 -26
- package/src/api/agency.ts +24 -9
- package/src/api/appData.ts +12 -2
- package/src/api/apps.ts +81 -31
- package/src/api/assets.ts +113 -43
- package/src/api/auth.ts +145 -77
- package/src/api/billing.ts +112 -65
- package/src/api/civic.ts +61 -19
- package/src/api/contacts.ts +4 -1
- package/src/api/devices.ts +54 -21
- package/src/api/follows.ts +88 -31
- package/src/api/identity.ts +101 -33
- package/src/api/linkedAccounts.ts +26 -8
- package/src/api/nodes.ts +18 -6
- package/src/api/notifications.ts +26 -6
- package/src/api/privacy.ts +42 -8
- package/src/api/reputation.ts +18 -7
- package/src/api/session.ts +23 -5
- package/src/api/store.ts +81 -31
- package/src/api/topics.ts +18 -6
- package/src/api/users.ts +98 -35
- package/src/boot/sessionColdBoot.ts +60 -19
- package/src/civic/payloads.ts +1 -4
- package/src/client/context.ts +6 -1
- package/src/constants/version.ts +7 -6
- package/src/crypto/aead.ts +1 -5
- package/src/crypto/ecdh.ts +1 -4
- package/src/crypto/identityDerivations.ts +5 -1
- package/src/crypto/identityMarker.ts +3 -1
- package/src/crypto/identityProof.ts +6 -1
- package/src/crypto/index.ts +11 -11
- package/src/crypto/internal.ts +6 -1
- package/src/crypto/keyManager.ts +348 -98
- package/src/crypto/recoveryPhrase.ts +14 -9
- package/src/crypto/registrationPow.ts +1 -1
- package/src/crypto/signatureService.ts +14 -6
- package/src/i18n/accountCategoryLabels.ts +1 -4
- package/src/i18n/accountRoleLabels.ts +1 -4
- package/src/i18n/index.ts +25 -7
- package/src/i18n/locales/ar-SA.ts +375 -366
- package/src/i18n/locales/ca-ES.ts +382 -366
- package/src/i18n/locales/de-DE.ts +387 -366
- package/src/i18n/locales/en-US.ts +2034 -1994
- package/src/i18n/locales/es-ES.ts +2043 -1994
- package/src/i18n/locales/fr-FR.ts +387 -366
- package/src/i18n/locales/it-IT.ts +380 -366
- package/src/i18n/locales/ja-JP.ts +380 -366
- package/src/i18n/locales/ko-KR.ts +377 -366
- package/src/i18n/locales/pt-PT.ts +383 -366
- package/src/i18n/locales/zh-CN.ts +373 -366
- package/src/i18n/trustTierLabels.ts +1 -4
- package/src/index.ts +371 -349
- package/src/inference/OxyInferenceClient.ts +784 -780
- package/src/models/interfaces.ts +30 -27
- package/src/server/OxyServer.ts +227 -68
- package/src/server/agentAccount.ts +8 -2
- package/src/server/aliaMachineCredential.ts +57 -16
- package/src/server/auth.ts +9 -5
- package/src/server/capabilityTicket.ts +30 -21
- package/src/server/index.ts +29 -6
- package/src/server/liveCapabilityTicket.ts +31 -9
- package/src/server/middleware.ts +212 -121
- package/src/server/namespaces.ts +247 -94
- package/src/server/rateLimit.ts +2 -4
- package/src/server/requesterAssertion.ts +93 -54
- package/src/server/serviceTokenLifetime.ts +9 -4
- package/src/server/traffic.ts +117 -23
- package/src/server/trafficNodeHttp.ts +61 -14
- package/src/server/userInvalidation.ts +1 -4
- package/src/server/workloadIdentity.client.ts +12 -1
- package/src/server/workloadIdentity.ts +52 -5
- package/src/session/SessionClient.ts +170 -49
- package/src/session/accountDelegationAccess.ts +24 -31
- package/src/session/accountDialogController.ts +59 -14
- package/src/session/accountSwitchTargets.ts +10 -15
- package/src/session/authStateStore.ts +121 -81
- package/src/session/deviceDirectory.ts +1 -3
- package/src/session/identityPin.ts +10 -11
- package/src/session/identitySession.ts +3 -1
- package/src/session/index.ts +87 -82
- package/src/session/refresh.ts +138 -44
- package/src/session/sessionClientHost.ts +1 -3
- package/src/session/sharedDeviceCredential.ts +35 -14
- package/src/session/socketLoader.ts +9 -2
- package/src/shared/utils/errorUtils.ts +5 -2
- package/src/shared/utils/networkUtils.ts +5 -8
- package/src/shared/utils/themeUtils.ts +2 -6
- package/src/types/buffer.d.ts +66 -21
- package/src/types/expo-secure-store.d.ts +5 -1
- package/src/utils/accountCacheSweep.ts +4 -5
- package/src/utils/accountUtils.ts +107 -108
- package/src/utils/apiUtils.ts +3 -3
- package/src/utils/asyncUtils.ts +2 -2
- package/src/utils/authHelpers.ts +10 -5
- package/src/utils/avatarUtils.ts +11 -6
- package/src/utils/cache.ts +9 -10
- package/src/utils/cacheKey.ts +5 -1
- package/src/utils/coldBoot.ts +1 -3
- package/src/utils/commonsDelivery.ts +1 -4
- package/src/utils/deviceManager.ts +15 -14
- package/src/utils/errorUtils.ts +68 -86
- package/src/utils/languageUtils.ts +407 -58
- package/src/utils/oauthPkce.ts +1 -4
- package/src/utils/platform.ts +0 -1
- package/src/utils/profileLinks.ts +2 -5
- package/src/utils/requestUtils.ts +18 -14
- package/src/utils/sessionUtils.ts +34 -33
- package/src/utils/userHandle.ts +3 -1
- package/src/utils/userIdentity.ts +1 -1
- package/src/utils/validationUtils.ts +11 -9
package/dist/cjs/api/identity.js
CHANGED
|
@@ -131,14 +131,19 @@ class IdentityApi {
|
|
|
131
131
|
* verification-method fragment.
|
|
132
132
|
*/
|
|
133
133
|
async authMethods() {
|
|
134
|
-
return this.ctx.request('GET', '/auth/methods', undefined, {
|
|
134
|
+
return this.ctx.request('GET', '/auth/methods', undefined, {
|
|
135
|
+
cache: true,
|
|
136
|
+
cacheTTL: SHORT_TTL,
|
|
137
|
+
});
|
|
135
138
|
}
|
|
136
139
|
/**
|
|
137
140
|
* How the signed-in account is kept (ADR 0029 D3): whether Commons' root is
|
|
138
141
|
* linked (self-custody), or the email of an account without a key.
|
|
139
142
|
*/
|
|
140
143
|
async rootStatus() {
|
|
141
|
-
return this.ctx.request('GET', '/identity/root-status', undefined, {
|
|
144
|
+
return this.ctx.request('GET', '/identity/root-status', undefined, {
|
|
145
|
+
cache: false,
|
|
146
|
+
});
|
|
142
147
|
}
|
|
143
148
|
/**
|
|
144
149
|
* Rotate the account's identity key: derive a brand-new keypair, prove
|
|
@@ -313,7 +318,9 @@ class IdentityApi {
|
|
|
313
318
|
*/
|
|
314
319
|
async rotationAlreadyApplied(userId, newPublicKey) {
|
|
315
320
|
return this.ctx
|
|
316
|
-
.request('GET', `/u/${encodeURIComponent(userId)}/did.json`, undefined, {
|
|
321
|
+
.request('GET', `/u/${encodeURIComponent(userId)}/did.json`, undefined, {
|
|
322
|
+
cache: false,
|
|
323
|
+
})
|
|
317
324
|
.then((doc) => doc.verificationMethod.some((vm) => 'publicKeyHex' in vm &&
|
|
318
325
|
typeof vm.publicKeyHex === 'string' &&
|
|
319
326
|
vm.publicKeyHex.toLowerCase() === newPublicKey.toLowerCase()))
|
|
@@ -343,7 +350,9 @@ class IdentityLinksApi {
|
|
|
343
350
|
* The "Link Commons" panel shows its `qrPayload`; Commons scans it and signs with `sign`.
|
|
344
351
|
*/
|
|
345
352
|
async create() {
|
|
346
|
-
const res = await this.ctx.request('POST', '/identity/link', undefined, {
|
|
353
|
+
const res = await this.ctx.request('POST', '/identity/link', undefined, {
|
|
354
|
+
cache: false,
|
|
355
|
+
});
|
|
347
356
|
const parsed = (0, contracts_1.safeParseContract)(contracts_1.identityLinkCreateResponseSchema, res);
|
|
348
357
|
if (!parsed)
|
|
349
358
|
throw new Error('identity/link returned an unexpected response shape');
|
|
@@ -367,7 +376,10 @@ class IdentityLinksApi {
|
|
|
367
376
|
*/
|
|
368
377
|
async sign(linkId, challenge) {
|
|
369
378
|
const { KeyManager, signIdentityProof, deriveIdentityLinkCode } = await Promise.resolve().then(() => __importStar(require('../crypto/internal')));
|
|
370
|
-
const [privateKey, publicKey] = await Promise.all([
|
|
379
|
+
const [privateKey, publicKey] = await Promise.all([
|
|
380
|
+
KeyManager.getPrivateKey(),
|
|
381
|
+
KeyManager.getPublicKey(),
|
|
382
|
+
]);
|
|
371
383
|
if (!privateKey || !publicKey) {
|
|
372
384
|
throw new Error('No identity on this device to link');
|
|
373
385
|
}
|
|
@@ -385,7 +397,11 @@ class IdentityLinksApi {
|
|
|
385
397
|
expiresAt: state.expiresAt,
|
|
386
398
|
});
|
|
387
399
|
await this.ctx.request('POST', `/identity/link/${encodeURIComponent(linkId)}/proof`, { publicKey: root, proof }, { cache: false, skipAuth: true });
|
|
388
|
-
return {
|
|
400
|
+
return {
|
|
401
|
+
publicKey: root,
|
|
402
|
+
code: deriveIdentityLinkCode(linkId, root),
|
|
403
|
+
username: state.username,
|
|
404
|
+
};
|
|
389
405
|
}
|
|
390
406
|
/**
|
|
391
407
|
* Complete a link with a code just sent to the account's email
|
|
@@ -527,18 +543,24 @@ class IdentityBackupApi {
|
|
|
527
543
|
createdAt,
|
|
528
544
|
lookupId,
|
|
529
545
|
};
|
|
530
|
-
return this.ctx.request('POST', '/identity/backup', body, {
|
|
546
|
+
return this.ctx.request('POST', '/identity/backup', body, {
|
|
547
|
+
cache: false,
|
|
548
|
+
});
|
|
531
549
|
}
|
|
532
550
|
/**
|
|
533
551
|
* Whether the signed-in user has a stored backup, plus its non-sensitive hint
|
|
534
552
|
* and timestamp. Returns no ciphertext and no locator.
|
|
535
553
|
*/
|
|
536
554
|
async status() {
|
|
537
|
-
return this.ctx.request('GET', '/identity/backup/status', undefined, {
|
|
555
|
+
return this.ctx.request('GET', '/identity/backup/status', undefined, {
|
|
556
|
+
cache: false,
|
|
557
|
+
});
|
|
538
558
|
}
|
|
539
559
|
/** Delete the signed-in user's stored backup. Idempotent. */
|
|
540
560
|
async delete() {
|
|
541
|
-
return this.ctx.request('DELETE', '/identity/backup', undefined, {
|
|
561
|
+
return this.ctx.request('DELETE', '/identity/backup', undefined, {
|
|
562
|
+
cache: false,
|
|
563
|
+
});
|
|
542
564
|
}
|
|
543
565
|
/**
|
|
544
566
|
* Restore an identity from its encrypted backup using ONLY the recovery
|
package/dist/cjs/api/nodes.js
CHANGED
|
@@ -48,7 +48,9 @@ class NodesApi {
|
|
|
48
48
|
}
|
|
49
49
|
/** Revoke the signed-in user's node registration. */
|
|
50
50
|
async removeMine() {
|
|
51
|
-
const res = await this.ctx.request('DELETE', '/nodes/me', undefined, {
|
|
51
|
+
const res = await this.ctx.request('DELETE', '/nodes/me', undefined, {
|
|
52
|
+
cache: false,
|
|
53
|
+
});
|
|
52
54
|
this.sweep();
|
|
53
55
|
return { revoked: res.success === true };
|
|
54
56
|
}
|
package/dist/cjs/api/privacy.js
CHANGED
|
@@ -30,7 +30,10 @@ class PrivacyApi {
|
|
|
30
30
|
// ── Blocked ──────────────────────────────────────────────────────────────
|
|
31
31
|
/** The signed-in user's blocked users. */
|
|
32
32
|
async blocked() {
|
|
33
|
-
return this.ctx.request('GET', '/privacy/blocked', undefined, {
|
|
33
|
+
return this.ctx.request('GET', '/privacy/blocked', undefined, {
|
|
34
|
+
cache: true,
|
|
35
|
+
cacheTTL: LIST_TTL,
|
|
36
|
+
});
|
|
34
37
|
}
|
|
35
38
|
/** Block a user. */
|
|
36
39
|
async block(userId) {
|
|
@@ -60,7 +63,10 @@ class PrivacyApi {
|
|
|
60
63
|
// ── Restricted ───────────────────────────────────────────────────────────
|
|
61
64
|
/** The signed-in user's restricted users. */
|
|
62
65
|
async restricted() {
|
|
63
|
-
return this.ctx.request('GET', '/privacy/restricted', undefined, {
|
|
66
|
+
return this.ctx.request('GET', '/privacy/restricted', undefined, {
|
|
67
|
+
cache: true,
|
|
68
|
+
cacheTTL: LIST_TTL,
|
|
69
|
+
});
|
|
64
70
|
}
|
|
65
71
|
/** Restrict a user: limit their interactions without blocking them. */
|
|
66
72
|
async restrict(userId) {
|
package/dist/cjs/api/session.js
CHANGED
|
@@ -107,7 +107,11 @@ class SessionApi {
|
|
|
107
107
|
return null;
|
|
108
108
|
try {
|
|
109
109
|
const proof = await provider();
|
|
110
|
-
if (proof &&
|
|
110
|
+
if (proof &&
|
|
111
|
+
typeof proof.deviceId === 'string' &&
|
|
112
|
+
proof.deviceId &&
|
|
113
|
+
typeof proof.deviceSecret === 'string' &&
|
|
114
|
+
proof.deviceSecret) {
|
|
111
115
|
return { deviceId: proof.deviceId, deviceSecret: proof.deviceSecret };
|
|
112
116
|
}
|
|
113
117
|
return null;
|
|
@@ -122,7 +126,10 @@ class SessionApi {
|
|
|
122
126
|
if (!this.isAuthenticated)
|
|
123
127
|
return false;
|
|
124
128
|
try {
|
|
125
|
-
const res = await this.ctx.request('GET', '/auth/validate', undefined, {
|
|
129
|
+
const res = await this.ctx.request('GET', '/auth/validate', undefined, {
|
|
130
|
+
cache: false,
|
|
131
|
+
retry: false,
|
|
132
|
+
});
|
|
126
133
|
return res.valid === true;
|
|
127
134
|
}
|
|
128
135
|
catch {
|
|
@@ -148,11 +155,15 @@ class SessionApi {
|
|
|
148
155
|
}
|
|
149
156
|
/** The sessions that belong with `sessionId` (same account set). */
|
|
150
157
|
async list(sessionId) {
|
|
151
|
-
return this.ctx.request('GET', `/session/sessions/${sessionId}`, undefined, {
|
|
158
|
+
return this.ctx.request('GET', `/session/sessions/${sessionId}`, undefined, {
|
|
159
|
+
cache: false,
|
|
160
|
+
});
|
|
152
161
|
}
|
|
153
162
|
/** Sign out `sessionId`, or — with `targetSessionId` — one of the sessions beside it. */
|
|
154
163
|
async logout(sessionId, targetSessionId) {
|
|
155
|
-
const url = targetSessionId
|
|
164
|
+
const url = targetSessionId
|
|
165
|
+
? `/session/logout/${sessionId}/${targetSessionId}`
|
|
166
|
+
: `/session/logout/${sessionId}`;
|
|
156
167
|
await this.ctx.request('POST', url, undefined, { cache: false });
|
|
157
168
|
}
|
|
158
169
|
/** Sign out every session beside `sessionId`, and it. */
|
package/dist/cjs/api/store.js
CHANGED
|
@@ -53,7 +53,9 @@ class StoreReviewsApi {
|
|
|
53
53
|
* hidden when its author edits it.
|
|
54
54
|
*/
|
|
55
55
|
async write(slug, input) {
|
|
56
|
-
const res = await this.ctx.request('PUT', reviewPath(slug), input, {
|
|
56
|
+
const res = await this.ctx.request('PUT', reviewPath(slug), input, {
|
|
57
|
+
cache: false,
|
|
58
|
+
});
|
|
57
59
|
return res.data;
|
|
58
60
|
}
|
|
59
61
|
/** Withdraw the caller's own review. A real delete — the words were theirs. */
|
|
@@ -69,7 +71,9 @@ class ListingScreenshotsApi {
|
|
|
69
71
|
}
|
|
70
72
|
/** Every picture on the listing, in the author's order. */
|
|
71
73
|
async list(applicationId) {
|
|
72
|
-
return this.ctx.request('GET', screenshotsPath(applicationId), undefined, {
|
|
74
|
+
return this.ctx.request('GET', screenshotsPath(applicationId), undefined, {
|
|
75
|
+
cache: false,
|
|
76
|
+
});
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
75
79
|
* Attach an already-uploaded image, appended to the end.
|
|
@@ -79,7 +83,9 @@ class ListingScreenshotsApi {
|
|
|
79
83
|
* one the caller is entitled to.
|
|
80
84
|
*/
|
|
81
85
|
async add(applicationId, input) {
|
|
82
|
-
return this.ctx.request('POST', screenshotsPath(applicationId), input, {
|
|
86
|
+
return this.ctx.request('POST', screenshotsPath(applicationId), input, {
|
|
87
|
+
cache: false,
|
|
88
|
+
});
|
|
83
89
|
}
|
|
84
90
|
/** Edit a picture's caption or the frame it was taken in. Order is `reorder`. */
|
|
85
91
|
async update(applicationId, screenshotId, input) {
|
|
@@ -113,7 +119,9 @@ class StoreListingApi {
|
|
|
113
119
|
}
|
|
114
120
|
/** The application's store page in whatever state, or `null` if it has none. */
|
|
115
121
|
async get(applicationId) {
|
|
116
|
-
return this.ctx.request('GET', listingPath(applicationId), undefined, {
|
|
122
|
+
return this.ctx.request('GET', listingPath(applicationId), undefined, {
|
|
123
|
+
cache: false,
|
|
124
|
+
});
|
|
117
125
|
}
|
|
118
126
|
/**
|
|
119
127
|
* Create the page or replace its content. Never its status.
|
|
@@ -122,7 +130,9 @@ class StoreListingApi {
|
|
|
122
130
|
* it live, and fixing a rejected one does not re-submit it.
|
|
123
131
|
*/
|
|
124
132
|
async write(applicationId, input) {
|
|
125
|
-
return this.ctx.request('PUT', listingPath(applicationId), input, {
|
|
133
|
+
return this.ctx.request('PUT', listingPath(applicationId), input, {
|
|
134
|
+
cache: false,
|
|
135
|
+
});
|
|
126
136
|
}
|
|
127
137
|
/** Hand the page to the store for review. From a draft, or a rejected page once fixed. */
|
|
128
138
|
async submit(applicationId) {
|
package/dist/cjs/api/topics.js
CHANGED
|
@@ -37,12 +37,17 @@ class TopicsApi {
|
|
|
37
37
|
const params = { q: query };
|
|
38
38
|
if (limit)
|
|
39
39
|
params.limit = limit;
|
|
40
|
-
const res = await this.ctx.request('GET', '/topics/search', params, {
|
|
40
|
+
const res = await this.ctx.request('GET', '/topics/search', params, {
|
|
41
|
+
cache: false,
|
|
42
|
+
});
|
|
41
43
|
return res.topics ?? [];
|
|
42
44
|
}
|
|
43
45
|
/** One topic by slug. */
|
|
44
46
|
async get(slug) {
|
|
45
|
-
return this.ctx.request('GET', `/topics/${slug}`, undefined, {
|
|
47
|
+
return this.ctx.request('GET', `/topics/${slug}`, undefined, {
|
|
48
|
+
cache: true,
|
|
49
|
+
cacheTTL: LONG,
|
|
50
|
+
});
|
|
46
51
|
}
|
|
47
52
|
/** The top-level categories, optionally translated. */
|
|
48
53
|
async categories(locale) {
|
|
@@ -58,7 +63,9 @@ class TopicsApi {
|
|
|
58
63
|
}
|
|
59
64
|
/** Update a topic's description and translations. Staff or service only. */
|
|
60
65
|
async update(slug, data) {
|
|
61
|
-
const topic = await this.ctx.request('PATCH', `/topics/${slug}`, data, {
|
|
66
|
+
const topic = await this.ctx.request('PATCH', `/topics/${slug}`, data, {
|
|
67
|
+
cache: false,
|
|
68
|
+
});
|
|
62
69
|
this.ctx.oxy.cache.delete(`GET:/topics/${slug}`);
|
|
63
70
|
return topic;
|
|
64
71
|
}
|
package/dist/cjs/api/users.js
CHANGED
|
@@ -110,7 +110,10 @@ class UsersApi {
|
|
|
110
110
|
}
|
|
111
111
|
/** The signed-in user. Cached 1 minute. */
|
|
112
112
|
async me(options) {
|
|
113
|
-
const user = await this.ctx.request('GET', '/users/me', undefined, {
|
|
113
|
+
const user = await this.ctx.request('GET', '/users/me', undefined, {
|
|
114
|
+
cache: options?.cache ?? true,
|
|
115
|
+
cacheTTL: ME_TTL,
|
|
116
|
+
});
|
|
114
117
|
return (0, userIdentity_1.normalizeUserIdentity)(user);
|
|
115
118
|
}
|
|
116
119
|
/** A profile by username. Cached 5 minutes; `{ cache: false }` as in `get`. */
|
|
@@ -183,7 +186,9 @@ class UsersApi {
|
|
|
183
186
|
// A 404 (absent) and an upstream failure both return null; the log keeps
|
|
184
187
|
// them distinguishable without turning expected misses into noise.
|
|
185
188
|
const status = (0, errorUtils_1.extractErrorStatus)(error);
|
|
186
|
-
logger_1.logger.debug(status === 404
|
|
189
|
+
logger_1.logger.debug(status === 404
|
|
190
|
+
? 'users.resolveHandle: handle not found'
|
|
191
|
+
: 'users.resolveHandle: discovery failed', {
|
|
187
192
|
method: 'users.resolveHandle',
|
|
188
193
|
handle,
|
|
189
194
|
status,
|
|
@@ -203,7 +208,9 @@ class UsersApi {
|
|
|
203
208
|
}
|
|
204
209
|
/** Profiles similar to `userId`, by co-follower overlap. Cached 5 minutes. */
|
|
205
210
|
async similar(userId, limitOrPagination) {
|
|
206
|
-
const pagination = typeof limitOrPagination === 'number'
|
|
211
|
+
const pagination = typeof limitOrPagination === 'number'
|
|
212
|
+
? { limit: limitOrPagination }
|
|
213
|
+
: (limitOrPagination ?? {});
|
|
207
214
|
const users = await this.ctx.request('GET', `/profiles/${userId}/similar`, (0, apiUtils_1.buildQueryParams)(pagination), {
|
|
208
215
|
cache: true,
|
|
209
216
|
cacheTTL: PROFILE_TTL,
|
|
@@ -303,7 +310,12 @@ class UsersApi {
|
|
|
303
310
|
}
|
|
304
311
|
const timestamp = Date.now();
|
|
305
312
|
const signature = await SignatureService.sign(`delete:${publicKey}:${timestamp}`);
|
|
306
|
-
return this.ctx.request('DELETE', '/users/me', {
|
|
313
|
+
return this.ctx.request('DELETE', '/users/me', {
|
|
314
|
+
signature,
|
|
315
|
+
timestamp,
|
|
316
|
+
confirmText,
|
|
317
|
+
...(proof.totpCode ? { totpCode: proof.totpCode } : {}),
|
|
318
|
+
}, { cache: false });
|
|
307
319
|
}
|
|
308
320
|
}
|
|
309
321
|
exports.UsersApi = UsersApi;
|
|
@@ -59,7 +59,7 @@ async function runSessionColdBoot(opts) {
|
|
|
59
59
|
const isNative = opts.platform?.isNative ?? (0, platform_1.isNative)();
|
|
60
60
|
// Non-null ONLY in identity mode; every `!== null` test below therefore reads
|
|
61
61
|
// as "is this boot identity-bound?" while also narrowing the binding.
|
|
62
|
-
const identityBinding = opts.sessionMode === 'identity' ? opts.identity ?? null : null;
|
|
62
|
+
const identityBinding = opts.sessionMode === 'identity' ? (opts.identity ?? null) : null;
|
|
63
63
|
if (opts.sessionMode === 'identity' && identityBinding === null) {
|
|
64
64
|
logger_1.logger.error('runSessionColdBoot: sessionMode "identity" requires an `identity` binding — refusing to run any lane (an identity-bound client must never adopt the device active account)', undefined, { component: 'sessionColdBoot', method: 'runSessionColdBoot' });
|
|
65
65
|
await opts.onSignedOut?.('error');
|
|
@@ -105,10 +105,15 @@ async function runSessionColdBoot(opts) {
|
|
|
105
105
|
steps.push({
|
|
106
106
|
id: 'warm-token-plant',
|
|
107
107
|
run: async () => {
|
|
108
|
-
if (identityBinding === null &&
|
|
108
|
+
if (identityBinding === null &&
|
|
109
|
+
isNative &&
|
|
110
|
+
(await store.isAutomaticIdentitySignInSuppressed?.()))
|
|
109
111
|
return { kind: 'skip' };
|
|
110
112
|
const persisted = await store.load();
|
|
111
|
-
if (!persisted?.accessToken ||
|
|
113
|
+
if (!persisted?.accessToken ||
|
|
114
|
+
!persisted.sessionId ||
|
|
115
|
+
!persisted.userId ||
|
|
116
|
+
!persisted.expiresAt) {
|
|
112
117
|
return { kind: 'skip' };
|
|
113
118
|
}
|
|
114
119
|
// Guard a malformed `expiresAt` (Date.parse -> NaN): treat as not-valid and
|
|
@@ -179,7 +184,9 @@ async function runSessionColdBoot(opts) {
|
|
|
179
184
|
},
|
|
180
185
|
};
|
|
181
186
|
case 'invalid-secret': {
|
|
182
|
-
if (identityBinding === null &&
|
|
187
|
+
if (identityBinding === null &&
|
|
188
|
+
store.setAutomaticIdentitySignInSuppressed &&
|
|
189
|
+
(await store.isAutomaticIdentitySignInSuppressed?.())) {
|
|
183
190
|
rejectedLocalHolder = true;
|
|
184
191
|
signedOutReason = 'no_session';
|
|
185
192
|
return { kind: 'skip' };
|
|
@@ -214,7 +221,10 @@ async function runSessionColdBoot(opts) {
|
|
|
214
221
|
return { kind: 'skip' };
|
|
215
222
|
case 'transient':
|
|
216
223
|
// Network / 5xx: keep the secret; a later attempt can succeed.
|
|
217
|
-
logger_1.logger.debug('device-secret mint failed (transient) — keeping secret', {
|
|
224
|
+
logger_1.logger.debug('device-secret mint failed (transient) — keeping secret', {
|
|
225
|
+
component: 'sessionColdBoot',
|
|
226
|
+
method: 'device-secret-mint',
|
|
227
|
+
});
|
|
218
228
|
return { kind: 'skip' };
|
|
219
229
|
case 'session-ended':
|
|
220
230
|
// The prior holder/epoch was superseded. This boot must not turn a
|
|
@@ -287,11 +297,22 @@ async function runSessionColdBoot(opts) {
|
|
|
287
297
|
// like every other network step.
|
|
288
298
|
enabled: () => isNative && !isOffline() && !accountRecoverySuperseded,
|
|
289
299
|
run: async () => {
|
|
290
|
-
const result = await (0, refresh_1.refreshSharedDeviceArm)({
|
|
300
|
+
const result = await (0, refresh_1.refreshSharedDeviceArm)({
|
|
301
|
+
oxy,
|
|
302
|
+
store,
|
|
303
|
+
shared: sharedSlot,
|
|
304
|
+
rejectedLocalHolder,
|
|
305
|
+
});
|
|
291
306
|
if (result.status === 'ok') {
|
|
292
|
-
return {
|
|
293
|
-
|
|
294
|
-
|
|
307
|
+
return {
|
|
308
|
+
kind: 'session',
|
|
309
|
+
session: {
|
|
310
|
+
sessionId: result.sessionId,
|
|
311
|
+
userId: result.userId,
|
|
312
|
+
accessToken: result.token,
|
|
313
|
+
state: result.state,
|
|
314
|
+
},
|
|
315
|
+
};
|
|
295
316
|
}
|
|
296
317
|
if (result.status === 'no-session')
|
|
297
318
|
signedOutReason = 'no_session';
|
|
@@ -322,11 +343,16 @@ async function runSessionColdBoot(opts) {
|
|
|
322
343
|
id: 'commons-proof-signin',
|
|
323
344
|
enabled: () => isNative && !isOffline(),
|
|
324
345
|
run: async () => {
|
|
325
|
-
if (accountRecoverySuperseded || await store.isAutomaticIdentitySignInSuppressed?.())
|
|
346
|
+
if (accountRecoverySuperseded || (await store.isAutomaticIdentitySignInSuppressed?.()))
|
|
326
347
|
return { kind: 'skip' };
|
|
327
348
|
const epoch = oxy.http.getSessionEpoch();
|
|
328
|
-
const session = await oxy.auth.signInWithCommonsIdentity({
|
|
329
|
-
|
|
349
|
+
const session = await oxy.auth.signInWithCommonsIdentity({
|
|
350
|
+
plantTokens: false,
|
|
351
|
+
requestOptions: { retry: false },
|
|
352
|
+
});
|
|
353
|
+
if (!session?.accessToken ||
|
|
354
|
+
oxy.http.getSessionEpoch() !== epoch ||
|
|
355
|
+
(await store.isAutomaticIdentitySignInSuppressed?.())) {
|
|
330
356
|
return { kind: 'skip' };
|
|
331
357
|
}
|
|
332
358
|
// `verifyChallenge` issues a deviceSecret; persist it so the next
|
|
@@ -342,7 +368,8 @@ async function runSessionColdBoot(opts) {
|
|
|
342
368
|
expiresAt: session.expiresAt,
|
|
343
369
|
});
|
|
344
370
|
}
|
|
345
|
-
if (oxy.http.getSessionEpoch() !== epoch ||
|
|
371
|
+
if (oxy.http.getSessionEpoch() !== epoch ||
|
|
372
|
+
(await store.isAutomaticIdentitySignInSuppressed?.()))
|
|
346
373
|
return { kind: 'skip' };
|
|
347
374
|
oxy.session.setAccessToken(session.accessToken);
|
|
348
375
|
return {
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.description = exports.version = exports.name = exports.packageInfo = void 0;
|
|
8
8
|
exports.packageInfo = {
|
|
9
|
-
name:
|
|
10
|
-
version:
|
|
11
|
-
description:
|
|
12
|
-
main:
|
|
13
|
-
module:
|
|
14
|
-
types:
|
|
9
|
+
name: '@oxy.so/services',
|
|
10
|
+
version: '5.2.1',
|
|
11
|
+
description: 'Reusable OxyHQ module to handle authentication, user management, reputation system (Oxy Trust) and more 🚀',
|
|
12
|
+
main: 'lib/commonjs/node/index.js',
|
|
13
|
+
module: 'lib/module/node/index.js',
|
|
14
|
+
types: 'lib/typescript/node/index.d.ts',
|
|
15
15
|
};
|
|
16
16
|
exports.name = exports.packageInfo.name, exports.version = exports.packageInfo.version, exports.description = exports.packageInfo.description;
|
|
@@ -215,7 +215,9 @@ async function updateIdentityMarker(partial) {
|
|
|
215
215
|
}
|
|
216
216
|
return false;
|
|
217
217
|
}
|
|
218
|
-
const nextOnboarding = partial.onboardingComplete !== undefined
|
|
218
|
+
const nextOnboarding = partial.onboardingComplete !== undefined
|
|
219
|
+
? partial.onboardingComplete
|
|
220
|
+
: existing.onboardingComplete;
|
|
219
221
|
const next = {
|
|
220
222
|
v: 1,
|
|
221
223
|
publicKey: partial.publicKey ?? existing.publicKey,
|
|
@@ -24,5 +24,10 @@ async function signIdentityProof(identity, claims) {
|
|
|
24
24
|
throw new Error('identity proof: the claims name a different root');
|
|
25
25
|
}
|
|
26
26
|
const signature = await (0, protocol_1.signMessage)((0, contracts_1.buildIdentityProofMessage)(claims), identity.privateKey);
|
|
27
|
-
return {
|
|
27
|
+
return {
|
|
28
|
+
v: contracts_1.IDENTITY_PROOF_VERSION,
|
|
29
|
+
challenge: claims.challenge,
|
|
30
|
+
expiresAt: claims.expiresAt,
|
|
31
|
+
signature,
|
|
32
|
+
};
|
|
28
33
|
}
|