@oxyhq/contracts 0.2.1 → 0.4.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/civic.js +163 -0
- package/dist/cjs/identity.js +216 -0
- package/dist/cjs/index.js +36 -1
- package/dist/cjs/userResponse.js +18 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/civic.js +160 -0
- package/dist/esm/identity.js +213 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/userResponse.js +18 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/civic.d.ts +338 -0
- package/dist/types/identity.d.ts +279 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/recommendations.d.ts +14 -14
- package/dist/types/sessionStatus.d.ts +2 -2
- package/dist/types/userResponse.d.ts +379 -22
- package/package.json +1 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Civic / Commons API contracts (Fase 1 — DNI + crypto-owned reputation).
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH for the wire shape of the public "DNI" card a Commons
|
|
5
|
+
* user shows (and others scan): the user's DID, display identity, trust tier,
|
|
6
|
+
* personhood status, verified domains, and credential badges — sealed with an
|
|
7
|
+
* Oxy custodial attestation so a scanner can verify it OFFLINE against the Oxy
|
|
8
|
+
* public key (the same `ES256K-DER-SHA256` scheme as the signed data export).
|
|
9
|
+
*
|
|
10
|
+
* The QR encodes ONLY the DID (`oxydni://card?did=…`) — never trust data — so a
|
|
11
|
+
* card cannot be spoofed by crafting a QR; the scanner resolves the signed card
|
|
12
|
+
* server-side and verifies the Oxy signature. The attestation is computed over
|
|
13
|
+
* the canonical-JSON of the `card` object, so a consumer re-canonicalizes the
|
|
14
|
+
* card it received and verifies `attestation.signature` against
|
|
15
|
+
* `attestation.publicKey` (which MUST be a current verification method of the
|
|
16
|
+
* Oxy DID).
|
|
17
|
+
*
|
|
18
|
+
* Explicit-`interface` exports (PublicCard, SignedPublicCard) follow the same
|
|
19
|
+
* node-resolution rationale as `UserNameResponse` / the identity contracts: a
|
|
20
|
+
* nested `z.infer<>` can degrade to `{}` under a consumer's
|
|
21
|
+
* `moduleResolution: "node"`, so the load-bearing shapes are declared as literal
|
|
22
|
+
* interfaces and the runtime schemas are annotated `z.ZodType<Interface>`.
|
|
23
|
+
*
|
|
24
|
+
* The `attestation` reuses the export-bundle `ExportAttestation` shape from
|
|
25
|
+
* `./identity` (mirrored, not duplicated): `{ issuer, publicKey, alg, signature,
|
|
26
|
+
* signedAt }`. It is `null` ONLY when the Oxy signing key is unconfigured (dev).
|
|
27
|
+
*
|
|
28
|
+
* Platform-agnostic — zod only, no react/react-native/expo, ESM-safe.
|
|
29
|
+
*/
|
|
30
|
+
import { z } from 'zod';
|
|
31
|
+
import { exportAttestationSchema } from './identity.js';
|
|
32
|
+
export const publicCardSchema = z.object({
|
|
33
|
+
did: z.string(),
|
|
34
|
+
userId: z.string(),
|
|
35
|
+
name: z.string(),
|
|
36
|
+
username: z.string().optional(),
|
|
37
|
+
avatarUrl: z.string().optional(),
|
|
38
|
+
trustTier: z.enum(['restricted', 'new', 'trusted', 'high_trust', 'verified']),
|
|
39
|
+
personhoodStatus: z.enum(['unverified', 'pending', 'verified']),
|
|
40
|
+
verifiedDomains: z.array(z.string()),
|
|
41
|
+
credentialBadges: z.array(z.string()),
|
|
42
|
+
issuedAt: z.number(),
|
|
43
|
+
});
|
|
44
|
+
export const signedPublicCardSchema = z.object({
|
|
45
|
+
card: publicCardSchema,
|
|
46
|
+
attestation: exportAttestationSchema.nullable(),
|
|
47
|
+
});
|
|
48
|
+
export const realLifeAttestationRecordSchema = z.object({
|
|
49
|
+
about: z.string(),
|
|
50
|
+
context: z.string(),
|
|
51
|
+
nonce: z.string(),
|
|
52
|
+
exp: z.number(),
|
|
53
|
+
geohash: z.string().optional(),
|
|
54
|
+
biometricOk: z.boolean().optional(),
|
|
55
|
+
});
|
|
56
|
+
export const realLifeAttestationResultSchema = z.object({
|
|
57
|
+
accepted: z.literal(true),
|
|
58
|
+
recordId: z.string(),
|
|
59
|
+
subjectUserId: z.string(),
|
|
60
|
+
attestorUserId: z.string(),
|
|
61
|
+
points: z.number(),
|
|
62
|
+
});
|
|
63
|
+
export const validationVerdictRecordSchema = z.object({
|
|
64
|
+
requestId: z.string(),
|
|
65
|
+
payloadHash: z.string(),
|
|
66
|
+
verdict: z.enum(['valid', 'invalid', 'abstain']),
|
|
67
|
+
});
|
|
68
|
+
/** Request body for opening a validation request (`POST /civic/validations`). */
|
|
69
|
+
export const validationOpenRequestSchema = z.object({
|
|
70
|
+
subjectUserId: z.string(),
|
|
71
|
+
actionType: z.string().min(1),
|
|
72
|
+
sourceActionId: z.string().min(1),
|
|
73
|
+
payload: z.record(z.unknown()),
|
|
74
|
+
highValue: z.boolean().optional(),
|
|
75
|
+
});
|
|
76
|
+
export const validationOpenResultSchema = z.object({
|
|
77
|
+
requestId: z.string(),
|
|
78
|
+
selectedValidatorCount: z.number(),
|
|
79
|
+
expiresAt: z.string(),
|
|
80
|
+
});
|
|
81
|
+
export const validationRequestSummarySchema = z.object({
|
|
82
|
+
id: z.string(),
|
|
83
|
+
subjectUserId: z.string(),
|
|
84
|
+
actionType: z.string(),
|
|
85
|
+
payload: z.record(z.unknown()),
|
|
86
|
+
payloadHash: z.string(),
|
|
87
|
+
status: z.enum(['pending', 'quorum_met', 'validated', 'rejected', 'expired']),
|
|
88
|
+
highValue: z.boolean(),
|
|
89
|
+
expiresAt: z.string(),
|
|
90
|
+
});
|
|
91
|
+
export const validationVoteResultSchema = z.object({
|
|
92
|
+
recorded: z.literal(true),
|
|
93
|
+
requestId: z.string(),
|
|
94
|
+
verdict: z.enum(['valid', 'invalid', 'abstain']),
|
|
95
|
+
status: z.enum(['pending', 'quorum_met', 'validated', 'rejected', 'expired']),
|
|
96
|
+
});
|
|
97
|
+
export const personhoodVouchRecordSchema = z.object({
|
|
98
|
+
about: z.string(),
|
|
99
|
+
context: z.string().optional(),
|
|
100
|
+
stake: z.number().optional(),
|
|
101
|
+
});
|
|
102
|
+
export const personhoodBreakdownSchema = z.object({
|
|
103
|
+
vouchSignal: z.number(),
|
|
104
|
+
realLifeSignal: z.number(),
|
|
105
|
+
biometricSignal: z.number(),
|
|
106
|
+
evidence: z.number(),
|
|
107
|
+
sybilPenalty: z.number(),
|
|
108
|
+
seed: z.boolean(),
|
|
109
|
+
});
|
|
110
|
+
export const personhoodStatusResultSchema = z.object({
|
|
111
|
+
userId: z.string(),
|
|
112
|
+
score: z.number(),
|
|
113
|
+
isRealPerson: z.boolean(),
|
|
114
|
+
vouchCount: z.number(),
|
|
115
|
+
realLifeCount: z.number(),
|
|
116
|
+
biometricBound: z.boolean(),
|
|
117
|
+
sybilPenalty: z.number(),
|
|
118
|
+
breakdown: personhoodBreakdownSchema.nullable(),
|
|
119
|
+
updatedAt: z.string().nullable(),
|
|
120
|
+
});
|
|
121
|
+
export const vouchResultSchema = z.object({
|
|
122
|
+
accepted: z.literal(true),
|
|
123
|
+
recordId: z.string(),
|
|
124
|
+
subjectUserId: z.string(),
|
|
125
|
+
voucherUserId: z.string(),
|
|
126
|
+
stakeAmount: z.number(),
|
|
127
|
+
points: z.number(),
|
|
128
|
+
});
|
|
129
|
+
export const credentialRecordSchema = z.object({
|
|
130
|
+
about: z.string(),
|
|
131
|
+
types: z.array(z.string().min(1)).min(1),
|
|
132
|
+
claims: z.record(z.unknown()),
|
|
133
|
+
expiresAt: z.number().optional(),
|
|
134
|
+
});
|
|
135
|
+
export const verifiableCredentialResponseSchema = z.object({
|
|
136
|
+
id: z.string(),
|
|
137
|
+
recordId: z.string(),
|
|
138
|
+
holderUserId: z.string(),
|
|
139
|
+
holderDid: z.string(),
|
|
140
|
+
issuerUserId: z.string().optional(),
|
|
141
|
+
issuerDid: z.string(),
|
|
142
|
+
types: z.array(z.string()),
|
|
143
|
+
claims: z.record(z.unknown()),
|
|
144
|
+
status: z.enum(['active', 'revoked', 'expired']),
|
|
145
|
+
issuedAt: z.number(),
|
|
146
|
+
expiresAt: z.number().optional(),
|
|
147
|
+
revokedAt: z.number().optional(),
|
|
148
|
+
});
|
|
149
|
+
export const credentialIssueResultSchema = z.object({
|
|
150
|
+
accepted: z.literal(true),
|
|
151
|
+
credential: verifiableCredentialResponseSchema,
|
|
152
|
+
});
|
|
153
|
+
export const credentialListResultSchema = z.object({
|
|
154
|
+
credentials: z.array(verifiableCredentialResponseSchema),
|
|
155
|
+
});
|
|
156
|
+
export const credentialVerifyResultSchema = z.object({
|
|
157
|
+
valid: z.boolean(),
|
|
158
|
+
reason: z.string().optional(),
|
|
159
|
+
credential: verifiableCredentialResponseSchema.nullable(),
|
|
160
|
+
});
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-sovereign identity API contracts.
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH for the wire shape of Oxy's AtProto/Bluesky-flavoured
|
|
5
|
+
* identity & portability layer: the W3C DID document the API derives on demand,
|
|
6
|
+
* the signed-record envelope clients sign with their cryptographic key (and the
|
|
7
|
+
* server verifies), the verified-domain badge, the auth-method ↔ DID
|
|
8
|
+
* verification-method mapping, and the signed data-export ("credible exit")
|
|
9
|
+
* bundle. The API validates its OUTPUT against these schemas; every consumer
|
|
10
|
+
* (the Commons vault app, `@oxyhq/core`'s identity mixin) validates its INPUT
|
|
11
|
+
* against the same definitions, so producer and consumers cannot drift.
|
|
12
|
+
*
|
|
13
|
+
* Design anchors (from the identity-layer plan):
|
|
14
|
+
* - DID = `did:web:oxy.so:u:<userId>` — anchored on the stable account id, NOT
|
|
15
|
+
* the keypair. The keypair is a *verification method* that maps 1:1 to the
|
|
16
|
+
* existing `authMethods[]`. Custodial (password-only) users get a DID
|
|
17
|
+
* controlled solely by Oxy (`OXY_DID`); creating a Commons key upgrades them
|
|
18
|
+
* to self-sovereign (`controller = [userDid, OXY_DID]`); fully reversible.
|
|
19
|
+
* - Verification methods use the secp256k1 `EcdsaSecp256k1VerificationKey2019`
|
|
20
|
+
* type with `publicKeyHex` for now (a `Multikey`/`publicKeyMultibase` form may
|
|
21
|
+
* be added later — see the plan's open risks).
|
|
22
|
+
* - Signed records carry an envelope whose signing input is the canonical-JSON
|
|
23
|
+
* of every field EXCEPT `publicKey` and `signature`; `alg` is
|
|
24
|
+
* `ES256K-DER-SHA256` (secp256k1 over the SHA-256 of the canonical bytes,
|
|
25
|
+
* DER-encoded signature) — the same scheme `SignatureService` uses.
|
|
26
|
+
*
|
|
27
|
+
* Explicit-`interface` exports (DidDocument, SignedRecordEnvelope, ExportBundle,
|
|
28
|
+
* VerifiedDomain, AuthMethodsResponse and their sub-parts) follow the same
|
|
29
|
+
* rationale as `UserNameResponse` in `./userResponse`: a `z.infer<>` of a nested
|
|
30
|
+
* object schema can degrade under a consumer's `moduleResolution: "node"`
|
|
31
|
+
* (node10) resolution, so the load-bearing response shapes are declared as
|
|
32
|
+
* literal interfaces and the runtime schemas are annotated `z.ZodType<Interface>`
|
|
33
|
+
* — the emitted `.d.ts` then states the field types verbatim and survives BOTH
|
|
34
|
+
* `node` and `bundler` resolution. Request schemas (no nested-object hazard) are
|
|
35
|
+
* inferred via `z.infer<>`.
|
|
36
|
+
*
|
|
37
|
+
* Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
|
|
38
|
+
* `require()`).
|
|
39
|
+
*/
|
|
40
|
+
import { z } from 'zod';
|
|
41
|
+
export const verificationMethodSchema = z.object({
|
|
42
|
+
id: z.string(),
|
|
43
|
+
type: z.literal('EcdsaSecp256k1VerificationKey2019'),
|
|
44
|
+
controller: z.string(),
|
|
45
|
+
publicKeyHex: z.string(),
|
|
46
|
+
});
|
|
47
|
+
export const didServiceSchema = z.object({
|
|
48
|
+
id: z.string(),
|
|
49
|
+
type: z.string(),
|
|
50
|
+
serviceEndpoint: z.string(),
|
|
51
|
+
});
|
|
52
|
+
export const didDocumentSchema = z.object({
|
|
53
|
+
'@context': z.array(z.string()),
|
|
54
|
+
id: z.string(),
|
|
55
|
+
controller: z.array(z.string()),
|
|
56
|
+
verificationMethod: z.array(verificationMethodSchema),
|
|
57
|
+
authentication: z.array(z.string()),
|
|
58
|
+
assertionMethod: z.array(z.string()),
|
|
59
|
+
alsoKnownAs: z.array(z.string()),
|
|
60
|
+
service: z.array(didServiceSchema),
|
|
61
|
+
});
|
|
62
|
+
export const signedRecordEnvelopeSchema = z
|
|
63
|
+
.object({
|
|
64
|
+
version: z.union([z.literal(1), z.literal(2)]),
|
|
65
|
+
type: z.enum([
|
|
66
|
+
'identity',
|
|
67
|
+
'profile',
|
|
68
|
+
'reputation_attestation',
|
|
69
|
+
'real_life_attestation',
|
|
70
|
+
'validation_verdict',
|
|
71
|
+
'personhood_vouch',
|
|
72
|
+
'credential',
|
|
73
|
+
'node',
|
|
74
|
+
]),
|
|
75
|
+
subject: z.string(),
|
|
76
|
+
issuer: z.string(),
|
|
77
|
+
record: z.record(z.unknown()),
|
|
78
|
+
issuedAt: z.number(),
|
|
79
|
+
seq: z.number().int().nonnegative().optional(),
|
|
80
|
+
prev: z.string().nullable().optional(),
|
|
81
|
+
collection: z.string().min(1).optional(),
|
|
82
|
+
rkey: z.string().min(1).optional(),
|
|
83
|
+
publicKey: z.string(),
|
|
84
|
+
alg: z.literal('ES256K-DER-SHA256'),
|
|
85
|
+
signature: z.string(),
|
|
86
|
+
})
|
|
87
|
+
.superRefine((env, ctx) => {
|
|
88
|
+
if (env.version === 2) {
|
|
89
|
+
// v2 REQUIRES the hash-chain fields. `prev` may be `null` at genesis,
|
|
90
|
+
// but the key must be present (it is part of the signed bytes), so we
|
|
91
|
+
// reject only when it is entirely absent.
|
|
92
|
+
if (typeof env.seq !== 'number') {
|
|
93
|
+
ctx.addIssue({
|
|
94
|
+
code: z.ZodIssueCode.custom,
|
|
95
|
+
message: 'v2 envelope requires `seq`',
|
|
96
|
+
path: ['seq'],
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (env.prev === undefined) {
|
|
100
|
+
ctx.addIssue({
|
|
101
|
+
code: z.ZodIssueCode.custom,
|
|
102
|
+
message: 'v2 envelope requires `prev` (use `null` at genesis)',
|
|
103
|
+
path: ['prev'],
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (typeof env.collection !== 'string') {
|
|
107
|
+
ctx.addIssue({
|
|
108
|
+
code: z.ZodIssueCode.custom,
|
|
109
|
+
message: 'v2 envelope requires `collection`',
|
|
110
|
+
path: ['collection'],
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (typeof env.rkey !== 'string') {
|
|
114
|
+
ctx.addIssue({
|
|
115
|
+
code: z.ZodIssueCode.custom,
|
|
116
|
+
message: 'v2 envelope requires `rkey`',
|
|
117
|
+
path: ['rkey'],
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
// v1 FORBIDS the v2 chain fields entirely, so a legacy envelope keeps
|
|
123
|
+
// its exact byte shape and cannot smuggle unsigned chain metadata.
|
|
124
|
+
if (env.seq !== undefined) {
|
|
125
|
+
ctx.addIssue({
|
|
126
|
+
code: z.ZodIssueCode.custom,
|
|
127
|
+
message: 'v1 envelope must not carry `seq`',
|
|
128
|
+
path: ['seq'],
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
if (env.prev !== undefined) {
|
|
132
|
+
ctx.addIssue({
|
|
133
|
+
code: z.ZodIssueCode.custom,
|
|
134
|
+
message: 'v1 envelope must not carry `prev`',
|
|
135
|
+
path: ['prev'],
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (env.collection !== undefined) {
|
|
139
|
+
ctx.addIssue({
|
|
140
|
+
code: z.ZodIssueCode.custom,
|
|
141
|
+
message: 'v1 envelope must not carry `collection`',
|
|
142
|
+
path: ['collection'],
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (env.rkey !== undefined) {
|
|
146
|
+
ctx.addIssue({
|
|
147
|
+
code: z.ZodIssueCode.custom,
|
|
148
|
+
message: 'v1 envelope must not carry `rkey`',
|
|
149
|
+
path: ['rkey'],
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
export const verifiedDomainSchema = z.object({
|
|
155
|
+
domain: z.string(),
|
|
156
|
+
verifiedAt: z.union([z.string(), z.date()]),
|
|
157
|
+
method: z.enum(['dns-txt', 'well-known']),
|
|
158
|
+
});
|
|
159
|
+
/** Request body for `POST /identity/domains` — the domain to start verifying. */
|
|
160
|
+
export const domainVerificationRequestSchema = z.object({
|
|
161
|
+
domain: z.string().trim().min(1),
|
|
162
|
+
});
|
|
163
|
+
/**
|
|
164
|
+
* The instructions the API returns when a domain verification is requested. The
|
|
165
|
+
* caller may prove ownership EITHER by publishing the `dns` TXT record OR by
|
|
166
|
+
* serving the `wellKnown` file; either path then satisfies
|
|
167
|
+
* `POST /identity/domains/:domain/verify`.
|
|
168
|
+
*/
|
|
169
|
+
export const domainVerificationInstructionsSchema = z.object({
|
|
170
|
+
domain: z.string(),
|
|
171
|
+
token: z.string(),
|
|
172
|
+
dns: z.object({
|
|
173
|
+
name: z.string(),
|
|
174
|
+
value: z.string(),
|
|
175
|
+
}),
|
|
176
|
+
wellKnown: z.object({
|
|
177
|
+
url: z.string(),
|
|
178
|
+
body: z.string(),
|
|
179
|
+
}),
|
|
180
|
+
});
|
|
181
|
+
export const authMethodEntrySchema = z.object({
|
|
182
|
+
type: z.enum(['identity', 'password', 'google', 'apple', 'github']),
|
|
183
|
+
linkedAt: z.union([z.string(), z.date()]),
|
|
184
|
+
verificationMethodId: z.string().optional(),
|
|
185
|
+
});
|
|
186
|
+
export const authMethodsResponseSchema = z.object({
|
|
187
|
+
did: z.string(),
|
|
188
|
+
methods: z.array(authMethodEntrySchema),
|
|
189
|
+
});
|
|
190
|
+
export const exportAttestationSchema = z.object({
|
|
191
|
+
issuer: z.string(),
|
|
192
|
+
publicKey: z.string(),
|
|
193
|
+
alg: z.literal('ES256K-DER-SHA256'),
|
|
194
|
+
signature: z.string(),
|
|
195
|
+
signedAt: z.number(),
|
|
196
|
+
});
|
|
197
|
+
export const exportBundleSchema = z.object({
|
|
198
|
+
'$schema': z.string(),
|
|
199
|
+
exportedAt: z.string(),
|
|
200
|
+
did: z.string(),
|
|
201
|
+
didDocument: didDocumentSchema,
|
|
202
|
+
profile: z.record(z.unknown()),
|
|
203
|
+
verifiedDomains: z.array(verifiedDomainSchema),
|
|
204
|
+
authMethods: z.array(authMethodEntrySchema),
|
|
205
|
+
signedRecords: z.array(signedRecordEnvelopeSchema),
|
|
206
|
+
appData: z.array(z.record(z.unknown())),
|
|
207
|
+
social: z.object({
|
|
208
|
+
following: z.array(z.string()),
|
|
209
|
+
followers: z.array(z.string()),
|
|
210
|
+
}),
|
|
211
|
+
attestation: exportAttestationSchema.nullable(),
|
|
212
|
+
proof: exportAttestationSchema.optional(),
|
|
213
|
+
});
|
package/dist/esm/index.js
CHANGED
|
@@ -23,3 +23,11 @@ fedcmTokenPayloadSchema, } from './fedcmToken.js';
|
|
|
23
23
|
export {
|
|
24
24
|
// Schemas
|
|
25
25
|
recommendationExcludeTypeSchema, recommendationBoostSchema, recommendationSignalWeightsSchema, recommendationRequestSchema, recommendationCountSchema, recommendationItemSchema, recommendationResponseSchema, appEndorsementInputSchema, appInterestInputSchema, appUserSignalIngestSchema, } from './recommendations.js';
|
|
26
|
+
export {
|
|
27
|
+
// Schemas
|
|
28
|
+
verificationMethodSchema, didServiceSchema, didDocumentSchema, signedRecordEnvelopeSchema, verifiedDomainSchema, domainVerificationRequestSchema, domainVerificationInstructionsSchema, authMethodEntrySchema, authMethodsResponseSchema, exportAttestationSchema, exportBundleSchema, } from './identity.js';
|
|
29
|
+
export {
|
|
30
|
+
// Schemas
|
|
31
|
+
publicCardSchema, signedPublicCardSchema, realLifeAttestationRecordSchema, realLifeAttestationResultSchema, validationVerdictRecordSchema, validationOpenRequestSchema, validationOpenResultSchema, validationRequestSummarySchema, validationVoteResultSchema, personhoodVouchRecordSchema, personhoodBreakdownSchema, personhoodStatusResultSchema, vouchResultSchema,
|
|
32
|
+
// Verifiable Credentials (Fase 4 — NEW)
|
|
33
|
+
credentialRecordSchema, verifiableCredentialResponseSchema, credentialIssueResultSchema, credentialListResultSchema, credentialVerifyResultSchema, } from './civic.js';
|
package/dist/esm/userResponse.js
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
* `require()`).
|
|
32
32
|
*/
|
|
33
33
|
import { z } from 'zod';
|
|
34
|
+
import { verifiedDomainSchema } from './identity.js';
|
|
34
35
|
export const userNameSchema = z
|
|
35
36
|
.object({
|
|
36
37
|
first: z.string().optional(),
|
|
@@ -63,6 +64,9 @@ export const userResponseSchema = z
|
|
|
63
64
|
publicKey: z.string().optional(),
|
|
64
65
|
username: z.string().optional(),
|
|
65
66
|
email: z.string().optional(),
|
|
67
|
+
phone: z.string().optional(),
|
|
68
|
+
address: z.string().optional(),
|
|
69
|
+
birthday: z.string().optional(),
|
|
66
70
|
/** Avatar file id (string) or null. */
|
|
67
71
|
avatar: z.string().nullable().optional(),
|
|
68
72
|
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
@@ -70,6 +74,17 @@ export const userResponseSchema = z
|
|
|
70
74
|
name: userNameSchema,
|
|
71
75
|
verified: z.boolean().optional(),
|
|
72
76
|
language: z.string().optional(),
|
|
77
|
+
/**
|
|
78
|
+
* The account's self-sovereign identifier
|
|
79
|
+
* (`did:web:<FEDERATION_DOMAIN>:u:<userId>`). Surfaced as a `User`
|
|
80
|
+
* virtual; present on formatted DTOs once the identity layer is live.
|
|
81
|
+
*/
|
|
82
|
+
did: z.string().optional(),
|
|
83
|
+
/**
|
|
84
|
+
* Proven domain-ownership badges. Each is a {@link verifiedDomainSchema}
|
|
85
|
+
* entry; present only when the account has verified at least one domain.
|
|
86
|
+
*/
|
|
87
|
+
verifiedDomains: z.array(verifiedDomainSchema).optional(),
|
|
73
88
|
})
|
|
74
89
|
.passthrough();
|
|
75
90
|
export const userProfileUpdateSchema = z
|
|
@@ -86,6 +101,9 @@ export const userProfileUpdateSchema = z
|
|
|
86
101
|
color: z.string().nullable().optional(),
|
|
87
102
|
bio: z.string().optional(),
|
|
88
103
|
description: z.string().optional(),
|
|
104
|
+
phone: z.string().optional(),
|
|
105
|
+
address: z.string().optional(),
|
|
106
|
+
birthday: z.string().optional(),
|
|
89
107
|
location: z.string().optional(),
|
|
90
108
|
locations: z.array(z.unknown()).optional(),
|
|
91
109
|
links: z.array(z.string()).optional(),
|