@libid/contracts 0.17.0 → 0.18.1
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 +108 -47
- package/dist/abis/bindErrors.d.ts +714 -0
- package/dist/abis/bindErrors.d.ts.map +1 -0
- package/dist/abis/bindErrors.js +955 -0
- package/dist/abis/bindErrors.js.map +1 -0
- package/dist/abis/ceremonyPayloads.d.ts +118 -0
- package/dist/abis/ceremonyPayloads.d.ts.map +1 -0
- package/dist/abis/ceremonyPayloads.js +154 -0
- package/dist/abis/ceremonyPayloads.js.map +1 -0
- package/dist/abis/ceremonyProofVerifier.d.ts +6 -6
- package/dist/abis/ceremonyProofVerifier.js +6 -6
- package/dist/abis/ceremonyProofVerifier.js.map +1 -1
- package/dist/abis/handleEscrow.d.ts +56 -16
- package/dist/abis/handleEscrow.d.ts.map +1 -1
- package/dist/abis/handleEscrow.js +71 -19
- package/dist/abis/handleEscrow.js.map +1 -1
- package/dist/abis/honkVerifierErrors.d.ts +54 -0
- package/dist/abis/honkVerifierErrors.d.ts.map +1 -0
- package/dist/abis/honkVerifierErrors.js +71 -0
- package/dist/abis/honkVerifierErrors.js.map +1 -0
- package/dist/abis/identityRegistry.d.ts +123 -157
- package/dist/abis/identityRegistry.d.ts.map +1 -1
- package/dist/abis/identityRegistry.js +150 -194
- package/dist/abis/identityRegistry.js.map +1 -1
- package/dist/abis/index.d.ts +3 -0
- package/dist/abis/index.d.ts.map +1 -1
- package/dist/abis/index.js +3 -0
- package/dist/abis/index.js.map +1 -1
- package/dist/calls/handleEscrow.d.ts +1 -0
- package/dist/calls/handleEscrow.d.ts.map +1 -1
- package/dist/calls/handleEscrow.js +7 -0
- package/dist/calls/handleEscrow.js.map +1 -1
- package/dist/calls/identityRegistry.d.ts +2 -1
- package/dist/calls/identityRegistry.d.ts.map +1 -1
- package/dist/calls/identityRegistry.js +9 -2
- package/dist/calls/identityRegistry.js.map +1 -1
- package/dist/ceremony/profiles.d.ts +38 -48
- package/dist/ceremony/profiles.d.ts.map +1 -1
- package/dist/ceremony/profiles.js +31 -36
- package/dist/ceremony/profiles.js.map +1 -1
- package/dist/identity/index.d.ts +1 -3
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +5 -11
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/resolve.d.ts +6 -8
- package/dist/identity/resolve.d.ts.map +1 -1
- package/dist/identity/resolve.js +53 -86
- package/dist/identity/resolve.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/payloads.d.ts +124 -0
- package/dist/payloads.d.ts.map +1 -0
- package/dist/payloads.js +59 -0
- package/dist/payloads.js.map +1 -0
- package/dist/platforms/handle.d.ts +11 -0
- package/dist/platforms/handle.d.ts.map +1 -0
- package/dist/platforms/handle.js +29 -0
- package/dist/platforms/handle.js.map +1 -0
- package/dist/platforms/id.d.ts +8 -0
- package/dist/platforms/id.d.ts.map +1 -0
- package/dist/platforms/id.js +21 -0
- package/dist/platforms/id.js.map +1 -0
- package/dist/platforms/index.d.ts +5 -0
- package/dist/platforms/index.d.ts.map +1 -0
- package/dist/platforms/index.js +8 -0
- package/dist/platforms/index.js.map +1 -0
- package/dist/platforms/node.d.ts +4 -0
- package/dist/platforms/node.d.ts.map +1 -0
- package/dist/platforms/node.js +36 -0
- package/dist/platforms/node.js.map +1 -0
- package/dist/platforms/platforms.d.ts +39 -0
- package/dist/platforms/platforms.d.ts.map +1 -0
- package/dist/platforms/platforms.js +90 -0
- package/dist/platforms/platforms.js.map +1 -0
- package/package.json +11 -3
- package/src/abis/bindErrors.ts +957 -0
- package/src/abis/ceremonyPayloads.ts +156 -0
- package/src/abis/ceremonyProofVerifier.ts +6 -6
- package/src/abis/handleEscrow.ts +71 -19
- package/src/abis/honkVerifierErrors.ts +73 -0
- package/src/abis/identityRegistry.ts +150 -194
- package/src/abis/index.ts +3 -0
- package/src/calls/handleEscrow.ts +12 -0
- package/src/calls/identityRegistry.ts +14 -2
- package/src/ceremony/profiles.ts +53 -65
- package/src/identity/index.ts +5 -11
- package/src/identity/resolve.ts +71 -118
- package/src/index.ts +3 -4
- package/src/payloads.ts +90 -0
- package/src/platforms/handle.ts +36 -0
- package/src/platforms/id.ts +26 -0
- package/src/platforms/index.ts +8 -0
- package/src/platforms/node.ts +41 -0
- package/src/platforms/platforms.ts +114 -0
- package/dist/identity/handle.d.ts +0 -22
- package/dist/identity/handle.d.ts.map +0 -1
- package/dist/identity/handle.js +0 -140
- package/dist/identity/handle.js.map +0 -1
- package/dist/identity/handleVectors.d.ts +0 -50
- package/dist/identity/handleVectors.d.ts.map +0 -1
- package/dist/identity/handleVectors.js +0 -89
- package/dist/identity/handleVectors.js.map +0 -1
- package/dist/identity/node.d.ts +0 -5
- package/dist/identity/node.d.ts.map +0 -1
- package/dist/identity/node.js +0 -19
- package/dist/identity/node.js.map +0 -1
- package/src/identity/handle.ts +0 -176
- package/src/identity/handleVectors.ts +0 -104
- package/src/identity/node.ts +0 -28
|
@@ -6,8 +6,9 @@ type IdentityRegistryFn = ContractFunctionName<typeof identityRegistryAbi, Mutab
|
|
|
6
6
|
type IdentityRegistryArgs<F extends IdentityRegistryFn> = ContractFunctionArgs<typeof identityRegistryAbi, Mutability, F>;
|
|
7
7
|
export declare function acceptOwnership(to: Address, ...args: IdentityRegistryArgs<'acceptOwnership'>): Call;
|
|
8
8
|
export declare function bind(to: Address, value: bigint, ...args: IdentityRegistryArgs<'bind'>): Call;
|
|
9
|
+
export declare function bindPrivately(to: Address, value: bigint, ...args: IdentityRegistryArgs<'bindPrivately'>): Call;
|
|
9
10
|
export declare function initialize(to: Address, ...args: IdentityRegistryArgs<'initialize'>): Call;
|
|
10
|
-
export declare function
|
|
11
|
+
export declare function publish(to: Address, ...args: IdentityRegistryArgs<'publish'>): Call;
|
|
11
12
|
export declare function setProofVerifier(to: Address, ...args: IdentityRegistryArgs<'setProofVerifier'>): Call;
|
|
12
13
|
export declare function transferOwnership(to: Address, ...args: IdentityRegistryArgs<'transferOwnership'>): Call;
|
|
13
14
|
export declare function unpublish(to: Address, ...args: IdentityRegistryArgs<'unpublish'>): Call;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityRegistry.d.ts","sourceRoot":"","sources":["../../src/calls/identityRegistry.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAE1B,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEjE,KAAK,UAAU,GAAG,YAAY,GAAG,SAAS,CAAA;AAC1C,KAAK,kBAAkB,GAAG,oBAAoB,CAAC,OAAO,mBAAmB,EAAE,UAAU,CAAC,CAAA;AACtF,KAAK,oBAAoB,CAAC,CAAC,SAAS,kBAAkB,IAAI,oBAAoB,CAC5E,OAAO,mBAAmB,EAC1B,UAAU,EACV,CAAC,CACF,CAAA;AAED,wBAAgB,eAAe,CAC7B,EAAE,EAAE,OAAO,EACX,GAAG,IAAI,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,GAC/C,IAAI,CAKN;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,GAAG,IAAI,CAM5F;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,oBAAoB,CAAC,YAAY,CAAC,GAAG,IAAI,CAKzF;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"identityRegistry.d.ts","sourceRoot":"","sources":["../../src/calls/identityRegistry.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,oBAAoB,EACzB,KAAK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CAKN;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,oBAAoB,CAAC,WAAW,CAAC,GAAG,IAAI,CAKvF;AAED,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,OAAO,EACX,KAAK,EAAE,MAAM,EACb,GAAG,IAAI,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,GAChD,IAAI,CAMN"}
|
|
@@ -15,16 +15,23 @@ export function bind(to, value, ...args) {
|
|
|
15
15
|
data: encodeFunctionData({ abi: identityRegistryAbi, functionName: 'bind', args }),
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
+
export function bindPrivately(to, value, ...args) {
|
|
19
|
+
return {
|
|
20
|
+
to,
|
|
21
|
+
value,
|
|
22
|
+
data: encodeFunctionData({ abi: identityRegistryAbi, functionName: 'bindPrivately', args }),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
18
25
|
export function initialize(to, ...args) {
|
|
19
26
|
return {
|
|
20
27
|
to,
|
|
21
28
|
data: encodeFunctionData({ abi: identityRegistryAbi, functionName: 'initialize', args }),
|
|
22
29
|
};
|
|
23
30
|
}
|
|
24
|
-
export function
|
|
31
|
+
export function publish(to, ...args) {
|
|
25
32
|
return {
|
|
26
33
|
to,
|
|
27
|
-
data: encodeFunctionData({ abi: identityRegistryAbi, functionName: '
|
|
34
|
+
data: encodeFunctionData({ abi: identityRegistryAbi, functionName: 'publish', args }),
|
|
28
35
|
};
|
|
29
36
|
}
|
|
30
37
|
export function setProofVerifier(to, ...args) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityRegistry.js","sourceRoot":"","sources":["../../src/calls/identityRegistry.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,2EAA2E;AAE3E,OAAO,EAIL,kBAAkB,GACnB,MAAM,MAAM,CAAA;AAGb,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAUjE,MAAM,UAAU,eAAe,CAC7B,E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AC,EAAE,GAAG,EAAE,mBAAmB,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;KACxF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,EAAW,EACX,KAAa,EACb,GAAG,IAA8C;IAEjD,OAAO;QACL,EAAE;QACF,KAAK;QACL,IAAI,EAAE,kBAAkB,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,YAAY,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;KAC/F,CAAA;AACH,CAAC"}
|
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
* TypeScript constants
|
|
4
|
-
*
|
|
5
|
-
* written and READ these constants; only the values live here.
|
|
2
|
+
* The ceremony profiles. scripts/regen-ceremony-profiles.py generates
|
|
3
|
+
* the Solidity, Rust and TypeScript constants from profiles.json, and
|
|
4
|
+
* the hand-written Platform Verifiers read them.
|
|
6
5
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* These literals are the one copy the verifiers, the browser that
|
|
7
|
+
* notarizes the sessions and the notary must reproduce byte for byte.
|
|
8
|
+
* A mismatch fails silently: a Consumer and a verifier keyed by
|
|
9
|
+
* different strings never meet, and a request line composed one byte
|
|
10
|
+
* differently is refused with no reason given.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* string and a verifier registered under another simply never meet, and a
|
|
17
|
-
* request line a prover composes one byte differently is an attestation
|
|
18
|
-
* rejected with no error that says why.
|
|
19
|
-
*
|
|
20
|
-
* Changing a value here changes what a deployed verifier accepts. That is a
|
|
21
|
-
* new ceremonyVersion, not an edit.
|
|
12
|
+
* Changing a value changes what a deployed verifier accepts. On a live
|
|
13
|
+
* deployment that is a new ceremonyVersion; a fresh deployment keeps its
|
|
14
|
+
* versions.
|
|
22
15
|
*/
|
|
23
16
|
/** Which shape a platform's immutable identifier takes in its response. */
|
|
24
17
|
export type IdShape = 'jsonString' | 'jsonInteger';
|
|
@@ -32,21 +25,21 @@ export interface Session {
|
|
|
32
25
|
}
|
|
33
26
|
export interface TokenSession {
|
|
34
27
|
readonly session: Session;
|
|
35
|
-
/** The header lines a Platform Verifier requires
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
28
|
+
/** The header lines a Platform Verifier requires exactly once: `host`
|
|
29
|
+
* and `content-type`. Other headers pass unless
|
|
30
|
+
* `FORBIDDEN_REQUEST_HEADERS` names them. `content-length` is absent:
|
|
31
|
+
* the HTTP client writes it. */
|
|
39
32
|
readonly requiredHeaders: readonly string[];
|
|
40
|
-
/** The form fields
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* decoded form on ASM-PROV-07, so the contract is stricter than the
|
|
45
|
-
* specification there. */
|
|
33
|
+
/** The body's form fields in serialization order. Verifiers require
|
|
34
|
+
* exactly these names in this order, each once with a nonempty value,
|
|
35
|
+
* and nothing after the last. GitHub's list is REQ-PLAT-61's and X's
|
|
36
|
+
* is REQ-PLAT-63's. */
|
|
46
37
|
readonly tokenFields: readonly string[];
|
|
47
38
|
}
|
|
48
39
|
export interface IdentitySession {
|
|
49
40
|
readonly session: Session;
|
|
41
|
+
/** The header lines a Platform Verifier requires exactly once: `host`. */
|
|
42
|
+
readonly requiredHeaders: readonly string[];
|
|
50
43
|
readonly idField: string;
|
|
51
44
|
readonly idShape: IdShape;
|
|
52
45
|
readonly handleField: string;
|
|
@@ -59,9 +52,9 @@ export interface Profile {
|
|
|
59
52
|
readonly identity: IdentitySession | null;
|
|
60
53
|
}
|
|
61
54
|
/**
|
|
62
|
-
* Google's evidence is a
|
|
63
|
-
*
|
|
64
|
-
*
|
|
55
|
+
* Google's evidence is a token signed with Google's published keys, so
|
|
56
|
+
* the profile notarizes nothing: no session, no attestation and no
|
|
57
|
+
* Notary Fee.
|
|
65
58
|
*/
|
|
66
59
|
export declare const GOOGLE: Profile;
|
|
67
60
|
/**
|
|
@@ -71,31 +64,28 @@ export declare const GOOGLE: Profile;
|
|
|
71
64
|
export declare const X: Profile;
|
|
72
65
|
/**
|
|
73
66
|
* The credential GitHub calls `client_secret` is sent and revealed, so
|
|
74
|
-
* an attestation publishes it
|
|
75
|
-
*
|
|
76
|
-
* authority per profile would be wrong.
|
|
67
|
+
* an attestation publishes it. The two sessions are served by different
|
|
68
|
+
* hosts, so each session pins its own authority.
|
|
77
69
|
*/
|
|
78
70
|
export declare const GITHUB: Profile;
|
|
79
|
-
/** The
|
|
71
|
+
/** The launch profiles. */
|
|
80
72
|
export declare const LAUNCH: readonly Profile[];
|
|
81
73
|
/** The launch profile for a platform name, or undefined. */
|
|
82
74
|
export declare function launch(platform: string): Profile | undefined;
|
|
83
75
|
/** How many attestations a submission for this profile carries. */
|
|
84
76
|
export declare function attestationCount(profile: Profile): number;
|
|
85
77
|
/**
|
|
86
|
-
* Header names no notarized request may carry, compared
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* both lists changes only what the platform answers, and a wrong answer
|
|
98
|
-
* is a response the verifier cannot read.
|
|
78
|
+
* Header names no notarized request may carry, compared lowercased, with
|
|
79
|
+
* whitespace removed and `_` read as `-`. Each changes what the platform
|
|
80
|
+
* does in a way no revealed byte shows: `authorization` the client it
|
|
81
|
+
* authenticates, `content-encoding` and `transfer-encoding` the bytes it
|
|
82
|
+
* parses, `cookie` the session, the three override names the method. The
|
|
83
|
+
* identity request is excepted from `authorization` alone: its one such
|
|
84
|
+
* header, under any scheme, is what REQ-COMMON-39 counts. The verifier
|
|
85
|
+
* also requires each session's requiredHeaders once with their value,
|
|
86
|
+
* reads the token request's `content-length`, and ignores every other
|
|
87
|
+
* header: such a header changes only the response, which the verifier
|
|
88
|
+
* then cannot read.
|
|
99
89
|
*/
|
|
100
90
|
export declare const FORBIDDEN_REQUEST_HEADERS: readonly string[];
|
|
101
91
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../src/ceremony/profiles.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../src/ceremony/profiles.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;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;;;oCAGgC;IAChC,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3C;;;2BAGuB;IACvB,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;CACxC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,0EAA0E;IAC1E,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3C,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,OAyBf,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,EAAE,OAyBpB,CAAA;AAED,2BAA2B;AAC3B,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;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAQtD,CAAA;AAaD;;;;GAIG;AACH,eAAO,MAAM,2CAA2C,OAAO,CAAA;AAK/D;;GAEG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAC5C;;;GAGG;AACH,eAAO,MAAM,qCAAqC,MAAM,CAAA;AACxD;;;;GAIG;AACH,eAAO,MAAM,sCAAsC,MAAM,CAAA;AAGzD;;GAEG;AACH,eAAO,MAAM,6BAA6B,OAAO,CAAA;AACjD;;;GAGG;AACH,eAAO,MAAM,0CAA0C,MAAM,CAAA;AAC7D;;;;GAIG;AACH,eAAO,MAAM,2CAA2C,MAAM,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Generated by scripts/regen-ceremony-profiles.py. Do not edit.
|
|
2
2
|
// The source of truth is solidity/contracts/ceremony/profiles.json.
|
|
3
3
|
/**
|
|
4
|
-
* Google's evidence is a
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Google's evidence is a token signed with Google's published keys, so
|
|
5
|
+
* the profile notarizes nothing: no session, no attestation and no
|
|
6
|
+
* Notary Fee.
|
|
7
7
|
*/
|
|
8
8
|
export const GOOGLE = {
|
|
9
9
|
platform: 'google',
|
|
@@ -35,6 +35,7 @@ export const X = {
|
|
|
35
35
|
path: '/2/users/me',
|
|
36
36
|
requestLine: 'GET /2/users/me ',
|
|
37
37
|
},
|
|
38
|
+
requiredHeaders: ['host: api.x.com'],
|
|
38
39
|
idField: 'id',
|
|
39
40
|
idShape: 'jsonString',
|
|
40
41
|
handleField: 'username',
|
|
@@ -42,9 +43,8 @@ export const X = {
|
|
|
42
43
|
};
|
|
43
44
|
/**
|
|
44
45
|
* The credential GitHub calls `client_secret` is sent and revealed, so
|
|
45
|
-
* an attestation publishes it
|
|
46
|
-
*
|
|
47
|
-
* authority per profile would be wrong.
|
|
46
|
+
* an attestation publishes it. The two sessions are served by different
|
|
47
|
+
* hosts, so each session pins its own authority.
|
|
48
48
|
*/
|
|
49
49
|
export const GITHUB = {
|
|
50
50
|
platform: 'github',
|
|
@@ -66,12 +66,13 @@ export const GITHUB = {
|
|
|
66
66
|
path: '/user',
|
|
67
67
|
requestLine: 'GET /user ',
|
|
68
68
|
},
|
|
69
|
+
requiredHeaders: ['host: api.github.com'],
|
|
69
70
|
idField: 'id',
|
|
70
71
|
idShape: 'jsonInteger',
|
|
71
72
|
handleField: 'login',
|
|
72
73
|
},
|
|
73
74
|
};
|
|
74
|
-
/** The
|
|
75
|
+
/** The launch profiles. */
|
|
75
76
|
export const LAUNCH = [GOOGLE, X, GITHUB];
|
|
76
77
|
/** The launch profile for a platform name, or undefined. */
|
|
77
78
|
export function launch(platform) {
|
|
@@ -82,19 +83,17 @@ export function attestationCount(profile) {
|
|
|
82
83
|
return (profile.token ? 1 : 0) + (profile.identity ? 1 : 0);
|
|
83
84
|
}
|
|
84
85
|
/**
|
|
85
|
-
* Header names no notarized request may carry, compared
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* both lists changes only what the platform answers, and a wrong answer
|
|
97
|
-
* is a response the verifier cannot read.
|
|
86
|
+
* Header names no notarized request may carry, compared lowercased, with
|
|
87
|
+
* whitespace removed and `_` read as `-`. Each changes what the platform
|
|
88
|
+
* does in a way no revealed byte shows: `authorization` the client it
|
|
89
|
+
* authenticates, `content-encoding` and `transfer-encoding` the bytes it
|
|
90
|
+
* parses, `cookie` the session, the three override names the method. The
|
|
91
|
+
* identity request is excepted from `authorization` alone: its one such
|
|
92
|
+
* header, under any scheme, is what REQ-COMMON-39 counts. The verifier
|
|
93
|
+
* also requires each session's requiredHeaders once with their value,
|
|
94
|
+
* reads the token request's `content-length`, and ignores every other
|
|
95
|
+
* header: such a header changes only the response, which the verifier
|
|
96
|
+
* then cannot read.
|
|
98
97
|
*/
|
|
99
98
|
export const FORBIDDEN_REQUEST_HEADERS = [
|
|
100
99
|
'authorization',
|
|
@@ -106,28 +105,24 @@ export const FORBIDDEN_REQUEST_HEADERS = [
|
|
|
106
105
|
'x-method-override',
|
|
107
106
|
];
|
|
108
107
|
// The seconds each profile fixes. A Platform Verifier reads them as
|
|
109
|
-
// constants
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
// observation is the token's `exp`: Google issues about an hour of
|
|
119
|
-
// life, and the claim reads roughly an hour ahead of the moment it
|
|
120
|
-
// describes.
|
|
108
|
+
// constants, so a different value is a new ceremonyVersion (REQ-PARAM-01)
|
|
109
|
+
// and a client that knows its version knows the validity every chain
|
|
110
|
+
// enforces. `IdentityRegistry` replaces a binding only on a strictly newer
|
|
111
|
+
// `observedAt`, so the future allowance bounds how long a proof dated ahead
|
|
112
|
+
// holds a name.
|
|
113
|
+
// The signed `exp` bounds validity, so the profile fixes no lifetime and
|
|
114
|
+
// no attestation skew. The OIDC circuit exposes no `iat`, so the
|
|
115
|
+
// observation is the token's `exp`, about an hour after Google issued
|
|
116
|
+
// it.
|
|
121
117
|
/**
|
|
122
118
|
* `google/v1`: how far ahead of Block Time the evidence time may run.
|
|
123
119
|
* The verifier subtracts it, so every version of a platform reports
|
|
124
120
|
* time on one scale.
|
|
125
121
|
*/
|
|
126
122
|
export const FUTURE_OBSERVATION_ALLOWANCE_SECONDS_GOOGLE = 7200;
|
|
127
|
-
// The token attestation's creation time is the evidence time. A
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
// and the chain.
|
|
123
|
+
// The token attestation's creation time is the evidence time. A notary
|
|
124
|
+
// states the wall-clock time it observes, so five minutes covers clock
|
|
125
|
+
// skew between the notary and the chain.
|
|
131
126
|
/**
|
|
132
127
|
* `x/v1`: maximum age of the token attestation.
|
|
133
128
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/ceremony/profiles.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,oEAAoE;
|
|
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;S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
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAMA,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA"}
|
package/dist/identity/index.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
///
|
|
1
|
+
/// Identity helpers: handle normalization, node derivation, and resolvers over
|
|
2
|
+
/// the `IdentityRegistry` view calls.
|
|
2
3
|
///
|
|
3
|
-
///
|
|
4
|
-
///
|
|
5
|
-
|
|
6
|
-
/// cannot drift apart silently.
|
|
7
|
-
///
|
|
8
|
-
/// Calldata for the writes is generated too, in `../calls` — `unpublish` had a
|
|
9
|
-
/// hand-written builder here until every write function got one.
|
|
10
|
-
export * from './handle.js';
|
|
11
|
-
export * from './handleVectors.js';
|
|
12
|
-
export * from './node.js';
|
|
4
|
+
/// Normalization applies the token check and the fold the circuits enforce;
|
|
5
|
+
/// the chain only folds A-Z. Calldata for the writes is in `../calls`.
|
|
6
|
+
export * from '../platforms/index.js';
|
|
13
7
|
export * from './resolve.js';
|
|
14
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/identity/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,sCAAsC;AACtC,GAAG;AACH,4EAA4E;AAC5E,uEAAuE;AAEvE,cAAc,uBAAuB,CAAA;AACrC,cAAc,cAAc,CAAA"}
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import { type Address, type PublicClient } from 'viem';
|
|
2
|
-
import type { Rules } from './handle.js';
|
|
3
2
|
export type PlatformKey<K extends string> = K extends `0x${string}` ? never : K;
|
|
4
3
|
export declare function platformId<K extends string>(platformKey: PlatformKey<K>): `0x${string}`;
|
|
5
4
|
export interface RegistryReader {
|
|
6
5
|
client: PublicClient;
|
|
7
6
|
address: Address;
|
|
8
7
|
}
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function resolveId(reader: RegistryReader, platformId: `0x${string}`, id: string): Promise<Address | null>;
|
|
11
|
-
export declare function resolveHandle(reader: RegistryReader, platformId: `0x${string}`, handle: string): Promise<Address | null>;
|
|
12
|
-
export declare function publishedHandleOf(reader: RegistryReader, holder: Address, platformId: `0x${string}`): Promise<string | null>;
|
|
8
|
+
export declare function resolveId(reader: RegistryReader, idNode: `0x${string}`): Promise<Address | null>;
|
|
13
9
|
export interface HandleAndIdResolution {
|
|
14
10
|
holder: Address | null;
|
|
15
11
|
idAgrees: boolean;
|
|
16
12
|
}
|
|
17
|
-
export declare function resolveHandleAndId(reader: RegistryReader,
|
|
13
|
+
export declare function resolveHandleAndId(reader: RegistryReader, id: `0x${string}`, handle: string, idNode: `0x${string}`): Promise<HandleAndIdResolution>;
|
|
14
|
+
export declare function resolveHandle(reader: RegistryReader, platformId: `0x${string}`, handle: string): Promise<Address | null>;
|
|
15
|
+
export declare function publishedHandleOf(reader: RegistryReader, holder: Address, platformId: `0x${string}`): Promise<string | null>;
|
|
18
16
|
export interface Identity {
|
|
19
17
|
platformId: `0x${string}`;
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
idNode: `0x${string}`;
|
|
19
|
+
handleNode: `0x${string}`;
|
|
22
20
|
handleCurrent: boolean;
|
|
23
21
|
}
|
|
24
22
|
export declare function identityCount(reader: RegistryReader, holder: Address): Promise<bigint>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/identity/resolve.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/identity/resolve.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAa,K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M,EAAE,CAAA;IAEzB,aAAa,EAAE,OAAO,CAAA;CACvB;AAGD,wBAAsB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAE5F;AAID,wBAAsB,YAAY,CAChC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,QAAQ,EAAE,CAAC,CAQrB"}
|
package/dist/identity/resolve.js
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
///
|
|
1
|
+
/// Reads identities from the `IdentityRegistry` through view calls.
|
|
2
2
|
///
|
|
3
|
-
///
|
|
4
|
-
///
|
|
5
|
-
|
|
6
|
-
///
|
|
7
|
-
/// The client and the contract address are arguments rather than imports. This
|
|
8
|
-
/// package ships separately from the repository it currently lives in, so it
|
|
9
|
-
/// carries no configuration of its own and reaches for nothing outside itself.
|
|
10
|
-
import { keccak256, toHex, zeroAddress } from 'viem';
|
|
3
|
+
/// The caller passes the client and the contract address; the package carries
|
|
4
|
+
/// no network configuration.
|
|
5
|
+
import { keccak256, toHex, zeroAddress, zeroHash } from 'viem';
|
|
11
6
|
import { identityRegistryAbi } from '../abis/identityRegistry.js';
|
|
12
|
-
|
|
13
|
-
///
|
|
7
|
+
import { HandleError, handleNode, PLATFORMS } from '../platforms/index.js';
|
|
8
|
+
/// A platform id is `keccak256` of its platform key, as `CeremonyProfile`
|
|
9
|
+
/// derives it.
|
|
14
10
|
export function platformId(platformKey) {
|
|
15
11
|
return keccak256(toHex(platformKey));
|
|
16
12
|
}
|
|
17
|
-
/// One view call.
|
|
18
|
-
///
|
|
19
|
-
/// Routed through a narrow cast for one reason:
|
|
20
|
-
/// viem's `PublicClient`, without its chain type parameters, types
|
|
21
|
-
/// `authorizationList` as required even for a read. The alternative is to
|
|
22
|
-
/// spread that noise across every call site here.
|
|
13
|
+
/// One view call. The cast is there because viem's `PublicClient`, without its
|
|
14
|
+
/// chain type parameters, types `authorizationList` as required even for a read.
|
|
23
15
|
function read(reader, functionName, args) {
|
|
24
16
|
return reader.client.readContract({
|
|
25
17
|
authorizationList: undefined,
|
|
@@ -29,90 +21,65 @@ function read(reader, functionName, args) {
|
|
|
29
21
|
args,
|
|
30
22
|
});
|
|
31
23
|
}
|
|
32
|
-
/// The
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const rules = await read(reader, 'rulesOf', [platformId]);
|
|
36
|
-
return {
|
|
37
|
-
maxLength: Number(rules.maxLength),
|
|
38
|
-
stripLeadingAt: rules.stripLeadingAt,
|
|
39
|
-
isEmail: rules.isEmail,
|
|
40
|
-
allowUnderscore: rules.allowUnderscore,
|
|
41
|
-
allowHyphen: rules.allowHyphen,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
/// The holder that proved this id, or `null`.
|
|
45
|
-
export async function resolveId(reader, platformId, id) {
|
|
46
|
-
const holder = await read(reader, 'resolveId', [platformId, id]);
|
|
24
|
+
/// The holder that proved this id node (`idNode(platformKey, id)`), or `null`.
|
|
25
|
+
export async function resolveId(reader, idNode) {
|
|
26
|
+
const holder = await read(reader, 'resolveId', [idNode]);
|
|
47
27
|
return holder === zeroAddress ? null : holder;
|
|
48
28
|
}
|
|
49
|
-
/// The
|
|
50
|
-
|
|
51
|
-
///
|
|
52
|
-
///
|
|
53
|
-
///
|
|
54
|
-
///
|
|
55
|
-
///
|
|
56
|
-
///
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
29
|
+
/// The generated platforms, keyed by platform id.
|
|
30
|
+
const PLATFORM_BY_ID = new Map(PLATFORMS.map((p) => [platformId(p.key), p]));
|
|
31
|
+
/// Resolve a handle and report whether an id node still agrees with it.
|
|
32
|
+
/// Read it before signing to warn the payer; do not let it block a transfer.
|
|
33
|
+
/// Only the handle's node is sent. Text no circuit hashes is sent as the zero
|
|
34
|
+
/// node and resolves to `{holder: null, idAgrees: false}`. Reverts such as
|
|
35
|
+
/// `UnknownPlatform` propagate; a platform missing from this package's table
|
|
36
|
+
/// throws.
|
|
37
|
+
export async function resolveHandleAndId(reader, id, handle, idNode) {
|
|
38
|
+
const keys = PLATFORM_BY_ID.get(id.toLowerCase());
|
|
39
|
+
let node = zeroHash;
|
|
40
|
+
if (keys !== undefined) {
|
|
41
|
+
try {
|
|
42
|
+
node = handleNode(keys.key, handle);
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
if (!(e instanceof HandleError))
|
|
46
|
+
throw e;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// The chain goes first, so a platform it does not know reverts UnknownPlatform there.
|
|
50
|
+
const [holder, idAgrees] = await read(reader, 'resolveHandleNodeAndId', [
|
|
51
|
+
id,
|
|
52
|
+
node,
|
|
53
|
+
idNode,
|
|
54
|
+
]);
|
|
55
|
+
if (keys === undefined)
|
|
56
|
+
throw new Error(`platform ${id} is not in this package's handle table`);
|
|
57
|
+
return { holder: holder === zeroAddress ? null : holder, idAgrees };
|
|
58
|
+
}
|
|
59
|
+
/// The holder that last proved this handle, or `null`. Only the handle's node
|
|
60
|
+
/// is sent; text no circuit hashes also answers `null`. Reverts such as
|
|
61
|
+
/// `UnknownPlatform` propagate.
|
|
60
62
|
export async function resolveHandle(reader, platformId, handle) {
|
|
61
|
-
|
|
62
|
-
return holder === zeroAddress ? null : holder;
|
|
63
|
+
return (await resolveHandleAndId(reader, platformId, handle, zeroHash)).holder;
|
|
63
64
|
}
|
|
64
|
-
/// The handle to show for a holder, or `null`.
|
|
65
|
-
///
|
|
66
|
-
/// Forward-checked on chain: empty once the stored handle resolves somewhere
|
|
67
|
-
/// else. ENS asks integrators to perform that check themselves and warns that
|
|
68
|
-
/// skipping it displays an ENS primary name that no longer resolves back; here
|
|
69
|
-
/// it cannot be skipped, because the contract does it.
|
|
65
|
+
/// The handle to show for a holder, or `null`. Forward-checked on chain:
|
|
66
|
+
/// empty once the stored handle resolves somewhere else.
|
|
70
67
|
export async function publishedHandleOf(reader, holder, platformId) {
|
|
71
68
|
const handle = await read(reader, 'publishedHandleOf', [holder, platformId]);
|
|
72
69
|
return handle.length === 0 ? null : handle;
|
|
73
70
|
}
|
|
74
|
-
/// Resolve a handle and report whether an id still agrees with it.
|
|
75
|
-
///
|
|
76
|
-
/// **Read this before signing, and do not let it block a transfer.** A handle
|
|
77
|
-
/// that will not route is not a handle: sending to a handle means sending to
|
|
78
|
-
/// whoever proved it last, which is what the handle now means. What the flag is
|
|
79
|
-
/// for is telling whoever is paying that the identity they think they are
|
|
80
|
-
/// paying is not the one that has the handle today — a decision they can only
|
|
81
|
-
/// make beforehand.
|
|
82
|
-
///
|
|
83
|
-
/// Both halves are needed. A handle on its own has nothing to disagree with.
|
|
84
|
-
///
|
|
85
|
-
/// A handle the platform's rules reject resolves to `{holder: null, idAgrees:
|
|
86
|
-
/// false}`, the same as one nobody has proved — see `resolveHandle`.
|
|
87
|
-
export async function resolveHandleAndId(reader, platformId, handle, id) {
|
|
88
|
-
const [holder, idAgrees] = await read(reader, 'resolveHandleAndId', [
|
|
89
|
-
platformId,
|
|
90
|
-
handle,
|
|
91
|
-
id,
|
|
92
|
-
]);
|
|
93
|
-
return { holder: holder === zeroAddress ? null : holder, idAgrees };
|
|
94
|
-
}
|
|
95
71
|
/// How many identities a holder has, on every platform together.
|
|
96
72
|
export async function identityCount(reader, holder) {
|
|
97
73
|
return read(reader, 'identityCount', [holder]);
|
|
98
74
|
}
|
|
99
|
-
///
|
|
100
|
-
///
|
|
101
|
-
/// clipped to the list. A `from` past the end answers an empty page. A reader
|
|
102
|
-
/// that wants one platform filters a page by `platformId`.
|
|
103
|
-
///
|
|
104
|
-
/// Order is arbitrary and changes when an identity leaves the list, so two
|
|
105
|
-
/// pages read across a removal may overlap or skip. A reader that needs every
|
|
106
|
-
/// identity reads `identityCount` and the pages against one block.
|
|
107
|
-
///
|
|
108
|
-
/// A list is as long as its holder made it, and a call's gas is not. A caller
|
|
109
|
-
/// enumerating a holder it did not choose keeps `limit` small and pages.
|
|
75
|
+
/// The holder's identities at indices `[from, from + limit)`, clipped to the list.
|
|
76
|
+
/// Order is arbitrary and changes on removal: read every page against one block.
|
|
110
77
|
export async function identitiesOf(reader, holder, from, limit) {
|
|
111
78
|
const page = await read(reader, 'identitiesOf', [holder, from, limit]);
|
|
112
|
-
return page.map(({ platformId,
|
|
79
|
+
return page.map(({ platformId, idNode, handleNode, handleCurrent }) => ({
|
|
113
80
|
platformId,
|
|
114
|
-
|
|
115
|
-
|
|
81
|
+
idNode,
|
|
82
|
+
handleNode,
|
|
116
83
|
handleCurrent,
|
|
117
84
|
}));
|
|
118
85
|
}
|