@oxyhq/contracts 0.19.0 → 0.21.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.
@@ -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.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = void 0;
3
+ exports.deviceBackgroundTokenResponseSchema = exports.deviceBackgroundTokenRequestSchema = exports.deviceBackgroundCredentialResponseSchema = 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(),
@@ -100,3 +100,64 @@ exports.sessionAccountsChangedEventSchema = zod_1.z.object({
100
100
  revision: zod_1.z.number().int().nonnegative(),
101
101
  reason: exports.sessionAccountsChangedReasonSchema,
102
102
  });
103
+ /* -------------------------------------------------------------------------- */
104
+ /* Background credential — native background code with no JS runtime */
105
+ /* -------------------------------------------------------------------------- */
106
+ /**
107
+ * Response from `POST /session/device/background-credential` — provisioned by
108
+ * the SDK WHILE THE APP IS RUNNING (bearer required, `deviceId` and account
109
+ * derived server-side from it) and consumed afterwards only by native
110
+ * background code, which has no JS runtime to mint a token for itself.
111
+ *
112
+ * Deliberately a SEPARATE credential from the rotating `deviceSecret`: that one
113
+ * rotates on every mint, so background code presenting it would become a second
114
+ * writer of a value the JS runtime depends on, and background code killed
115
+ * mid-rotation would silently sign the user out on the next cold start. Against
116
+ * this credential background code is the sole writer, and it can never rotate
117
+ * anything JS reads.
118
+ *
119
+ * The raw `secret` is returned exactly once, at provision time — never stored
120
+ * retrievably, never logged, never re-read. A caller that loses it provisions
121
+ * a new one.
122
+ *
123
+ * `expiresAt` is an unvalidated string, like every other expiry in this file:
124
+ * no consumer on the JS path interprets it (native background code parses it
125
+ * itself), and a `.datetime()` here alone would leave one strict field beside
126
+ * two lax ones. If expiry is ever validated it goes on all three at once, with
127
+ * the API's serializers checked against it — the producer is the same server.
128
+ */
129
+ exports.deviceBackgroundCredentialResponseSchema = zod_1.z.object({
130
+ deviceId: zod_1.z.string().min(1),
131
+ secret: zod_1.z.string().min(1),
132
+ accountId: zod_1.z.string().min(1),
133
+ expiresAt: zod_1.z.string(),
134
+ });
135
+ /**
136
+ * Request body for `POST /session/device/background-token` — presented by
137
+ * native background code with NO bearer and NO cookies: possession of the
138
+ * background `secret` IS the proof, as it is for the device-secret mint.
139
+ *
140
+ * Unlike that mint this one NEVER rotates the presented secret (hence no
141
+ * `next…` field to persist in the response), so background code interrupted
142
+ * anywhere between request and response leaves the credential intact and
143
+ * usable on its next run.
144
+ */
145
+ exports.deviceBackgroundTokenRequestSchema = zod_1.z.object({
146
+ deviceId: zod_1.z.string().min(1),
147
+ secret: zod_1.z.string().min(1),
148
+ });
149
+ /**
150
+ * Wire shape of a successful `POST /session/device/background-token`: the short
151
+ * access token, its expiry, and the account the token belongs to — the last so
152
+ * a caller can key cached data per account and drop data belonging to a
153
+ * foreign one.
154
+ *
155
+ * Carries NO device state — no account list, no `activeAccountId`, no
156
+ * `revision`, unlike {@link deviceTokenMintResponseSchema} — deliberately, to
157
+ * cap what a compromised credential record yields.
158
+ */
159
+ exports.deviceBackgroundTokenResponseSchema = zod_1.z.object({
160
+ accessToken: zod_1.z.string(),
161
+ expiresAt: zod_1.z.string(),
162
+ accountId: zod_1.z.string().min(1),
163
+ });
package/dist/cjs/index.js CHANGED
@@ -11,9 +11,11 @@
11
11
  * expo, no `require()` in the ESM build.
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
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;
14
+ 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.oxyUserInvalidationEventSchema = exports.isPublishedOxyUserChangeReason = exports.OXY_PUBLISHED_USER_CHANGE_REASONS = exports.OXY_USER_CHANGE_REASONS = exports.OXY_USER_INVALIDATION_CHANNEL = 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.upsertReputationRuleSchema = exports.resolveReputationDisputeSchema = exports.createReputationDisputeSchema = exports.awardReputationSchema = exports.reverseReputationTransactionResultSchema = exports.reputationInfluenceResultSchema = exports.reputationLeaderboardEntrySchema = exports.reputationLeaderboardUserSchema = exports.reputationRuleSchema = exports.reputationDisputeSchema = exports.reputationBalanceSchema = exports.reputationBalanceSummarySchema = exports.reputationReliabilitySchema = exports.reputationInfluenceSchema = exports.reputationBalanceBreakdownSchema = exports.reputationTransactionSchema = exports.reputationInfluenceContextSchema = exports.reputationDisputeStatusSchema = exports.reputationTargetEntityTypeSchema = exports.trustTierSchema = exports.reputationTransactionStatusSchema = exports.reputationCategorySchema = exports.REPUTATION_INFLUENCE_CONTEXTS = exports.REPUTATION_DISPUTE_STATUSES = exports.REPUTATION_TARGET_ENTITY_TYPES = exports.TRUST_TIERS = exports.REPUTATION_TRANSACTION_STATUSES = exports.REPUTATION_CATEGORIES = 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 = exports.publicCardSchema = exports.logPageResponseSchema = exports.chainHeadResponseSchema = exports.oxySignedRecordTypeSchema = exports.exportBundleSchema = void 0;
16
+ exports.linkPreviewBatchRequestSchema = exports.linkPreviewSchema = exports.applicationModerationTrustSchema = exports.reputationContextualInfluenceSchema = exports.reputationReviewingSchema = exports.reputationReportingSchema = exports.reputationConductSchema = exports.reputationContributionSchema = exports.reputationPersonhoodSchema = exports.identityBindingSchema = exports.registerIdentityBindingSchema = exports.reverseModerationEffectResultSchema = exports.applyModerationDecisionResultSchema = exports.moderationEffectSchema = exports.reverseModerationEffectSchema = exports.finalizeModerationDecisionSchema = exports.moderationDecisionEventSchema = exports.moderationPolicyVersionsSchema = exports.moderationDecisionEventSubjectSchema = exports.moderationFindingSchema = exports.applicationModerationStandingSchema = exports.identityBindingStatusSchema = exports.identityBindingTypeSchema = exports.personhoodStatusSchema = exports.contributionTierSchema = exports.conductStandingSchema = exports.conductStrikeStatusSchema = exports.moderationEffectSkipReasonSchema = exports.moderationEffectStatusSchema = exports.moderationEffectTypeSchema = exports.moderationDecisionStatusSchema = exports.moderationAttributionSchema = exports.moderationFindingScopeSchema = exports.moderationSeveritySchema = exports.APPLICATION_MODERATION_STANDINGS = exports.IDENTITY_BINDING_STATUSES = exports.IDENTITY_BINDING_TYPES = exports.PERSONHOOD_STATUSES = exports.CONTRIBUTION_TIERS = exports.CONDUCT_STANDINGS = exports.CONDUCT_STRIKE_STATUSES = exports.MODERATION_EFFECT_SKIP_REASONS = exports.MODERATION_EFFECT_STATUSES = exports.MODERATION_EFFECT_TYPES = exports.MODERATION_DECISION_STATUSES = exports.MODERATION_ATTRIBUTIONS = exports.MODERATION_FINDING_SCOPES = exports.MODERATION_SEVERITIES = exports.isFullReputationBalance = exports.reverseReputationTransactionSchema = void 0;
17
+ 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 = 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.deviceBackgroundTokenResponseSchema = exports.deviceBackgroundTokenRequestSchema = exports.deviceBackgroundCredentialResponseSchema = exports.deviceTokenMintResponseSchema = exports.deviceTokenMintRequestSchema = exports.deviceSessionSyncSchema = exports.activeTokenSchema = exports.deviceSessionStateSchema = exports.sessionAccountSchema = exports.linkPreviewResponseSchema = exports.linkPreviewBatchResponseSchema = void 0;
18
+ 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 = void 0;
17
19
  var accountGraph_1 = require("./accountGraph");
