@oxy.so/contracts 2.0.0 → 2.1.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.
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Wire contract for `POST /federation/instance-fetch/sign`: Oxy's INSTANCE
3
+ * actor signs one ActivityPub GET for a first-party service, so the service can
4
+ * read an instance running in authorized-fetch ("secure") mode without holding
5
+ * a key.
6
+ *
7
+ * The caller sends a URL, never a signing string: Oxy builds the string itself
8
+ * (`(request-target): get <path>`, `host`, `date`), the method is always GET
9
+ * and the key is always the instance actor's. The caller sends the returned
10
+ * headers, unchanged, on exactly that URL, within the few minutes remote
11
+ * servers accept a `Date` for. A redirect is a new URL and needs a new
12
+ * signature.
13
+ *
14
+ * Needs a service token whose application holds the privileged
15
+ * `federation:instance-fetch` scope.
16
+ *
17
+ * Platform-agnostic — zod only.
18
+ */
19
+ import { z } from 'zod';
20
+ /** The longest URL Oxy will sign (the same cap as its own safe fetch). */
21
+ export declare const INSTANCE_FETCH_MAX_URL_LENGTH = 2048;
22
+ export declare const instanceFetchSignRequestSchema: z.ZodObject<{
23
+ /** The absolute public `https://` URL the caller is about to GET. */
24
+ url: z.ZodString;
25
+ }, "strict", z.ZodTypeAny, {
26
+ url: string;
27
+ }, {
28
+ url: string;
29
+ }>;
30
+ export type InstanceFetchSignRequest = z.infer<typeof instanceFetchSignRequestSchema>;
31
+ export declare const instanceFetchSignResponseSchema: z.ZodObject<{
32
+ /** The instance actor's key, e.g. `https://oxy.so/ap/users/instance#main-key`. */
33
+ keyId: z.ZodString;
34
+ /** Send all three on the GET, as they are. */
35
+ headers: z.ZodObject<{
36
+ Host: z.ZodString;
37
+ Date: z.ZodString;
38
+ Signature: z.ZodString;
39
+ }, "strict", z.ZodTypeAny, {
40
+ Host: string;
41
+ Date: string;
42
+ Signature: string;
43
+ }, {
44
+ Host: string;
45
+ Date: string;
46
+ Signature: string;
47
+ }>;
48
+ }, "strict", z.ZodTypeAny, {
49
+ keyId: string;
50
+ headers: {
51
+ Host: string;
52
+ Date: string;
53
+ Signature: string;
54
+ };
55
+ }, {
56
+ keyId: string;
57
+ headers: {
58
+ Host: string;
59
+ Date: string;
60
+ Signature: string;
61
+ };
62
+ }>;
63
+ export type InstanceFetchSignResponse = z.infer<typeof instanceFetchSignResponseSchema>;
@@ -104,4 +104,5 @@ export { inboxComposeRequestSchema, inboxDailyBriefRequestSchema, inboxNaturalSe
104
104
  export type { InboxComposeRequest, InboxDailyBriefRequest, InboxInferenceTextResponse, InboxNaturalSearchResponse, InboxSmartRepliesResponse, InboxThreadSummaryResponse, InboxInferenceStreamEvent, } from './inference/inbox';
105
105
  export * from './externalIdentity';
106
106
  export * from './linkedAccounts';
107
+ export * from './federationInstanceFetch';
107
108
  export * from './notifications';
@@ -141,15 +141,15 @@ export declare const aliaReleaseSignatureSchema: z.ZodObject<{
141
141
  }, "strict", z.ZodTypeAny, {
142
142
  signature: string;
143
143
  signedAt: string;
144
+ keyId: string;
144
145
  algorithm: "ed25519";
145
146
  canonicalization: "jcs";
146
- keyId: string;
147
147
  }, {
148
148
  signature: string;
149
149
  signedAt: string;
150
+ keyId: string;
150
151
  algorithm: "ed25519";
151
152
  canonicalization: "jcs";
152
- keyId: string;
153
153
  }>;
154
154
  /**
155
155
  * A signed release of an `alia/*` model revision.
@@ -377,15 +377,15 @@ export declare const aliaModelReleaseManifestSchema: z.ZodEffects<z.ZodObject<{
377
377
  }, "strict", z.ZodTypeAny, {
378
378
  signature: string;
379
379
  signedAt: string;
380
+ keyId: string;
380
381
  algorithm: "ed25519";
381
382
  canonicalization: "jcs";
382
- keyId: string;
383
383
  }, {
384
384
  signature: string;
385
385
  signedAt: string;
386
+ keyId: string;
386
387
  algorithm: "ed25519";
387
388
  canonicalization: "jcs";
388
- keyId: string;
389
389
  }>, "many">;
390
390
  }, "strict", z.ZodTypeAny, {
391
391
  schemaVersion: 1;
@@ -417,9 +417,9 @@ export declare const aliaModelReleaseManifestSchema: z.ZodEffects<z.ZodObject<{
417
417
  signatures: {
418
418
  signature: string;
419
419
  signedAt: string;
420
+ keyId: string;
420
421
  algorithm: "ed25519";
421
422
  canonicalization: "jcs";
422
- keyId: string;
423
423
  }[];
424
424
  license: {
425
425
  displayName: string;
@@ -471,9 +471,9 @@ export declare const aliaModelReleaseManifestSchema: z.ZodEffects<z.ZodObject<{
471
471
  signatures: {
472
472
  signature: string;
473
473
  signedAt: string;
474
+ keyId: string;
474
475
  algorithm: "ed25519";
475
476
  canonicalization: "jcs";
476
- keyId: string;
477
477
  }[];
478
478
  license: {
479
479
  displayName: string;
@@ -525,9 +525,9 @@ export declare const aliaModelReleaseManifestSchema: z.ZodEffects<z.ZodObject<{
525
525
  signatures: {
526
526
  signature: string;
527
527
  signedAt: string;
528
+ keyId: string;
528
529
  algorithm: "ed25519";
529
530
  canonicalization: "jcs";
530
- keyId: string;
531
531
  }[];
532
532
  license: {
533
533
  displayName: string;
@@ -579,9 +579,9 @@ export declare const aliaModelReleaseManifestSchema: z.ZodEffects<z.ZodObject<{
579
579
  signatures: {
580
580
  signature: string;
581
581
  signedAt: string;
582
+ keyId: string;
582
583
  algorithm: "ed25519";
583
584
  canonicalization: "jcs";
584
- keyId: string;
585
585
  }[];
586
586
  license: {
587
587
  displayName: string;
@@ -626,15 +626,15 @@ export declare const modelReleaseIngestionRequestSchema: z.ZodObject<{
626
626
  }, "strict", z.ZodTypeAny, {
627
627
  signature: string;
628
628
  signedAt: string;
629
+ keyId: string;
629
630
  algorithm: "ed25519";
630
631
  canonicalization: "jcs";
631
- keyId: string;
632
632
  }, {
633
633
  signature: string;
634
634
  signedAt: string;
635
+ keyId: string;
635
636
  algorithm: "ed25519";
636
637
  canonicalization: "jcs";
637
- keyId: string;
638
638
  }>, "many">;
639
639
  }, "strict", z.ZodTypeAny, {
640
640
  schemaVersion: 1;
@@ -666,9 +666,9 @@ export declare const modelReleaseIngestionRequestSchema: z.ZodObject<{
666
666
  signatures: {
667
667
  signature: string;
668
668
  signedAt: string;
669
+ keyId: string;
669
670
  algorithm: "ed25519";
670
671
  canonicalization: "jcs";
671
- keyId: string;
672
672
  }[];
673
673
  license: {
674
674
  displayName: string;
@@ -720,9 +720,9 @@ export declare const modelReleaseIngestionRequestSchema: z.ZodObject<{
720
720
  signatures: {
721
721
  signature: string;
722
722
  signedAt: string;
723
+ keyId: string;
723
724
  algorithm: "ed25519";
724
725
  canonicalization: "jcs";
725
- keyId: string;
726
726
  }[];
727
727
  license: {
728
728
  displayName: string;
@@ -774,9 +774,9 @@ export declare const modelReleaseIngestionRequestSchema: z.ZodObject<{
774
774
  signatures: {
775
775
  signature: string;
776
776
  signedAt: string;
777
+ keyId: string;
777
778
  algorithm: "ed25519";
778
779
  canonicalization: "jcs";
779
- keyId: string;
780
780
  }[];
781
781
  license: {
782
782
  displayName: string;
@@ -828,9 +828,9 @@ export declare const modelReleaseIngestionRequestSchema: z.ZodObject<{
828
828
  signatures: {
829
829
  signature: string;
830
830
  signedAt: string;
831
+ keyId: string;
831
832
  algorithm: "ed25519";
832
833
  canonicalization: "jcs";
833
- keyId: string;
834
834
  }[];
835
835
  license: {
836
836
  displayName: string;
@@ -1087,9 +1087,9 @@ export declare const modelReleaseIngestionRequestSchema: z.ZodObject<{
1087
1087
  signatures: {
1088
1088
  signature: string;
1089
1089
  signedAt: string;
1090
+ keyId: string;
1090
1091
  algorithm: "ed25519";
1091
1092
  canonicalization: "jcs";
1092
- keyId: string;
1093
1093
  }[];
1094
1094
  license: {
1095
1095
  displayName: string;
@@ -1178,9 +1178,9 @@ export declare const modelReleaseIngestionRequestSchema: z.ZodObject<{
1178
1178
  signatures: {
1179
1179
  signature: string;
1180
1180
  signedAt: string;
1181
+ keyId: string;
1181
1182
  algorithm: "ed25519";
1182
1183
  canonicalization: "jcs";
1183
- keyId: string;
1184
1184
  }[];
1185
1185
  license: {
1186
1186
  displayName: string;
@@ -339,3 +339,36 @@ export type ServiceLinkedAccountListResponse = z.infer<typeof serviceLinkedAccou
339
339
  */
340
340
  export declare const LINKED_ACCOUNT_CALLBACK_ERRORS: readonly ["access_denied", "verification_failed", "provider_unavailable"];
341
341
  export type LinkedAccountCallbackError = (typeof LINKED_ACCOUNT_CALLBACK_ERRORS)[number];
342
+ /**
343
+ * Why `POST /linked-accounts/:network/start` refused, as `details.reason` on
344
+ * its 400 (`{ error: 'BAD_REQUEST', message, details: { reason } }`). The
345
+ * message is for logs; show the user a text chosen from the reason.
346
+ *
347
+ * - `instance_invalid`: the ActivityPub `instance` is not a server name.
348
+ * - `instance_unreachable`: the server does not resolve to a public address, or
349
+ * could not be connected to.
350
+ * - `handle_unresolvable`: the atproto handle or DID does not resolve to an
351
+ * account. The only reason that means "check what you typed".
352
+ * - `provider_rejected`: the other network answered and refused Oxy's
353
+ * request — for atproto an authorization-server error such as
354
+ * `invalid_client_metadata`; for a Mastodon-API server a refused app
355
+ * registration (often: not a Mastodon-compatible server). Nothing the user
356
+ * typed is wrong.
357
+ * - `provider_unavailable`: the other network could not be asked right now
358
+ * (its OAuth metadata did not load, a 5xx, a timeout). Try again later.
359
+ *
360
+ * A refusal with no `details.reason` (a bad `returnTo`, a missing field) is a
361
+ * client bug, not something to show.
362
+ */
363
+ export declare const LINKED_ACCOUNT_START_ERROR_REASONS: readonly ["instance_invalid", "instance_unreachable", "handle_unresolvable", "provider_rejected", "provider_unavailable"];
364
+ export type LinkedAccountStartErrorReason = (typeof LINKED_ACCOUNT_START_ERROR_REASONS)[number];
365
+ export declare const linkedAccountStartErrorReasonSchema: z.ZodEnum<["instance_invalid", "instance_unreachable", "handle_unresolvable", "provider_rejected", "provider_unavailable"]>;
366
+ /** The `details` of a start refusal. */
367
+ export declare const linkedAccountStartErrorDetailsSchema: z.ZodObject<{
368
+ reason: z.ZodEnum<["instance_invalid", "instance_unreachable", "handle_unresolvable", "provider_rejected", "provider_unavailable"]>;
369
+ }, "strict", z.ZodTypeAny, {
370
+ reason: "provider_unavailable" | "instance_invalid" | "instance_unreachable" | "handle_unresolvable" | "provider_rejected";
371
+ }, {
372
+ reason: "provider_unavailable" | "instance_invalid" | "instance_unreachable" | "handle_unresolvable" | "provider_rejected";
373
+ }>;
374
+ export type LinkedAccountStartErrorDetails = z.infer<typeof linkedAccountStartErrorDetailsSchema>;
@@ -91,3 +91,29 @@ export declare const createOxyNotificationRequestSchema: z.ZodEffects<z.ZodObjec
91
91
  title?: string | undefined;
92
92
  }>;
