@metacensus/api 0.2.0 → 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.
Files changed (39) hide show
  1. package/README.md +158 -73
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +3 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/public.d.ts +1 -1
  7. package/dist/public.d.ts.map +1 -1
  8. package/dist/public.js +2 -2
  9. package/dist/public.js.map +1 -1
  10. package/dist/signing.d.ts +2 -1
  11. package/dist/signing.d.ts.map +1 -1
  12. package/dist/signing.js +1 -1
  13. package/dist/signing.js.map +1 -1
  14. package/dist/src/client.d.ts +57 -38
  15. package/dist/src/client.d.ts.map +1 -1
  16. package/dist/src/client.js +146 -79
  17. package/dist/src/client.js.map +1 -1
  18. package/dist/src/metacensus/v1/auth.d.ts +52 -8
  19. package/dist/src/metacensus/v1/auth.d.ts.map +1 -1
  20. package/dist/src/metacensus/v1/common.d.ts +77 -31
  21. package/dist/src/metacensus/v1/common.d.ts.map +1 -1
  22. package/dist/src/metacensus/v1/common.js +0 -10
  23. package/dist/src/metacensus/v1/common.js.map +1 -1
  24. package/dist/src/metacensus/v1/prop.d.ts +44 -31
  25. package/dist/src/metacensus/v1/prop.d.ts.map +1 -1
  26. package/dist/src/metacensus/v1/prop.js +18 -18
  27. package/dist/src/metacensus/v1/prop.js.map +1 -1
  28. package/dist/src/metacensus/v1/topic.d.ts +16 -13
  29. package/dist/src/metacensus/v1/topic.d.ts.map +1 -1
  30. package/dist/src/metacensus/v1/user.d.ts +15 -12
  31. package/dist/src/metacensus/v1/user.d.ts.map +1 -1
  32. package/dist/src/route-manifest.d.ts.map +1 -1
  33. package/dist/src/route-manifest.js +9 -8
  34. package/dist/src/route-manifest.js.map +1 -1
  35. package/dist/src/signing.d.ts +84 -17
  36. package/dist/src/signing.d.ts.map +1 -1
  37. package/dist/src/signing.js +254 -68
  38. package/dist/src/signing.js.map +1 -1
  39. package/package.json +4 -4
@@ -1,146 +1,213 @@
1
1
  // Code generated by routegen. DO NOT EDIT.
