@libid/contracts 0.6.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/README.md +65 -26
- package/dist/abis/{googleIdentityVerifier.d.ts → ceremonyProofVerifier.d.ts} +146 -128
- package/dist/abis/{googleIdentityVerifier.d.ts.map → ceremonyProofVerifier.d.ts.map} +1 -1
- package/dist/abis/{googleIdentityVerifier.js → ceremonyProofVerifier.js} +182 -156
- package/dist/abis/ceremonyProofVerifier.js.map +1 -0
- package/dist/abis/{identityJwksRoots.d.ts → googleJwtRoots.d.ts} +273 -211
- package/dist/abis/{xZkVerifier.d.ts.map → googleJwtRoots.d.ts.map} +1 -1
- package/dist/abis/{identityJwksRoots.js → googleJwtRoots.js} +345 -253
- package/dist/abis/googleJwtRoots.js.map +1 -0
- package/dist/abis/{walletFactory.d.ts → handleResolver.d.ts} +185 -151
- package/dist/abis/handleResolver.d.ts.map +1 -0
- package/dist/abis/{walletFactory.js → handleResolver.js} +219 -170
- package/dist/abis/handleResolver.js.map +1 -0
- package/dist/abis/identityNames.d.ts +173 -219
- package/dist/abis/identityNames.d.ts.map +1 -1
- package/dist/abis/identityNames.js +210 -266
- package/dist/abis/identityNames.js.map +1 -1
- package/dist/abis/index.d.ts +4 -16
- package/dist/abis/index.d.ts.map +1 -1
- package/dist/abis/index.js +4 -16
- package/dist/abis/index.js.map +1 -1
- package/dist/abis/{xZkVerifier.d.ts → notaryService.d.ts} +237 -273
- package/dist/abis/{webWallet.d.ts.map → notaryService.d.ts.map} +1 -1
- package/dist/abis/{xZkVerifier.js → notaryService.js} +297 -337
- package/dist/abis/notaryService.js.map +1 -0
- package/dist/call.d.ts +7 -0
- package/dist/call.d.ts.map +1 -0
- package/dist/call.js +2 -0
- package/dist/call.js.map +1 -0
- package/dist/calls/ceremonyProofVerifier.d.ts +14 -0
- package/dist/calls/ceremonyProofVerifier.d.ts.map +1 -0
- package/dist/calls/ceremonyProofVerifier.js +55 -0
- package/dist/calls/ceremonyProofVerifier.js.map +1 -0
- package/dist/calls/googleJwtRoots.d.ts +14 -0
- package/dist/calls/googleJwtRoots.d.ts.map +1 -0
- package/dist/calls/googleJwtRoots.js +43 -0
- package/dist/calls/googleJwtRoots.js.map +1 -0
- package/dist/calls/handleResolver.d.ts +12 -0
- package/dist/calls/handleResolver.d.ts.map +1 -0
- package/dist/calls/handleResolver.js +29 -0
- package/dist/calls/handleResolver.js.map +1 -0
- package/dist/calls/identityNames.d.ts +16 -0
- package/dist/calls/identityNames.d.ts.map +1 -0
- package/dist/calls/identityNames.js +55 -0
- package/dist/calls/identityNames.js.map +1 -0
- package/dist/calls/index.d.ts +8 -0
- package/dist/calls/index.d.ts.map +1 -0
- package/dist/calls/index.js +10 -0
- package/dist/calls/index.js.map +1 -0
- package/dist/calls/libidFactory.d.ts +13 -0
- package/dist/calls/libidFactory.d.ts.map +1 -0
- package/dist/calls/libidFactory.js +36 -0
- package/dist/calls/libidFactory.js.map +1 -0
- package/dist/calls/notaryService.d.ts +16 -0
- package/dist/calls/notaryService.d.ts.map +1 -0
- package/dist/calls/notaryService.js +55 -0
- package/dist/calls/notaryService.js.map +1 -0
- package/dist/calls/wtia9.d.ts +13 -0
- package/dist/calls/wtia9.d.ts.map +1 -0
- package/dist/calls/wtia9.js +36 -0
- package/dist/calls/wtia9.js.map +1 -0
- 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/identity/handleVectors.d.ts +3 -3
- package/dist/identity/handleVectors.d.ts.map +1 -1
- package/dist/identity/handleVectors.js +3 -3
- package/dist/identity/handleVectors.js.map +1 -1
- package/dist/identity/index.d.ts +0 -1
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +7 -6
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/resolve.js +4 -4
- package/dist/identity/resolve.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +12 -7
- package/src/abis/{googleIdentityVerifier.ts → ceremonyProofVerifier.ts} +181 -155
- package/src/abis/{identityJwksRoots.ts → googleJwtRoots.ts} +344 -252
- package/src/abis/{walletFactory.ts → handleResolver.ts} +218 -169
- package/src/abis/identityNames.ts +210 -266
- package/src/abis/index.ts +4 -16
- package/src/abis/{xZkVerifier.ts → notaryService.ts} +296 -336
- package/src/call.ts +15 -0
- package/src/calls/ceremonyProofVerifier.ts +90 -0
- package/src/calls/googleJwtRoots.ts +74 -0
- package/src/calls/handleResolver.ts +51 -0
- package/src/calls/identityNames.ts +88 -0
- package/src/calls/index.ts +9 -0
- package/src/calls/libidFactory.ts +63 -0
- package/src/calls/notaryService.ts +85 -0
- package/src/calls/wtia9.ts +52 -0
- package/src/ceremony/index.ts +13 -0
- package/src/ceremony/profiles.ts +151 -0
- package/src/identity/handleVectors.ts +3 -3
- package/src/identity/index.ts +7 -6
- package/src/identity/resolve.ts +4 -4
- package/src/index.ts +7 -3
- package/dist/abis/adminFacet.d.ts +0 -339
- package/dist/abis/adminFacet.d.ts.map +0 -1
- package/dist/abis/adminFacet.js +0 -442
- package/dist/abis/adminFacet.js.map +0 -1
- package/dist/abis/bank.d.ts +0 -916
- package/dist/abis/bank.d.ts.map +0 -1
- package/dist/abis/bank.js +0 -1184
- package/dist/abis/bank.js.map +0 -1
- package/dist/abis/diamondLoupeFacet.d.ts +0 -73
- package/dist/abis/diamondLoupeFacet.d.ts.map +0 -1
- package/dist/abis/diamondLoupeFacet.js +0 -100
- package/dist/abis/diamondLoupeFacet.js.map +0 -1
- package/dist/abis/gitHubIdentityVerifier.d.ts +0 -409
- package/dist/abis/gitHubIdentityVerifier.d.ts.map +0 -1
- package/dist/abis/gitHubIdentityVerifier.js +0 -531
- package/dist/abis/gitHubIdentityVerifier.js.map +0 -1
- package/dist/abis/googleIdentityVerifier.js.map +0 -1
- package/dist/abis/googleOidcVerifier.d.ts +0 -838
- package/dist/abis/googleOidcVerifier.d.ts.map +0 -1
- package/dist/abis/googleOidcVerifier.js +0 -1082
- package/dist/abis/googleOidcVerifier.js.map +0 -1
- package/dist/abis/identityJwksRoots.d.ts.map +0 -1
- package/dist/abis/identityJwksRoots.js.map +0 -1
- package/dist/abis/mockErc20.d.ts +0 -262
- package/dist/abis/mockErc20.d.ts.map +0 -1
- package/dist/abis/mockErc20.js +0 -347
- package/dist/abis/mockErc20.js.map +0 -1
- package/dist/abis/notary.d.ts +0 -263
- package/dist/abis/notary.d.ts.map +0 -1
- package/dist/abis/notary.js +0 -343
- package/dist/abis/notary.js.map +0 -1
- package/dist/abis/registry.d.ts +0 -1170
- package/dist/abis/registry.d.ts.map +0 -1
- package/dist/abis/registry.js +0 -1511
- package/dist/abis/registry.js.map +0 -1
- package/dist/abis/transferFacet.d.ts +0 -814
- package/dist/abis/transferFacet.d.ts.map +0 -1
- package/dist/abis/transferFacet.js +0 -1035
- package/dist/abis/transferFacet.js.map +0 -1
- package/dist/abis/vaultFacet.d.ts +0 -306
- package/dist/abis/vaultFacet.d.ts.map +0 -1
- package/dist/abis/vaultFacet.js +0 -398
- package/dist/abis/vaultFacet.js.map +0 -1
- package/dist/abis/walletFactory.d.ts.map +0 -1
- package/dist/abis/walletFactory.js.map +0 -1
- package/dist/abis/webWallet.d.ts +0 -523
- package/dist/abis/webWallet.js +0 -680
- package/dist/abis/webWallet.js.map +0 -1
- package/dist/abis/xIdentityVerifier.d.ts +0 -473
- package/dist/abis/xIdentityVerifier.d.ts.map +0 -1
- package/dist/abis/xIdentityVerifier.js +0 -612
- package/dist/abis/xIdentityVerifier.js.map +0 -1
- package/dist/abis/xZkVerifier.js.map +0 -1
- package/dist/identity/bind.d.ts +0 -59
- package/dist/identity/bind.d.ts.map +0 -1
- package/dist/identity/bind.fixtures.d.ts +0 -8
- package/dist/identity/bind.fixtures.d.ts.map +0 -1
- package/dist/identity/bind.fixtures.js +0 -55
- package/dist/identity/bind.fixtures.js.map +0 -1
- package/dist/identity/bind.js +0 -148
- package/dist/identity/bind.js.map +0 -1
- package/src/abis/adminFacet.ts +0 -444
- package/src/abis/bank.ts +0 -1186
- package/src/abis/diamondLoupeFacet.ts +0 -102
- package/src/abis/gitHubIdentityVerifier.ts +0 -533
- package/src/abis/googleOidcVerifier.ts +0 -1084
- package/src/abis/mockErc20.ts +0 -349
- package/src/abis/notary.ts +0 -345
- package/src/abis/registry.ts +0 -1513
- package/src/abis/transferFacet.ts +0 -1037
- package/src/abis/vaultFacet.ts +0 -400
- package/src/abis/webWallet.ts +0 -682
- package/src/abis/xIdentityVerifier.ts +0 -614
- package/src/identity/bind.fixtures.ts +0 -63
- package/src/identity/bind.ts +0 -243
package/src/identity/bind.ts
DELETED
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
/// Binding a name: the write half.
|
|
2
|
-
///
|
|
3
|
-
/// Reading a name is a view call and needs nothing. Writing one is a
|
|
4
|
-
/// transaction the holder's own address sends, because `IdentityNames` requires
|
|
5
|
-
/// the proof's target to be the caller — that single rule is the whole of the
|
|
6
|
-
/// authorization, and it is why a proof read from the mempool is useless to
|
|
7
|
-
/// anybody else.
|
|
8
|
-
///
|
|
9
|
-
/// This module builds the calldata and nothing more. It does not sign, does not
|
|
10
|
-
/// send, and does not know what kind of address the caller is: an EOA sends it
|
|
11
|
-
/// directly, a smart account wraps it in whatever its own execute looks like.
|
|
12
|
-
/// Keeping it at calldata is what lets a product with its own account model use
|
|
13
|
-
/// the naming system without either side knowing about the other.
|
|
14
|
-
|
|
15
|
-
import { type Address, encodeAbiParameters, encodeFunctionData, type Hex } from 'viem'
|
|
16
|
-
|
|
17
|
-
import { identityNamesAbi } from '../abis/identityNames.js'
|
|
18
|
-
|
|
19
|
-
/// The proof each platform's verifier takes, as it travels on chain.
|
|
20
|
-
///
|
|
21
|
-
/// The verifier decodes one `bytes` argument, so a platform's fields are
|
|
22
|
-
/// abi-encoded into it here. The shapes mirror the verifier structs exactly; a
|
|
23
|
-
/// mismatch does not compile there and reverts here, which is why they are
|
|
24
|
-
/// written out rather than built by hand at a call site.
|
|
25
|
-
|
|
26
|
-
/// One notarized TLS session, as `GitHubIdentityVerifier` takes it.
|
|
27
|
-
export interface TlsProof {
|
|
28
|
-
notarySignature: Hex
|
|
29
|
-
/// The address the proof is made out to. `IdentityNames` refuses a zero.
|
|
30
|
-
walletAddress: Address
|
|
31
|
-
domainHash: Hex
|
|
32
|
-
clientRandom: Hex
|
|
33
|
-
serverRandom: Hex
|
|
34
|
-
serverEphemeralKey: Hex
|
|
35
|
-
transcriptRoot: Hex
|
|
36
|
-
timestamp: bigint
|
|
37
|
-
domainPath: readonly Hex[]
|
|
38
|
-
usernamePath: readonly Hex[]
|
|
39
|
-
endpointPath: readonly Hex[]
|
|
40
|
-
idPath: readonly Hex[]
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface GitHubProof {
|
|
44
|
-
tls: TlsProof
|
|
45
|
-
domain: string
|
|
46
|
-
handle: string
|
|
47
|
-
userId: string
|
|
48
|
-
endpoint: string
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/// The notarized `/me` session, as `XIdentityVerifier` takes it. There is only
|
|
52
|
-
/// one: a name binding does not read the OAuth client id, so it never asks for
|
|
53
|
-
/// the `/token` session that exists to carry it.
|
|
54
|
-
export interface MeAttestation {
|
|
55
|
-
bearerHash: Hex
|
|
56
|
-
bearerRangeStart: number
|
|
57
|
-
bearerRangeEnd: number
|
|
58
|
-
sentRevealed: Hex
|
|
59
|
-
sentPrefixEnd: number
|
|
60
|
-
sentSuffixEnd: number
|
|
61
|
-
recvRevealed: Hex
|
|
62
|
-
handle: string
|
|
63
|
-
userId: string
|
|
64
|
-
sessionAddr: Address
|
|
65
|
-
timestamp: bigint
|
|
66
|
-
notarySignature: Hex
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface XProof {
|
|
70
|
-
proof: Hex
|
|
71
|
-
publicInputs: readonly Hex[]
|
|
72
|
-
meAttest: MeAttestation
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface GoogleProof {
|
|
76
|
-
honkProof: Hex
|
|
77
|
-
publicInputs: readonly Hex[]
|
|
78
|
-
email: string
|
|
79
|
-
/// The address inside the Google-signed nonce. This is the target, so it must
|
|
80
|
-
/// be the address that will hold the name — the wallet, not a session key.
|
|
81
|
-
sessionKey: Address
|
|
82
|
-
sub: string
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const tlsProofComponents = [
|
|
86
|
-
{ name: 'notarySignature', type: 'bytes' },
|
|
87
|
-
{ name: 'walletAddress', type: 'address' },
|
|
88
|
-
{ name: 'domainHash', type: 'bytes32' },
|
|
89
|
-
{ name: 'clientRandom', type: 'bytes32' },
|
|
90
|
-
{ name: 'serverRandom', type: 'bytes32' },
|
|
91
|
-
{ name: 'serverEphemeralKey', type: 'bytes' },
|
|
92
|
-
{ name: 'transcriptRoot', type: 'bytes32' },
|
|
93
|
-
{ name: 'timestamp', type: 'uint256' },
|
|
94
|
-
{ name: 'domainPath', type: 'bytes32[]' },
|
|
95
|
-
{ name: 'usernamePath', type: 'bytes32[]' },
|
|
96
|
-
{ name: 'endpointPath', type: 'bytes32[]' },
|
|
97
|
-
{ name: 'idPath', type: 'bytes32[]' },
|
|
98
|
-
] as const
|
|
99
|
-
|
|
100
|
-
export function encodeGitHubProof(p: GitHubProof): Hex {
|
|
101
|
-
return encodeAbiParameters(
|
|
102
|
-
[
|
|
103
|
-
{
|
|
104
|
-
type: 'tuple',
|
|
105
|
-
components: [
|
|
106
|
-
{ name: 'tls', type: 'tuple', components: tlsProofComponents },
|
|
107
|
-
{ name: 'domain', type: 'string' },
|
|
108
|
-
{ name: 'handle', type: 'string' },
|
|
109
|
-
{ name: 'userId', type: 'string' },
|
|
110
|
-
{ name: 'endpoint', type: 'string' },
|
|
111
|
-
],
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
[p],
|
|
115
|
-
)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function encodeXProof(p: XProof): Hex {
|
|
119
|
-
return encodeAbiParameters(
|
|
120
|
-
[
|
|
121
|
-
{
|
|
122
|
-
type: 'tuple',
|
|
123
|
-
components: [
|
|
124
|
-
{ name: 'proof', type: 'bytes' },
|
|
125
|
-
{ name: 'publicInputs', type: 'bytes32[]' },
|
|
126
|
-
{
|
|
127
|
-
name: 'meAttest',
|
|
128
|
-
type: 'tuple',
|
|
129
|
-
components: [
|
|
130
|
-
{ name: 'bearerHash', type: 'bytes32' },
|
|
131
|
-
{ name: 'bearerRangeStart', type: 'uint32' },
|
|
132
|
-
{ name: 'bearerRangeEnd', type: 'uint32' },
|
|
133
|
-
{ name: 'sentRevealed', type: 'bytes' },
|
|
134
|
-
{ name: 'sentPrefixEnd', type: 'uint32' },
|
|
135
|
-
{ name: 'sentSuffixEnd', type: 'uint32' },
|
|
136
|
-
{ name: 'recvRevealed', type: 'bytes' },
|
|
137
|
-
{ name: 'handle', type: 'string' },
|
|
138
|
-
{ name: 'userId', type: 'string' },
|
|
139
|
-
{ name: 'sessionAddr', type: 'address' },
|
|
140
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
141
|
-
{ name: 'notarySignature', type: 'bytes' },
|
|
142
|
-
],
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
[p],
|
|
148
|
-
)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export function encodeGoogleProof(p: GoogleProof): Hex {
|
|
152
|
-
return encodeAbiParameters(
|
|
153
|
-
[
|
|
154
|
-
{
|
|
155
|
-
type: 'tuple',
|
|
156
|
-
components: [
|
|
157
|
-
{ name: 'honkProof', type: 'bytes' },
|
|
158
|
-
{ name: 'publicInputs', type: 'bytes32[]' },
|
|
159
|
-
{ name: 'email', type: 'string' },
|
|
160
|
-
{ name: 'sessionKey', type: 'address' },
|
|
161
|
-
{ name: 'sub', type: 'string' },
|
|
162
|
-
],
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
[p],
|
|
166
|
-
)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/// One call, ready to send or to wrap.
|
|
170
|
-
export interface Call {
|
|
171
|
-
to: Address
|
|
172
|
-
data: Hex
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/// Bind a proven account to the caller.
|
|
176
|
-
///
|
|
177
|
-
/// `publishName` also stores the handle as a string, so a contract can read the
|
|
178
|
-
/// reverse direction on chain. The event carries the plaintext either way, so
|
|
179
|
-
/// an indexer never needs it — say true only when something on chain must
|
|
180
|
-
/// display the name. For Google the handle is an email address, which is worth
|
|
181
|
-
/// a thought before publishing it.
|
|
182
|
-
///
|
|
183
|
-
/// **The proof version is resolved on chain, at the moment the call lands** —
|
|
184
|
-
/// not when this calldata is built. The day the owner moves a platform's
|
|
185
|
-
/// default, this call starts handing the proof to the new format's verifier.
|
|
186
|
-
/// That is right for a client that builds its proof fresh from this package
|
|
187
|
-
/// each time, because both sides move together.
|
|
188
|
-
///
|
|
189
|
-
/// It is wrong for a client pinned to one format: a shipped wallet that still
|
|
190
|
-
/// encodes version 1 would hand version-1 bytes to a version-2 verifier, and
|
|
191
|
-
/// the best case is an opaque revert. Such a client wants
|
|
192
|
-
/// `bindAtVersionCall`.
|
|
193
|
-
export function bindCall(names: Address, platformId: Hex, proof: Hex, publishName: boolean): Call {
|
|
194
|
-
return {
|
|
195
|
-
to: names,
|
|
196
|
-
data: encodeFunctionData({
|
|
197
|
-
abi: identityNamesAbi,
|
|
198
|
-
functionName: 'bind',
|
|
199
|
-
args: [platformId, proof, publishName],
|
|
200
|
-
}),
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/// Bind with a named proof version.
|
|
205
|
-
///
|
|
206
|
-
/// A platform's proof can change shape while the account behind it does not —
|
|
207
|
-
/// X gaining OIDC, say — so several formats are accepted at once while users
|
|
208
|
-
/// migrate. `bindCall` uses whichever version the platform currently defaults
|
|
209
|
-
/// to, which is what a client building its proof fresh each time wants.
|
|
210
|
-
///
|
|
211
|
-
/// Use this when the client is pinned to a format: a proof built for version 1
|
|
212
|
-
/// keeps binding on the day the default moves to 2, and stops only when the
|
|
213
|
-
/// owner retires version 1 outright.
|
|
214
|
-
export function bindAtVersionCall(
|
|
215
|
-
names: Address,
|
|
216
|
-
platformId: Hex,
|
|
217
|
-
version: number,
|
|
218
|
-
proof: Hex,
|
|
219
|
-
publishName: boolean,
|
|
220
|
-
): Call {
|
|
221
|
-
return {
|
|
222
|
-
to: names,
|
|
223
|
-
data: encodeFunctionData({
|
|
224
|
-
abi: identityNamesAbi,
|
|
225
|
-
functionName: 'bindAtVersion',
|
|
226
|
-
args: [platformId, version, proof, publishName],
|
|
227
|
-
}),
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/// Withdraw a published handle. The binding itself stays: this stops the chain
|
|
232
|
-
/// displaying the string, and needs no proof, because withdrawing what you
|
|
233
|
-
/// chose to show must not depend on being able to log in again.
|
|
234
|
-
export function unpublishCall(names: Address, platformId: Hex): Call {
|
|
235
|
-
return {
|
|
236
|
-
to: names,
|
|
237
|
-
data: encodeFunctionData({
|
|
238
|
-
abi: identityNamesAbi,
|
|
239
|
-
functionName: 'unpublish',
|
|
240
|
-
args: [platformId],
|
|
241
|
-
}),
|
|
242
|
-
}
|
|
243
|
-
}
|