@oxyhq/contracts 0.18.0 → 0.19.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,59 @@
1
+ "use strict";
2
+ /**
3
+ * Canonical contract for the "Sign in with Oxy" approval handoff.
4
+ *
5
+ * SINGLE SOURCE OF TRUTH for the closed set of reasons an approver may attach
6
+ * when it DENIES a pending request via
7
+ * `POST /auth/session/deny/:authorizeCode`.
8
+ *
9
+ * That endpoint is UNAUTHENTICATED — the public `authorizeCode` is the only
10
+ * credential — so a free-form string from it is never stored: it would be an
11
+ * unauthenticated write of arbitrary text onto a record other surfaces read.
12
+ * The set is therefore deliberately tiny, and closed:
13
+ *
14
+ * - `'declined'` the approver rejected a request they recognised ("Not now").
15
+ * - `'not_me'` the approver did not start the request ("This wasn't me").
16
+ * The ONE value that records the denial as suspicious rather
17
+ * than an ordinary cancel, so a UI may only offer it where the
18
+ * user genuinely said so.
19
+ *
20
+ * Why this lives in `@oxyhq/contracts` rather than in either consumer: the same
21
+ * closed set is enforced in three places — the request schema of the API route,
22
+ * the `enum` of the persisted `AuthSession.deniedReason` field, and the client
23
+ * SDK's `denyCommonsSignIn` parameter. Two hand-maintained copies of a wire
24
+ * contract drift the moment a value is added on one side only, and the failure
25
+ * lands at runtime, in an auth path, as a generic validation error. One
26
+ * declaration makes that impossible.
27
+ *
28
+ * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
29
+ * `require()`).
30
+ */
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.IDENTITY_APPROVAL_PUSH_CHANNEL = exports.commonsDenyReasonSchema = exports.COMMONS_DENY_REASONS = void 0;
33
+ const zod_1 = require("zod");
34
+ /**
35
+ * The closed set, as a value — consumed directly where a runtime list is
36
+ * required (e.g. the Mongoose `enum` of `AuthSession.deniedReason`, which is
37
+ * the storage-level guarantee that an unauthenticated caller can never write
38
+ * free-form text into the field).
39
+ */
40
+ exports.COMMONS_DENY_REASONS = ['declined', 'not_me'];
41
+ /**
42
+ * The same set as a zod enum — the edge validator. Anything outside it
43
+ * (including free-form text) is rejected with 400 before any handler runs.
44
+ */
45
+ exports.commonsDenyReasonSchema = zod_1.z.enum(exports.COMMONS_DENY_REASONS);
46
+ /**
47
+ * Android notification channel id the identity-approval push is sent on.
48
+ *
49
+ * A wire contract for the same reason the deny set is: Android 8+ DROPS a
50
+ * notification whose channel id the app has not created, silently and with no
51
+ * client-side error. The API attaches this id when it sends, and the vault
52
+ * creates the channel with it before registering a push token — two hand-typed
53
+ * copies of that string would fail as "the notification never arrived", which
54
+ * is the single hardest push symptom to diagnose.
55
+ *
56
+ * The channel's user-visible NAME and description are deliberately NOT here:
57
+ * those are localized app copy, and the vault owns them.
58
+ */
59
+ exports.IDENTITY_APPROVAL_PUSH_CHANNEL = 'auth-approval';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sessionAccountsChangedEventSchema = exports.sessionAccountsChangedReasonSchema = exports.SESSION_ACCOUNTS_CHANGED_EVENT = exports.deviceHubTicketRedeemResponseSchema = exports.deviceHubTicketRedeemRequestSchema = exports.deviceHubTicketIssueResponseSchema = exports.deviceHubTicketIssueRequestSchema = exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = void 0;
3
+ exports.sessionAccountsChangedEventSchema = exports.sessionAccountsChangedReasonSchema = exports.SESSION_ACCOUNTS_CHANGED_EVENT = exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.sessionAccountSchema = zod_1.z.object({
6
6
  accountId: zod_1.z.string(),
@@ -60,28 +60,6 @@ exports.deviceTokenMintResponseSchema = zod_1.z.object({
60
60
  state: exports.deviceSessionStateSchema,
61
61
  });
62
62
  /* -------------------------------------------------------------------------- */
63
- /* Hub ticket — server-side cross-origin device credential sync */
64
- /* -------------------------------------------------------------------------- */
65
- /** Request body for `POST /session/device/hub-ticket`. */
66
- exports.deviceHubTicketIssueRequestSchema = zod_1.z.object({
67
- returnOrigin: zod_1.z.string().min(1),
68
- });
69
- /** Response from `POST /session/device/hub-ticket`. */
70
- exports.deviceHubTicketIssueResponseSchema = zod_1.z.object({
71
- ticket: zod_1.z.string().min(1),
72
- expiresIn: zod_1.z.number().int().positive(),
73
- });
74
- /** Request body for `POST /session/device/redeem-ticket`. */
75
- exports.deviceHubTicketRedeemRequestSchema = zod_1.z.object({
76
- ticket: zod_1.z.string().min(1),
77
- returnOrigin: zod_1.z.string().min(1),
78
- });
79
- /** Response from `POST /session/device/redeem-ticket`. */
80
- exports.deviceHubTicketRedeemResponseSchema = zod_1.z.object({
81
- deviceId: zod_1.z.string().min(1),
82
- deviceSecret: zod_1.z.string().min(1),
83
- });
84
- /* -------------------------------------------------------------------------- */
85
63
  /* Instant cross-app session sync (token-free socket signal) */
86
64
  /* -------------------------------------------------------------------------- */
87
65
  /**
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /**
3
+ * Canonical contract for Inbox new-mail push notifications.
4
+ *
5
+ * The Android channel id and payload `type` are wire contracts: Android 8+
6
+ * drops a notification whose channel the app has not created, and the client
7
+ * only routes taps it recognises. Two hand-typed copies of either string fail as
8
+ * "the notification never arrived" or "tapping does nothing" — the hardest push
9
+ * symptoms to diagnose.
10
+ *
11
+ * Platform-agnostic — zod only, no react/react-native/expo.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.inboxEmailPushDataSchema = exports.INBOX_EMAIL_PUSH_TYPE = exports.INBOX_EMAIL_PUSH_CHANNEL = void 0;
15
+ const zod_1 = require("zod");
16
+ /** Android notification channel id the new-mail push is sent on. */
17
+ exports.INBOX_EMAIL_PUSH_CHANNEL = 'email';
18
+ /** Runtime type discriminator of the new-mail push payload. */
19
+ exports.INBOX_EMAIL_PUSH_TYPE = 'oxy_inbox_new_message';
20
+ exports.inboxEmailPushDataSchema = zod_1.z.object({
21
+ type: zod_1.z.literal(exports.INBOX_EMAIL_PUSH_TYPE),
22
+ messageId: zod_1.z.string().min(1),
23
+ mailboxId: zod_1.z.string().min(1),
24
+ });
package/dist/cjs/index.js CHANGED
@@ -11,9 +11,9 @@
11
11
  * expo, no `require()` in the ESM build.
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.validationOpenResultSchema = exports.validationOpenRequestSchema = exports.validationVerdictRecordSchema = exports.realLifeAttestationResultSchema = exports.realLifeAttestationRecordSchema = exports.signedPublicCardSchema = exports.publicCardSchema = exports.logPageResponseSchema = exports.chainHeadResponseSchema = exports.oxySignedRecordTypeSchema = exports.exportBundleSchema = exports.exportAttestationSchema = exports.authMethodsResponseSchema = exports.authMethodEntrySchema = exports.domainVerificationInstructionsSchema = exports.domainVerificationRequestSchema = exports.verifiedDomainSchema = exports.signedRecordEnvelopeSchema = exports.didDocumentSchema = exports.didServiceSchema = exports.verificationMethodSchema = exports.appAffinityEventsIngestSchema = exports.appAffinityEventSchema = exports.appAffinityEventTypeSchema = exports.appUserSignalIngestSchema = exports.appInterestInputSchema = exports.appEndorsementInputSchema = exports.recommendationResponseSchema = exports.recommendationItemSchema = exports.recommendationCountSchema = exports.recommendationRequestSchema = exports.recommendationSignalWeightsSchema = exports.recommendationBoostSchema = exports.recommendationExcludeTypeSchema = exports.sessionStatusSchema = exports.publicApplicationSchema = exports.applicationTypeSchema = exports.safeParseContract = exports.resolveUserId = exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema = exports.currentUserResponseSchema = exports.userProfileUpdateSchema = exports.userResponseSchema = exports.themePreferenceSchema = exports.userRelationshipSchema = exports.userNameSchema = exports.createAccountRequestSchema = exports.organizationCategorySchema = exports.ORGANIZATION_CATEGORIES = void 0;
15
- exports.assetCompleteResponseSchema = exports.assetCompleteResultItemSchema = exports.assetCompleteRequestSchema = exports.assetInitResponseSchema = exports.assetUploadTicketSchema = exports.assetInitRequestSchema = exports.assetInitItemSchema = exports.rolloutPercentSchema = exports.runtimeVersionSchema = exports.channelNameSchema = exports.sha256HexSchema = exports.updateAssetStatusSchema = exports.updateStatusSchema = exports.updatePlatformSchema = exports.backupStatusResponseSchema = exports.backupUploadRequestSchema = exports.encryptedBackupEnvelopeSchema = exports.backupLookupIdSchema = exports.rotateKeyCompleteResponseSchema = exports.rotateKeyCompleteRequestSchema = exports.rotateKeyChallengeResponseSchema = exports.loginResultSchema = exports.sessionAccountsChangedEventSchema = exports.sessionAccountsChangedReasonSchema = exports.SESSION_ACCOUNTS_CHANGED_EVENT = exports.deviceHubTicketRedeemResponseSchema = exports.deviceHubTicketRedeemRequestSchema = exports.deviceHubTicketIssueResponseSchema = exports.deviceHubTicketIssueRequestSchema = exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = exports.linkPreviewResponseSchema = exports.linkPreviewBatchResponseSchema = exports.linkPreviewBatchRequestSchema = exports.linkPreviewSchema = exports.credentialVerifyResultSchema = exports.credentialListResultSchema = exports.credentialIssueResultSchema = exports.verifiableCredentialResponseSchema = exports.credentialRecordSchema = exports.vouchResultSchema = exports.personhoodStatusResultSchema = exports.personhoodBreakdownSchema = exports.personhoodVouchRecordSchema = exports.validationVoteResultSchema = exports.validationRequestSummarySchema = void 0;
16
- exports.transparencyCheckpointListSchema = exports.transparencyInclusionProofSchema = exports.transparencyCheckpointSchema = exports.transparencyAnchorSchema = exports.transparencyCheckpointSignatureSchema = exports.deviceTransferDenyResponseSchema = exports.deviceTransferApproveResponseSchema = exports.deviceTransferApproveRequestSchema = exports.deviceTransferInfoResponseSchema = exports.deviceTransferInitResponseSchema = exports.deviceTransferInitRequestSchema = exports.devicePairingStatusSchema = exports.webauthnLoginVerifyRequestSchema = exports.webauthnRegisterVerifyRequestSchema = exports.webauthnLoginOptionsRequestSchema = exports.webauthnRegisterOptionsRequestSchema = exports.updateRolloutPatchSchema = exports.promoteRequestSchema = exports.rollbackToEmbeddedRequestSchema = exports.rollbackRequestSchema = exports.updateListResponseSchema = exports.channelListResponseSchema = exports.channelSchema = exports.rollbackToEmbeddedEntrySchema = exports.createUpdateResponseSchema = exports.updateSchema = exports.createUpdateRequestSchema = exports.updateAssetRefSchema = void 0;
14
+ exports.publicCardSchema = exports.logPageResponseSchema = exports.chainHeadResponseSchema = exports.oxySignedRecordTypeSchema = exports.exportBundleSchema = exports.exportAttestationSchema = exports.authMethodsResponseSchema = exports.authMethodEntrySchema = exports.domainVerificationInstructionsSchema = exports.domainVerificationRequestSchema = exports.verifiedDomainSchema = exports.signedRecordEnvelopeSchema = exports.didDocumentSchema = exports.didServiceSchema = exports.verificationMethodSchema = exports.appAffinityEventsIngestSchema = exports.appAffinityEventSchema = exports.appAffinityEventTypeSchema = exports.appUserSignalIngestSchema = exports.appInterestInputSchema = exports.appEndorsementInputSchema = exports.recommendationResponseSchema = exports.recommendationItemSchema = exports.recommendationCountSchema = exports.recommendationRequestSchema = exports.recommendationSignalWeightsSchema = exports.recommendationBoostSchema = exports.recommendationExcludeTypeSchema = exports.inboxEmailPushDataSchema = exports.INBOX_EMAIL_PUSH_TYPE = exports.INBOX_EMAIL_PUSH_CHANNEL = exports.IDENTITY_APPROVAL_PUSH_CHANNEL = exports.commonsDenyReasonSchema = exports.COMMONS_DENY_REASONS = exports.sessionStatusSchema = exports.publicApplicationSchema = exports.applicationTypeSchema = exports.safeParseContract = exports.resolveUserId = exports.deviceLinkedSessionsResponseSchema = exports.deviceLinkedSessionSchema = exports.currentUserResponseSchema = exports.userProfileUpdateSchema = exports.userResponseSchema = exports.themePreferenceSchema = exports.userRelationshipSchema = exports.userNameSchema = exports.createAccountRequestSchema = exports.organizationCategorySchema = exports.ORGANIZATION_CATEGORIES = void 0;
15
+ exports.assetCompleteRequestSchema = exports.assetInitResponseSchema = exports.assetUploadTicketSchema = exports.assetInitRequestSchema = exports.assetInitItemSchema = exports.rolloutPercentSchema = exports.runtimeVersionSchema = exports.channelNameSchema = exports.sha256HexSchema = exports.updateAssetStatusSchema = exports.updateStatusSchema = exports.updatePlatformSchema = exports.backupStatusResponseSchema = exports.backupUploadRequestSchema = exports.encryptedBackupEnvelopeSchema = exports.backupLookupIdSchema = exports.rotateKeyCompleteResponseSchema = exports.rotateKeyCompleteRequestSchema = exports.rotateKeyChallengeResponseSchema = exports.loginResultSchema = exports.sessionAccountsChangedEventSchema = exports.sessionAccountsChangedReasonSchema = exports.SESSION_ACCOUNTS_CHANGED_EVENT = exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = exports.linkPreviewResponseSchema = exports.linkPreviewBatchResponseSchema = exports.linkPreviewBatchRequestSchema = exports.linkPreviewSchema = exports.credentialVerifyResultSchema = exports.credentialListResultSchema = exports.credentialIssueResultSchema = exports.verifiableCredentialResponseSchema = exports.credentialRecordSchema = exports.vouchResultSchema = exports.personhoodStatusResultSchema = exports.personhoodBreakdownSchema = exports.personhoodVouchRecordSchema = exports.validationVoteResultSchema = exports.validationRequestSummarySchema = exports.validationOpenResultSchema = exports.validationOpenRequestSchema = exports.validationVerdictRecordSchema = exports.realLifeAttestationResultSchema = exports.realLifeAttestationRecordSchema = exports.signedPublicCardSchema = void 0;
16
+ exports.transparencyCheckpointListSchema = exports.transparencyInclusionProofSchema = exports.transparencyCheckpointSchema = exports.transparencyAnchorSchema = exports.transparencyCheckpointSignatureSchema = exports.deviceTransferDenyResponseSchema = exports.deviceTransferApproveResponseSchema = exports.deviceTransferApproveRequestSchema = exports.deviceTransferInfoResponseSchema = exports.deviceTransferInitResponseSchema = exports.deviceTransferInitRequestSchema = exports.devicePairingStatusSchema = exports.webauthnLoginVerifyRequestSchema = exports.webauthnRegisterVerifyRequestSchema = exports.webauthnLoginOptionsRequestSchema = exports.webauthnRegisterOptionsRequestSchema = exports.updateRolloutPatchSchema = exports.promoteRequestSchema = exports.rollbackToEmbeddedRequestSchema = exports.rollbackRequestSchema = exports.updateListResponseSchema = exports.channelListResponseSchema = exports.channelSchema = exports.rollbackToEmbeddedEntrySchema = exports.createUpdateResponseSchema = exports.updateSchema = exports.createUpdateRequestSchema = exports.updateAssetRefSchema = exports.assetCompleteResponseSchema = exports.assetCompleteResultItemSchema = void 0;
17
17
  var accountGraph_1 = require("./accountGraph");
18
18
  Object.defineProperty(exports, "ORGANIZATION_CATEGORIES", { enumerable: true, get: function () { return accountGraph_1.ORGANIZATION_CATEGORIES; } });
19
19
  Object.defineProperty(exports, "organizationCategorySchema", { enumerable: true, get: function () { return accountGraph_1.organizationCategorySchema; } });
@@ -36,6 +36,17 @@ var sessionStatus_1 = require("./sessionStatus");
36
36
  Object.defineProperty(exports, "applicationTypeSchema", { enumerable: true, get: function () { return sessionStatus_1.applicationTypeSchema; } });
37
37
  Object.defineProperty(exports, "publicApplicationSchema", { enumerable: true, get: function () { return sessionStatus_1.publicApplicationSchema; } });
38
38
  Object.defineProperty(exports, "sessionStatusSchema", { enumerable: true, get: function () { return sessionStatus_1.sessionStatusSchema; } });
39
+ var commonsSignIn_1 = require("./commonsSignIn");
40
+ // Closed set of denial reasons for POST /auth/session/deny/:authorizeCode —
41
+ // shared by the API request schema, the persisted `AuthSession.deniedReason`
42
+ // enum, and the SDK's `denyCommonsSignIn`.
43
+ Object.defineProperty(exports, "COMMONS_DENY_REASONS", { enumerable: true, get: function () { return commonsSignIn_1.COMMONS_DENY_REASONS; } });
44
+ Object.defineProperty(exports, "commonsDenyReasonSchema", { enumerable: true, get: function () { return commonsSignIn_1.commonsDenyReasonSchema; } });
45
+ Object.defineProperty(exports, "IDENTITY_APPROVAL_PUSH_CHANNEL", { enumerable: true, get: function () { return commonsSignIn_1.IDENTITY_APPROVAL_PUSH_CHANNEL; } });
46
+ var inboxPush_1 = require("./inboxPush");
47
+ Object.defineProperty(exports, "INBOX_EMAIL_PUSH_CHANNEL", { enumerable: true, get: function () { return inboxPush_1.INBOX_EMAIL_PUSH_CHANNEL; } });
48
+ Object.defineProperty(exports, "INBOX_EMAIL_PUSH_TYPE", { enumerable: true, get: function () { return inboxPush_1.INBOX_EMAIL_PUSH_TYPE; } });
49
+ Object.defineProperty(exports, "inboxEmailPushDataSchema", { enumerable: true, get: function () { return inboxPush_1.inboxEmailPushDataSchema; } });
39
50
  var recommendations_1 = require("./recommendations");
40
51
  // Schemas
41
52
  Object.defineProperty(exports, "recommendationExcludeTypeSchema", { enumerable: true, get: function () { return recommendations_1.recommendationExcludeTypeSchema; } });
@@ -105,10 +116,6 @@ Object.defineProperty(exports, "activeTokenSchema", { enumerable: true, get: fun
105
116
  Object.defineProperty(exports, "deviceSessionSyncSchema", { enumerable: true, get: function () { return deviceSession_1.deviceSessionSyncSchema; } });
106
117
  Object.defineProperty(exports, "deviceTokenMintRequestSchema", { enumerable: true, get: function () { return deviceSession_1.deviceTokenMintRequestSchema; } });
107
118
  Object.defineProperty(exports, "deviceTokenMintResponseSchema", { enumerable: true, get: function () { return deviceSession_1.deviceTokenMintResponseSchema; } });
108
- Object.defineProperty(exports, "deviceHubTicketIssueRequestSchema", { enumerable: true, get: function () { return deviceSession_1.deviceHubTicketIssueRequestSchema; } });
109
- Object.defineProperty(exports, "deviceHubTicketIssueResponseSchema", { enumerable: true, get: function () { return deviceSession_1.deviceHubTicketIssueResponseSchema; } });
110
- Object.defineProperty(exports, "deviceHubTicketRedeemRequestSchema", { enumerable: true, get: function () { return deviceSession_1.deviceHubTicketRedeemRequestSchema; } });
111
- Object.defineProperty(exports, "deviceHubTicketRedeemResponseSchema", { enumerable: true, get: function () { return deviceSession_1.deviceHubTicketRedeemResponseSchema; } });
112
119
  Object.defineProperty(exports, "SESSION_ACCOUNTS_CHANGED_EVENT", { enumerable: true, get: function () { return deviceSession_1.SESSION_ACCOUNTS_CHANGED_EVENT; } });
113
120
  Object.defineProperty(exports, "sessionAccountsChangedReasonSchema", { enumerable: true, get: function () { return deviceSession_1.sessionAccountsChangedReasonSchema; } });
114
121
  Object.defineProperty(exports, "sessionAccountsChangedEventSchema", { enumerable: true, get: function () { return deviceSession_1.sessionAccountsChangedEventSchema; } });