18
20
  Object.defineProperty(exports, "ORGANIZATION_CATEGORIES", { enumerable: true, get: function () { return accountGraph_1.ORGANIZATION_CATEGORIES; } });
19
21
  Object.defineProperty(exports, "organizationCategorySchema", { enumerable: true, get: function () { return accountGraph_1.organizationCategorySchema; } });
@@ -47,6 +49,12 @@ var inboxPush_1 = require("./inboxPush");
47
49
  Object.defineProperty(exports, "INBOX_EMAIL_PUSH_CHANNEL", { enumerable: true, get: function () { return inboxPush_1.INBOX_EMAIL_PUSH_CHANNEL; } });
48
50
  Object.defineProperty(exports, "INBOX_EMAIL_PUSH_TYPE", { enumerable: true, get: function () { return inboxPush_1.INBOX_EMAIL_PUSH_TYPE; } });
49
51
  Object.defineProperty(exports, "inboxEmailPushDataSchema", { enumerable: true, get: function () { return inboxPush_1.inboxEmailPushDataSchema; } });
52
+ var userInvalidation_1 = require("./userInvalidation");
53
+ Object.defineProperty(exports, "OXY_USER_INVALIDATION_CHANNEL", { enumerable: true, get: function () { return userInvalidation_1.OXY_USER_INVALIDATION_CHANNEL; } });
54
+ Object.defineProperty(exports, "OXY_USER_CHANGE_REASONS", { enumerable: true, get: function () { return userInvalidation_1.OXY_USER_CHANGE_REASONS; } });
55
+ Object.defineProperty(exports, "OXY_PUBLISHED_USER_CHANGE_REASONS", { enumerable: true, get: function () { return userInvalidation_1.OXY_PUBLISHED_USER_CHANGE_REASONS; } });
56
+ Object.defineProperty(exports, "isPublishedOxyUserChangeReason", { enumerable: true, get: function () { return userInvalidation_1.isPublishedOxyUserChangeReason; } });
57
+ Object.defineProperty(exports, "oxyUserInvalidationEventSchema", { enumerable: true, get: function () { return userInvalidation_1.oxyUserInvalidationEventSchema; } });
50
58
  var recommendations_1 = require("./recommendations");
51
59
  // Schemas
52
60
  Object.defineProperty(exports, "recommendationExcludeTypeSchema", { enumerable: true, get: function () { return recommendations_1.recommendationExcludeTypeSchema; } });
