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