@indorania/contracts 0.1.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/README.md +117 -0
- package/dist/common.d.ts +144 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +162 -0
- package/dist/common.js.map +1 -0
- package/dist/constitution/index.d.ts +9 -0
- package/dist/constitution/index.d.ts.map +1 -0
- package/dist/constitution/index.js +9 -0
- package/dist/constitution/index.js.map +1 -0
- package/dist/constitution/openapi.d.ts +23 -0
- package/dist/constitution/openapi.d.ts.map +1 -0
- package/dist/constitution/openapi.js +375 -0
- package/dist/constitution/openapi.js.map +1 -0
- package/dist/constitution/report.d.ts +63 -0
- package/dist/constitution/report.d.ts.map +1 -0
- package/dist/constitution/report.js +73 -0
- package/dist/constitution/report.js.map +1 -0
- package/dist/constitution/tables.d.ts +53 -0
- package/dist/constitution/tables.d.ts.map +1 -0
- package/dist/constitution/tables.js +96 -0
- package/dist/constitution/tables.js.map +1 -0
- package/dist/constitution/words.d.ts +39 -0
- package/dist/constitution/words.d.ts.map +1 -0
- package/dist/constitution/words.js +126 -0
- package/dist/constitution/words.js.map +1 -0
- package/dist/document.d.ts +12 -0
- package/dist/document.d.ts.map +1 -0
- package/dist/document.js +106 -0
- package/dist/document.js.map +1 -0
- package/dist/domain-error.d.ts +14 -0
- package/dist/domain-error.d.ts.map +1 -0
- package/dist/domain-error.js +23 -0
- package/dist/domain-error.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/op.d.ts +92 -0
- package/dist/op.d.ts.map +1 -0
- package/dist/op.js +113 -0
- package/dist/op.js.map +1 -0
- package/dist/routes/asks.d.ts +77 -0
- package/dist/routes/asks.d.ts.map +1 -0
- package/dist/routes/asks.js +182 -0
- package/dist/routes/asks.js.map +1 -0
- package/dist/routes/backup.d.ts +12 -0
- package/dist/routes/backup.d.ts.map +1 -0
- package/dist/routes/backup.js +63 -0
- package/dist/routes/backup.js.map +1 -0
- package/dist/routes/capabilities.d.ts +67 -0
- package/dist/routes/capabilities.d.ts.map +1 -0
- package/dist/routes/capabilities.js +88 -0
- package/dist/routes/capabilities.js.map +1 -0
- package/dist/routes/entitlements.d.ts +137 -0
- package/dist/routes/entitlements.d.ts.map +1 -0
- package/dist/routes/entitlements.js +101 -0
- package/dist/routes/entitlements.js.map +1 -0
- package/dist/routes/guest.d.ts +57 -0
- package/dist/routes/guest.d.ts.map +1 -0
- package/dist/routes/guest.js +140 -0
- package/dist/routes/guest.js.map +1 -0
- package/dist/routes/integration.d.ts +187 -0
- package/dist/routes/integration.d.ts.map +1 -0
- package/dist/routes/integration.js +243 -0
- package/dist/routes/integration.js.map +1 -0
- package/dist/routes/meta.d.ts +50 -0
- package/dist/routes/meta.d.ts.map +1 -0
- package/dist/routes/meta.js +90 -0
- package/dist/routes/meta.js.map +1 -0
- package/dist/routes/organisations.d.ts +121 -0
- package/dist/routes/organisations.d.ts.map +1 -0
- package/dist/routes/organisations.js +175 -0
- package/dist/routes/organisations.js.map +1 -0
- package/dist/routes/presentations.d.ts +95 -0
- package/dist/routes/presentations.d.ts.map +1 -0
- package/dist/routes/presentations.js +121 -0
- package/dist/routes/presentations.js.map +1 -0
- package/dist/routes/sessions.d.ts +180 -0
- package/dist/routes/sessions.d.ts.map +1 -0
- package/dist/routes/sessions.js +240 -0
- package/dist/routes/sessions.js.map +1 -0
- package/dist/routes/standing.d.ts +24 -0
- package/dist/routes/standing.d.ts.map +1 -0
- package/dist/routes/standing.js +74 -0
- package/dist/routes/standing.js.map +1 -0
- package/dist/routes/thank-yous.d.ts +30 -0
- package/dist/routes/thank-yous.d.ts.map +1 -0
- package/dist/routes/thank-yous.js +139 -0
- package/dist/routes/thank-yous.js.map +1 -0
- package/dist/versions.d.ts +46 -0
- package/dist/versions.d.ts.map +1 -0
- package/dist/versions.js +54 -0
- package/dist/versions.js.map +1 -0
- package/dist/webhooks.d.ts +55 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +76 -0
- package/dist/webhooks.js.map +1 -0
- package/dist/zod.d.ts +3 -0
- package/dist/zod.d.ts.map +1 -0
- package/dist/zod.js +7 -0
- package/dist/zod.js.map +1 -0
- package/node/kernel-esm.mjs +27 -0
- package/node/register.mjs +5 -0
- package/openapi/2026-09-25.json +6959 -0
- package/openapi/versions.json +10 -0
- package/package.json +49 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/** Businesses, institutes and houses; and the seats staff hold in them. */
|
|
2
|
+
import { HttpsUrl, OrgDid, OrganisationId, SeatId, UnixTime, pageOf, PageQuery, words } from "../common.js";
|
|
3
|
+
import { BIRTH_OR_ORIGIN } from "../constitution/words.js";
|
|
4
|
+
import { operation } from "../op.js";
|
|
5
|
+
import { VERSION_PATTERN } from "../versions.js";
|
|
6
|
+
import { z } from "../zod.js";
|
|
7
|
+
export const ORGANISATION_TYPES = ["business", "institute", "house"];
|
|
8
|
+
export const HOUSE_RULE_BASES = ["place", "craft", "goal"];
|
|
9
|
+
export const ROLES = ["owner", "admin", "staff"];
|
|
10
|
+
/**
|
|
11
|
+
* The open door (d47(c)): a house is joined by place, craft or goal. A rule based on birth,
|
|
12
|
+
* descent, ethnicity, sect or caste cannot be written — there is no such basis — and a statement
|
|
13
|
+
* that reaches for one is refused. This is a floor; human review sits above it (PL-7).
|
|
14
|
+
*/
|
|
15
|
+
export const HouseJoinRule = z
|
|
16
|
+
.object({
|
|
17
|
+
basis: z.enum(HOUSE_RULE_BASES).meta({ description: "What the door opens on. Birth is not a basis, and cannot be written here." }),
|
|
18
|
+
statement: words(280)
|
|
19
|
+
.min(12)
|
|
20
|
+
.refine((s) => !BIRTH_OR_ORIGIN.test(s), {
|
|
21
|
+
message: "A house's door opens on place, craft or goal — never on birth, descent, ethnicity, sect or caste (d27, d36, d47(c)).",
|
|
22
|
+
params: { rule: "OPEN-DOOR" },
|
|
23
|
+
})
|
|
24
|
+
.meta({ description: "Who may join, in plain words — for example: \"Anyone who works leather in the old city\"." }),
|
|
25
|
+
})
|
|
26
|
+
.strict()
|
|
27
|
+
.meta({ id: "HouseJoinRule" });
|
|
28
|
+
const ApiVersionId = z.string().regex(new RegExp(VERSION_PATTERN)).meta({ description: "A dated API version, YYYY-MM-DD." });
|
|
29
|
+
export const Organisation = z
|
|
30
|
+
.object({
|
|
31
|
+
id: OrganisationId,
|
|
32
|
+
type: z.enum(ORGANISATION_TYPES),
|
|
33
|
+
name: words(120),
|
|
34
|
+
apiVersion: ApiVersionId.meta({ description: "The version this organisation is pinned to. Its requests without a version header, and its webhooks, speak it." }),
|
|
35
|
+
joinRule: HouseJoinRule.nullable(),
|
|
36
|
+
did: OrgDid.meta({ description: "The organisation's own signing identity. Its key never leaves the key service." }),
|
|
37
|
+
review: z.enum(["pending", "approved", "held"]).nullable().meta({
|
|
38
|
+
description: "A house is read by a person before it is shown anywhere: `pending` until then, and again after any edit to its name or door. Null for any other organisation.",
|
|
39
|
+
}),
|
|
40
|
+
createdAtUnix: UnixTime,
|
|
41
|
+
})
|
|
42
|
+
.strict()
|
|
43
|
+
.meta({ id: "Organisation", description: "`joinRule` is a house's open door, and null for any other organisation." });
|
|
44
|
+
export const OrganisationCreate = z
|
|
45
|
+
.discriminatedUnion("type", [
|
|
46
|
+
z.object({ type: z.literal("business"), name: words(120) }).strict(),
|
|
47
|
+
z.object({ type: z.literal("institute"), name: words(120) }).strict(),
|
|
48
|
+
z.object({ type: z.literal("house"), name: words(120), joinRule: HouseJoinRule }).strict(),
|
|
49
|
+
])
|
|
50
|
+
.meta({ id: "OrganisationCreate", description: "The caller takes the owner seat. A house must state its open door." });
|
|
51
|
+
export const OrganisationUpdate = z
|
|
52
|
+
.object({
|
|
53
|
+
name: words(120).optional(),
|
|
54
|
+
joinRule: HouseJoinRule.optional(),
|
|
55
|
+
apiVersion: ApiVersionId.optional().meta({ description: "Upgrade the pin to a later released version. Never downgraded." }),
|
|
56
|
+
})
|
|
57
|
+
.strict()
|
|
58
|
+
.meta({ id: "OrganisationUpdate", description: "`joinRule` is for houses only, and is checked again on every edit." });
|
|
59
|
+
export const Role = z.enum(ROLES).meta({ id: "Role", description: "Roles are scoped to one organisation (architecture §7.3)." });
|
|
60
|
+
export const Seat = z
|
|
61
|
+
.object({
|
|
62
|
+
id: SeatId,
|
|
63
|
+
organisation: OrganisationId,
|
|
64
|
+
role: Role,
|
|
65
|
+
label: words(80).nullable().meta({ description: "A name the organisation chose for this seat, if any. Never an email." }),
|
|
66
|
+
createdAtUnix: UnixTime,
|
|
67
|
+
})
|
|
68
|
+
.strict()
|
|
69
|
+
.meta({ id: "Seat", description: "A staff login's place in one organisation. The platform keeps no email here, and no activity." });
|
|
70
|
+
export const SeatInvite = z.object({ role: Role, label: words(80).optional() }).strict().meta({ id: "SeatInvite" });
|
|
71
|
+
export const SeatInvitation = z
|
|
72
|
+
.object({
|
|
73
|
+
seat: Seat,
|
|
74
|
+
inviteLink: HttpsUrl.meta({ description: "A single-use link the organisation passes on however it likes. The invited person signs in with a passkey; the platform needs no email." }),
|
|
75
|
+
expiresAtUnix: UnixTime,
|
|
76
|
+
})
|
|
77
|
+
.strict()
|
|
78
|
+
.meta({ id: "SeatInvitation" });
|
|
79
|
+
export const SeatUpdate = z
|
|
80
|
+
.object({ role: Role.optional(), label: words(80).nullable().optional() })
|
|
81
|
+
.strict()
|
|
82
|
+
.meta({ id: "SeatUpdate" });
|
|
83
|
+
const OrgParams = z.object({ orgId: OrganisationId }).strict();
|
|
84
|
+
const SeatParams = z.object({ orgId: OrganisationId, seatId: SeatId }).strict();
|
|
85
|
+
export const organisationOperations = [
|
|
86
|
+
operation({
|
|
87
|
+
operationId: "createOrganisation",
|
|
88
|
+
method: "post",
|
|
89
|
+
path: "/v1/organisations",
|
|
90
|
+
tag: "organisations",
|
|
91
|
+
summary: "Create a business, an institute or a house",
|
|
92
|
+
auth: ["seat"],
|
|
93
|
+
pending: null,
|
|
94
|
+
idempotency: "key",
|
|
95
|
+
body: { schema: OrganisationCreate },
|
|
96
|
+
responses: { 201: { description: "Created, with the caller as owner.", schema: Organisation } },
|
|
97
|
+
}),
|
|
98
|
+
operation({
|
|
99
|
+
operationId: "getOrganisation",
|
|
100
|
+
method: "get",
|
|
101
|
+
path: "/v1/organisations/{orgId}",
|
|
102
|
+
tag: "organisations",
|
|
103
|
+
summary: "Read an organisation you hold a seat in",
|
|
104
|
+
auth: ["seat"],
|
|
105
|
+
pending: null,
|
|
106
|
+
params: OrgParams,
|
|
107
|
+
responses: { 200: { description: "The organisation.", schema: Organisation } },
|
|
108
|
+
}),
|
|
109
|
+
operation({
|
|
110
|
+
operationId: "updateOrganisation",
|
|
111
|
+
method: "patch",
|
|
112
|
+
path: "/v1/organisations/{orgId}",
|
|
113
|
+
tag: "organisations",
|
|
114
|
+
summary: "Rename, restate a house's open door, or upgrade the version pin",
|
|
115
|
+
auth: ["seat"],
|
|
116
|
+
pending: null,
|
|
117
|
+
idempotency: "key",
|
|
118
|
+
params: OrgParams,
|
|
119
|
+
body: { schema: OrganisationUpdate },
|
|
120
|
+
responses: { 200: { description: "Updated.", schema: Organisation } },
|
|
121
|
+
}),
|
|
122
|
+
operation({
|
|
123
|
+
operationId: "listSeats",
|
|
124
|
+
method: "get",
|
|
125
|
+
path: "/v1/organisations/{orgId}/seats",
|
|
126
|
+
tag: "seats",
|
|
127
|
+
summary: "The seats in your own organisation",
|
|
128
|
+
description: "For a house, its stewards' seats. A house's members are never seats, and the platform holds no list of them (d47(c)).",
|
|
129
|
+
auth: ["seat"],
|
|
130
|
+
pending: null,
|
|
131
|
+
collection: "An organisation's own staff seats, for its owners and admins. Never a house's members.",
|
|
132
|
+
params: OrgParams,
|
|
133
|
+
query: PageQuery,
|
|
134
|
+
responses: { 200: { description: "One page of seats.", schema: pageOf(Seat, "SeatPage") } },
|
|
135
|
+
}),
|
|
136
|
+
operation({
|
|
137
|
+
operationId: "inviteSeat",
|
|
138
|
+
method: "post",
|
|
139
|
+
path: "/v1/organisations/{orgId}/seats",
|
|
140
|
+
tag: "seats",
|
|
141
|
+
summary: "Invite someone to a seat",
|
|
142
|
+
auth: ["seat"],
|
|
143
|
+
pending: null,
|
|
144
|
+
idempotency: "key",
|
|
145
|
+
params: OrgParams,
|
|
146
|
+
body: { schema: SeatInvite },
|
|
147
|
+
responses: { 201: { description: "The seat, waiting for its invite link to be used.", schema: SeatInvitation } },
|
|
148
|
+
}),
|
|
149
|
+
operation({
|
|
150
|
+
operationId: "updateSeat",
|
|
151
|
+
method: "patch",
|
|
152
|
+
path: "/v1/organisations/{orgId}/seats/{seatId}",
|
|
153
|
+
tag: "seats",
|
|
154
|
+
summary: "Change a seat's role or label",
|
|
155
|
+
auth: ["seat"],
|
|
156
|
+
pending: null,
|
|
157
|
+
idempotency: "key",
|
|
158
|
+
params: SeatParams,
|
|
159
|
+
body: { schema: SeatUpdate },
|
|
160
|
+
responses: { 200: { description: "Updated.", schema: Seat } },
|
|
161
|
+
}),
|
|
162
|
+
operation({
|
|
163
|
+
operationId: "removeSeat",
|
|
164
|
+
method: "delete",
|
|
165
|
+
path: "/v1/organisations/{orgId}/seats/{seatId}",
|
|
166
|
+
tag: "seats",
|
|
167
|
+
summary: "Remove a seat",
|
|
168
|
+
auth: ["seat"],
|
|
169
|
+
pending: null,
|
|
170
|
+
idempotency: "key",
|
|
171
|
+
params: SeatParams,
|
|
172
|
+
responses: { 204: { description: "Removed." } },
|
|
173
|
+
}),
|
|
174
|
+
];
|
|
175
|
+
//# sourceMappingURL=organisations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"organisations.js","sourceRoot":"","sources":["../../src/routes/organisations.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC5G,O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ose: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
kind: z.ZodLiteral<"ask">;
|
|
4
|
+
key: z.ZodString;
|
|
5
|
+
version: z.ZodNumber;
|
|
6
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
7
|
+
kind: z.ZodLiteral<"redemption">;
|
|
8
|
+
}, z.core.$strict>], "kind">;
|
|
9
|
+
export declare const PresentationRequestCreate: z.ZodObject<{
|
|
10
|
+
purpose: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
11
|
+
kind: z.ZodLiteral<"ask">;
|
|
12
|
+
key: z.ZodString;
|
|
13
|
+
version: z.ZodNumber;
|
|
14
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
15
|
+
kind: z.ZodLiteral<"redemption">;
|
|
16
|
+
}, z.core.$strict>], "kind">;
|
|
17
|
+
}, z.core.$strict>;
|
|
18
|
+
export declare const PresentationRequest: z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
purpose: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
21
|
+
kind: z.ZodLiteral<"ask">;
|
|
22
|
+
key: z.ZodString;
|
|
23
|
+
version: z.ZodNumber;
|
|
24
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
25
|
+
kind: z.ZodLiteral<"redemption">;
|
|
26
|
+
}, z.core.$strict>], "kind">;
|
|
27
|
+
request: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
28
|
+
requestUri: z.ZodString;
|
|
29
|
+
expiresAtUnix: z.ZodNumber;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export declare const PresentationResult: z.ZodObject<{
|
|
32
|
+
holder: z.ZodString;
|
|
33
|
+
predicates: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
34
|
+
kind: z.ZodString;
|
|
35
|
+
rule: z.ZodObject<{
|
|
36
|
+
id: z.ZodString;
|
|
37
|
+
version: z.ZodString;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
window: z.ZodObject<{
|
|
40
|
+
from: z.ZodString;
|
|
41
|
+
to: z.ZodString;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
issuer: z.ZodString;
|
|
44
|
+
}, z.core.$strict>>>;
|
|
45
|
+
voucher: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
value: z.ZodString;
|
|
47
|
+
redeemAt: z.ZodString;
|
|
48
|
+
}, z.core.$strict>>;
|
|
49
|
+
statusAsOfUnix: z.ZodNullable<z.ZodNumber>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export declare const PresentationRequestState: z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
purpose: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
54
|
+
kind: z.ZodLiteral<"ask">;
|
|
55
|
+
key: z.ZodString;
|
|
56
|
+
version: z.ZodNumber;
|
|
57
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
58
|
+
kind: z.ZodLiteral<"redemption">;
|
|
59
|
+
}, z.core.$strict>], "kind">;
|
|
60
|
+
state: z.ZodEnum<{
|
|
61
|
+
waiting: "waiting";
|
|
62
|
+
answered: "answered";
|
|
63
|
+
}>;
|
|
64
|
+
result: z.ZodNullable<z.ZodObject<{
|
|
65
|
+
holder: z.ZodString;
|
|
66
|
+
predicates: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
67
|
+
kind: z.ZodString;
|
|
68
|
+
rule: z.ZodObject<{
|
|
69
|
+
id: z.ZodString;
|
|
70
|
+
version: z.ZodString;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
window: z.ZodObject<{
|
|
73
|
+
from: z.ZodString;
|
|
74
|
+
to: z.ZodString;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
issuer: z.ZodString;
|
|
77
|
+
}, z.core.$strict>>>;
|
|
78
|
+
voucher: z.ZodOptional<z.ZodObject<{
|
|
79
|
+
value: z.ZodString;
|
|
80
|
+
redeemAt: z.ZodString;
|
|
81
|
+
}, z.core.$strict>>;
|
|
82
|
+
statusAsOfUnix: z.ZodNullable<z.ZodNumber>;
|
|
83
|
+
}, z.core.$strict>>;
|
|
84
|
+
expiresAtUnix: z.ZodNumber;
|
|
85
|
+
}, z.core.$strict>;
|
|
86
|
+
/** OpenID4VP 1.0 `direct_post`: form-encoded, from the wallet. */
|
|
87
|
+
export declare const PresentationResponse: z.ZodObject<{
|
|
88
|
+
vp_token: z.ZodString;
|
|
89
|
+
state: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
export declare const PresentationResponseAck: z.ZodObject<{
|
|
92
|
+
redirect_uri: z.ZodOptional<z.ZodURL>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
export declare const presentationOperations: import("../op.ts").Operation[];
|
|
95
|
+
//# sourceMappingURL=presentations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentations.d.ts","sourceRoot":"","sources":["../../src/routes/presentations.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAG9B,eAAO,MAAM,mBAAmB;;;;;;4BAKM,CAAC;AAEvC,eAAO,MAAM,yBAAyB;;;;;;;;kBAAgG,CAAC;AAEvI,eAAO,MAAM,mBAAmB;;;;;;;;;;;;kBASM,CAAC;AAEvC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;kBAwB+G,CAAC;AAE/I,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAYjC,CAAC;AAEL,kEAAkE;AAClE,eAAO,MAAM,oBAAoB;;;kBAMM,CAAC;AAExC,eAAO,MAAM,uBAAuB;;kBAGM,CAAC;AAI3C,eAAO,MAAM,sBAAsB,gCAyClC,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presentation requests: how a person answers — an ask, or a thank-you's redemption — in their
|
|
3
|
+
* wallet, over OpenID for Verifiable Presentations 1.0 (specs/presentation.md §1, §3). The
|
|
4
|
+
* platform hosts the verifier's single-use response endpoint and keeps the verified result only
|
|
5
|
+
* until the request expires.
|
|
6
|
+
*
|
|
7
|
+
* A decline has no format and no endpoint (presentation §6, d49(a)): the wallet sends nothing, and
|
|
8
|
+
* the request stays `waiting` until it expires, exactly as if nobody had looked at it.
|
|
9
|
+
*/
|
|
10
|
+
import { HttpsUrl, PresentationRequestId, RelationshipId, UnixTime, words } from "../common.js";
|
|
11
|
+
import { operation } from "../op.js";
|
|
12
|
+
import { z } from "../zod.js";
|
|
13
|
+
import { AskKey, PredicateKind } from "./asks.js";
|
|
14
|
+
export const PresentationPurpose = z
|
|
15
|
+
.discriminatedUnion("kind", [
|
|
16
|
+
z.object({ kind: z.literal("ask"), key: AskKey, version: z.number().int().min(1) }).strict().meta({ description: "A person answering a published ask." }),
|
|
17
|
+
z.object({ kind: z.literal("redemption") }).strict().meta({ description: "A person redeeming a thank-you with you, its issuer." }),
|
|
18
|
+
])
|
|
19
|
+
.meta({ id: "PresentationPurpose" });
|
|
20
|
+
export const PresentationRequestCreate = z.object({ purpose: PresentationPurpose }).strict().meta({ id: "PresentationRequestCreate" });
|
|
21
|
+
export const PresentationRequest = z
|
|
22
|
+
.object({
|
|
23
|
+
id: PresentationRequestId,
|
|
24
|
+
purpose: PresentationPurpose,
|
|
25
|
+
request: z.record(z.string(), z.unknown()).meta({ description: "The OpenID4VP authorization request, by value: a DCQL query, a fresh nonce, the response_uri, and for an ask the ask itself (`kash_ask`, `kash_ask_sha256`)." }),
|
|
26
|
+
requestUri: z.string().regex(/^openid4vp:\/\//).meta({ description: "The same request as a deep link, for a QR code." }),
|
|
27
|
+
expiresAtUnix: UnixTime,
|
|
28
|
+
})
|
|
29
|
+
.strict()
|
|
30
|
+
.meta({ id: "PresentationRequest" });
|
|
31
|
+
export const PresentationResult = z
|
|
32
|
+
.object({
|
|
33
|
+
holder: RelationshipId,
|
|
34
|
+
predicates: z
|
|
35
|
+
.array(z
|
|
36
|
+
.object({
|
|
37
|
+
kind: PredicateKind,
|
|
38
|
+
rule: z.object({ id: z.string(), version: z.string() }).strict().meta({ description: "The rule version it was judged against (d43)." }),
|
|
39
|
+
window: z.object({ from: z.string(), to: z.string() }).strict(),
|
|
40
|
+
issuer: z.string(),
|
|
41
|
+
})
|
|
42
|
+
.strict())
|
|
43
|
+
.optional()
|
|
44
|
+
.meta({ description: "For an ask: each yes, and what it rests on. Never the records." }),
|
|
45
|
+
voucher: z
|
|
46
|
+
.object({ value: words(140), redeemAt: words(140) })
|
|
47
|
+
.strict()
|
|
48
|
+
.optional()
|
|
49
|
+
.meta({ description: "For a redemption: the thank-you, now marked used." }),
|
|
50
|
+
statusAsOfUnix: UnixTime.nullable().meta({ description: "\"Valid unless revoked, as of\" this time — the one check that touches the network. Null when no status list was checked." }),
|
|
51
|
+
})
|
|
52
|
+
.strict()
|
|
53
|
+
.meta({ id: "PresentationResult", description: "`holder` is the key the holder answered with: their relationship with you, and only you." });
|
|
54
|
+
export const PresentationRequestState = z
|
|
55
|
+
.object({
|
|
56
|
+
id: PresentationRequestId,
|
|
57
|
+
purpose: PresentationPurpose,
|
|
58
|
+
state: z.enum(["waiting", "answered"]),
|
|
59
|
+
result: PresentationResult.nullable(),
|
|
60
|
+
expiresAtUnix: UnixTime,
|
|
61
|
+
})
|
|
62
|
+
.strict()
|
|
63
|
+
.meta({
|
|
64
|
+
id: "PresentationRequestState",
|
|
65
|
+
description: "Waiting, or answered. No state says someone declined: an unanswered request waits until it expires, then it is gone.",
|
|
66
|
+
});
|
|
67
|
+
/** OpenID4VP 1.0 `direct_post`: form-encoded, from the wallet. */
|
|
68
|
+
export const PresentationResponse = z
|
|
69
|
+
.object({
|
|
70
|
+
vp_token: z.string().min(1).meta({ description: "JSON, form-encoded: each credential query id mapped to its presentations." }),
|
|
71
|
+
state: z.string().optional(),
|
|
72
|
+
})
|
|
73
|
+
.strict()
|
|
74
|
+
.meta({ id: "PresentationResponse" });
|
|
75
|
+
export const PresentationResponseAck = z
|
|
76
|
+
.object({ redirect_uri: HttpsUrl.optional() })
|
|
77
|
+
.strict()
|
|
78
|
+
.meta({ id: "PresentationResponseAck" });
|
|
79
|
+
const RequestParams = z.object({ requestId: PresentationRequestId }).strict();
|
|
80
|
+
export const presentationOperations = [
|
|
81
|
+
operation({
|
|
82
|
+
operationId: "createPresentationRequest",
|
|
83
|
+
method: "post",
|
|
84
|
+
path: "/v1/presentation-requests",
|
|
85
|
+
tag: "presentations",
|
|
86
|
+
summary: "Mint a presentation request for one encounter",
|
|
87
|
+
description: "Show its requestUri as a QR code, or send it as a link. One request per encounter; it is used once.",
|
|
88
|
+
auth: ["seat", "integration"],
|
|
89
|
+
pending: "PL-8",
|
|
90
|
+
idempotency: "key",
|
|
91
|
+
body: { schema: PresentationRequestCreate },
|
|
92
|
+
responses: { 201: { description: "The request.", schema: PresentationRequest } },
|
|
93
|
+
}),
|
|
94
|
+
operation({
|
|
95
|
+
operationId: "getPresentationRequest",
|
|
96
|
+
method: "get",
|
|
97
|
+
path: "/v1/presentation-requests/{requestId}",
|
|
98
|
+
tag: "presentations",
|
|
99
|
+
summary: "See whether your request was answered",
|
|
100
|
+
auth: ["seat", "integration"],
|
|
101
|
+
pending: "PL-8",
|
|
102
|
+
params: RequestParams,
|
|
103
|
+
responses: { 200: { description: "Waiting, or answered with the verified result.", schema: PresentationRequestState } },
|
|
104
|
+
}),
|
|
105
|
+
operation({
|
|
106
|
+
operationId: "respondToPresentationRequest",
|
|
107
|
+
method: "post",
|
|
108
|
+
path: "/v1/presentation-requests/{requestId}/response",
|
|
109
|
+
tag: "presentations",
|
|
110
|
+
summary: "The wallet's answer (OpenID4VP direct_post)",
|
|
111
|
+
description: "A standard endpoint: any conforming wallet can answer, with no account and no Indorania header, so it is exempt from dated versions. Holder binding is the KB-JWT in each presentation; the request's nonce makes it single-use.",
|
|
112
|
+
auth: [],
|
|
113
|
+
pending: "PL-8",
|
|
114
|
+
versioning: "exempt",
|
|
115
|
+
idempotency: "protocol",
|
|
116
|
+
params: RequestParams,
|
|
117
|
+
body: { schema: PresentationResponse, type: "application/x-www-form-urlencoded" },
|
|
118
|
+
responses: { 200: { description: "Received.", schema: PresentationResponseAck } },
|
|
119
|
+
}),
|
|
120
|
+
];
|
|
121
|
+
//# sourceMappingURL=presentations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentations.js","sourceRoot":"","sources":["../../src/routes/presentations.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,cAAc,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,kBAAkB,CAAC,MAAM,EAAE;IAC1B,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;IACzJ,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,sDAAsD,EAAE,CAAC;CACnI,CAAC;KACD,IAAI,CAAC,EAAE,EAAE,EAAE,qBAAqB,EAAE,CAAC,CAAC;AAEvC,MAAM,CAAC,MA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,CAAC;IACF,SAAS,CAAC;QACR,WAAW,EAAE,8BAA8B;QAC3C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,gDAAgD;QACtD,GAAG,EAAE,eAAe;QACpB,OAAO,EAAE,6CAA6C;QACtD,WAAW,EACT,kOAAkO;QACpO,IAAI,EAAE,EAAE;QACR,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,UAAU;QACvB,MAAM,EAAE,aAAa;QACrB,IAAI,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE,IAAI,EAAE,mCAAmC,EAAE;QACjF,SAAS,EAAE,EAAE,GAAG,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,uBAAuB,EAAE,EAAE;KAClF,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { z } from "../zod.ts";
|
|
2
|
+
export declare const RECORD_KINDS: readonly ["presence", "process", "flow"];
|
|
3
|
+
export declare const SessionProfile: z.ZodEnum<{
|
|
4
|
+
"presence+flow": "presence+flow";
|
|
5
|
+
"process+flow": "process+flow";
|
|
6
|
+
"presence+process+flow": "presence+process+flow";
|
|
7
|
+
"flow+process": "flow+process";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const SessionOpen: z.ZodObject<{
|
|
10
|
+
profile: z.ZodEnum<{
|
|
11
|
+
"presence+flow": "presence+flow";
|
|
12
|
+
"process+flow": "process+flow";
|
|
13
|
+
"presence+process+flow": "presence+process+flow";
|
|
14
|
+
"flow+process": "flow+process";
|
|
15
|
+
}>;
|
|
16
|
+
consent: z.ZodObject<{
|
|
17
|
+
records: z.ZodArray<z.ZodEnum<{
|
|
18
|
+
presence: "presence";
|
|
19
|
+
process: "process";
|
|
20
|
+
flow: "flow";
|
|
21
|
+
}>>;
|
|
22
|
+
asks: z.ZodArray<z.ZodObject<{
|
|
23
|
+
key: z.ZodString;
|
|
24
|
+
version: z.ZodNumber;
|
|
25
|
+
}, z.core.$strict>>;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
place: z.ZodOptional<z.ZodString>;
|
|
28
|
+
expiresInSec: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
export declare const SessionTerms: z.ZodObject<{
|
|
31
|
+
id: z.ZodString;
|
|
32
|
+
profile: z.ZodEnum<{
|
|
33
|
+
"presence+flow": "presence+flow";
|
|
34
|
+
"process+flow": "process+flow";
|
|
35
|
+
"presence+process+flow": "presence+process+flow";
|
|
36
|
+
"flow+process": "flow+process";
|
|
37
|
+
}>;
|
|
38
|
+
consent: z.ZodObject<{
|
|
39
|
+
records: z.ZodArray<z.ZodEnum<{
|
|
40
|
+
presence: "presence";
|
|
41
|
+
process: "process";
|
|
42
|
+
flow: "flow";
|
|
43
|
+
}>>;
|
|
44
|
+
asks: z.ZodArray<z.ZodObject<{
|
|
45
|
+
key: z.ZodString;
|
|
46
|
+
version: z.ZodNumber;
|
|
47
|
+
}, z.core.$strict>>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
place: z.ZodNullable<z.ZodString>;
|
|
50
|
+
establishment: z.ZodString;
|
|
51
|
+
expiresAtUnix: z.ZodNumber;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
export declare const SessionInvitation: z.ZodObject<{
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
profile: z.ZodEnum<{
|
|
56
|
+
"presence+flow": "presence+flow";
|
|
57
|
+
"process+flow": "process+flow";
|
|
58
|
+
"presence+process+flow": "presence+process+flow";
|
|
59
|
+
"flow+process": "flow+process";
|
|
60
|
+
}>;
|
|
61
|
+
consent: z.ZodObject<{
|
|
62
|
+
records: z.ZodArray<z.ZodEnum<{
|
|
63
|
+
presence: "presence";
|
|
64
|
+
process: "process";
|
|
65
|
+
flow: "flow";
|
|
66
|
+
}>>;
|
|
67
|
+
asks: z.ZodArray<z.ZodObject<{
|
|
68
|
+
key: z.ZodString;
|
|
69
|
+
version: z.ZodNumber;
|
|
70
|
+
}, z.core.$strict>>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
place: z.ZodNullable<z.ZodString>;
|
|
73
|
+
establishment: z.ZodString;
|
|
74
|
+
expiresAtUnix: z.ZodNumber;
|
|
75
|
+
joinUri: z.ZodURL;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
export declare const LineWrite: z.ZodObject<{
|
|
78
|
+
line: z.ZodObject<{
|
|
79
|
+
payloadType: z.ZodString;
|
|
80
|
+
payload: z.ZodString;
|
|
81
|
+
signatures: z.ZodArray<z.ZodObject<{
|
|
82
|
+
keyid: z.ZodString;
|
|
83
|
+
sig: z.ZodString;
|
|
84
|
+
}, z.core.$strict>>;
|
|
85
|
+
}, z.core.$strict>;
|
|
86
|
+
}, z.core.$strict>;
|
|
87
|
+
export declare const LineAccepted: z.ZodObject<{
|
|
88
|
+
seq: z.ZodNumber;
|
|
89
|
+
}, z.core.$strict>;
|
|
90
|
+
export declare const Countersignature: z.ZodObject<{
|
|
91
|
+
signature: z.ZodObject<{
|
|
92
|
+
keyid: z.ZodString;
|
|
93
|
+
sig: z.ZodString;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
export declare const LineState: z.ZodEnum<{
|
|
97
|
+
waiting: "waiting";
|
|
98
|
+
"signed-by-both": "signed-by-both";
|
|
99
|
+
}>;
|
|
100
|
+
export declare const SessionLine: z.ZodObject<{
|
|
101
|
+
seq: z.ZodNumber;
|
|
102
|
+
line: z.ZodObject<{
|
|
103
|
+
payloadType: z.ZodString;
|
|
104
|
+
payload: z.ZodString;
|
|
105
|
+
signatures: z.ZodArray<z.ZodObject<{
|
|
106
|
+
keyid: z.ZodString;
|
|
107
|
+
sig: z.ZodString;
|
|
108
|
+
}, z.core.$strict>>;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
state: z.ZodEnum<{
|
|
111
|
+
waiting: "waiting";
|
|
112
|
+
"signed-by-both": "signed-by-both";
|
|
113
|
+
}>;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
export declare const SyncBatch: z.ZodObject<{
|
|
116
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
117
|
+
payloadType: z.ZodString;
|
|
118
|
+
payload: z.ZodString;
|
|
119
|
+
signatures: z.ZodArray<z.ZodObject<{
|
|
120
|
+
keyid: z.ZodString;
|
|
121
|
+
sig: z.ZodString;
|
|
122
|
+
}, z.core.$strict>>;
|
|
123
|
+
}, z.core.$strict>>;
|
|
124
|
+
countersignatures: z.ZodArray<z.ZodObject<{
|
|
125
|
+
seq: z.ZodNumber;
|
|
126
|
+
signature: z.ZodObject<{
|
|
127
|
+
keyid: z.ZodString;
|
|
128
|
+
sig: z.ZodString;
|
|
129
|
+
}, z.core.$strict>;
|
|
130
|
+
}, z.core.$strict>>;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
export declare const SyncResult: z.ZodObject<{
|
|
133
|
+
accepted: z.ZodArray<z.ZodNumber>;
|
|
134
|
+
rejected: z.ZodArray<z.ZodObject<{
|
|
135
|
+
seq: z.ZodNumber;
|
|
136
|
+
problem: z.ZodObject<{
|
|
137
|
+
type: z.ZodString;
|
|
138
|
+
title: z.ZodString;
|
|
139
|
+
status: z.ZodNumber;
|
|
140
|
+
code: z.ZodString;
|
|
141
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
142
|
+
instance: z.ZodOptional<z.ZodString>;
|
|
143
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
144
|
+
path: z.ZodString;
|
|
145
|
+
message: z.ZodString;
|
|
146
|
+
rule: z.ZodOptional<z.ZodString>;
|
|
147
|
+
}, z.core.$strict>>>;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
}, z.core.$strict>>;
|
|
150
|
+
}, z.core.$strict>;
|
|
151
|
+
/** `kashscript-session-receipt/1`, as attest's `SessionReceipt` defines it. */
|
|
152
|
+
export declare const SessionReceipt: z.ZodObject<{
|
|
153
|
+
formatVersion: z.ZodLiteral<"kashscript-session-receipt/1">;
|
|
154
|
+
sessionId: z.ZodString;
|
|
155
|
+
profile: z.ZodEnum<{
|
|
156
|
+
"presence+flow": "presence+flow";
|
|
157
|
+
"process+flow": "process+flow";
|
|
158
|
+
"presence+process+flow": "presence+process+flow";
|
|
159
|
+
"flow+process": "flow+process";
|
|
160
|
+
}>;
|
|
161
|
+
parties: z.ZodObject<{
|
|
162
|
+
establishment: z.ZodString;
|
|
163
|
+
person: z.ZodString;
|
|
164
|
+
}, z.core.$strict>;
|
|
165
|
+
events: z.ZodArray<z.ZodObject<{
|
|
166
|
+
payloadType: z.ZodString;
|
|
167
|
+
payload: z.ZodString;
|
|
168
|
+
signatures: z.ZodArray<z.ZodObject<{
|
|
169
|
+
keyid: z.ZodString;
|
|
170
|
+
sig: z.ZodString;
|
|
171
|
+
}, z.core.$strict>>;
|
|
172
|
+
}, z.core.$strict>>;
|
|
173
|
+
anchor: z.ZodNullable<z.ZodObject<{
|
|
174
|
+
headSha256: z.ZodString;
|
|
175
|
+
coversSeq: z.ZodNumber;
|
|
176
|
+
witness: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
177
|
+
}, z.core.$strict>>;
|
|
178
|
+
}, z.core.$strict>;
|
|
179
|
+
export declare const sessionOperations: import("../op.ts").Operation[];
|
|
180
|
+
//# sourceMappingURL=sessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/routes/sessions.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAI9B,eAAO,MAAM,YAAY,0CAA2C,CAAC;AAErE,eAAO,MAAM,cAAc;;;;;EAGzB,CAAC;AASH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;kBAmBM,CAAC;AAE/B,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;kBAUmI,CAAC;AAE7J,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;kBAEM,CAAC;AAErC,eAAO,MAAM,SAAS;;;;;;;;;kBAGqG,CAAC;AAE5H,eAAO,MAAM,YAAY;;kBAAmF,CAAC;AAI7G,eAAO,MAAM,gBAAgB;;;;;kBAGM,CAAC;AAEpC,eAAO,MAAM,SAAS;;;EAGpB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;kBAAwH,CAAC;AAEjJ,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;kBAMgF,CAAC;AAEvG,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;kBAMM,CAAC;AAE9B,+EAA+E;AAC/E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;kBAoBvB,CAAC;AAOL,eAAO,MAAM,iBAAiB,gCA4H7B,CAAC"}
|