@@ -103,6 +111,96 @@ Object.defineProperty(exports, "verifiableCredentialResponseSchema", { enumerabl
103
111
  Object.defineProperty(exports, "credentialIssueResultSchema", { enumerable: true, get: function () { return civic_1.credentialIssueResultSchema; } });
104
112
  Object.defineProperty(exports, "credentialListResultSchema", { enumerable: true, get: function () { return civic_1.credentialListResultSchema; } });
105
113
  Object.defineProperty(exports, "credentialVerifyResultSchema", { enumerable: true, get: function () { return civic_1.credentialVerifyResultSchema; } });
114
+ var reputation_1 = require("./reputation");
115
+ // Closed value sets — shared by the API's mongoose enums, the API's request
116
+ // validation, and the SDK's unions, so a new category/tier/status cannot be
117
+ // added on one side only.
118
+ Object.defineProperty(exports, "REPUTATION_CATEGORIES", { enumerable: true, get: function () { return reputation_1.REPUTATION_CATEGORIES; } });
119
+ Object.defineProperty(exports, "REPUTATION_TRANSACTION_STATUSES", { enumerable: true, get: function () { return reputation_1.REPUTATION_TRANSACTION_STATUSES; } });
120
+ Object.defineProperty(exports, "TRUST_TIERS", { enumerable: true, get: function () { return reputation_1.TRUST_TIERS; } });
121
+ Object.defineProperty(exports, "REPUTATION_TARGET_ENTITY_TYPES", { enumerable: true, get: function () { return reputation_1.REPUTATION_TARGET_ENTITY_TYPES; } });
122
+ Object.defineProperty(exports, "REPUTATION_DISPUTE_STATUSES", { enumerable: true, get: function () { return reputation_1.REPUTATION_DISPUTE_STATUSES; } });
123
+ Object.defineProperty(exports, "REPUTATION_INFLUENCE_CONTEXTS", { enumerable: true, get: function () { return reputation_1.REPUTATION_INFLUENCE_CONTEXTS; } });
124
+ // Schemas — closed value sets
125
+ Object.defineProperty(exports, "reputationCategorySchema", { enumerable: true, get: function () { return reputation_1.reputationCategorySchema; } });
126
+ Object.defineProperty(exports, "reputationTransactionStatusSchema", { enumerable: true, get: function () { return reputation_1.reputationTransactionStatusSchema; } });
127
+ Object.defineProperty(exports, "trustTierSchema", { enumerable: true, get: function () { return reputation_1.trustTierSchema; } });
128
+ Object.defineProperty(exports, "reputationTargetEntityTypeSchema", { enumerable: true, get: function () { return reputation_1.reputationTargetEntityTypeSchema; } });
129
+ Object.defineProperty(exports, "reputationDisputeStatusSchema", { enumerable: true, get: function () { return reputation_1.reputationDisputeStatusSchema; } });
130
+ Object.defineProperty(exports, "reputationInfluenceContextSchema", { enumerable: true, get: function () { return reputation_1.reputationInfluenceContextSchema; } });
131
+ // Schemas — responses
132
+ Object.defineProperty(exports, "reputationTransactionSchema", { enumerable: true, get: function () { return reputation_1.reputationTransactionSchema; } });
133
+ Object.defineProperty(exports, "reputationBalanceBreakdownSchema", { enumerable: true, get: function () { return reputation_1.reputationBalanceBreakdownSchema; } });
134
+ Object.defineProperty(exports, "reputationInfluenceSchema", { enumerable: true, get: function () { return reputation_1.reputationInfluenceSchema; } });
135
+ Object.defineProperty(exports, "reputationReliabilitySchema", { enumerable: true, get: function () { return reputation_1.reputationReliabilitySchema; } });
136
+ Object.defineProperty(exports, "reputationBalanceSummarySchema", { enumerable: true, get: function () { return reputation_1.reputationBalanceSummarySchema; } });
137
+ Object.defineProperty(exports, "reputationBalanceSchema", { enumerable: true, get: function () { return reputation_1.reputationBalanceSchema; } });
138
+ Object.defineProperty(exports, "reputationDisputeSchema", { enumerable: true, get: function () { return reputation_1.reputationDisputeSchema; } });
139
+ Object.defineProperty(exports, "reputationRuleSchema", { enumerable: true, get: function () { return reputation_1.reputationRuleSchema; } });
140
+ Object.defineProperty(exports, "reputationLeaderboardUserSchema", { enumerable: true, get: function () { return reputation_1.reputationLeaderboardUserSchema; } });
141
+ Object.defineProperty(exports, "reputationLeaderboardEntrySchema", { enumerable: true, get: function () { return reputation_1.reputationLeaderboardEntrySchema; } });
142
+ Object.defineProperty(exports, "reputationInfluenceResultSchema", { enumerable: true, get: function () { return reputation_1.reputationInfluenceResultSchema; } });
143
+ Object.defineProperty(exports, "reverseReputationTransactionResultSchema", { enumerable: true, get: function () { return reputation_1.reverseReputationTransactionResultSchema; } });
144
+ // Schemas — request bodies
145
+ Object.defineProperty(exports, "awardReputationSchema", { enumerable: true, get: function () { return reputation_1.awardReputationSchema; } });
146
+ Object.defineProperty(exports, "createReputationDisputeSchema", { enumerable: true, get: function () { return reputation_1.createReputationDisputeSchema; } });
147
+ Object.defineProperty(exports, "resolveReputationDisputeSchema", { enumerable: true, get: function () { return reputation_1.resolveReputationDisputeSchema; } });
148
+ Object.defineProperty(exports, "upsertReputationRuleSchema", { enumerable: true, get: function () { return reputation_1.upsertReputationRuleSchema; } });
149
+ Object.defineProperty(exports, "reverseReputationTransactionSchema", { enumerable: true, get: function () { return reputation_1.reverseReputationTransactionSchema; } });
150
+ // Narrows the two balance views apart at runtime.
151
+ Object.defineProperty(exports, "isFullReputationBalance", { enumerable: true, get: function () { return reputation_1.isFullReputationBalance; } });
152
+ var moderationReputation_1 = require("./moderationReputation");
153
+ // Closed value sets — the moderation reputation bridge (CrowdSource → Oxy Trust).
154
+ Object.defineProperty(exports, "MODERATION_SEVERITIES", { enumerable: true, get: function () { return moderationReputation_1.MODERATION_SEVERITIES; } });
155
+ Object.defineProperty(exports, "MODERATION_FINDING_SCOPES", { enumerable: true, get: function () { return moderationReputation_1.MODERATION_FINDING_SCOPES; } });
156
+ Object.defineProperty(exports, "MODERATION_ATTRIBUTIONS", { enumerable: true, get: function () { return moderationReputation_1.MODERATION_ATTRIBUTIONS; } });
157
+ Object.defineProperty(exports, "MODERATION_DECISION_STATUSES", { enumerable: true, get: function () { return moderationReputation_1.MODERATION_DECISION_STATUSES; } });
158
+ Object.defineProperty(exports, "MODERATION_EFFECT_TYPES", { enumerable: true, get: function () { return moderationReputation_1.MODERATION_EFFECT_TYPES; } });
159
+ Object.defineProperty(exports, "MODERATION_EFFECT_STATUSES", { enumerable: true, get: function () { return moderationReputation_1.MODERATION_EFFECT_STATUSES; } });
160
+ Object.defineProperty(exports, "MODERATION_EFFECT_SKIP_REASONS", { enumerable: true, get: function () { return moderationReputation_1.MODERATION_EFFECT_SKIP_REASONS; } });
161
+ Object.defineProperty(exports, "CONDUCT_STRIKE_STATUSES", { enumerable: true, get: function () { return moderationReputation_1.CONDUCT_STRIKE_STATUSES; } });
162
+ Object.defineProperty(exports, "CONDUCT_STANDINGS", { enumerable: true, get: function () { return moderationReputation_1.CONDUCT_STANDINGS; } });
163
+ Object.defineProperty(exports, "CONTRIBUTION_TIERS", { enumerable: true, get: function () { return moderationReputation_1.CONTRIBUTION_TIERS; } });
164
+ Object.defineProperty(exports, "PERSONHOOD_STATUSES", { enumerable: true, get: function () { return moderationReputation_1.PERSONHOOD_STATUSES; } });
165
+ Object.defineProperty(exports, "IDENTITY_BINDING_TYPES", { enumerable: true, get: function () { return moderationReputation_1.IDENTITY_BINDING_TYPES; } });
166
+ Object.defineProperty(exports, "IDENTITY_BINDING_STATUSES", { enumerable: true, get: function () { return moderationReputation_1.IDENTITY_BINDING_STATUSES; } });
167
+ Object.defineProperty(exports, "APPLICATION_MODERATION_STANDINGS", { enumerable: true, get: function () { return moderationReputation_1.APPLICATION_MODERATION_STANDINGS; } });
168
+ // Schemas — closed value sets
169
+ Object.defineProperty(exports, "moderationSeveritySchema", { enumerable: true, get: function () { return moderationReputation_1.moderationSeveritySchema; } });
170
+ Object.defineProperty(exports, "moderationFindingScopeSchema", { enumerable: true, get: function () { return moderationReputation_1.moderationFindingScopeSchema; } });
171
+ Object.defineProperty(exports, "moderationAttributionSchema", { enumerable: true, get: function () { return moderationReputation_1.moderationAttributionSchema; } });
172
+ Object.defineProperty(exports, "moderationDecisionStatusSchema", { enumerable: true, get: function () { return moderationReputation_1.moderationDecisionStatusSchema; } });
173
+ Object.defineProperty(exports, "moderationEffectTypeSchema", { enumerable: true, get: function () { return moderationReputation_1.moderationEffectTypeSchema; } });
174
+ Object.defineProperty(exports, "moderationEffectStatusSchema", { enumerable: true, get: function () { return moderationReputation_1.moderationEffectStatusSchema; } });
175
+ Object.defineProperty(exports, "moderationEffectSkipReasonSchema", { enumerable: true, get: function () { return moderationReputation_1.moderationEffectSkipReasonSchema; } });
176
+ Object.defineProperty(exports, "conductStrikeStatusSchema", { enumerable: true, get: function () { return moderationReputation_1.conductStrikeStatusSchema; } });
177
+ Object.defineProperty(exports, "conductStandingSchema", { enumerable: true, get: function () { return moderationReputation_1.conductStandingSchema; } });
178
+ Object.defineProperty(exports, "contributionTierSchema", { enumerable: true, get: function () { return moderationReputation_1.contributionTierSchema; } });
179
+ Object.defineProperty(exports, "personhoodStatusSchema", { enumerable: true, get: function () { return moderationReputation_1.personhoodStatusSchema; } });
180
+ Object.defineProperty(exports, "identityBindingTypeSchema", { enumerable: true, get: function () { return moderationReputation_1.identityBindingTypeSchema; } });
181
+ Object.defineProperty(exports, "identityBindingStatusSchema", { enumerable: true, get: function () { return moderationReputation_1.identityBindingStatusSchema; } });
182
+ Object.defineProperty(exports, "applicationModerationStandingSchema", { enumerable: true, get: function () { return moderationReputation_1.applicationModerationStandingSchema; } });
183
+ // Schemas — the event and its receipt
184
+ Object.defineProperty(exports, "moderationFindingSchema", { enumerable: true, get: function () { return moderationReputation_1.moderationFindingSchema; } });
185
+ Object.defineProperty(exports, "moderationDecisionEventSubjectSchema", { enumerable: true, get: function () { return moderationReputation_1.moderationDecisionEventSubjectSchema; } });
186
+ Object.defineProperty(exports, "moderationPolicyVersionsSchema", { enumerable: true, get: function () { return moderationReputation_1.moderationPolicyVersionsSchema; } });
187
+ Object.defineProperty(exports, "moderationDecisionEventSchema", { enumerable: true, get: function () { return moderationReputation_1.moderationDecisionEventSchema; } });
188
+ Object.defineProperty(exports, "finalizeModerationDecisionSchema", { enumerable: true, get: function () { return moderationReputation_1.finalizeModerationDecisionSchema; } });
189
+ Object.defineProperty(exports, "reverseModerationEffectSchema", { enumerable: true, get: function () { return moderationReputation_1.reverseModerationEffectSchema; } });
190
+ Object.defineProperty(exports, "moderationEffectSchema", { enumerable: true, get: function () { return moderationReputation_1.moderationEffectSchema; } });
191
+ Object.defineProperty(exports, "applyModerationDecisionResultSchema", { enumerable: true, get: function () { return moderationReputation_1.applyModerationDecisionResultSchema; } });
192
+ Object.defineProperty(exports, "reverseModerationEffectResultSchema", { enumerable: true, get: function () { return moderationReputation_1.reverseModerationEffectResultSchema; } });
193
+ // Schemas — identity binding
194
+ Object.defineProperty(exports, "registerIdentityBindingSchema", { enumerable: true, get: function () { return moderationReputation_1.registerIdentityBindingSchema; } });
195
+ Object.defineProperty(exports, "identityBindingSchema", { enumerable: true, get: function () { return moderationReputation_1.identityBindingSchema; } });
196
+ // Schemas — the derived V2 axes
197
+ Object.defineProperty(exports, "reputationPersonhoodSchema", { enumerable: true, get: function () { return moderationReputation_1.reputationPersonhoodSchema; } });
198
+ Object.defineProperty(exports, "reputationContributionSchema", { enumerable: true, get: function () { return moderationReputation_1.reputationContributionSchema; } });
199
+ Object.defineProperty(exports, "reputationConductSchema", { enumerable: true, get: function () { return moderationReputation_1.reputationConductSchema; } });
200
+ Object.defineProperty(exports, "reputationReportingSchema", { enumerable: true, get: function () { return moderationReputation_1.reputationReportingSchema; } });
201
+ Object.defineProperty(exports, "reputationReviewingSchema", { enumerable: true, get: function () { return moderationReputation_1.reputationReviewingSchema; } });
202
+ Object.defineProperty(exports, "reputationContextualInfluenceSchema", { enumerable: true, get: function () { return moderationReputation_1.reputationContextualInfluenceSchema; } });
203
+ Object.defineProperty(exports, "applicationModerationTrustSchema", { enumerable: true, get: function () { return moderationReputation_1.applicationModerationTrustSchema; } });
106
204
  var links_1 = require("./links");
107
205
  // Schemas
108
206
  Object.defineProperty(exports, "linkPreviewSchema", { enumerable: true, get: function () { return links_1.linkPreviewSchema; } });
@@ -116,6 +214,9 @@ Object.defineProperty(exports, "activeTokenSchema", { enumerable: true, get: fun
116
214
  Object.defineProperty(exports, "deviceSessionSyncSchema", { enumerable: true, get: function () { return deviceSession_1.deviceSessionSyncSchema; } });
117
215
  Object.defineProperty(exports, "deviceTokenMintRequestSchema", { enumerable: true, get: function () { return deviceSession_1.deviceTokenMintRequestSchema; } });
118
216
  Object.defineProperty(exports, "deviceTokenMintResponseSchema", { enumerable: true, get: function () { return deviceSession_1.deviceTokenMintResponseSchema; } });
217
+ Object.defineProperty(exports, "deviceBackgroundCredentialResponseSchema", { enumerable: true, get: function () { return deviceSession_1.deviceBackgroundCredentialResponseSchema; } });
218
+ Object.defineProperty(exports, "deviceBackgroundTokenRequestSchema", { enumerable: true, get: function () { return deviceSession_1.deviceBackgroundTokenRequestSchema; } });
219
+ Object.defineProperty(exports, "deviceBackgroundTokenResponseSchema", { enumerable: true, get: function () { return deviceSession_1.deviceBackgroundTokenResponseSchema; } });
119
220
  Object.defineProperty(exports, "SESSION_ACCOUNTS_CHANGED_EVENT", { enumerable: true, get: function () { return deviceSession_1.SESSION_ACCOUNTS_CHANGED_EVENT; } });
120
221
  Object.defineProperty(exports, "sessionAccountsChangedReasonSchema", { enumerable: true, get: function () { return deviceSession_1.sessionAccountsChangedReasonSchema; } });
121
222
  Object.defineProperty(exports, "sessionAccountsChangedEventSchema", { enumerable: true, get: function () { return deviceSession_1.sessionAccountsChangedEventSchema; } });
@@ -0,0 +1,298 @@
1
+ "use strict";
2
+ /**
3
+ * Oxy Trust — the moderation reputation bridge (CrowdSource → Oxy Trust).
4
+ *
5
+ * SINGLE SOURCE OF TRUTH for the wire shapes crossing the one-way boundary
6
+ * between a participatory-moderation service and the Oxy reputation ledger.
7
+ *
8
+ * The direction is not negotiable: a moderation service NEVER writes reputation.
9
+ * It emits an authenticated internal event describing a decision it published,
10
+ * and Oxy's own consequence engine validates that event and derives the effect.
11
+ * Everything in this module is therefore either (a) the event, (b) the receipt
12
+ * the engine returns, or (c) the derived state the engine publishes back to the
13
+ * subject.
14
+ *
15
+ * Design anchors, all load-bearing:
16
+ *
17
+ * - **Conduct is a separate axis from contribution.** A conduct penalty raises
18
+ * `activeRisk` and creates a strike; positive contribution points can never
19
+ * cancel a strike, because standing is derived from active risk and not from
20
+ * the point total. See {@link ReputationConduct}.
21
+ * - **The reporting axis carries only reporting signals.** `abuseScore` on the
22
+ * legacy reliability block conflated rejected reports with every negative
23
+ * transaction; {@link ReputationReporting} exists so a conduct penalty can
24
+ * never inflate a report-abuse figure.
25
+ * - **No binding proof, no effect.** {@link ModerationDecisionEventSubject}
26
+ * requires a `bindingProofId`, and the engine rejects an event whose binding
27
+ * does not resolve to the claimed principal at or before `occurredAt`. An
28
+ * application cannot move a reputation figure by naming a user id.
29
+ * - **One penalty per incident.** The idempotency key is
30
+ * `moderation:<incidentId>:<decisionRevision>:<effectType>`; a hundred
31
+ * reports about the same material produce one effect.
32
+ * - **Every effect carries the policy version it was decided under**, so a
33
+ * consequence can be recomputed under the original policy rather than under
34
+ * whatever the current tuning happens to be.
35
+ *
36
+ * Platform-agnostic — zod only. ESM-safe (no `require()`).
37
+ */
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.applicationModerationTrustSchema = exports.reputationContextualInfluenceSchema = exports.reputationReviewingSchema = exports.reputationReportingSchema = exports.reputationConductSchema = exports.reputationContributionSchema = exports.reputationPersonhoodSchema = exports.identityBindingSchema = exports.registerIdentityBindingSchema = exports.reverseModerationEffectResultSchema = exports.applyModerationDecisionResultSchema = exports.moderationEffectSchema = exports.reverseModerationEffectSchema = exports.finalizeModerationDecisionSchema = exports.moderationDecisionEventSchema = exports.moderationPolicyVersionsSchema = exports.moderationDecisionEventSubjectSchema = exports.moderationFindingSchema = exports.moderationEffectSkipReasonSchema = exports.MODERATION_EFFECT_SKIP_REASONS = exports.applicationModerationStandingSchema = exports.APPLICATION_MODERATION_STANDINGS = exports.identityBindingStatusSchema = exports.IDENTITY_BINDING_STATUSES = exports.identityBindingTypeSchema = exports.IDENTITY_BINDING_TYPES = exports.personhoodStatusSchema = exports.PERSONHOOD_STATUSES = exports.contributionTierSchema = exports.CONTRIBUTION_TIERS = exports.conductStandingSchema = exports.CONDUCT_STANDINGS = exports.conductStrikeStatusSchema = exports.CONDUCT_STRIKE_STATUSES = exports.moderationEffectStatusSchema = exports.MODERATION_EFFECT_STATUSES = exports.moderationEffectTypeSchema = exports.MODERATION_EFFECT_TYPES = exports.moderationDecisionStatusSchema = exports.MODERATION_DECISION_STATUSES = exports.moderationAttributionSchema = exports.MODERATION_ATTRIBUTIONS = exports.moderationFindingScopeSchema = exports.MODERATION_FINDING_SCOPES = exports.moderationSeveritySchema = exports.MODERATION_SEVERITIES = void 0;
40
+ const zod_1 = require("zod");
41
+ /* -------------------------------------------------------------------------- */
42
+ /* Closed value sets */
43
+ /* -------------------------------------------------------------------------- */
44
+ /**
45
+ * Severity band of a moderation finding, lowest → highest.
46
+ *
47
+ * The band — not the taxonomy code — is what the consequence engine consumes:
48
+ * points, active risk and expiry are all keyed by severity in the versioned
49
+ * conduct policy, so a new taxonomy code needs no engine change and no
50
+ * intimate category ever reaches the ledger.
51
+ */
52
+ exports.MODERATION_SEVERITIES = ['low', 'medium', 'high', 'critical'];
53
+ exports.moderationSeveritySchema = zod_1.z.enum(exports.MODERATION_SEVERITIES);
54
+ /**
55
+ * How far a finding reaches.
56
+ *
57
+ * - `application_local` — the application enforces locally; Oxy Trust is NOT
58
+ * touched. Emitted for completeness; the engine rejects the effect.
59
+ * - `oxy_network` — conduct against the Oxy network as a whole.
60
+ * - `identity_integrity` — impersonation, sybil behaviour, credential abuse.
61
+ *
62
+ * Only `oxy_network` and `identity_integrity` can produce a global effect.
63
+ */
64
+ exports.MODERATION_FINDING_SCOPES = [
65
+ 'application_local',
66
+ 'oxy_network',
67
+ 'identity_integrity',
68
+ ];
69
+ exports.moderationFindingScopeSchema = zod_1.z.enum(exports.MODERATION_FINDING_SCOPES);
70
+ /** Which participant in the reported material the finding attributes to. */
71
+ exports.MODERATION_ATTRIBUTIONS = ['author', 'sharer', 'reporter', 'reviewer'];
72
+ exports.moderationAttributionSchema = zod_1.z.enum(exports.MODERATION_ATTRIBUTIONS);
73
+ /**
74
+ * Lifecycle of the decision the event describes.
75
+ *
76
+ * `inconclusive` is its own outcome and never collapses into "no violation";
77
+ * it simply produces no effect. `superseded` and `corrected` describe a
78
+ * revision that a later one replaced — an event in either state is rejected,
79
+ * because applying it would resurrect a consequence the appeal removed.
80
+ */
81
+ exports.MODERATION_DECISION_STATUSES = [
82
+ 'provisional',
83
+ 'final',
84
+ 'inconclusive',
85
+ 'superseded',
86
+ 'corrected',
87
+ ];
88
+ exports.moderationDecisionStatusSchema = zod_1.z.enum(exports.MODERATION_DECISION_STATUSES);
89
+ /**
90
+ * The kind of consequence an effect carries. Each is its own axis, and the
91
+ * idempotency key includes it — one incident may legitimately produce a conduct
92
+ * effect for the author AND a report-abuse effect for a malicious reporter.
93
+ */
94
+ exports.MODERATION_EFFECT_TYPES = [
95
+ 'conduct_penalty',
96
+ 'report_abuse_penalty',
97
+ 'review_abuse_penalty',
98
+ ];
99
+ exports.moderationEffectTypeSchema = zod_1.z.enum(exports.MODERATION_EFFECT_TYPES);
100
+ /** Lifecycle of a stored effect. */
101
+ exports.MODERATION_EFFECT_STATUSES = ['applied', 'reversed'];
102
+ exports.moderationEffectStatusSchema = zod_1.z.enum(exports.MODERATION_EFFECT_STATUSES);
103
+ /** Lifecycle of a conduct strike. Only `active` strikes carry active risk. */
104
+ exports.CONDUCT_STRIKE_STATUSES = ['active', 'expired', 'reversed'];
105
+ exports.conductStrikeStatusSchema = zod_1.z.enum(exports.CONDUCT_STRIKE_STATUSES);
106
+ /**
107
+ * Conduct standing, derived from ACTIVE RISK and nothing else.
108
+ *
109
+ * Deliberately independent of the point total: a person may hold a high
110
+ * contribution tier and a `limited` standing at the same time, and earning
111
+ * points cannot move standing back toward `good`. Only expiry or reversal can.
112
+ */
113
+ exports.CONDUCT_STANDINGS = ['good', 'watch', 'limited', 'restricted'];
114
+ exports.conductStandingSchema = zod_1.z.enum(exports.CONDUCT_STANDINGS);
115
+ /** Contribution tier, derived from contribution points only. */
116
+ exports.CONTRIBUTION_TIERS = ['new', 'trusted', 'high_trust'];
117
+ exports.contributionTierSchema = zod_1.z.enum(exports.CONTRIBUTION_TIERS);
118
+ /** Personhood status. Being a real person proves neither conduct nor competence. */
119
+ exports.PERSONHOOD_STATUSES = ['unknown', 'probable', 'verified'];
120
+ exports.personhoodStatusSchema = zod_1.z.enum(exports.PERSONHOOD_STATUSES);
121
+ /**
122
+ * How an Oxy identity was bound to the actor an application reported.
123
+ *
124
+ * - `oauth_grant` — the user authorized the application through Oxy's own
125
+ * OAuth flow. Oxy wrote the record; the application asserts nothing.
126
+ * - `session_proof` — the application presented the USER'S OWN Oxy access
127
+ * token alongside its service credential, proving the user was present in
128
+ * that application under a named local principal id.
129
+ * - `commons_signature` — a DID-verifiable signature over a server-issued nonce.
130
+ * - `federated_actor` — a resolvable, authorized federated actor link.
131
+ */
132
+ exports.IDENTITY_BINDING_TYPES = [
133
+ 'oauth_grant',
134
+ 'session_proof',
135
+ 'commons_signature',
136
+ 'federated_actor',
137
+ ];
138
+ exports.identityBindingTypeSchema = zod_1.z.enum(exports.IDENTITY_BINDING_TYPES);
139
+ /** Binding lifecycle. A revoked binding proves nothing about a later action. */
140
+ exports.IDENTITY_BINDING_STATUSES = ['active', 'revoked'];
141
+ exports.identityBindingStatusSchema = zod_1.z.enum(exports.IDENTITY_BINDING_STATUSES);
142
+ /**
143
+ * An application's own moderation standing. An external application can abuse
144
+ * the system too, so it carries standing exactly like a person does.
145
+ *
146
+ * `sandbox` applications moderate locally and produce NO global effect.
147
+ */
148
+ exports.APPLICATION_MODERATION_STANDINGS = ['sandbox', 'trusted', 'restricted'];
149
+ exports.applicationModerationStandingSchema = zod_1.z.enum(exports.APPLICATION_MODERATION_STANDINGS);
150
+ /**
151
+ * Why the engine declined to apply an effect.
152
+ *
153
+ * Returned rather than thrown for the cases that are a legitimate outcome of a
154
+ * well-formed event (a sandboxed application, a local-only finding, an
155
+ * inconclusive decision): the emitter must be able to record "delivered, no
156
+ * effect" and stop retrying. Malformed or unauthorized events are HTTP errors,
157
+ * not skip reasons.
158
+ */
159
+ exports.MODERATION_EFFECT_SKIP_REASONS = [
160
+ 'no_binding_proof',
161
+ 'binding_after_action',
162
+ 'binding_principal_mismatch',
163
+ 'binding_revoked',
164
+ 'decision_not_effective',
165
+ 'decision_superseded',
166
+ 'finding_scope_local',
167
+ 'finding_not_in_policy',
168
+ 'application_not_permitted',
169
+ 'no_effective_finding',
170
+ ];
171
+ exports.moderationEffectSkipReasonSchema = zod_1.z.enum(exports.MODERATION_EFFECT_SKIP_REASONS);
172
+ exports.moderationFindingSchema = zod_1.z.object({
173
+ code: zod_1.z.string().trim().min(1).max(200),
174
+ severity: exports.moderationSeveritySchema,
175
+ scope: exports.moderationFindingScopeSchema,
176
+ attribution: exports.moderationAttributionSchema,
177
+ family: zod_1.z.string().trim().min(1).max(100),
178
+ });
179
+ exports.moderationDecisionEventSubjectSchema = zod_1.z.object({
180
+ principalType: zod_1.z.literal('oxy_user'),
181
+ principalId: zod_1.z.string().trim().min(1),
182
+ bindingProofId: zod_1.z.string().trim().min(1),
183
+ });
184
+ exports.moderationPolicyVersionsSchema = zod_1.z.object({
185
+ universal: zod_1.z.string().trim().min(1).max(100),
186
+ application: zod_1.z.string().trim().min(1).max(100),
187
+ oxyConduct: zod_1.z.string().trim().min(1).max(100),
188
+ });
189
+ exports.moderationDecisionEventSchema = zod_1.z.object({
190
+ eventId: zod_1.z.string().trim().min(1).max(200),
191
+ reportedApplicationId: zod_1.z.string().trim().min(1).max(200),
192
+ type: zod_1.z.string().trim().min(1).max(200),
193
+ caseId: zod_1.z.string().trim().min(1).max(200),
194
+ incidentId: zod_1.z.string().trim().min(1).max(200),
195
+ decisionId: zod_1.z.string().trim().min(1).max(200),
196
+ decisionRevision: zod_1.z.number().int().min(1),
197
+ subject: exports.moderationDecisionEventSubjectSchema,
198
+ findings: zod_1.z.array(exports.moderationFindingSchema).min(1).max(20),
199
+ decisionStatus: exports.moderationDecisionStatusSchema,
200
+ policyVersions: exports.moderationPolicyVersionsSchema,
201
+ occurredAt: zod_1.z.string().trim().min(1),
202
+ proofHash: zod_1.z.string().trim().min(1).max(200),
203
+ });
204
+ exports.finalizeModerationDecisionSchema = zod_1.z.object({
205
+ decisionId: zod_1.z.string().trim().min(1).max(200),
206
+ decisionRevision: zod_1.z.number().int().min(1),
207
+ });
208
+ exports.reverseModerationEffectSchema = zod_1.z.object({
209
+ decisionId: zod_1.z.string().trim().min(1).max(200),
210
+ decisionRevision: zod_1.z.number().int().min(1),
211
+ reason: zod_1.z.string().trim().min(1).max(500),
212
+ });
213
+ exports.moderationEffectSchema = zod_1.z.object({
214
+ id: zod_1.z.string(),
215
+ incidentId: zod_1.z.string(),
216
+ caseId: zod_1.z.string(),
217
+ decisionId: zod_1.z.string(),
218
+ decisionRevision: zod_1.z.number(),
219
+ principalId: zod_1.z.string(),
220
+ effectType: exports.moderationEffectTypeSchema,
221
+ status: exports.moderationEffectStatusSchema,
222
+ points: zod_1.z.number(),
223
+ activeRisk: zod_1.z.number(),
224
+ severity: exports.moderationSeveritySchema,
225
+ repetitionMultiplier: zod_1.z.number(),
226
+ multiFindingMultiplier: zod_1.z.number(),
227
+ idempotencyKey: zod_1.z.string(),
228
+ transactionId: zod_1.z.string(),
229
+ strikeId: zod_1.z.string().optional(),
230
+ reversalTransactionId: zod_1.z.string().optional(),
231
+ policyVersions: exports.moderationPolicyVersionsSchema,
232
+ appliedAt: zod_1.z.string(),
233
+ reversedAt: zod_1.z.string().optional(),
234
+ });
235
+ exports.applyModerationDecisionResultSchema = zod_1.z.object({
236
+ applied: zod_1.z.boolean(),
237
+ effect: exports.moderationEffectSchema.optional(),
238
+ skipReason: exports.moderationEffectSkipReasonSchema.optional(),
239
+ idempotent: zod_1.z.boolean(),
240
+ });
241
+ exports.reverseModerationEffectResultSchema = zod_1.z.object({
242
+ reversed: zod_1.z.array(exports.moderationEffectSchema),
243
+ idempotent: zod_1.z.boolean(),
244
+ });
245
+ exports.registerIdentityBindingSchema = zod_1.z.object({
246
+ localPrincipalId: zod_1.z.string().trim().min(1).max(200),
247
+ userProofToken: zod_1.z.string().trim().min(1),
248
+ });
249
+ exports.identityBindingSchema = zod_1.z.object({
250
+ id: zod_1.z.string(),
251
+ applicationId: zod_1.z.string(),
252
+ userId: zod_1.z.string(),
253
+ localPrincipalId: zod_1.z.string(),
254
+ bindingType: exports.identityBindingTypeSchema,
255
+ status: exports.identityBindingStatusSchema,
256
+ verifiedAt: zod_1.z.string(),
257
+ createdAt: zod_1.z.string(),
258
+ });
259
+ exports.reputationPersonhoodSchema = zod_1.z.object({
260
+ status: exports.personhoodStatusSchema,
261
+ score: zod_1.z.number(),
262
+ });
263
+ exports.reputationContributionSchema = zod_1.z.object({
264
+ points: zod_1.z.number(),
265
+ tier: exports.contributionTierSchema,
266
+ });
267
+ exports.reputationConductSchema = zod_1.z.object({
268
+ standing: exports.conductStandingSchema,
269
+ activeRisk: zod_1.z.number(),
270
+ activeStrikes: zod_1.z.number(),
271
+ nextExpiryAt: zod_1.z.string().optional(),
272
+ });
273
+ exports.reputationReportingSchema = zod_1.z.object({
274
+ reliability: zod_1.z.number(),
275
+ confidence: zod_1.z.number(),
276
+ confirmed: zod_1.z.number(),
277
+ rejected: zod_1.z.number(),
278
+ malicious: zod_1.z.number(),
279
+ });
280
+ exports.reputationReviewingSchema = zod_1.z.object({
281
+ globalReliability: zod_1.z.number(),
282
+ categoryReliability: zod_1.z.record(zod_1.z.number()),
283
+ languageReliability: zod_1.z.record(zod_1.z.number()),
284
+ });
285
+ exports.reputationContextualInfluenceSchema = zod_1.z.object({
286
+ reportPriorityWeight: zod_1.z.number(),
287
+ reviewSelectionWeight: zod_1.z.number(),
288
+ rankingWeight: zod_1.z.number(),
289
+ });
290
+ exports.applicationModerationTrustSchema = zod_1.z.object({
291
+ applicationId: zod_1.z.string(),
292
+ standing: exports.applicationModerationStandingSchema,
293
+ evidenceIntegrity: zod_1.z.number(),
294
+ identityBindingReliability: zod_1.z.number(),
295
+ decisionOverturnRate: zod_1.z.number(),
296
+ policyQuality: zod_1.z.number(),
297
+ globalReputationEffectsAllowed: zod_1.z.boolean(),
298
+ });