@libid/contracts 0.7.0 → 0.9.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.
@@ -0,0 +1,2 @@
1
+ export * from './profiles.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ceremony/index.ts"],"names":[],"mappings":"AAYA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,13 @@
1
+ /// The ceremony profiles, TypeScript half.
2
+ ///
3
+ /// What each platform's notarized sessions request, which host answers them,
4
+ /// and which bytes of the response a Platform Verifier reads. Generated from
5
+ /// `solidity/contracts/ceremony/profiles.json`, the same file `CeremonyProfile
6
+ /// .sol` and the Rust table come from, so the browser and the chain cannot
7
+ /// hold different copies.
8
+ ///
9
+ /// The platform id is `keccak256` of `Profile.platform` and the authority id
10
+ /// is `keccak256` of `Session.authority`. Neither is computed here: a caller
11
+ /// that needs one already has a hasher, and this layer stays dependency-free.
12
+ export * from './profiles.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ceremony/index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,GAAG;AACH,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,2EAA2E;AAC3E,0BAA0B;AAC1B,GAAG;AACH,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAE9E,cAAc,eAAe,CAAA"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The single source of truth for the ceremony profiles. Solidity, Rust and
3
+ * TypeScript constants are generated from this file by
4
+ * scripts/regen-ceremony-profiles.py. The Platform Verifiers are hand
5
+ * written and READ these constants; only the values live here.
6
+ *
7
+ * THESE STRINGS ARE OURS, NOT THE SPECIFICATION'S. ceremony-common fixes no
8
+ * literal of its own: platform-ceremonies REQ-PLAT-01 fixes the profile
9
+ * NAMES, and every byte below is the profile author's choice. So this is a
10
+ * cross-implementation agreement, and it is agreed here rather than four
11
+ * times over.
12
+ *
13
+ * Four components must produce the same bytes: this repository's verifiers,
14
+ * the browser that notarizes three of the four sessions, the deployment that
15
+ * notarizes the fourth, and the notary that signs what they observed. A
16
+ * disagreement is silent -- a Consumer dispatching on one string and a
17
+ * verifier registered under another simply never meet, and a request line a
18
+ * prover composes one byte differently is an attestation rejected with no
19
+ * error that says why.
20
+ *
21
+ * Changing a value here changes what a deployed verifier accepts. That is a
22
+ * new ceremonyVersion, not an edit.
23
+ */
24
+ /** Which shape a platform's immutable identifier takes in its response. */
25
+ export type IdShape = 'jsonString' | 'jsonInteger';
26
+ export interface Session {
27
+ /** The lowercase TLS server name the notary authenticates. */
28
+ readonly authority: string;
29
+ readonly method: string;
30
+ readonly path: string;
31
+ /** The request-line prefix the verifier compares byte for byte. */
32
+ readonly requestLine: string;
33
+ }
34
+ export interface TokenSession {
35
+ readonly session: Session;
36
+ /** The body field committed rather than revealed, or null. */
37
+ readonly secretField: string | null;
38
+ /** Every header this request sends, lowercased, in no particular order.
39
+ * `content-length` is absent: the HTTP client appends it. */
40
+ readonly requestHeaders: readonly string[];
41
+ /** The same lines joined by CRLF, which a Platform Verifier splits and
42
+ * matches as a set. */
43
+ readonly requestHeaderBlock: string;
44
+ }
45
+ export interface IdentitySession {
46
+ readonly session: Session;
47
+ readonly idField: string;
48
+ readonly idShape: IdShape;
49
+ readonly handleField: string;
50
+ }
51
+ export interface Profile {
52
+ /** The platform name. The platform id is its keccak256. */
53
+ readonly platform: string;
54
+ readonly ceremonyVersion: number;
55
+ readonly token: TokenSession | null;
56
+ readonly identity: IdentitySession | null;
57
+ }
58
+ /**
59
+ * Google's evidence is a signed token checked against Google's published
60
+ * keys, so the profile notarizes nothing: no session, no attestation,
61
+ * and no Notary Fee.
62
+ */
63
+ export declare const GOOGLE: Profile;
64
+ /**
65
+ * A public client with S256 PKCE and two browser-owned sessions, both
66
+ * served by the same host.
67
+ */
68
+ export declare const X: Profile;
69
+ /**
70
+ * A confidential client. The exchange runs in the deployment because the
71
+ * secret cannot reach the browser, and the two sessions are served by
72
+ * DIFFERENT hosts -- which is why one pinned authority per profile would
73
+ * be wrong.
74
+ */
75
+ export declare const GITHUB: Profile;
76
+ /** The closed launch list. */
77
+ export declare const LAUNCH: readonly Profile[];
78
+ /** The launch profile for a platform name, or undefined. */
79
+ export declare function launch(platform: string): Profile | undefined;
80
+ /** How many attestations a submission for this profile carries. */
81
+ export declare function attestationCount(profile: Profile): number;
82
+ /** Governance-owned launch parameters, in seconds. */
83
+ export declare const MAX_FUTURE_ATTESTATION_SKEW_SECONDS = 300;
84
+ export declare const PROOF_LIFETIME_SECONDS_X = 3600;
85
+ export declare const PROOF_LIFETIME_SECONDS_GITHUB = 3600;
86
+ //# sourceMappingURL=profiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../src/ceremony/profiles.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,2EAA2E;AAC3E,MAAM,MAAM,OAAO,GAAG,YAAY,GAAG,aAAa,CAAA;AAElD,MAAM,WAAW,OAAO;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,mEAAmE;IACnE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC;iEAC6D;IAC7D,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1C;2BACuB;IACvB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAA;CACpC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,OAAO;IACtB,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAA;IACnC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAA;CAC1C;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,OAKpB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,CAAC,EAAE,OA+Bf,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,EAAE,OA+BpB,CAAA;AAED,8BAA8B;AAC9B,eAAO,MAAM,MAAM,EAAE,SAAS,OAAO,EAAwB,CAAA;AAE7D,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE5D;AAED,mEAAmE;AACnE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAEzD;AAED,sDAAsD;AACtD,eAAO,MAAM,mCAAmC,MAAM,CAAA;AACtD,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAC5C,eAAO,MAAM,6BAA6B,OAAO,CAAA"}
@@ -0,0 +1,100 @@
1
+ // Generated by scripts/regen-ceremony-profiles.py. Do not edit.
2
+ // The source of truth is solidity/contracts/ceremony/profiles.json.
3
+ /**
4
+ * Google's evidence is a signed token checked against Google's published
5
+ * keys, so the profile notarizes nothing: no session, no attestation,
6
+ * and no Notary Fee.
7
+ */
8
+ export const GOOGLE = {
9
+ platform: 'google',
10
+ ceremonyVersion: 1,
11
+ token: null,
12
+ identity: null,
13
+ };
14
+ /**
15
+ * A public client with S256 PKCE and two browser-owned sessions, both
16
+ * served by the same host.
17
+ */
18
+ export const X = {
19
+ platform: 'x',
20
+ ceremonyVersion: 1,
21
+ token: {
22
+ session: {
23
+ authority: 'api.x.com',
24
+ method: 'POST',
25
+ path: '/2/oauth2/token',
26
+ requestLine: 'POST /2/oauth2/token ',
27
+ },
28
+ secretField: null,
29
+ requestHeaders: [
30
+ 'host: api.x.com',
31
+ 'content-type: application/x-www-form-urlencoded',
32
+ 'accept: application/json',
33
+ 'connection: close',
34
+ ],
35
+ requestHeaderBlock: 'host: api.x.com\r\ncontent-type: application/x-www-form-urlencoded\r\naccept: application/json\r\nconnection: close',
36
+ },
37
+ identity: {
38
+ session: {
39
+ authority: 'api.x.com',
40
+ method: 'GET',
41
+ path: '/2/users/me',
42
+ requestLine: 'GET /2/users/me ',
43
+ },
44
+ idField: 'id',
45
+ idShape: 'jsonString',
46
+ handleField: 'username',
47
+ },
48
+ };
49
+ /**
50
+ * A confidential client. The exchange runs in the deployment because the
51
+ * secret cannot reach the browser, and the two sessions are served by
52
+ * DIFFERENT hosts -- which is why one pinned authority per profile would
53
+ * be wrong.
54
+ */
55
+ export const GITHUB = {
56
+ platform: 'github',
57
+ ceremonyVersion: 1,
58
+ token: {
59
+ session: {
60
+ authority: 'github.com',
61
+ method: 'POST',
62
+ path: '/login/oauth/access_token',
63
+ requestLine: 'POST /login/oauth/access_token ',
64
+ },
65
+ secretField: 'client_secret',
66
+ requestHeaders: [
67
+ 'host: github.com',
68
+ 'content-type: application/x-www-form-urlencoded',
69
+ 'accept: application/json',
70
+ 'connection: close',
71
+ ],
72
+ requestHeaderBlock: 'host: github.com\r\ncontent-type: application/x-www-form-urlencoded\r\naccept: application/json\r\nconnection: close',
73
+ },
74
+ identity: {
75
+ session: {
76
+ authority: 'api.github.com',
77
+ method: 'GET',
78
+ path: '/user',
79
+ requestLine: 'GET /user ',
80
+ },
81
+ idField: 'id',
82
+ idShape: 'jsonInteger',
83
+ handleField: 'login',
84
+ },
85
+ };
86
+ /** The closed launch list. */
87
+ export const LAUNCH = [GOOGLE, X, GITHUB];
88
+ /** The launch profile for a platform name, or undefined. */
89
+ export function launch(platform) {
90
+ return LAUNCH.find((p) => p.platform === platform);
91
+ }
92
+ /** How many attestations a submission for this profile carries. */
93
+ export function attestationCount(profile) {
94
+ return (profile.token ? 1 : 0) + (profile.identity ? 1 : 0);
95
+ }
96
+ /** Governance-owned launch parameters, in seconds. */
97
+ export const MAX_FUTURE_ATTESTATION_SKEW_SECONDS = 300;
98
+ export const PROOF_LIFETIME_SECONDS_X = 3600;
99
+ export const PROOF_LIFETIME_SECONDS_GITHUB = 3600;
100
+ //# sourceMappingURL=profiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/ceremony/profiles.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,oEAAoE;AAiEpE;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAY;IAC7B,QAAQ,EAAE,QAAQ;IAClB,eAAe,EAAE,CAAC;IAClB,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,IAAI;CACf,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,CAAC,GAAY;IACxB,QAAQ,EAAE,GAAG;IACb,eAAe,EAAE,CAAC;IAClB,KAAK,EAAE;QACL,OAAO,EAAE;YACP,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,iBAAiB;YACvB,WAAW,EAAE,uBAAuB;SACrC;QACD,WAAW,EAAE,IAAI;QACjB,cAAc,EAAE;YACd,iBAAiB;YACjB,iDAAiD;YACjD,0BAA0B;YAC1B,mBAAmB;SACpB;QACD,kBAAkB,EAChB,qHAAqH;KACxH;IACD,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,SAAS,EAAE,WAAW;YACtB,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,kBAAkB;SAChC;QACD,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,YAAY;QACrB,WAAW,EAAE,UAAU;KACxB;CACF,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAY;IAC7B,QAAQ,EAAE,QAAQ;IAClB,eAAe,EAAE,CAAC;IAClB,KAAK,EAAE;QACL,OAAO,EAAE;YACP,SAAS,EAAE,YAAY;YACvB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,2BAA2B;YACjC,WAAW,EAAE,iCAAiC;SAC/C;QACD,WAAW,EAAE,eAAe;QAC5B,cAAc,EAAE;YACd,kBAAkB;YAClB,iDAAiD;YACjD,0BAA0B;YAC1B,mBAAmB;SACpB;QACD,kBAAkB,EAChB,sHAAsH;KACzH;IACD,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,SAAS,EAAE,gBAAgB;YAC3B,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,YAAY;SAC1B;QACD,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,aAAa;QACtB,WAAW,EAAE,OAAO;KACrB;CACF,CAAA;AAED,8BAA8B;AAC9B,MAAM,CAAC,MAAM,MAAM,GAAuB,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAA;AAE7D,4DAA4D;AAC5D,MAAM,UAAU,MAAM,CAAC,QAAgB;IACrC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAA;AACpD,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAC7D,CAAC;AAED,sDAAsD;AACtD,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,CAAA;AACtD,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAA;AAC5C,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './abis/index.js';
2
2
  export type { Call } from './call.js';