93
93
  export type CreateOxyNotificationRequest = z.infer<typeof createOxyNotificationRequestSchema>;
94
+ /**
95
+ * Android notification channel a `system` notification is pushed on — a wire
96
+ * contract, because Android 8+ silently drops a push whose channel the app has
97
+ * not created. Created by the vault (Commons) before it registers its token.
98
+ */
99
+ export declare const OXY_ACCOUNT_PUSH_CHANNEL = "account";
100
+ /** Runtime type discriminator of the push that announces a `system` notification. */
101
+ export declare const OXY_SYSTEM_NOTIFICATION_PUSH_TYPE = "oxy_system_notification";
102
+ /**
103
+ * The ONLY data a `system` notification's push carries: its id. The title and
104
+ * message ride as the push's own title and body; the deep link does NOT travel,
105
+ * because a push payload is untrusted at the receiver. On a tap the vault
106
+ * re-reads the notification from Oxy by id (scoped to the signed-in recipient)
107
+ * and opens the `url` stored there.
108
+ */
109
+ export declare const oxySystemNotificationPushDataSchema: z.ZodObject<{
110
+ type: z.ZodLiteral<"oxy_system_notification">;
111
+ notificationId: z.ZodString;
112
+ }, "strip", z.ZodTypeAny, {
113
+ type: "oxy_system_notification";
114
+ notificationId: string;
115
+ }, {
116
+ type: "oxy_system_notification";
117
+ notificationId: string;
118
+ }>;
119
+ export type OxySystemNotificationPushData = z.infer<typeof oxySystemNotificationPushDataSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/contracts",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "OxyHQ API contracts — single source of truth for request/response Zod schemas and inferred types, shared by the backend and the client SDKs",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",