@oxy.so/core 1.10.0 → 1.11.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.
Files changed (35) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/crypto/deviceBackup.js +75 -0
  3. package/dist/cjs/crypto/keyManager.js +285 -12
  4. package/dist/cjs/mixins/OxyServices.linkedAccounts.js +79 -0
  5. package/dist/cjs/mixins/OxyServices.user.js +5 -1
  6. package/dist/cjs/mixins/index.js +4 -0
  7. package/dist/cjs/server/securityHeaders.js +3 -0
  8. package/dist/esm/.tsbuildinfo +1 -1
  9. package/dist/esm/crypto/deviceBackup.js +70 -0
  10. package/dist/esm/crypto/keyManager.js +252 -12
  11. package/dist/esm/mixins/OxyServices.linkedAccounts.js +76 -0
  12. package/dist/esm/mixins/OxyServices.user.js +5 -1
  13. package/dist/esm/mixins/index.js +4 -0
  14. package/dist/esm/server/securityHeaders.js +3 -0
  15. package/dist/types/.tsbuildinfo +1 -1
  16. package/dist/types/crypto/deviceBackup.d.ts +60 -0
  17. package/dist/types/crypto/keyManager.d.ts +79 -12
  18. package/dist/types/index.d.ts +1 -0
  19. package/dist/types/mixins/OxyServices.linkedAccounts.d.ts +107 -0
  20. package/dist/types/mixins/OxyServices.user.d.ts +7 -2
  21. package/dist/types/mixins/index.d.ts +2 -1
  22. package/dist/types/models/interfaces.d.ts +30 -0
  23. package/dist/types/server/securityHeaders.d.ts +5 -0
  24. package/package.json +2 -2
  25. package/src/crypto/__tests__/keyManager.deviceBackup.test.ts +310 -0
  26. package/src/crypto/deviceBackup.ts +108 -0
  27. package/src/crypto/keyManager.ts +278 -13
  28. package/src/index.ts +1 -0
  29. package/src/mixins/OxyServices.linkedAccounts.ts +129 -0
  30. package/src/mixins/OxyServices.user.ts +7 -2
  31. package/src/mixins/__tests__/linkedAccounts.test.ts +109 -0
  32. package/src/mixins/index.ts +6 -0
  33. package/src/models/interfaces.ts +30 -1
  34. package/src/server/__tests__/securityHeaders.test.ts +7 -0
  35. package/src/server/securityHeaders.ts +8 -0
@@ -115,6 +115,13 @@ export interface User {
115
115
  * lists, profile search) — the two are separate fields on the User document.
116
116
  */
117
117
  description?: string;
118
+ /**
119
+ * ActivityPub actor URIs this account is also known as — its live,
120
+ * OAuth-proven linked Mastodon-API accounts. Emitted by
121
+ * `GET /profiles/username/:username`; a relying app passes it to the shared
122
+ * actor builder (`@oxy.so/federation`) so its actor publishes it.
123
+ */
124
+ alsoKnownAs?: string[];
118
125
  phone?: string;
119
126
  address?: string;
120
127
  /** Legacy free-text birthday, kept for backward compatibility. Prefer `dateOfBirth`. */
@@ -263,7 +270,22 @@ export interface LoginResponse {
263
270
  export interface Notification {
264
271
  id: string;
265
272
  message: string;
266
- // Add other notification fields as needed
273
+ /** One of `OXY_NOTIFICATION_TYPES` (`@oxy.so/contracts`). */
274
+ type?: string;
275
+ /**
276
+ * `system` notifications only (with `message`): the text an Oxy service sent
277
+ * about the recipient's own account. Render these two instead of composing a
278
+ * sentence from actor + entity.
279
+ */
280
+ title?: string;
281
+ /** `system` notifications only: an optional deep link (https or the sending app's scheme). */
282
+ url?: string;
283
+ /**
284
+ * What `entityId` names: `post` | `reply` | `profile`, or `app` — an opaque id
285
+ * in the notifying application's namespace (`system` notifications only).
286
+ */
287
+ entityType?: string;
288
+ entityId?: string;
267
289
  }
268
290
 
269
291
  export interface Wallet {
@@ -666,6 +688,13 @@ export interface ServiceAssetMetadata {
666
688
  * play. Treat absence as "no adaptive stream, play the progressive original".
667
689
  */
668
690
  hlsReadyAt?: string;
691
+ /**
692
+ * The Oxy user who owns the file (`null` for a system-owned file such as the
693
+ * federated media cache). PRESENT ONLY for Oxy's own applications (service
694
+ * tokens with `tier: 'internal'`), so a first-party service can check that an
695
+ * asset a user attached is really that user's. Absent for every other caller.
696
+ */
697
+ ownerUserId?: string | null;
669
698
  }
670
699
 
671
700
  /**
@@ -211,6 +211,13 @@ describe('@oxy.so/core/server buildOxyPagesHeaders on a sensitive origin (ADR 00
211
211
  expect(sensitive).toContain('https://api.oxy.so');
212
212
  expect(sensitive).toContain("frame-ancestors 'none'");
213
213
  });
214
+
215
+ it('sends no-transform so the edge never injects the beacon, and only there', () => {
216
+ expect(buildOxyPagesHeaders({ sensitive: true })).toContain(
217
+ 'Cache-Control: public, max-age=0, must-revalidate, no-transform',
218
+ );
219
+ expect(buildOxyPagesHeaders()).not.toContain('Cache-Control');
220
+ });
214
221
  });
215
222
 
216
223
  describe('@oxy.so/core/server extractInlineScripts', () => {
@@ -366,6 +366,11 @@ export interface OxyPagesHeadersOptions {
366
366
  * the app — is REMOVED from `script-src` and `connect-src`, so third-party
367
367
  * measurement cannot run there even when the zone has Web Analytics enabled.
368
368
  * A structural block in the policy the page is served with, not a build flag.
369
+ *
370
+ * It also sends `Cache-Control: no-transform`, which stops the edge from
371
+ * injecting the beacon at all — otherwise every page load logs a CSP
372
+ * violation for a script we never asked for. The rest of the value is Pages'
373
+ * own default, so caching is unchanged.
369
374
  */
370
375
  sensitive?: boolean;
371
376
  /**
@@ -429,6 +434,9 @@ export function buildOxyPagesHeaders(options: OxyPagesHeadersOptions = {}): stri
429
434
  if (options.hsts !== false) {
430
435
  lines.push(' Strict-Transport-Security: max-age=31536000; includeSubDomains; preload');
431
436
  }
437
+ if (options.sensitive) {
438
+ lines.push(' Cache-Control: public, max-age=0, must-revalidate, no-transform');
439
+ }
432
440
  lines.push('');
433
441
  return lines.join('\n');
434
442
  }