3
3
  export * as calls from './calls/index.js';
4
+ export * from './ceremony/index.js';
4
5
  export * from './identity/index.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,iBAAiB,CAAA;AAC/B,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,iBAAiB,CAAA;AAC/B,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA"}
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  /// @libid/contracts — typed viem-ready ABIs for every contract, a call builder
2
2
  /// for every state-changing function, and the identity helper layer. Subpath
3
- /// imports work too: `@libid/contracts/abis`, `@libid/contracts/calls` and
4
- /// `@libid/contracts/identity`.
3
+ /// imports work too: `@libid/contracts/abis`, `@libid/contracts/calls`,
4
+ /// `@libid/contracts/identity` and `@libid/contracts/ceremony`.
5
5
  export * from './abis/index.js';
6
6
  export * as calls from './calls/index.js';
7
+ export * from './ceremony/index.js';
7
8
  export * from './identity/index.js';
8
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6EAA6E;AAC7E,2EAA2E;AAC3E,gCAAgC;AAEhC,cAAc,iBAAiB,CAAA;AAE/B,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6EAA6E;AAC7E,wEAAwE;AACxE,gEAAgE;AAEhE,cAAc,iBAAiB,CAAA;AAE/B,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libid/contracts",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Typed viem-ready ABIs and call builders for the libid contracts, plus the identity helper layer (handle normalization, name resolution).",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "repository": {
@@ -26,6 +26,10 @@
26
26
  "types": "./dist/abis/index.d.ts",
27
27
  "default": "./dist/abis/index.js"
28
28
  },
