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