2
- // The same literal as route-manifest.ts's apiPrefix, re-emitted rather than
3
- // imported, since a value import under src/ is forbidden (check-no-runtime.mjs).
4
- const apiPrefixDefault = "/metacensus/api/v1";
5
- // The same literal as route-manifest.ts's publicPrefix, re-emitted rather than
6
- // imported, since a value import under src/ is forbidden (check-no-runtime.mjs).
7
- const publicPrefixDefault = "/metacensus/public";
8
- function param(v) {
9
- return encodeURIComponent(String(v));
10
- }
11
- // ApiError is any non-2xx the transport did not act on itself. body is the
12
- // response text, unparsed: a 404 or 405 comes from the router, not a handler, so
13
- // parse it defensively rather than assuming JSON.
2
+ import { apiPrefix, publicPrefix } from "./route-manifest.js";
3
+ // ApiError is any non-2xx response. body is the response text, unparsed: a 404
4
+ // or 405 comes from the router, not a handler, so parse it defensively.
14
5
  export class ApiError extends Error {
15
6
  method;
16
- path;
7
+ url;
17
8
  status;
18
9
  body;
19
- constructor(method, path, status, body) {
20
- super(`${method} ${path}: HTTP ${status}`);
10
+ constructor(method, url, status, body) {
11
+ super(`${method} ${url}: HTTP ${status}`);
21
12
  this.method = method;
22
- this.path = path;
13
+ this.url = url;
23
14
  this.status = status;
24
15
  this.body = body;
25
16
  this.name = "ApiError";
26
17
  }
27
18
  }
28
- // Client calls the authenticated API: every route under /metacensus/api/v1.
19
+ function param(v) {
20
+ return encodeURIComponent(String(v));
21
+ }
22
+ async function request(f, url, method, body, token, credentials) {
23
+ const headers = {};
24
+ if (body !== undefined)
25
+ headers["Content-Type"] = "application/json";
26
+ if (token !== undefined)
27
+ headers["Authorization"] = `Bearer ${token}`;
28
+ const res = await f(url, { method, headers, body, credentials });
29
+ if (res.status < 200 || res.status >= 300) {
30
+ throw new ApiError(method, url, res.status, await res.text());
31
+ }
32
+ const text = await res.text();
33
+ return (text === "" ? {} : JSON.parse(text));
34
+ }
35
+ function flattenProp(r) {
36
+ return { id: r.id, recorded: r.recorded, ...r.content };
37
+ }
38
+ function flattenTopic(r) {
39
+ return { id: r.id, recorded: r.recorded, ...r.content };
40
+ }
41
+ function flattenUser(r) {
42
+ return { id: r.id, recorded: r.recorded, ...r.content };
43
+ }
44
+ function flattenVote(r) {
45
+ return { recorded: r.recorded, ...r.content };
46
+ }
47
+ // Client calls the authenticated API.
29
48
  export class Client {
30
- transport;
31
- prefix;
32
- // Defaults to this surface's own apiPrefix, but can be overridden so a
33
- // test harness can mount the same routes elsewhere.
34
- constructor(transport, prefix = apiPrefixDefault) {
35
- this.transport = transport;
36
- this.prefix = prefix;
37
- }
38
- async call(method, path, body) {
39
- const full = this.prefix + path;
40
- const res = await this.transport({ method, path: full, body });
41
- if (res.status < 200 || res.status >= 300) {
42
- throw new ApiError(method, full, res.status, res.body);
49
+ #baseUrl;
50
+ #fetch;
51
+ #prefix;
52
+ #signer;
53
+ #credentials;
54
+ #token;
55
+ constructor(options) {
56
+ this.#baseUrl = options.baseUrl;
57
+ this.#fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
58
+ this.#prefix = options.prefix ?? apiPrefix;
59
+ this.#signer = options.signer;
60
+ this.#credentials = options.credentials;
61
+ this.#token = options.token;
62
+ }
63
+ // The session token from the last login/signUp, for persisting a session.
64
+ get token() {
65
+ return this.#token;
66
+ }
67
+ #request(method, path, body) {
68
+ return request(this.#fetch, this.#baseUrl + this.#prefix + path, method, body, this.#token, this.#credentials);
69
+ }
70
+ #sign(content, contentType) {
71
+ if (this.#signer === undefined) {
72
+ throw new Error("Client: a write needs a signer; construct new Client({ ..., signer })");
43
73
  }
44
- // A cast: no runtime schema to validate against.
45
- return (res.body === "" ? {} : JSON.parse(res.body));
74
+ return this.#signer(content, contentType);
46
75
  }
47
76
  // AuthRoutes.Login: POST /login
48
- login(req) {
49
- const body = req;
50
- return this.call("POST", "/login", JSON.stringify(body));
77
+ async login(req) {
78
+ const session = await this.#request("POST", "/login", JSON.stringify(req));
79
+ this.#token = session.token;
80
+ return session;
51
81
  }
52
82
  // AuthRoutes.SignUp: POST /signup
53
- signUp(req) {
54
- const body = req;
55
- return this.call("POST", "/signup", JSON.stringify(body));
83
+ async signUp(req) {
84
+ const { interpretation, signature, publicKey } = await this.#sign(req.content, "metacensus.v1.User");
85
+ const session = await this.#request("POST", "/signup", JSON.stringify({ ...req, interpretation, publicKey, userSignature: signature }));
86
+ this.#token = session.token;
87
+ return session;
88
+ }
89
+ // AuthRoutes.Refresh: POST /refresh
90
+ async refresh(req) {
91
+ const session = await this.#request("POST", "/refresh", JSON.stringify(req));
92
+ this.#token = session.token;
93
+ return session;
56
94
  }
57
95
  // AuthRoutes.Logout: POST /logout
58
- logout(req) {
59
- return this.call("POST", "/logout", undefined);
96
+ async logout(req) {
97
+ const res = await this.#request("POST", "/logout", JSON.stringify(req));
98
+ this.#token = undefined;
99
+ return res;
60
100
  }
61
101
  // HealthRoutes.Healthcheck: GET /healthcheck
62
102
  healthcheck(req) {
63
- return this.call("GET", "/healthcheck", undefined);
103
+ return this.#request("GET", "/healthcheck", undefined);
64
104
  }
65
105
  // PropRoutes.ListProps: GET /topic/{topicId}/prop
66
106
  listProps(req) {
67
- return this.call("GET", `/topic/${param(req.topicId)}/prop`, undefined);
107
+ return this.#request("GET", `/topic/${param(req.topicId)}/prop`, undefined).then((r) => r.items.map(flattenProp));
108
+ }
109
+ // PropRoutes.ListProps: GET /topic/{topicId}/prop
110
+ listPropsSigned(req) {
111
+ return this.#request("GET", `/topic/${param(req.topicId)}/prop`, undefined).then((r) => r.items);
68
112
  }
69
113
  // PropRoutes.GetProp: GET /topic/{topicId}/prop/{propId}
70
114
  getProp(req) {
71
- return this.call("GET", `/topic/${param(req.topicId)}/prop/${param(req.propId)}`, undefined);
115
+ return this.#request("GET", `/topic/${param(req.topicId)}/prop/${param(req.propId)}`, undefined).then(flattenProp);
116
+ }
117
+ // PropRoutes.GetProp: GET /topic/{topicId}/prop/{propId}
118
+ getPropSigned(req) {
119
+ return this.#request("GET", `/topic/${param(req.topicId)}/prop/${param(req.propId)}`, undefined);
72
120
  }
73
121
  // PropRoutes.CreateProp: POST /topic/{topicId}/prop
74
- createProp(req) {
75
- const { topicId, ...body } = req;
76
- return this.call("POST", `/topic/${param(topicId)}/prop`, JSON.stringify(body));
122
+ async createProp(req) {
123
+ const { topicId, ...rest } = req;
124
+ const { interpretation, signature } = await this.#sign(rest.content, "metacensus.v1.Prop");
125
+ return flattenProp(await this.#request("POST", `/topic/${param(topicId)}/prop`, JSON.stringify({ ...rest, interpretation, userSignature: signature })));
77
126
  }
78
127
  // PropRoutes.ListVotes: GET /topic/{topicId}/prop/{propId}/vote
79
128
  listVotes(req) {
80
- return this.call("GET", `/topic/${param(req.topicId)}/prop/${param(req.propId)}/vote`, undefined);
129
+ return this.#request("GET", `/topic/${param(req.topicId)}/prop/${param(req.propId)}/vote`, undefined).then((r) => r.items.map(flattenVote));
130
+ }
131
+ // PropRoutes.ListVotes: GET /topic/{topicId}/prop/{propId}/vote
132
+ listVotesSigned(req) {
133
+ return this.#request("GET", `/topic/${param(req.topicId)}/prop/${param(req.propId)}/vote`, undefined).then((r) => r.items);
81
134
  }
82
135
  // PropRoutes.SetVote: POST /topic/{topicId}/prop/{propId}/vote
83
- setVote(req) {
84
- const { topicId, propId, ...body } = req;
85
- return this.call("POST", `/topic/${param(topicId)}/prop/${param(propId)}/vote`, JSON.stringify(body));
136
+ async setVote(req) {
137
+ const { topicId, propId, ...rest } = req;
138
+ const { interpretation, signature } = await this.#sign(rest.content, "metacensus.v1.Vote");
139
+ return flattenVote(await this.#request("POST", `/topic/${param(topicId)}/prop/${param(propId)}/vote`, JSON.stringify({ ...rest, interpretation, userSignature: signature })));
86
140
  }
87
141
  // TopicRoutes.ListTopics: GET /topic
88
142
  listTopics(req) {
89
- return this.call("GET", "/topic", undefined);
143
+ return this.#request("GET", "/topic", undefined).then((r) => r.items.map(flattenTopic));
144
+ }
145
+ // TopicRoutes.ListTopics: GET /topic
146
+ listTopicsSigned(req) {
147
+ return this.#request("GET", "/topic", undefined).then((r) => r.items);
90
148
  }
91
149
  // TopicRoutes.GetTopic: GET /topic/{topicId}
92
150
  getTopic(req) {
93
- return this.call("GET", `/topic/${param(req.topicId)}`, undefined);
151
+ return this.#request("GET", `/topic/${param(req.topicId)}`, undefined).then(flattenTopic);
152
+ }
153
+ // TopicRoutes.GetTopic: GET /topic/{topicId}
154
+ getTopicSigned(req) {
155
+ return this.#request("GET", `/topic/${param(req.topicId)}`, undefined);
94
156
  }
95
157
  // TopicRoutes.CreateTopic: POST /topic
96
- createTopic(req) {
97
- const body = req;
98
- return this.call("POST", "/topic", JSON.stringify(body));
158
+ async createTopic(req) {
159
+ const { interpretation, signature } = await this.#sign(req.content, "metacensus.v1.Topic");
160
+ return flattenTopic(await this.#request("POST", "/topic", JSON.stringify({ ...req, interpretation, userSignature: signature })));
99
161
  }
100
162
  // TopicRoutes.ListMembers: GET /topic/{topicId}/member
101
163
  listMembers(req) {
102
- return this.call("GET", `/topic/${param(req.topicId)}/member`, undefined);
164
+ return this.#request("GET", `/topic/${param(req.topicId)}/member`, undefined).then((r) => r.items);
103
165
  }
104
166
  // TopicRoutes.GetMember: GET /topic/{topicId}/member/{userId}
105
167
  getMember(req) {
106
- return this.call("GET", `/topic/${param(req.topicId)}/member/${param(req.userId)}`, undefined);
168
+ return this.#request("GET", `/topic/${param(req.topicId)}/member/${param(req.userId)}`, undefined);
107
169
  }
108
170
  // UserRoutes.ListUsers: GET /user
109
171
  listUsers(req) {
110
- return this.call("GET", "/user", undefined);
172
+ return this.#request("GET", "/user", undefined).then((r) => r.items.map(flattenUser));
173
+ }
174
+ // UserRoutes.ListUsers: GET /user
175
+ listUsersSigned(req) {
176
+ return this.#request("GET", "/user", undefined).then((r) => r.items);
111
177
  }
112
178
  // UserRoutes.GetUser: GET /user/{userId}
113
179
  getUser(req) {
114
- return this.call("GET", `/user/${param(req.userId)}`, undefined);
180
+ return this.#request("GET", `/user/${param(req.userId)}`, undefined).then(flattenUser);
181
+ }
182
+ // UserRoutes.GetUser: GET /user/{userId}
183
+ getUserSigned(req) {
184
+ return this.#request("GET", `/user/${param(req.userId)}`, undefined);
115
185
  }
116
186
  // UserRoutes.GetSelf: GET /self
117
187
  getSelf(req) {
118
- return this.call("GET", "/self", undefined);
188
+ return this.#request("GET", "/self", undefined).then(flattenUser);
189
+ }
190
+ // UserRoutes.GetSelf: GET /self
191
+ getSelfSigned(req) {
192
+ return this.#request("GET", "/self", undefined);
119
193
  }
120
194
  }
121
- // PublicClient calls the public, unauthenticated surface: every route under /metacensus/public.
195
+ // PublicClient calls the public, unauthenticated surface.
122
196
  export class PublicClient {
123
- transport;
124
- prefix;
125
- // Defaults to this surface's own publicPrefix, but can be overridden so a
126
- // test harness can mount the same routes elsewhere.
127
- constructor(transport, prefix = publicPrefixDefault) {
128
- this.transport = transport;
129
- this.prefix = prefix;
130
- }
131
- async call(method, path, body) {
132
- const full = this.prefix + path;
133
- const res = await this.transport({ method, path: full, body });
134
- if (res.status < 200 || res.status >= 300) {
135
- throw new ApiError(method, full, res.status, res.body);
136
- }
137
- // A cast: no runtime schema to validate against.
138
- return (res.body === "" ? {} : JSON.parse(res.body));
197
+ #baseUrl;
198
+ #fetch;
199
+ #prefix;
200
+ constructor(options) {
201
+ this.#baseUrl = options.baseUrl;
202
+ this.#fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
203
+ this.#prefix = options.prefix ?? publicPrefix;
204
+ }
205
+ #request(method, path, body) {
206
+ return request(this.#fetch, this.#baseUrl + this.#prefix + path, method, body, undefined);
139
207
  }
140
208
  // PartnerRoutes.SubmitPartnerInterest: POST /partner
141
209
  submitPartnerInterest(req) {
142
- const body = req;
143
- return this.call("POST", "/partner", JSON.stringify(body));
210
+ return this.#request("POST", "/partner", JSON.stringify(req));
144
211
  }
145
212
  }
146
213
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,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IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IAC/F,CAAC;IAED,qDAAqD;IACrD,qBAAqB,CAAC,GAAsB;QAC1C,OAAO,IAAI,CAAC,QAAQ,CAAiB,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAChF,CAAC;CACF"}
@@ -1,4 +1,4 @@
1
- import type { UserContent, UserSignature } from "./common.js";
1
+ import type { Interpretation, Signature, User } from "./common.js";
2
2
  export declare const protobufPackage = "metacensus.v1";
3
3
  /** Sign-up, login and logout. */
4
4
  export interface LoginRequest {
@@ -8,27 +8,71 @@ export interface LoginRequest {
8
8
  /**
9
9
  * Creates an account and enrolls the signing key every later write is
10
10
  * signed with: trust on first use — nobody vouches for the key, the service
11
- * binds whatever it's handed, and the signature proves possession of the
12
- * matching private key at enrollment.
11
+ * binds whatever it's handed, and the assertion proves possession of the
12
+ * matching private key at enrollment. This is the one write whose key is not
13
+ * resolved from persistence: no account, and so no key history, exists yet.
13
14
  */
14
15
  export interface SignUpRequest {
15
- content?: UserContent | undefined;
16
+ content?: User | undefined;
16
17
  /**
17
18
  * Deliberately outside `content`: a password must never be inside a
18
19
  * signed, stored document.
19
20
  */
20
21
  password: string;
22
+ /** How the enrolling assertion is to be read; re-stamped onto the UserSigned. */
23
+ interpretation?: Interpretation | undefined;
21
24
  /**
22
- * Over `content`, made with the key being enrolled. `signer_id` is empty
23
- * (no id exists yet) and `public_key` carries the key inline.
25
+ * The public half of the key being enrolled: base64url SPKI DER. Carried
26
+ * here, on the one enrollment write, rather than on every Signature — a
27
+ * usually-empty key field on every record is a footgun (forge content, key
28
+ * and signature and it "verifies"). The store checks `user_signature.key_id`
29
+ * thumbprints this key before binding it. For a passkey this is the public
30
+ * key the navigator.credentials.create() ceremony yielded.
24
31
  */
25
- userSignature?: UserSignature | undefined;
32
+ publicKey: string;
33
+ /**
34
+ * Over `content`, made with the key being enrolled; verified at sign-up
35
+ * against `public_key` (bound by key_id), not against a resolved key.
36
+ */
37
+ userSignature?: Signature | undefined;
26
38
  }
27
39
  export interface Session {
28
- /** Bearer token, sent back as `Authorization: Bearer <token>`. */
40
+ /**
41
+ * Short-lived access token, sent back as `Authorization: Bearer <token>`.
42
+ * Opaque; the client cannot read an expiry out of it, which is what
43
+ * `expires_in` is for.
44
+ */
29
45
  token: string;
46
+ /**
47
+ * Seconds until `token` expires, measured from when this response was
48
+ * issued. The client refreshes at or before that horizon (see `/refresh`);
49
+ * it is the only expiry signal, since the token is opaque.
50
+ */
51
+ expiresIn: number;
52
+ /**
53
+ * Long-lived credential that mints a fresh access token at `/refresh`,
54
+ * rotated on every use and revoked at logout. In the browser posture it
55
+ * never travels here: the server lifts it into an `HttpOnly` cookie and
56
+ * blanks this field, so JavaScript never holds it. A non-browser caller (a
57
+ * proxy or another server) reads it here instead. See ts/README.md, "Auth
58
+ * and the session token".
59
+ */
60
+ refreshToken: string;
61
+ }
62
+ /**
63
+ * Exchanges a refresh token for a fresh session. Cookie or body delivery is as
64
+ * on `Session.refresh_token`; a request that carries neither is rejected.
65
+ */
66
+ export interface RefreshRequest {
67
+ refreshToken: string;
30
68
  }
31
69
  export interface LogoutRequest {
70
+ /**
71
+ * The refresh token whose session to end — its rotation lineage and its
72
+ * access tokens with it. Cookie or body delivery is as on
73
+ * `Session.refresh_token`.
74
+ */
75
+ refreshToken: string;
32
76
  }
33
77
  export interface LogoutResponse {
34
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/auth.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,iCAAiC;AAEjC,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;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WAAW,aAAa;IAC5B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;CAC9B"}
@@ -14,53 +14,99 @@ export interface HealthcheckResponse {
14
14
  status: string;
15
15
  }
16
16
  /**
17
- * One participant's signature over one content message. Not verified at the
18
- * API edge — see README.md, "The signing chain".
17
+ * How to read a stored record: which signing scheme produced it and which
18
+ * message its `content` holds. A stored record is append-only — it can be
19
+ * neither re-signed nor allowed to assume the schema around it stays put — so
20
+ * it self-describes how to verify it rather than deriving that from the current
21
+ * envelope. Two independent axes of one concern, so one object; it is a
22
+ * record-level property, identical for both signatures, sealed by both digests.
23
+ * See README.md, "The signing chain".
19
24
  */
20
- export interface UserSignature {
25
+ export interface Interpretation {
21
26
  /**
22
- * Empty only on the sign-up that enrolls the key; public_key carries it
23
- * inline there instead.
27
+ * The signing scheme as one atom: canonicalization, digest, curve and
28
+ * encoding together. Changing any of them changes this string, and a verifier
29
+ * that does not recognize it refuses rather than guesses.
24
30
  */
25
- signerId: string;
26
- /** base64url SHA-256 of public_key's SPKI DER. */
27
- keyId: string;
28
- alg: UserSignature_Alg;
29
- /** base64url SPKI DER; set only on the sign-up that enrolls the key. */
30
- publicKey: string;
31
+ spec: string;
31
32
  /**
32
- * The signer's claimed time, not the server's — see `recorded` on signed
33
- * records for what the pair does and does not bound.
33
+ * Full proto name of the message `content` holds, e.g. "metacensus.v1.Prop".
34
+ * Read from the record, never inferred from the surrounding envelope: the
35
+ * envelope's schema may drift, the sealed name does not. Stops a signature
36
+ * over one type being replayed as another.
34
37
  */
35
- signingTime?: string | undefined;
38
+ contentType: string;
39
+ }
40
+ /**
41
+ * One signature in the chain, in one format for every layer. The participant
42
+ * signs with a passkey (WebAuthn); the institution countersigns headless
43
+ * (server/HSM). Both are the same object — a WebAuthn-shaped assertion whose
44
+ * challenge is the record's digest — so there is one decoder and one crypto
45
+ * primitive (ECDSA P-256 / ES256) the whole chain down. The only honest
46
+ * difference between the layers is the assertion's own metadata (`type`,
47
+ * `origin`, the user-verified flag), which each layer's acceptance policy
48
+ * checks; it is never a second code path. Not verified at the API edge — see
49
+ * README.md, "The signing chain".
50
+ */
51
+ export interface Signature {
36
52
  /**
37
- * Exactly how this signature is computed and checked; changing the
38
- * canonicalization, digest, or encoding changes this string.
53
+ * Selects the signer's enrolled key from persistence's key history; that
54
+ * enrolled key is the trust anchor. Deliberately not a key carried on the
55
+ * record: resolving against persistence is what stops a forged {content, key,
56
+ * signature} triple verifying against itself. The signer's id is not carried
57
+ * either — it is this key_id's resolved owner, persistence's to determine,
58
+ * never a client claim. The one exception is sign-up, where no key is
59
+ * enrolled yet; see auth.proto's SignUpRequest.
39
60
  */
40
- spec: string;
61
+ keyId: string;
41
62
  /**
42
- * Full proto name of the message `content` holds, e.g.
43
- * "metacensus.v1.PropContent". Stops a signature over one type being
44
- * replayed as another.
63
+ * This signer's own time: a participant's claim, an institution's
64
+ * observation. Inside the digest, so it cannot be re-dated after the fact.
65
+ * Record ordering still uses the record-level `recorded`, never this — see
66
+ * `recorded` on the signed records.
45
67
  */
46
- contentType: string;
47
- /** Excluded from its own digest by being emptied, not dropped. */
48
- value: string;
68
+ time?: string | undefined;
69
+ /**
70
+ * The WebAuthn assertion. Stored verbatim; the digest it commits to is
71
+ * recomputed from the record's own fields at verify time, never
72
+ * reverse-engineered from what is stored.
73
+ */
74
+ assertion?: Signature_Assertion | undefined;
49
75
  }
50
76
  /**
51
- * Closed vocabulary: an unrecognized value fails to decode rather than
52
- * reaching a verifier. See README.md, "The signing chain", before adding one.
77
+ * What navigator.credentials.get() returns for a passkey, and what a headless
78
+ * signer emits in the identical shape. WebAuthn does not sign arbitrary bytes:
79
+ * it signs authenticator_data ‖ SHA-256(client_data_json), with the content
80
+ * digest carried inside client_data_json.challenge.
53
81
  */
54
- export declare enum UserSignature_Alg {
55
- Unspecified = "Unspecified",
56
- /** Es384 - JOSE fixed-width r||s, never DER. */
57
- Es384 = "Es384"
82
+ export interface Signature_Assertion {
83
+ /**
84
+ * base64url of authenticatorData: the rpId hash, and the UP/UV/BE/BS flags
85
+ * a verifier reads presence, user-verification and credential custody
86
+ * (synced vs device-bound) from. Signed over directly.
87
+ */
88
+ authenticatorData: string;
89
+ /**
90
+ * base64url of the UTF-8 clientDataJSON. Its `challenge` is this record's
91
+ * digest (base64url); its `type` and, for a passkey, `origin` are the
92
+ * honest per-layer metadata the acceptance policy checks. A headless signer
93
+ * uses an honest institutional `type` and no origin, and never forges a
94
+ * passkey's metadata — the flags and type are the custody signal a verifier
95
+ * reads.
96
+ */
97
+ clientDataJson: string;
98
+ /**
99
+ * base64url of the ECDSA signature over authenticator_data ‖
100
+ * SHA-256(client_data_json). DER (ASN.1 SEQUENCE), as WebAuthn emits — not
101
+ * the fixed-width r‖s the prior scheme carried.
102
+ */
103
+ signature: string;
58
104
  }
59
105
  /**
60
106
  * The part of a user record its owner signs. Lives here, not user.proto,
61
- * because auth.proto's SignUpRequest and user.proto's User both need it.
107
+ * because auth.proto's SignUpRequest and user.proto's UserSigned both need it.
62
108
  */
63
- export interface UserContent {
109
+ export interface User {
64
110
  name: string;
65
111
  email: string;
66
112
  country: string;
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/common.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,oBAAoB;AAEpB,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC3B,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,iBAAiB,CAAC;IACvB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EACR,MAAM,GACN,SAAS,CAAC;IACd;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,oBAAY,iBAAiB;IAC3B,WAAW,gBAAgB;IAC3B,gDAAgD;IAChD,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/metacensus/v1/common.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAE/C,oBAAoB;AAEpB,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC3B,eAAe;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;;;OAQG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,IAAI,CAAC,EACD,MAAM,GACN,SAAS,CAAC;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC;CAC7C;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;;;;;;OAOG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB"}
@@ -5,14 +5,4 @@
5
5
  // source: metacensus/v1/common.proto
6
6
  /* eslint-disable */
7
7
  export const protobufPackage = "metacensus.v1";
8
- /**
9
- * Closed vocabulary: an unrecognized value fails to decode rather than
10
- * reaching a verifier. See README.md, "The signing chain", before adding one.
11
- */
12
- export var UserSignature_Alg;
13
- (function (UserSignature_Alg) {
14
- UserSignature_Alg["Unspecified"] = "Unspecified";
15
- /** Es384 - JOSE fixed-width r||s, never DER. */
16
- UserSignature_Alg["Es384"] = "Es384";
17
- })(UserSignature_Alg || (UserSignature_Alg = {}));
18
8
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/metacensus/v1/common.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,qCAAqC;AAErC,oBAAoB;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AAyD/C;;;GAGG;AACH,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,gDAA2B,CAAA;IAC3B,gDAAgD;IAChD,oCAAe,CAAA;AACjB,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B"}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/metacensus/v1/common.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,qCAAqC;AAErC,oBAAoB;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC"}