29
+ "./ceremony": {
30
+ "types": "./dist/ceremony/index.d.ts",
31
+ "default": "./dist/ceremony/index.js"
32
+ },
29
33
  "./identity": {
30
34
  "types": "./dist/identity/index.d.ts",
31
35
  "default": "./dist/identity/index.js"
@@ -0,0 +1,13 @@
1
+ /// The ceremony profiles, TypeScript half.
2
+ ///
3
+ /// What each platform's notarized sessions request, which host answers them,
4
+ /// and which bytes of the response a Platform Verifier reads. Generated from
5
+ /// `solidity/contracts/ceremony/profiles.json`, the same file `CeremonyProfile
6
+ /// .sol` and the Rust table come from, so the browser and the chain cannot
7
+ /// hold different copies.
8
+ ///
9
+ /// The platform id is `keccak256` of `Profile.platform` and the authority id
10
+ /// is `keccak256` of `Session.authority`. Neither is computed here: a caller
11
+ /// that needs one already has a hasher, and this layer stays dependency-free.
12
+
13
+ export * from './profiles.js'
@@ -0,0 +1,171 @@
1
+ // Generated by scripts/regen-ceremony-profiles.py. Do not edit.
2
+ // The source of truth is solidity/contracts/ceremony/profiles.json.
3
+
4
+ /**
5
+ * The single source of truth for the ceremony profiles. Solidity, Rust and
6
+ * TypeScript constants are generated from this file by
7
+ * scripts/regen-ceremony-profiles.py. The Platform Verifiers are hand
8
+ * written and READ these constants; only the values live here.
9
+ *
10
+ * THESE STRINGS ARE OURS, NOT THE SPECIFICATION'S. ceremony-common fixes no
11
+ * literal of its own: platform-ceremonies REQ-PLAT-01 fixes the profile
12
+ * NAMES, and every byte below is the profile author's choice. So this is a
13
+ * cross-implementation agreement, and it is agreed here rather than four
14
+ * times over.
15
+ *
16
+ * Four components must produce the same bytes: this repository's verifiers,
17
+ * the browser that notarizes three of the four sessions, the deployment that
18
+ * notarizes the fourth, and the notary that signs what they observed. A
19
+ * disagreement is silent -- a Consumer dispatching on one string and a
20
+ * verifier registered under another simply never meet, and a request line a
21
+ * prover composes one byte differently is an attestation rejected with no
22
+ * error that says why.
23
+ *
24
+ * Changing a value here changes what a deployed verifier accepts. That is a
25
+ * new ceremonyVersion, not an edit.
26
+ */
27
+
28
+ /** Which shape a platform's immutable identifier takes in its response. */
29
+ export type IdShape = 'jsonString' | 'jsonInteger'
30
+
31
+ export interface Session {
32
+ /** The lowercase TLS server name the notary authenticates. */
33
+ readonly authority: string
34
+ readonly method: string
35
+ readonly path: string
36
+ /** The request-line prefix the verifier compares byte for byte. */
37
+ readonly requestLine: string
38
+ }
39
+
40
+ export interface TokenSession {
41
+ readonly session: Session
42
+ /** The body field committed rather than revealed, or null. */
43
+ readonly secretField: string | null
44
+ /** Every header this request sends, lowercased, in no particular order.
45
+ * `content-length` is absent: the HTTP client appends it. */
46
+ readonly requestHeaders: readonly string[]
47
+ /** The same lines joined by CRLF, which a Platform Verifier splits and
48
+ * matches as a set. */
49
+ readonly requestHeaderBlock: string
50
+ }
51
+
52
+ export interface IdentitySession {
53
+ readonly session: Session
54
+ readonly idField: string
55
+ readonly idShape: IdShape
56
+ readonly handleField: string
57
+ }
58
+
59
+ export interface Profile {
60
+ /** The platform name. The platform id is its keccak256. */
61
+ readonly platform: string
62
+ readonly ceremonyVersion: number
63
+ readonly token: TokenSession | null
64
+ readonly identity: IdentitySession | null
65
+ }
66
+
67
+ /**
68
+ * Google's evidence is a signed token checked against Google's published
69
+ * keys, so the profile notarizes nothing: no session, no attestation,
70
+ * and no Notary Fee.
71
+ */
72
+ export const GOOGLE: Profile = {
73
+ platform: 'google',
74
+ ceremonyVersion: 1,
75
+ token: null,
76
+ identity: null,
77
+ }
78
+
79
+ /**
80
+ * A public client with S256 PKCE and two browser-owned sessions, both
81
+ * served by the same host.
82
+ */
83
+ export const X: Profile = {
84
+ platform: 'x',
85
+ ceremonyVersion: 1,
86
+ token: {
87
+ session: {
88
+ authority: 'api.x.com',
89
+ method: 'POST',
90
+ path: '/2/oauth2/token',
91
+ requestLine: 'POST /2/oauth2/token ',
92
+ },
93
+ secretField: null,
94
+ requestHeaders: [
95
+ 'host: api.x.com',
96
+ 'content-type: application/x-www-form-urlencoded',
97
+ 'accept: application/json',
98
+ 'connection: close',
99
+ ],
100
+ requestHeaderBlock:
101
+ 'host: api.x.com\r\ncontent-type: application/x-www-form-urlencoded\r\naccept: application/json\r\nconnection: close',
102
+ },
103
+ identity: {
104
+ session: {
105
+ authority: 'api.x.com',
106
+ method: 'GET',
107
+ path: '/2/users/me',
108
+ requestLine: 'GET /2/users/me ',
109
+ },
110
+ idField: 'id',
111
+ idShape: 'jsonString',
112
+ handleField: 'username',
113
+ },
114
+ }
115
+
116
+ /**
117
+ * A confidential client. The exchange runs in the deployment because the
118
+ * secret cannot reach the browser, and the two sessions are served by
119
+ * DIFFERENT hosts -- which is why one pinned authority per profile would
120
+ * be wrong.
121
+ */
122
+ export const GITHUB: Profile = {
123
+ platform: 'github',
124
+ ceremonyVersion: 1,
125
+ token: {
126
+ session: {
127
+ authority: 'github.com',
128
+ method: 'POST',
129
+ path: '/login/oauth/access_token',
130
+ requestLine: 'POST /login/oauth/access_token ',
131
+ },
132
+ secretField: 'client_secret',
133
+ requestHeaders: [
134
+ 'host: github.com',
135
+ 'content-type: application/x-www-form-urlencoded',
136
+ 'accept: application/json',
137
+ 'connection: close',
138
+ ],
139
+ requestHeaderBlock:
140
+ 'host: github.com\r\ncontent-type: application/x-www-form-urlencoded\r\naccept: application/json\r\nconnection: close',
141
+ },
142
+ identity: {
143
+ session: {
144
+ authority: 'api.github.com',
145
+ method: 'GET',
146
+ path: '/user',
147
+ requestLine: 'GET /user ',
148
+ },
149
+ idField: 'id',
150
+ idShape: 'jsonInteger',
151
+ handleField: 'login',
152
+ },
153
+ }
154
+
155
+ /** The closed launch list. */
156
+ export const LAUNCH: readonly Profile[] = [GOOGLE, X, GITHUB]
157
+
158
+ /** The launch profile for a platform name, or undefined. */
159
+ export function launch(platform: string): Profile | undefined {
160
+ return LAUNCH.find((p) => p.platform === platform)
161
+ }
162
+
163
+ /** How many attestations a submission for this profile carries. */
164
+ export function attestationCount(profile: Profile): number {
165
+ return (profile.token ? 1 : 0) + (profile.identity ? 1 : 0)
166
+ }
167
+
168
+ /** Governance-owned launch parameters, in seconds. */
169
+ export const MAX_FUTURE_ATTESTATION_SKEW_SECONDS = 300
170
+ export const PROOF_LIFETIME_SECONDS_X = 3600
171
+ export const PROOF_LIFETIME_SECONDS_GITHUB = 3600
package/src/index.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  /// @libid/contracts — typed viem-ready ABIs for every contract, a call builder
2
2
  /// for every state-changing function, and the identity helper layer. Subpath
3
- /// imports work too: `@libid/contracts/abis`, `@libid/contracts/calls` and
4
- /// `@libid/contracts/identity`.
3
+ /// imports work too: `@libid/contracts/abis`, `@libid/contracts/calls`,
4
+ /// `@libid/contracts/identity` and `@libid/contracts/ceremony`.
5
5
 
6
6
  export * from './abis/index.js'
7
7
  export type { Call } from './call.js'
8
8
  export * as calls from './calls/index.js'
9
+ export * from './ceremony/index.js'
9
10
  export * from './identity/index.js'