@libid/contracts 0.7.0 → 0.8.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/ceremony/index.d.ts +2 -0
- package/dist/ceremony/index.d.ts.map +1 -0
- package/dist/ceremony/index.js +13 -0
- package/dist/ceremony/index.js.map +1 -0
- package/dist/ceremony/profiles.d.ts +82 -0
- package/dist/ceremony/profiles.d.ts.map +1 -0
- package/dist/ceremony/profiles.js +86 -0
- package/dist/ceremony/profiles.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
- package/src/ceremony/index.ts +13 -0
- package/src/ceremony/profiles.ts +151 -0
- package/src/index.ts +3 -2
|
@@ -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,82 @@
|
|
|
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: --check compares every shipped profile
|
|
23
|
+
* against the last release and refuses a changed profile that kept its
|
|
24
|
+
* version.
|
|
25
|
+
*/
|
|
26
|
+
/** Which shape a platform's immutable identifier takes in its response. */
|
|
27
|
+
export type IdShape = 'jsonString' | 'jsonInteger';
|
|
28
|
+
export interface Session {
|
|
29
|
+
/** The lowercase TLS server name the notary authenticates. */
|
|
30
|
+
readonly authority: string;
|
|
31
|
+
readonly method: string;
|
|
32
|
+
readonly path: string;
|
|
33
|
+
/** The request-line prefix the verifier compares byte for byte. */
|
|
34
|
+
readonly requestLine: string;
|
|
35
|
+
}
|
|
36
|
+
export interface TokenSession {
|
|
37
|
+
readonly session: Session;
|
|
38
|
+
/** The body field committed rather than revealed, or null. */
|
|
39
|
+
readonly secretField: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface IdentitySession {
|
|
42
|
+
readonly session: Session;
|
|
43
|
+
readonly idField: string;
|
|
44
|
+
readonly idShape: IdShape;
|
|
45
|
+
readonly handleField: string;
|
|
46
|
+
}
|
|
47
|
+
export interface Profile {
|
|
48
|
+
/** The platform name. The platform id is its keccak256. */
|
|
49
|
+
readonly platform: string;
|
|
50
|
+
readonly ceremonyVersion: number;
|
|
51
|
+
readonly token: TokenSession | null;
|
|
52
|
+
readonly identity: IdentitySession | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Google's evidence is a signed token checked against Google's published
|
|
56
|
+
* keys, so the profile notarizes nothing: no session, no attestation,
|
|
57
|
+
* and no Notary Fee.
|
|
58
|
+
*/
|
|
59
|
+
export declare const GOOGLE: Profile;
|
|
60
|
+
/**
|
|
61
|
+
* A public client with S256 PKCE and two browser-owned sessions, both
|
|
62
|
+
* served by the same host.
|
|
63
|
+
*/
|
|
64
|
+
export declare const X: Profile;
|
|
65
|
+
/**
|
|
66
|
+
* A confidential client. The exchange runs in the deployment because the
|
|
67
|
+
* secret cannot reach the browser, and the two sessions are served by
|
|
68
|
+
* DIFFERENT hosts -- which is why one pinned authority per profile would
|
|
69
|
+
* be wrong.
|
|
70
|
+
*/
|
|
71
|
+
export declare const GITHUB: Profile;
|
|
72
|
+
/** The closed launch list. */
|
|
73
|
+
export declare const LAUNCH: readonly Profile[];
|
|
74
|
+
/** The launch profile for a platform name, or undefined. */
|
|
75
|
+
export declare function launch(platform: string): Profile | undefined;
|
|
76
|
+
/** How many attestations a submission for this profile carries. */
|
|
77
|
+
export declare function attestationCount(profile: Profile): number;
|
|
78
|
+
/** Governance-owned launch parameters, in seconds. */
|
|
79
|
+
export declare const MAX_FUTURE_ATTESTATION_SKEW_SECONDS = 300;
|
|
80
|
+
export declare const PROOF_LIFETIME_SECONDS_X = 3600;
|
|
81
|
+
export declare const PROOF_LIFETIME_SECONDS_GITHUB = 3600;
|
|
82
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../src/ceremony/profiles.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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;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,OAuBf,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,EAAE,OAuBpB,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,86 @@
|
|
|
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
|
+
},
|
|
30
|
+
identity: {
|
|
31
|
+
session: {
|
|
32
|
+
authority: 'api.x.com',
|
|
33
|
+
method: 'GET',
|
|
34
|
+
path: '/2/users/me',
|
|
35
|
+
requestLine: 'GET /2/users/me ',
|
|
36
|
+
},
|
|
37
|
+
idField: 'id',
|
|
38
|
+
idShape: 'jsonString',
|
|
39
|
+
handleField: 'username',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A confidential client. The exchange runs in the deployment because the
|
|
44
|
+
* secret cannot reach the browser, and the two sessions are served by
|
|
45
|
+
* DIFFERENT hosts -- which is why one pinned authority per profile would
|
|
46
|
+
* be wrong.
|
|
47
|
+
*/
|
|
48
|
+
export const GITHUB = {
|
|
49
|
+
platform: 'github',
|
|
50
|
+
ceremonyVersion: 1,
|
|
51
|
+
token: {
|
|
52
|
+
session: {
|
|
53
|
+
authority: 'github.com',
|
|
54
|
+
method: 'POST',
|
|
55
|
+
path: '/login/oauth/access_token',
|
|
56
|
+
requestLine: 'POST /login/oauth/access_token ',
|
|
57
|
+
},
|
|
58
|
+
secretField: 'client_secret',
|
|
59
|
+
},
|
|
60
|
+
identity: {
|
|
61
|
+
session: {
|
|
62
|
+
authority: 'api.github.com',
|
|
63
|
+
method: 'GET',
|
|
64
|
+
path: '/user',
|
|
65
|
+
requestLine: 'GET /user ',
|
|
66
|
+
},
|
|
67
|
+
idField: 'id',
|
|
68
|
+
idShape: 'jsonInteger',
|
|
69
|
+
handleField: 'login',
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
/** The closed launch list. */
|
|
73
|
+
export const LAUNCH = [GOOGLE, X, GITHUB];
|
|
74
|
+
/** The launch profile for a platform name, or undefined. */
|
|
75
|
+
export function launch(platform) {
|
|
76
|
+
return LAUNCH.find((p) => p.platform === platform);
|
|
77
|
+
}
|
|
78
|
+
/** How many attestations a submission for this profile carries. */
|
|
79
|
+
export function attestationCount(profile) {
|
|
80
|
+
return (profile.token ? 1 : 0) + (profile.identity ? 1 : 0);
|
|
81
|
+
}
|
|
82
|
+
/** Governance-owned launch parameters, in seconds. */
|
|
83
|
+
export const MAX_FUTURE_ATTESTATION_SKEW_SECONDS = 300;
|
|
84
|
+
export const PROOF_LIFETIME_SECONDS_X = 3600;
|
|
85
|
+
export const PROOF_LIFETIME_SECONDS_GITHUB = 3600;
|
|
86
|
+
//# 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;AA6DpE;;;;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;KAClB;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;KAC7B;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
package/dist/index.d.ts.map
CHANGED
|
@@ -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
|
|
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,
|
|
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.
|
|
3
|
+
"version": "0.8.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,151 @@
|
|
|
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: --check compares every shipped profile
|
|
26
|
+
* against the last release and refuses a changed profile that kept its
|
|
27
|
+
* version.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** Which shape a platform's immutable identifier takes in its response. */
|
|
31
|
+
export type IdShape = 'jsonString' | 'jsonInteger'
|
|
32
|
+
|
|
33
|
+
export interface Session {
|
|
34
|
+
/** The lowercase TLS server name the notary authenticates. */
|
|
35
|
+
readonly authority: string
|
|
36
|
+
readonly method: string
|
|
37
|
+
readonly path: string
|
|
38
|
+
/** The request-line prefix the verifier compares byte for byte. */
|
|
39
|
+
readonly requestLine: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface TokenSession {
|
|
43
|
+
readonly session: Session
|
|
44
|
+
/** The body field committed rather than revealed, or null. */
|
|
45
|
+
readonly secretField: string | null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface IdentitySession {
|
|
49
|
+
readonly session: Session
|
|
50
|
+
readonly idField: string
|
|
51
|
+
readonly idShape: IdShape
|
|
52
|
+
readonly handleField: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface Profile {
|
|
56
|
+
/** The platform name. The platform id is its keccak256. */
|
|
57
|
+
readonly platform: string
|
|
58
|
+
readonly ceremonyVersion: number
|
|
59
|
+
readonly token: TokenSession | null
|
|
60
|
+
readonly identity: IdentitySession | null
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Google's evidence is a signed token checked against Google's published
|
|
65
|
+
* keys, so the profile notarizes nothing: no session, no attestation,
|
|
66
|
+
* and no Notary Fee.
|
|
67
|
+
*/
|
|
68
|
+
export const GOOGLE: Profile = {
|
|
69
|
+
platform: 'google',
|
|
70
|
+
ceremonyVersion: 1,
|
|
71
|
+
token: null,
|
|
72
|
+
identity: null,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A public client with S256 PKCE and two browser-owned sessions, both
|
|
77
|
+
* served by the same host.
|
|
78
|
+
*/
|
|
79
|
+
export const X: Profile = {
|
|
80
|
+
platform: 'x',
|
|
81
|
+
ceremonyVersion: 1,
|
|
82
|
+
token: {
|
|
83
|
+
session: {
|
|
84
|
+
authority: 'api.x.com',
|
|
85
|
+
method: 'POST',
|
|
86
|
+
path: '/2/oauth2/token',
|
|
87
|
+
requestLine: 'POST /2/oauth2/token ',
|
|
88
|
+
},
|
|
89
|
+
secretField: null,
|
|
90
|
+
},
|
|
91
|
+
identity: {
|
|
92
|
+
session: {
|
|
93
|
+
authority: 'api.x.com',
|
|
94
|
+
method: 'GET',
|
|
95
|
+
path: '/2/users/me',
|
|
96
|
+
requestLine: 'GET /2/users/me ',
|
|
97
|
+
},
|
|
98
|
+
idField: 'id',
|
|
99
|
+
idShape: 'jsonString',
|
|
100
|
+
handleField: 'username',
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* A confidential client. The exchange runs in the deployment because the
|
|
106
|
+
* secret cannot reach the browser, and the two sessions are served by
|
|
107
|
+
* DIFFERENT hosts -- which is why one pinned authority per profile would
|
|
108
|
+
* be wrong.
|
|
109
|
+
*/
|
|
110
|
+
export const GITHUB: Profile = {
|
|
111
|
+
platform: 'github',
|
|
112
|
+
ceremonyVersion: 1,
|
|
113
|
+
token: {
|
|
114
|
+
session: {
|
|
115
|
+
authority: 'github.com',
|
|
116
|
+
method: 'POST',
|
|
117
|
+
path: '/login/oauth/access_token',
|
|
118
|
+
requestLine: 'POST /login/oauth/access_token ',
|
|
119
|
+
},
|
|
120
|
+
secretField: 'client_secret',
|
|
121
|
+
},
|
|
122
|
+
identity: {
|
|
123
|
+
session: {
|
|
124
|
+
authority: 'api.github.com',
|
|
125
|
+
method: 'GET',
|
|
126
|
+
path: '/user',
|
|
127
|
+
requestLine: 'GET /user ',
|
|
128
|
+
},
|
|
129
|
+
idField: 'id',
|
|
130
|
+
idShape: 'jsonInteger',
|
|
131
|
+
handleField: 'login',
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** The closed launch list. */
|
|
136
|
+
export const LAUNCH: readonly Profile[] = [GOOGLE, X, GITHUB]
|
|
137
|
+
|
|
138
|
+
/** The launch profile for a platform name, or undefined. */
|
|
139
|
+
export function launch(platform: string): Profile | undefined {
|
|
140
|
+
return LAUNCH.find((p) => p.platform === platform)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** How many attestations a submission for this profile carries. */
|
|
144
|
+
export function attestationCount(profile: Profile): number {
|
|
145
|
+
return (profile.token ? 1 : 0) + (profile.identity ? 1 : 0)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Governance-owned launch parameters, in seconds. */
|
|
149
|
+
export const MAX_FUTURE_ATTESTATION_SKEW_SECONDS = 300
|
|
150
|
+
export const PROOF_LIFETIME_SECONDS_X = 3600
|
|
151
|
+
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
|
|
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'
|