@jibidieuw/dexes 0.0.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 +169 -0
- package/dist/index.d.mts +4749 -0
- package/dist/index.d.ts +4749 -0
- package/dist/index.js +4056 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4013 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +71 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,4749 @@
|
|
|
1
|
+
import { Address, TransactionReceipt, PublicClient, WalletClient, BlockTag } from 'viem';
|
|
2
|
+
import * as openpgp from 'openpgp';
|
|
3
|
+
|
|
4
|
+
declare class InvalidHexError extends Error {
|
|
5
|
+
readonly code = "INVALID_HEX";
|
|
6
|
+
readonly input: string;
|
|
7
|
+
constructor(input: string);
|
|
8
|
+
}
|
|
9
|
+
declare class HexTooLongError extends Error {
|
|
10
|
+
readonly code = "HEX_TOO_LONG";
|
|
11
|
+
readonly input: string;
|
|
12
|
+
constructor(input: string);
|
|
13
|
+
}
|
|
14
|
+
declare const BYTES32_ZERO: `0x${string}`;
|
|
15
|
+
/**
|
|
16
|
+
* Normalize a hex fingerprint into a valid bytes32.
|
|
17
|
+
* Pads left with zeros if it's shorter than 32 bytes.
|
|
18
|
+
*
|
|
19
|
+
* @param hex The hex string to normalize.
|
|
20
|
+
* @returns The normalized bytes32 hex string.
|
|
21
|
+
* @throws HexTooLongError If the input hex string is longer than 32 bytes.
|
|
22
|
+
*/
|
|
23
|
+
declare function toBytes32(hex: `0x${string}`): `0x${string}`;
|
|
24
|
+
/**
|
|
25
|
+
* Converts a hex string to a 0x-prefixed hex string.
|
|
26
|
+
*
|
|
27
|
+
* @param hexstr The hex string to convert.
|
|
28
|
+
* @returns The 0x-prefixed hex string.
|
|
29
|
+
* @throws InvalidHexError If the input is not a valid hex string.
|
|
30
|
+
*/
|
|
31
|
+
declare function to0x(hexstr: string): `0x${string}`;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Base type representing common properties of all event logs emitted by the Web3Doc smart contract.
|
|
35
|
+
*
|
|
36
|
+
* @property transactionHash The hash of the transaction that emitted the event.
|
|
37
|
+
* @property blockNumber The number of the block that contains the transaction.
|
|
38
|
+
* @property blockHash The hash of the block that contains the transaction.
|
|
39
|
+
* @property blockTimestamp The timestamp of the block that contains the transaction.
|
|
40
|
+
*/
|
|
41
|
+
type BaseLog = {
|
|
42
|
+
transactionHash: `0x${string}`;
|
|
43
|
+
blockNumber: bigint;
|
|
44
|
+
blockHash: `0x${string}`;
|
|
45
|
+
blockTimestamp: Date;
|
|
46
|
+
logIndex: number;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Emitted when the fee is updated.
|
|
51
|
+
*
|
|
52
|
+
* @property oldFee The old fee.
|
|
53
|
+
* @property newFee The new fee.
|
|
54
|
+
*/
|
|
55
|
+
type RequestedFeeUpdatedLog = BaseLog & {
|
|
56
|
+
oldFee: bigint | undefined;
|
|
57
|
+
newFee: bigint | undefined;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Emitted when the fees are withdrawn.
|
|
61
|
+
*
|
|
62
|
+
* @property to The address to which the fees are withdrawn.
|
|
63
|
+
* @property amount The amount withdrawn.
|
|
64
|
+
*/
|
|
65
|
+
type FeesWithdrawnLog = BaseLog & {
|
|
66
|
+
to: Address | undefined;
|
|
67
|
+
amount: bigint | undefined;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Interface for flat fee management operations.
|
|
72
|
+
*/
|
|
73
|
+
interface IFlatFee {
|
|
74
|
+
/*****************************************************************************************************************/
|
|
75
|
+
/*****************************************************************************************************************/
|
|
76
|
+
/**
|
|
77
|
+
* Updates the requested service fee.
|
|
78
|
+
* @dev This function should be restricted to authorized users.
|
|
79
|
+
* @param newFee The new requested fee to be set.
|
|
80
|
+
*/
|
|
81
|
+
updateRequestedFee(newFee: bigint): Promise<TransactionReceipt>;
|
|
82
|
+
/**
|
|
83
|
+
* Withdraws the full contract balance to the specified address.
|
|
84
|
+
* @param to The address to which the fees are withdrawn.
|
|
85
|
+
* @dev This function should be restricted to authorized users.
|
|
86
|
+
*/
|
|
87
|
+
withdrawFees(to: Address): Promise<TransactionReceipt>;
|
|
88
|
+
/*****************************************************************************************************************/
|
|
89
|
+
/*****************************************************************************************************************/
|
|
90
|
+
/**
|
|
91
|
+
* Indicate the fee requested by the smart contract to perform its operations.
|
|
92
|
+
* @returns The requested fee in wei.
|
|
93
|
+
*/
|
|
94
|
+
requestedFee(): Promise<bigint>;
|
|
95
|
+
/*****************************************************************************************************************/
|
|
96
|
+
/*****************************************************************************************************************/
|
|
97
|
+
/**
|
|
98
|
+
* Searches for RequestedFeeUpdated events emitted by the smart contract.
|
|
99
|
+
*
|
|
100
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
101
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
102
|
+
* @returns The list of RequestedFeeUpdatedLog matching the provided filters.
|
|
103
|
+
*/
|
|
104
|
+
searchRequestedFeeUpdatedLogs(fromBlock?: bigint, toBlock?: bigint): Promise<RequestedFeeUpdatedLog[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Searches for FeesWithdrawn events emitted by the smart contract.
|
|
107
|
+
*
|
|
108
|
+
* @param recipients Filter by recipient addresses.
|
|
109
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
110
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
111
|
+
* @returns The list of FeesWithdrawnLog matching the provided filters.
|
|
112
|
+
*/
|
|
113
|
+
searchFeesWithdrawnLogs(recipients?: Address[], fromBlock?: bigint, toBlock?: bigint): Promise<FeesWithdrawnLog[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Extracts FeesWithdrawnLog entries from a transaction receipt.
|
|
116
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
117
|
+
* @returns The list of FeesWithdrawnLog extracted from the receipt.
|
|
118
|
+
*/
|
|
119
|
+
extractFeesWithdrawnLog(receipt: TransactionReceipt): Promise<FeesWithdrawnLog[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Extracts RequestedFeeUpdatedLog entries from a transaction receipt.
|
|
122
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
123
|
+
* @returns The list of RequestedFeeUpdatedLog extracted from the receipt.
|
|
124
|
+
*/
|
|
125
|
+
extractRequestedFeeUpdatedLog(receipt: TransactionReceipt): Promise<RequestedFeeUpdatedLog[]>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Implementation of the FlatFee contract interface.
|
|
130
|
+
*
|
|
131
|
+
* This class provides low-level bindings to interact with contracts implementing the IFlatFee interface.
|
|
132
|
+
*/
|
|
133
|
+
declare class FlatFee implements IFlatFee {
|
|
134
|
+
private _address;
|
|
135
|
+
private _client;
|
|
136
|
+
private _walletClient;
|
|
137
|
+
/**
|
|
138
|
+
* Creates a new FlatFee instance.
|
|
139
|
+
*
|
|
140
|
+
* @param address The address of the contract implementing IFlatFee.
|
|
141
|
+
* @param client A Viem public client for interacting with the blockchain.
|
|
142
|
+
* @param walletClient Optional Viem wallet client for signing transactions.
|
|
143
|
+
*/
|
|
144
|
+
constructor(address: Address, client: PublicClient, walletClient?: WalletClient);
|
|
145
|
+
/*****************************************************************************************************************/
|
|
146
|
+
/*****************************************************************************************************************/
|
|
147
|
+
/**
|
|
148
|
+
* Gets the contract address.
|
|
149
|
+
*/
|
|
150
|
+
get address(): Address;
|
|
151
|
+
/**
|
|
152
|
+
* Sets the contract address.
|
|
153
|
+
*/
|
|
154
|
+
set address(value: Address);
|
|
155
|
+
/**
|
|
156
|
+
* Gets the Viem public client.
|
|
157
|
+
*/
|
|
158
|
+
get client(): PublicClient;
|
|
159
|
+
/**
|
|
160
|
+
* Sets the Viem public client.
|
|
161
|
+
*/
|
|
162
|
+
set client(client: PublicClient);
|
|
163
|
+
/**
|
|
164
|
+
* Gets the Viem wallet client.
|
|
165
|
+
*/
|
|
166
|
+
get walletClient(): WalletClient | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Sets the Viem wallet client.
|
|
169
|
+
*/
|
|
170
|
+
set walletClient(value: WalletClient | undefined);
|
|
171
|
+
/**
|
|
172
|
+
* Validate that a wallet client is available for write operations.
|
|
173
|
+
* @throws Error if wallet client is not configured
|
|
174
|
+
*/
|
|
175
|
+
protected ensureWalletClient(): void;
|
|
176
|
+
/*****************************************************************************************************************/
|
|
177
|
+
/*****************************************************************************************************************/
|
|
178
|
+
/**
|
|
179
|
+
* Updates the requested service fee.
|
|
180
|
+
*
|
|
181
|
+
* @param newFee The new requested fee to be set.
|
|
182
|
+
* @returns The transaction receipt of the update operation.
|
|
183
|
+
*/
|
|
184
|
+
updateRequestedFee(newFee: bigint): Promise<TransactionReceipt>;
|
|
185
|
+
/**
|
|
186
|
+
* Withdraws the full contract balance to the specified address.
|
|
187
|
+
* @param to The address to which the fees are withdrawn.
|
|
188
|
+
* @dev This function should be restricted to authorized users.
|
|
189
|
+
*/
|
|
190
|
+
withdrawFees(to: Address): Promise<TransactionReceipt>;
|
|
191
|
+
/*****************************************************************************************************************/
|
|
192
|
+
/*****************************************************************************************************************/
|
|
193
|
+
/**
|
|
194
|
+
* Indicate the fee requested by the smart contract to perform its operations.
|
|
195
|
+
* @returns The requested fee in wei.
|
|
196
|
+
*/
|
|
197
|
+
requestedFee(): Promise<bigint>;
|
|
198
|
+
/*****************************************************************************************************************/
|
|
199
|
+
/*****************************************************************************************************************/
|
|
200
|
+
/**
|
|
201
|
+
* Searches for RequestedFeeUpdated events emitted by the smart contract.
|
|
202
|
+
*
|
|
203
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
204
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
205
|
+
* @returns The list of RequestedFeeUpdatedLog matching the provided filters.
|
|
206
|
+
*/
|
|
207
|
+
searchRequestedFeeUpdatedLogs(fromBlock?: bigint, toBlock?: bigint): Promise<RequestedFeeUpdatedLog[]>;
|
|
208
|
+
/**
|
|
209
|
+
* Searches for FeesWithdrawn events emitted by the smart contract.
|
|
210
|
+
*
|
|
211
|
+
* @param recipients Filter by recipient addresses.
|
|
212
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
213
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
214
|
+
* @returns The list of FeesWithdrawnLog matching the provided filters.
|
|
215
|
+
*/
|
|
216
|
+
searchFeesWithdrawnLogs(recipients?: Address[], fromBlock?: bigint, toBlock?: bigint): Promise<FeesWithdrawnLog[]>;
|
|
217
|
+
/**
|
|
218
|
+
* Extracts FeesWithdrawnLog entries from a transaction receipt.
|
|
219
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
220
|
+
* @returns The list of FeesWithdrawnLog extracted from the receipt.
|
|
221
|
+
*/
|
|
222
|
+
extractFeesWithdrawnLog(receipt: TransactionReceipt): Promise<FeesWithdrawnLog[]>;
|
|
223
|
+
/**
|
|
224
|
+
* Extracts RequestedFeeUpdatedLog entries from a transaction receipt.
|
|
225
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
226
|
+
* @returns The list of RequestedFeeUpdatedLog extracted from the receipt.
|
|
227
|
+
*/
|
|
228
|
+
extractRequestedFeeUpdatedLog(receipt: TransactionReceipt): Promise<RequestedFeeUpdatedLog[]>;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
declare const Web3PGPEvents: {
|
|
232
|
+
readonly KeyRegistered: "KeyRegistered";
|
|
233
|
+
readonly KeyUpdated: "KeyUpdated";
|
|
234
|
+
readonly SubkeyAdded: "SubkeyAdded";
|
|
235
|
+
readonly KeyRevoked: "KeyRevoked";
|
|
236
|
+
readonly KeyCertified: "KeyCertified";
|
|
237
|
+
readonly KeyCertificationRevoked: "KeyCertificationRevoked";
|
|
238
|
+
readonly OwnershipChallenged: "OwnershipChallenged";
|
|
239
|
+
readonly OwnershipProved: "OwnershipProved";
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* Type representing a KeyRegistered event log emitted by the Web3PGP smart contract.
|
|
243
|
+
*
|
|
244
|
+
* This log contains technical details about the blockchain event as well as the data that were recorded on-chain.
|
|
245
|
+
* The log data are not validated by the smart contract and must be verified by the client application using a
|
|
246
|
+
* OpenPGP implementation.
|
|
247
|
+
*/
|
|
248
|
+
type KeyRegisteredLog = BaseLog & {
|
|
249
|
+
type: typeof Web3PGPEvents.KeyRegistered;
|
|
250
|
+
primaryKeyFingerprint: `0x${string}`;
|
|
251
|
+
subkeyFingerprints: readonly `0x${string}`[];
|
|
252
|
+
openPGPMsg: `0x${string}`;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Type representing a KeyUpdated event log emitted by the Web3PGP smart contract.
|
|
256
|
+
*
|
|
257
|
+
* This log contains technical details about the blockchain event as well as the data that were recorded on-chain.
|
|
258
|
+
* The log data are not validated by the smart contract and must be verified by the client application using a
|
|
259
|
+
* OpenPGP implementation.
|
|
260
|
+
*/
|
|
261
|
+
type KeyUpdatedLog = BaseLog & {
|
|
262
|
+
type: typeof Web3PGPEvents.KeyUpdated;
|
|
263
|
+
fingerprint: `0x${string}`;
|
|
264
|
+
openPGPMsg: `0x${string}`;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Type representing a SubkeyAdded event log emitted by the Web3PGP smart contract.
|
|
268
|
+
*
|
|
269
|
+
* This log contains technical details about the blockchain event as well as the data that were recorded on-chain.
|
|
270
|
+
* The log data are not validated by the smart contract and must be verified by the client application using a
|
|
271
|
+
* OpenPGP implementation.
|
|
272
|
+
*/
|
|
273
|
+
type SubkeyAddedLog = BaseLog & {
|
|
274
|
+
type: typeof Web3PGPEvents.SubkeyAdded;
|
|
275
|
+
primaryKeyFingerprint: `0x${string}`;
|
|
276
|
+
subkeyFingerprint: `0x${string}`;
|
|
277
|
+
openPGPMsg: `0x${string}`;
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Type representing a KeyRevoked event log emitted by the Web3PGP smart contract.
|
|
281
|
+
*
|
|
282
|
+
* This log contains technical details about the blockchain event as well as the data that were recorded on-chain.
|
|
283
|
+
* The log data are not validated by the smart contract and must be verified by the client application using a
|
|
284
|
+
* OpenPGP implementation.
|
|
285
|
+
*/
|
|
286
|
+
type KeyRevokedLog = BaseLog & {
|
|
287
|
+
type: typeof Web3PGPEvents.KeyRevoked;
|
|
288
|
+
fingerprint: `0x${string}`;
|
|
289
|
+
revocationCertificate: `0x${string}`;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Type representing a KeyCertified event log emitted by the Web3PGP smart contract.
|
|
293
|
+
*
|
|
294
|
+
* This log contains technical details about the blockchain event as well as the data that were recorded on-chain.
|
|
295
|
+
*/
|
|
296
|
+
type KeyCertifiedLog = BaseLog & {
|
|
297
|
+
type: typeof Web3PGPEvents.KeyCertified;
|
|
298
|
+
fingerprint: `0x${string}`;
|
|
299
|
+
issuerFingerprint: `0x${string}`;
|
|
300
|
+
keyCertificate: `0x${string}`;
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* Type representing a KeyCertificationRevoked event log emitted by the Web3PGP smart contract.
|
|
304
|
+
*
|
|
305
|
+
* This log contains technical details about the blockchain event as well as the data that were recorded on-chain.
|
|
306
|
+
*/
|
|
307
|
+
type KeyCertificationRevokedLog = BaseLog & {
|
|
308
|
+
type: typeof Web3PGPEvents.KeyCertificationRevoked;
|
|
309
|
+
fingerprint: `0x${string}`;
|
|
310
|
+
issuerFingerprint: `0x${string}`;
|
|
311
|
+
revocationSignature: `0x${string}`;
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* Type representing an OwnershipChallenged event log emitted by the Web3PGP smart contract.
|
|
315
|
+
*
|
|
316
|
+
* This log contains technical details about the blockchain event as well as the data that were recorded on-chain.
|
|
317
|
+
*/
|
|
318
|
+
type OwnershipChallengedLog = BaseLog & {
|
|
319
|
+
type: typeof Web3PGPEvents.OwnershipChallenged;
|
|
320
|
+
fingerprint: `0x${string}`;
|
|
321
|
+
challenge: `0x${string}`;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Type representing an OwnershipProved event log emitted by the Web3PGP smart contract.
|
|
325
|
+
*
|
|
326
|
+
* This log contains technical details about the blockchain event as well as the data that were recorded on-chain.
|
|
327
|
+
*/
|
|
328
|
+
type OwnershipProvedLog = BaseLog & {
|
|
329
|
+
type: typeof Web3PGPEvents.OwnershipProved;
|
|
330
|
+
fingerprint: `0x${string}`;
|
|
331
|
+
challenge: `0x${string}`;
|
|
332
|
+
signature: `0x${string}`;
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Union type representing all possible Web3PGP event logs.
|
|
336
|
+
*/
|
|
337
|
+
type Web3PGPEventLog = KeyRegisteredLog | KeyUpdatedLog | SubkeyAddedLog | KeyRevokedLog | KeyCertifiedLog | KeyCertificationRevokedLog | OwnershipChallengedLog | OwnershipProvedLog;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Interface for the Web3PGP contract methods.
|
|
341
|
+
* This defines the low-level contract interactions following the IWeb3PGP Solidity interface.
|
|
342
|
+
*/
|
|
343
|
+
interface IWeb3PGP extends IFlatFee {
|
|
344
|
+
/*****************************************************************************************************************/
|
|
345
|
+
/*****************************************************************************************************************/
|
|
346
|
+
/**
|
|
347
|
+
* Check if a given fingerprint has been used to register a key in the contract.
|
|
348
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
349
|
+
* @return True if the fingerprint has been used to register a key in the contract, false otherwise.
|
|
350
|
+
*/
|
|
351
|
+
exists(fingerprint: `0x${string}`): Promise<boolean>;
|
|
352
|
+
/**
|
|
353
|
+
* Check if a given fingerprint corresponds to a key registered as a subkey in the contract.
|
|
354
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
355
|
+
* @return True if the key is a subkey, false otherwise.
|
|
356
|
+
*/
|
|
357
|
+
isSubKey(fingerprint: `0x${string}`): Promise<boolean>;
|
|
358
|
+
/**
|
|
359
|
+
* Get the fingerprint of the parent key for a given subkey.
|
|
360
|
+
* @param subkeyFingerprint The fingerprint of the subkey.
|
|
361
|
+
* @return The fingerprint of the parent key or zero bytes if there is no parent.
|
|
362
|
+
*/
|
|
363
|
+
parentOf(subkeyFingerprint: `0x${string}`): Promise<`0x${string}`>;
|
|
364
|
+
/**
|
|
365
|
+
* Get the block number when a key was published.
|
|
366
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
367
|
+
* @return The block number when the key was published, or 0 if not published.
|
|
368
|
+
*/
|
|
369
|
+
getKeyPublicationBlock(fingerprint: `0x${string}`): Promise<bigint>;
|
|
370
|
+
/**
|
|
371
|
+
* Get the block numbers when multiple keys were published.
|
|
372
|
+
* @param fingerprints The fingerprints of the keys to check.
|
|
373
|
+
* @return An array of block numbers corresponding to each fingerprint in the order they were provided.
|
|
374
|
+
*/
|
|
375
|
+
getKeyPublicationBlockBatch(fingerprints: `0x${string}`[]): Promise<bigint[]>;
|
|
376
|
+
/**
|
|
377
|
+
* List the block numbers when updates were published for the given fingerprint.
|
|
378
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
379
|
+
* @param start The starting index in the list of updates.
|
|
380
|
+
* @param limit The maximum number of results to return.
|
|
381
|
+
* @return An array of block numbers when updates were published.
|
|
382
|
+
*/
|
|
383
|
+
listKeyUpdates(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
384
|
+
/**
|
|
385
|
+
* List the block numbers when revocation certificates were published for the given fingerprint.
|
|
386
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
387
|
+
* @param start The starting index in the list of revocations.
|
|
388
|
+
* @param limit The maximum number of results to return.
|
|
389
|
+
* @return An array of block numbers when revocation certificates were published.
|
|
390
|
+
*/
|
|
391
|
+
listRevocations(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
392
|
+
/**
|
|
393
|
+
* List the fingerprints of subkeys registered under a given parent key.
|
|
394
|
+
* @param parentKeyFingerprint The fingerprint of the parent key to check.
|
|
395
|
+
* @param start The starting index in the list of subkeys.
|
|
396
|
+
* @param limit The maximum number of results to return.
|
|
397
|
+
* @return An array of subkey fingerprints.
|
|
398
|
+
*/
|
|
399
|
+
listSubkeys(parentKeyFingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<`0x${string}`[]>;
|
|
400
|
+
/**
|
|
401
|
+
* List the block numbers when certifications were published for a given key.
|
|
402
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
403
|
+
* @param start The starting index in the list of certifications.
|
|
404
|
+
* @param limit The maximum number of results to return.
|
|
405
|
+
* @return An array of block numbers when certifications were published.
|
|
406
|
+
*/
|
|
407
|
+
listCertifications(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
408
|
+
/**
|
|
409
|
+
* List the block numbers when certification revocations were published for a given key.
|
|
410
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
411
|
+
* @param start The starting index in the list of certification revocations.
|
|
412
|
+
* @param limit The maximum number of results to return.
|
|
413
|
+
* @return An array of block numbers when certification revocations were published.
|
|
414
|
+
*/
|
|
415
|
+
listCertificationRevocations(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
416
|
+
/*****************************************************************************************************************/
|
|
417
|
+
/*****************************************************************************************************************/
|
|
418
|
+
/**
|
|
419
|
+
* Register a new primary public key and its optional subkeys.
|
|
420
|
+
* @param primaryKeyFingerprint The declared fingerprint of the primary public key.
|
|
421
|
+
* @param subkeyFingerprints Optional array of declared fingerprints of the subkeys attached to the primary key.
|
|
422
|
+
* @param openPGPMsg A binary OpenPGP message containing the primary key, binding signature, metadata, and subkeys.
|
|
423
|
+
* @return Transaction receipt after registration.
|
|
424
|
+
*/
|
|
425
|
+
register(primaryKeyFingerprint: `0x${string}`, subkeyFingerprints: `0x${string}`[], openPGPMsg: `0x${string}`): Promise<TransactionReceipt>;
|
|
426
|
+
/**
|
|
427
|
+
* Update the metadata of an already registered public key.
|
|
428
|
+
* @param fingerprint The fingerprint of the key to update.
|
|
429
|
+
* @param openPGPMsg A binary OpenPGP message containing the updated key and metadata.
|
|
430
|
+
* @return Transaction receipt after updating the key.
|
|
431
|
+
*/
|
|
432
|
+
update(fingerprint: `0x${string}`, openPGPMsg: `0x${string}`): Promise<TransactionReceipt>;
|
|
433
|
+
/**
|
|
434
|
+
* Add a new subkey to an already registered primary key.
|
|
435
|
+
* @param primaryKeyFingerprint The fingerprint of the primary key to which to attach the subkey.
|
|
436
|
+
* @param subkeyFingerprint The fingerprint of the subkey.
|
|
437
|
+
* @param openPGPMsg A binary OpenPGP message containing the subkey and its key binding signatures.
|
|
438
|
+
* @return Transaction receipt after adding the subkey.
|
|
439
|
+
*/
|
|
440
|
+
addSubkey(primaryKeyFingerprint: `0x${string}`, subkeyFingerprint: `0x${string}`, openPGPMsg: `0x${string}`): Promise<TransactionReceipt>;
|
|
441
|
+
/**
|
|
442
|
+
* Publish a key revocation certificate for a target public key.
|
|
443
|
+
* @param fingerprint The fingerprint of the key to be revoked.
|
|
444
|
+
* @param revocationCertificate The binary OpenPGP message containing the key revocation certificate.
|
|
445
|
+
* @return Transaction receipt after publishing the revocation.
|
|
446
|
+
*/
|
|
447
|
+
revoke(fingerprint: `0x${string}`, revocationCertificate: `0x${string}`): Promise<TransactionReceipt>;
|
|
448
|
+
/**
|
|
449
|
+
* Certifies a key by issuing a key certification.
|
|
450
|
+
*
|
|
451
|
+
* @param fingerprint The fingerprint of the key being certified.
|
|
452
|
+
* @param issuerFingerprint The fingerprint of the issuer key.
|
|
453
|
+
* @param keyCertificate The OpenPGP key certification.
|
|
454
|
+
* @returns A transaction receipt.
|
|
455
|
+
*/
|
|
456
|
+
certifyKey(fingerprint: `0x${string}`, issuerFingerprint: `0x${string}`, keyCertificate: `0x${string}`): Promise<TransactionReceipt>;
|
|
457
|
+
/**
|
|
458
|
+
* Issues a revocation for a previously issued key certification.
|
|
459
|
+
*
|
|
460
|
+
* @param fingerprint The fingerprint of the key whose certification is being revoked.
|
|
461
|
+
* @param issuerFingerprint The fingerprint of the issuer who issued the certification.
|
|
462
|
+
* @param revocationSignature The OpenPGP revocation signature.
|
|
463
|
+
* @returns A transaction receipt.
|
|
464
|
+
*/
|
|
465
|
+
revokeCertification(fingerprint: `0x${string}`, issuerFingerprint: `0x${string}`, revocationSignature: `0x${string}`): Promise<TransactionReceipt>;
|
|
466
|
+
/**
|
|
467
|
+
* Challenges ownership of a key.
|
|
468
|
+
*
|
|
469
|
+
* @param fingerprint The fingerprint of the key.
|
|
470
|
+
* @param challengeHash The keccak256 hash of the challenge.
|
|
471
|
+
* @returns A transaction receipt.
|
|
472
|
+
*/
|
|
473
|
+
challengeOwnership(fingerprint: `0x${string}`, challengeHash: `0x${string}`): Promise<TransactionReceipt>;
|
|
474
|
+
/**
|
|
475
|
+
* Proves ownership of a key by responding to a challenge.
|
|
476
|
+
*
|
|
477
|
+
* @param fingerprint The fingerprint of the key.
|
|
478
|
+
* @param challengeHash The keccak256 hash of the challenge.
|
|
479
|
+
* @param signature A signature proving ownership.
|
|
480
|
+
* @returns A transaction receipt.
|
|
481
|
+
*/
|
|
482
|
+
proveOwnership(fingerprint: `0x${string}`, challengeHash: `0x${string}`, signature: `0x${string}`): Promise<TransactionReceipt>;
|
|
483
|
+
/*****************************************************************************************************************/
|
|
484
|
+
/*****************************************************************************************************************/
|
|
485
|
+
/**
|
|
486
|
+
* Get the log of a key registration event using the provided primary key fingerprint and block number.
|
|
487
|
+
*
|
|
488
|
+
* @param primaryKeyFingerprint The fingerprint of the primary key to retrieve the log for.
|
|
489
|
+
* @param blockNumber The block number where the event was emitted.
|
|
490
|
+
* @throws Error if the event log cannot be found.
|
|
491
|
+
* @return The KeyRegisteredLog object containing event details.
|
|
492
|
+
*/
|
|
493
|
+
getKeyRegisteredLog(primaryKeyFingerprint: `0x${string}`, blockNumber: bigint): Promise<KeyRegisteredLog>;
|
|
494
|
+
/**
|
|
495
|
+
* Search for KeyRegistered event logs.
|
|
496
|
+
*
|
|
497
|
+
* @param primaryKeyFingerprint The fingerprint(s) of the primary key to search logs for. Default to all keys.
|
|
498
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.
|
|
499
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.
|
|
500
|
+
* @return An array of KeyRegisteredLog objects matching the search criteria.
|
|
501
|
+
*/
|
|
502
|
+
searchKeyRegisteredLogs(primaryKeyFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyRegisteredLog[]>;
|
|
503
|
+
/**
|
|
504
|
+
* Search for KeyUpdated event logs.
|
|
505
|
+
*
|
|
506
|
+
* @param fingerprint The fingerprint(s) of the key to search logs for. Default to all keys.
|
|
507
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.
|
|
508
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.
|
|
509
|
+
* @return An array of KeyUpdatedLog objects matching the search criteria.
|
|
510
|
+
*/
|
|
511
|
+
searchKeyUpdatedLogs(fingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyUpdatedLog[]>;
|
|
512
|
+
/**
|
|
513
|
+
* Get the log of a subkey addition event using the provided primary key fingerprint, subkey fingerprint, and block number.
|
|
514
|
+
* @param primaryKeyFingerprint The fingerprint of the primary key.
|
|
515
|
+
* @param subkeyFingerprint The fingerprint of the subkey.
|
|
516
|
+
* @param blockNumber The block number where the event was emitted.
|
|
517
|
+
* @throws Error if the event log cannot be found.
|
|
518
|
+
* @return The SubkeyAddedLog object containing event details.
|
|
519
|
+
*/
|
|
520
|
+
getSubkeyAddedLog(primaryKeyFingerprint: `0x${string}`, subkeyFingerprint: `0x${string}`, blockNumber: bigint): Promise<SubkeyAddedLog>;
|
|
521
|
+
/**
|
|
522
|
+
* Search for SubkeyAdded event logs.
|
|
523
|
+
* @param primaryKeyFingerprint The fingerprint(s) of the primary key to search logs for. Default to all keys.
|
|
524
|
+
* @param subkeyFingerprint The fingerprint(s) of the subkey to search logs for. Default to all subkeys.
|
|
525
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.
|
|
526
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.
|
|
527
|
+
* @return An array of SubkeyAddedLog objects matching the search criteria.
|
|
528
|
+
*/
|
|
529
|
+
searchSubkeyAddedLogs(primaryKeyFingerprint?: `0x${string}` | `0x${string}`[], subkeyFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<SubkeyAddedLog[]>;
|
|
530
|
+
/**
|
|
531
|
+
* Search for KeyRevoked event logs.
|
|
532
|
+
* @param fingerprint The fingerprint(s) of the key to search logs for. Default to all keys.
|
|
533
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.
|
|
534
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.
|
|
535
|
+
* @return An array of KeyRevokedLog objects matching the search criteria.
|
|
536
|
+
*/
|
|
537
|
+
searchKeyRevokedLogs(fingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyRevokedLog[]>;
|
|
538
|
+
/**
|
|
539
|
+
* Search for OwnershipChallenged event logs.
|
|
540
|
+
*
|
|
541
|
+
* @param fingerprint The fingerprint(s) of the key to search logs for. Default to all keys.
|
|
542
|
+
* @param challenge The challenge(s) to search logs for. Default to all challenges.
|
|
543
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.
|
|
544
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.
|
|
545
|
+
* @return An array of OwnershipChallengedLog objects matching the search criteria.
|
|
546
|
+
*/
|
|
547
|
+
searchOwnershipChallengedLogs(fingerprint?: `0x${string}` | `0x${string}`[], challenge?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<OwnershipChallengedLog[]>;
|
|
548
|
+
/**
|
|
549
|
+
* Search for OwnershipProved event logs.
|
|
550
|
+
*
|
|
551
|
+
* @param fingerprint The fingerprint(s) of the key to search logs for. Default to all keys.
|
|
552
|
+
* @param challenge The challenge(s) to search logs for. Default to all challenges.
|
|
553
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.
|
|
554
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.
|
|
555
|
+
* @return An array of OwnershipProvedLog objects matching the search criteria.
|
|
556
|
+
*/
|
|
557
|
+
searchOwnershipProvedLogs(fingerprint?: `0x${string}` | `0x${string}`[], challenge?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<OwnershipProvedLog[]>;
|
|
558
|
+
/**
|
|
559
|
+
* Search for KeyCertified event logs.
|
|
560
|
+
*
|
|
561
|
+
* @param fingerprint The fingerprint(s) of the key to search logs for. Default to all keys.
|
|
562
|
+
* @param issuerFingerprint The fingerprint(s) of the issuer to search logs for. Default to all issuers.
|
|
563
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.
|
|
564
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.
|
|
565
|
+
* @return An array of KeyCertifiedLog objects matching the search criteria.
|
|
566
|
+
*/
|
|
567
|
+
searchKeyCertifiedLogs(fingerprint?: `0x${string}` | `0x${string}`[], issuerFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyCertifiedLog[]>;
|
|
568
|
+
/**
|
|
569
|
+
* Search for KeyCertificationRevoked event logs.
|
|
570
|
+
*
|
|
571
|
+
* @param fingerprint The fingerprint(s) of the key to search logs for. Default to all keys.
|
|
572
|
+
* @param issuerFingerprint The fingerprint(s) of the issuer to search logs for. Default to all issuers.
|
|
573
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.
|
|
574
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.
|
|
575
|
+
* @return An array of KeyCertificationRevokedLog objects matching the search criteria.
|
|
576
|
+
*/
|
|
577
|
+
searchKeyCertificationRevokedLogs(fingerprint?: `0x${string}` | `0x${string}`[], issuerFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyCertificationRevokedLog[]>;
|
|
578
|
+
/**
|
|
579
|
+
* Searches for all key-related events within a specified block range. Optionally filters by fingerprints.
|
|
580
|
+
*
|
|
581
|
+
* Note: The fingerprints are the subjects of the events (i.e., the keys being registered, updated, revoked, certified, etc.).
|
|
582
|
+
* Results will also include subkeys added, challenges, and proofs of ownership related to the listed fingerprints.
|
|
583
|
+
*
|
|
584
|
+
* @param fingerprints The fingerprint(s) of the keys to filter events for. Can be a single fingerprint or an array. Defaults to all keys if not provided.
|
|
585
|
+
* @param fromBlock Starting block number (inclusive). Defaults to 'earliest' if not provided. 'pending' is not allowed.
|
|
586
|
+
* @param toBlock Ending block number (inclusive). Defaults to 'latest' if not provided. 'pending' is not allowed.
|
|
587
|
+
* @return An array of Web3PGPEventLog.
|
|
588
|
+
*/
|
|
589
|
+
searchKeyEvents(fingerprints?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<Web3PGPEventLog[]>;
|
|
590
|
+
/**
|
|
591
|
+
* Extracts KeyRegisteredLog entries from a transaction receipt.
|
|
592
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
593
|
+
* @return The list of KeyRegisteredLog extracted from the receipt.
|
|
594
|
+
*/
|
|
595
|
+
extractKeyRegisteredLog(receipt: TransactionReceipt): Promise<KeyRegisteredLog[]>;
|
|
596
|
+
/**
|
|
597
|
+
* Extracts KeyUpdatedLog entries from a transaction receipt.
|
|
598
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
599
|
+
* @return The list of KeyUpdatedLog extracted from the receipt.
|
|
600
|
+
*/
|
|
601
|
+
extractKeyUpdatedLog(receipt: TransactionReceipt): Promise<KeyUpdatedLog[]>;
|
|
602
|
+
/**
|
|
603
|
+
* Extracts SubkeyAddedLog entries from a transaction receipt.
|
|
604
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
605
|
+
* @return The list of SubkeyAddedLog extracted from the receipt.
|
|
606
|
+
*/
|
|
607
|
+
extractSubkeyAddedLog(receipt: TransactionReceipt): Promise<SubkeyAddedLog[]>;
|
|
608
|
+
/**
|
|
609
|
+
* Extracts KeyRevokedLog entries from a transaction receipt.
|
|
610
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
611
|
+
* @return The list of KeyRevokedLog extracted from the receipt.
|
|
612
|
+
*/
|
|
613
|
+
extractKeyRevokedLog(receipt: TransactionReceipt): Promise<KeyRevokedLog[]>;
|
|
614
|
+
/**
|
|
615
|
+
* Extracts OwnershipChallengedLog entries from a transaction receipt.
|
|
616
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
617
|
+
* @return The list of OwnershipChallengedLog extracted from the receipt.
|
|
618
|
+
*/
|
|
619
|
+
extractOwnershipChallengedLog(receipt: TransactionReceipt): Promise<OwnershipChallengedLog[]>;
|
|
620
|
+
/**
|
|
621
|
+
* Extracts OwnershipProvedLog entries from a transaction receipt.
|
|
622
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
623
|
+
* @return The list of OwnershipProvedLog extracted from the receipt.
|
|
624
|
+
*/
|
|
625
|
+
extractOwnershipProvedLog(receipt: TransactionReceipt): Promise<OwnershipProvedLog[]>;
|
|
626
|
+
/**
|
|
627
|
+
* Extracts KeyCertifiedLog entries from a transaction receipt.
|
|
628
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
629
|
+
* @return The list of KeyCertifiedLog extracted from the receipt.
|
|
630
|
+
*/
|
|
631
|
+
extractKeyCertifiedLog(receipt: TransactionReceipt): Promise<KeyCertifiedLog[]>;
|
|
632
|
+
/**
|
|
633
|
+
* Extracts KeyCertificationRevokedLog entries from a transaction receipt.
|
|
634
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
635
|
+
* @return The list of KeyCertificationRevokedLog extracted from the receipt.
|
|
636
|
+
*/
|
|
637
|
+
extractKeyCertificationRevokedLog(receipt: TransactionReceipt): Promise<KeyCertificationRevokedLog[]>;
|
|
638
|
+
/*****************************************************************************************************************/
|
|
639
|
+
/*****************************************************************************************************************/
|
|
640
|
+
/**
|
|
641
|
+
* Get the current block number of the connected blockchain.
|
|
642
|
+
* @return The current block number as a bigint.
|
|
643
|
+
*/
|
|
644
|
+
getBlockNumber(): Promise<bigint>;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Interface for the Web3PGP service that provides high-level operations for managing OpenPGP keys on the blockchain.
|
|
649
|
+
*
|
|
650
|
+
* This service layer handles:
|
|
651
|
+
* - OpenPGP key validation and processing
|
|
652
|
+
* - Fingerprint extraction and verification
|
|
653
|
+
* - Key serialization to binary format for blockchain storage
|
|
654
|
+
* - Key retrieval and reconstruction from blockchain events
|
|
655
|
+
* - Revocation certificate handling
|
|
656
|
+
*
|
|
657
|
+
* @remarks
|
|
658
|
+
* This is a higher-order service built on top of the low-level Web3PGP contract bindings.
|
|
659
|
+
* It abstracts away the complexity of working with raw OpenPGP messages and fingerprints,
|
|
660
|
+
* providing a cleaner API that works directly with OpenPGP.js key objects.
|
|
661
|
+
*/
|
|
662
|
+
interface IWeb3PGPService {
|
|
663
|
+
/*****************************************************************************************************************/
|
|
664
|
+
/*****************************************************************************************************************/
|
|
665
|
+
/**
|
|
666
|
+
* Register a new OpenPGP public key (primary key with optional subkeys) on the blockchain.
|
|
667
|
+
*
|
|
668
|
+
* @description
|
|
669
|
+
* This method:
|
|
670
|
+
* 1. Verifies the provided public key and subkeys have a valid signature, are not expired and not revoked.
|
|
671
|
+
* 2. Extracts the primary key fingerprint and subkey fingerprints
|
|
672
|
+
* 3. Ensures the key and its subkeys are not registered on-chain (enforced by smart contract).
|
|
673
|
+
* 4. Serializes the key into the OpenPGP binary format.
|
|
674
|
+
* 5. Registers the key on-chain via the Web3PGP contract
|
|
675
|
+
*
|
|
676
|
+
* @param key The OpenPGP public key to register (may include subkeys)
|
|
677
|
+
* @returns Transaction receipt after successful registration
|
|
678
|
+
*
|
|
679
|
+
* @throws Error if the key or one of its subkeys are invalid
|
|
680
|
+
* @throws Error if the key or one of its subkeys are already registered on-chain
|
|
681
|
+
* @throws Error if wallet client is not configured
|
|
682
|
+
* @throws Error if transaction fails
|
|
683
|
+
*
|
|
684
|
+
* @example
|
|
685
|
+
* ```typescript
|
|
686
|
+
* const armoredKey = '-----BEGIN PGP PUBLIC KEY BLOCK-----...';
|
|
687
|
+
* const publicKey = await openpgp.readKey({ armoredKey });
|
|
688
|
+
* const receipt = await service.register(publicKey);
|
|
689
|
+
* console.log(`Key registered at block ${receipt.blockNumber}`);
|
|
690
|
+
* ```
|
|
691
|
+
*/
|
|
692
|
+
register(key: openpgp.PublicKey): Promise<TransactionReceipt>;
|
|
693
|
+
/**
|
|
694
|
+
* Update an existing OpenPGP public key on the blockchain to add or revoke user ID packets,
|
|
695
|
+
* change preferences or update key expiration.
|
|
696
|
+
*
|
|
697
|
+
* @description
|
|
698
|
+
* This method:
|
|
699
|
+
* 1. Verifies the provided public key has a valid signature, is not expired and is not revoked.
|
|
700
|
+
* 2. Prunes subkeys from the key (isolating the primary key for metadata updates).
|
|
701
|
+
* 3. Extracts the primary key fingerprint.
|
|
702
|
+
* 4. Ensures the key is registered on-chain (enforced by smart contract).
|
|
703
|
+
* 5. Serializes the key into the OpenPGP binary format.
|
|
704
|
+
* 6. Calls the update function of the Web3PGP contract to store the updated key on-chain.
|
|
705
|
+
*
|
|
706
|
+
* @param key The OpenPGP public key to update (must include primary key).
|
|
707
|
+
* @returns Transaction receipt after successful update.
|
|
708
|
+
*
|
|
709
|
+
* @throws Error if the key is invalid.
|
|
710
|
+
* @throws Error if the key is not already registered on-chain.
|
|
711
|
+
* @throws Error if wallet client is not configured.
|
|
712
|
+
* @throws Error if the transaction fails.
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* ```typescript
|
|
716
|
+
* const armoredKey = '-----BEGIN PGP PUBLIC KEY BLOCK-----...';
|
|
717
|
+
* const publicKey = await openpgp.readKey({ armoredKey });
|
|
718
|
+
* const receipt = await service.update(publicKey);
|
|
719
|
+
* console.log(`Key updated at block ${receipt.blockNumber}`);
|
|
720
|
+
* ```
|
|
721
|
+
*/
|
|
722
|
+
update(key: openpgp.PublicKey): Promise<TransactionReceipt>;
|
|
723
|
+
/**
|
|
724
|
+
* Add a new subkey to a primary key registered on the blockchain.
|
|
725
|
+
*
|
|
726
|
+
* This method:
|
|
727
|
+
* 1. Validates the provided key contains the specified subkey
|
|
728
|
+
* 2. Removes extra subkeys.
|
|
729
|
+
* 3. Verifies the primary key is registered on-chain (enforced by smart contract)
|
|
730
|
+
* 4. Verifies the subkey is not registered on-chain (enforced by smart contract)
|
|
731
|
+
* 5. Extracts the primary key fingerprint
|
|
732
|
+
* 6. Verifies the provided key and subkey have valid signatures, are not expired and not revoked.
|
|
733
|
+
* 7. Serializes the key and its subkey into the OpenPGP binary format.
|
|
734
|
+
* 8. Adds the subkey on-chain via the Web3PGP contract
|
|
735
|
+
*
|
|
736
|
+
* @param key The OpenPGP public key containing both the primary key and the new subkey
|
|
737
|
+
* @param subkeyFingerprint The fingerprint of the specific subkey to add (must exist in the key)
|
|
738
|
+
* @returns Transaction receipt after successful subkey addition
|
|
739
|
+
*
|
|
740
|
+
* @throws Error if the key is invalid or doesn't contain the specified subkey
|
|
741
|
+
* @throws Error if the primary key is not registered on-chain
|
|
742
|
+
* @throws Error if the subkey is already registered on-chain
|
|
743
|
+
* @throws Error if wallet client is not configured
|
|
744
|
+
* @throws Error if transaction fails
|
|
745
|
+
*
|
|
746
|
+
* @example
|
|
747
|
+
* ```typescript
|
|
748
|
+
* const armoredKey = '-----BEGIN PGP PUBLIC KEY BLOCK-----...';
|
|
749
|
+
* const publicKey = await openpgp.readKey({ armoredKey });
|
|
750
|
+
* const subkeyFp = '0x' + publicKey.subkeys[0].getFingerprint();
|
|
751
|
+
* const receipt = await service.addSubkey(publicKey, subkeyFp);
|
|
752
|
+
* ```
|
|
753
|
+
*/
|
|
754
|
+
addSubkey(key: openpgp.PublicKey, subkeyFingerprint: `0x${string}`): Promise<TransactionReceipt>;
|
|
755
|
+
/**
|
|
756
|
+
* Publish a key revocation certificate on the blockchain.
|
|
757
|
+
*
|
|
758
|
+
* @description
|
|
759
|
+
* This method allows users who have revoked their key using standard OpenPGP tools to publish the key revocation
|
|
760
|
+
* certificate on-chain and inform others that the key is no longer valid.
|
|
761
|
+
*
|
|
762
|
+
* The method accepts either a key object with the revocation signature or a standalone revocation certificate
|
|
763
|
+
* in armored format. In the later case, the method will download and verify the public key from the blockchain
|
|
764
|
+
* using the provided fingerprint as ID, apply the revocation certificate, verify the key is revoked at present time
|
|
765
|
+
* and publish the revoked key on-chain.
|
|
766
|
+
*
|
|
767
|
+
* When a revoked key is provided, the method will verify the target key or subkey, identified by the provided
|
|
768
|
+
* fingerprint, is indeed revoked in the key object at the present time and will publish the revoked key on-chain.
|
|
769
|
+
*
|
|
770
|
+
* @param keyOrCertificate The revoked OpenPGP public key or a revocation certificate
|
|
771
|
+
* @param fingerprint The fingerprint of the key being revoked (primary key or subkey)
|
|
772
|
+
* @returns Transaction receipt after successful revocation publication
|
|
773
|
+
*
|
|
774
|
+
* @throws Error if the key doesn't contain a valid revocation signature at the present time
|
|
775
|
+
* @throws Error if the fingerprint doesn't match any key in the provided key object
|
|
776
|
+
* @throws Error if the target key is not registered on-chain
|
|
777
|
+
* @throws Error if wallet client is not configured
|
|
778
|
+
* @throws Error if transaction fails
|
|
779
|
+
*
|
|
780
|
+
* @example
|
|
781
|
+
* ```typescript
|
|
782
|
+
* // After revoking the key with OpenPGP tools
|
|
783
|
+
* const revokedKey = await openpgp.readKey({ armoredKey: revokedArmoredKey });
|
|
784
|
+
* const fingerprint = '0x' + revokedKey.getFingerprint();
|
|
785
|
+
* const receipt = await service.revoke(revokedKey, fingerprint);
|
|
786
|
+
* ```
|
|
787
|
+
*/
|
|
788
|
+
revoke(keyOrCertificate: openpgp.PublicKey | string, fingerprint: `0x${string}`): Promise<TransactionReceipt>;
|
|
789
|
+
/**
|
|
790
|
+
* Initiate a challenge to prove ownership of an OpenPGP key registered on-chain.
|
|
791
|
+
*
|
|
792
|
+
* This method submits a hash of a random challenge generated by the user to the blockchain. The owner
|
|
793
|
+
* of the private key corresponding to the public key must later sign the bytes of the hash off-chain
|
|
794
|
+
* and submit the signature using the `proveOwnership` method to complete the ownership proof process.
|
|
795
|
+
*
|
|
796
|
+
* @param fingerprint The fingerprint of the key to challenge ownership for (primary key or subkey)
|
|
797
|
+
* @param challengeHash The keccak256 hash of the random challenge generated and hashed by the user (32 bytes hex string)
|
|
798
|
+
* @returns Transaction receipt after successful challenge submission
|
|
799
|
+
*
|
|
800
|
+
* @throws Error if the key is not registered on-chain
|
|
801
|
+
* @throws Error if wallet client is not configured
|
|
802
|
+
* @throws Error if transaction fails
|
|
803
|
+
*/
|
|
804
|
+
challengeOwnership(fingerprint: `0x${string}`, challengeHash: `0x${string}`): Promise<TransactionReceipt>;
|
|
805
|
+
/**
|
|
806
|
+
* Prove ownership of an OpenPGP key by submitting a signature of a previously issued challenge.
|
|
807
|
+
*
|
|
808
|
+
* This method verifies the provided signature against the challenge associated with the specified
|
|
809
|
+
* key fingerprint on-chain. If the signature is valid, ownership is proven.
|
|
810
|
+
*
|
|
811
|
+
* The method:
|
|
812
|
+
* 1. Fetches the up-to-date public key from the blockchain using the provided fingerprint
|
|
813
|
+
* 2. Verifies the signature of the challenge (the bytes of the hash) using the public key
|
|
814
|
+
* 3. Submits the ownership proof on-chain via the Web3PGP contract
|
|
815
|
+
*
|
|
816
|
+
* @param fingerprint The fingerprint of the key to prove ownership for (primary key or subkey)
|
|
817
|
+
* @param challengeHash The keccak256 hash of the original challenge that was issued
|
|
818
|
+
* @param signature The signature of the challenge created using the private key corresponding to the public key
|
|
819
|
+
* @returns Transaction receipt after successful ownership proof submission
|
|
820
|
+
*
|
|
821
|
+
* @throws Error if the key is not registered on-chain
|
|
822
|
+
* @throws Error if the signature is invalid or the key is revoked or expired at present time
|
|
823
|
+
* @throws Error if wallet client is not configured
|
|
824
|
+
* @throws Error if transaction fails
|
|
825
|
+
*/
|
|
826
|
+
proveOwnership(fingerprint: `0x${string}`, challengeHash: `0x${string}`, signature: openpgp.Signature): Promise<TransactionReceipt>;
|
|
827
|
+
/**
|
|
828
|
+
* Publish a third-party certification of an OpenPGP key on the blockchain.
|
|
829
|
+
*
|
|
830
|
+
* This method allows a user (the issuer) to certify another user's OpenPGP public key by publishing
|
|
831
|
+
* the certification on-chain. The certified key is an OpenPGP public key that contains a certification
|
|
832
|
+
* signature made by the issuer over the target key.
|
|
833
|
+
*
|
|
834
|
+
* @description
|
|
835
|
+
* This method:
|
|
836
|
+
* 1. Verifies the target key is registered on-chain (enforced by smart contract)
|
|
837
|
+
* 2. Extracts and verifies the certification signature in the certified key
|
|
838
|
+
* 3. Serializes the certified key into the OpenPGP binary format.
|
|
839
|
+
* 4. Publishes the certification on-chain via the Web3PGP contract.
|
|
840
|
+
*
|
|
841
|
+
* @param issuer The OpenPGP public key of the issuer certifying the target key
|
|
842
|
+
* @param certifiedKey The public key containing the certification signature made by the issuer
|
|
843
|
+
* @returns Transaction receipt after successful certification publication
|
|
844
|
+
*
|
|
845
|
+
* @throws Error if the target key is not registered on-chain
|
|
846
|
+
* @throws Error if the fingerprint doesn't match the fingerprint of the primary key
|
|
847
|
+
* @throws Error if the certification signature is invalid or not made by the issuer
|
|
848
|
+
* @throws Error if wallet client is not configured
|
|
849
|
+
* @throws Error if transaction fails
|
|
850
|
+
*/
|
|
851
|
+
certify(issuer: openpgp.PublicKey, certifiedKey: openpgp.PublicKey): Promise<TransactionReceipt>;
|
|
852
|
+
/**
|
|
853
|
+
* Revoke a third-party certification of an OpenPGP key on the blockchain.
|
|
854
|
+
*
|
|
855
|
+
* This method allows a user (the issuer) to revoke a previously published certification of another user's
|
|
856
|
+
* OpenPGP public key by publishing a revocation on-chain. The revoked key is an OpenPGP public key that
|
|
857
|
+
* contains a revocation signature made by the issuer over the target key.
|
|
858
|
+
*
|
|
859
|
+
* @description
|
|
860
|
+
* This method:
|
|
861
|
+
* 1. Verifies the target key is registered on-chain (enforced by smart contract)
|
|
862
|
+
* 2. Extracts and verifies the revoked third-party signature in the key.
|
|
863
|
+
* 3. Serializes the certified key into the OpenPGP binary format.
|
|
864
|
+
* 4. Publishes the certification revocation on-chain via the Web3PGP contract.
|
|
865
|
+
*
|
|
866
|
+
* @param issuer The OpenPGP public key of the issuer revoking the certification
|
|
867
|
+
* @param keyWithRevokedCertification The public key containing the revocation signature made by the issuer
|
|
868
|
+
* @returns Transaction receipt after successful revocation publication
|
|
869
|
+
*
|
|
870
|
+
* @throws Error if the target key is not registered on-chain
|
|
871
|
+
* @throws Error if the fingerprint doesn't match the fingerprint of the primary key
|
|
872
|
+
* @throws Error if the revocation signature is invalid or not made by the issuer
|
|
873
|
+
* @throws Error if wallet client is not configured
|
|
874
|
+
* @throws Error if transaction fails
|
|
875
|
+
*/
|
|
876
|
+
revokeCertification(issuer: openpgp.PublicKey, keyWithRevokedCertification: openpgp.PublicKey): Promise<TransactionReceipt>;
|
|
877
|
+
/*****************************************************************************************************************/
|
|
878
|
+
/*****************************************************************************************************************/
|
|
879
|
+
/**
|
|
880
|
+
* Retrieve and reconstruct an OpenPGP public key from the blockchain by its fingerprint.
|
|
881
|
+
*
|
|
882
|
+
* This method:
|
|
883
|
+
* 1. Verifies the key exists on-chain
|
|
884
|
+
* 2. Retrieves the key publication block number
|
|
885
|
+
* 3. Fetches the KeyRegistered or SubkeyAdded event from that block
|
|
886
|
+
* 4. Extracts the binary OpenPGP message from the event
|
|
887
|
+
* 5. Parses and validates the OpenPGP message
|
|
888
|
+
* 6. If the fingerprint belongs to a subkey, get the fingerprint of the primary key and call recursively to get the full key
|
|
889
|
+
* 7. Retrieves and adds registered subkeys
|
|
890
|
+
* 8. Retrieves and applies revocations using the block timestamp of each event
|
|
891
|
+
* 9. Retrieves and applies key certifications, key certification revocations and updates of the primary key
|
|
892
|
+
* 10. Returns the reconstructed public key
|
|
893
|
+
*
|
|
894
|
+
* @param fingerprint The fingerprint of the key to retrieve (primary key or subkey)
|
|
895
|
+
* @returns The reconstructed and validated OpenPGP public key, with revocations applied if any
|
|
896
|
+
*
|
|
897
|
+
* @throws Error if the key is not registered on-chain
|
|
898
|
+
* @throws Error if the key data cannot be retrieved from blockchain events
|
|
899
|
+
* @throws Error if the retrieved OpenPGP message is invalid or corrupted
|
|
900
|
+
*
|
|
901
|
+
* @remarks
|
|
902
|
+
* - The returned key will include all subkeys that were registered with the primary key
|
|
903
|
+
* - If the key has been revoked, the revocation signature will be included in the returned key
|
|
904
|
+
* - The key is validated for correctness and fingerprint matching before being returned
|
|
905
|
+
*
|
|
906
|
+
* @example
|
|
907
|
+
* ```typescript
|
|
908
|
+
* const fingerprint = '0x1234567890abcdef...';
|
|
909
|
+
* const publicKey = await service.getPublicKey(fingerprint);
|
|
910
|
+
* const armored = publicKey.armor();
|
|
911
|
+
* console.log(armored);
|
|
912
|
+
*
|
|
913
|
+
* // Check if key is revoked
|
|
914
|
+
* const revoked = await publicKey.isRevoked();
|
|
915
|
+
* if (revoked) {
|
|
916
|
+
* console.log('Warning: This key has been revoked');
|
|
917
|
+
* }
|
|
918
|
+
* ```
|
|
919
|
+
*/
|
|
920
|
+
getPublicKey(fingerprint: `0x${string}`): Promise<openpgp.PublicKey>;
|
|
921
|
+
/*****************************************************************************************************************/
|
|
922
|
+
/*****************************************************************************************************************/
|
|
923
|
+
/**
|
|
924
|
+
* Validate and extract the public key from a KeyRegisteredLog event.
|
|
925
|
+
*
|
|
926
|
+
* @description
|
|
927
|
+
* This method:
|
|
928
|
+
* 1. Validates the log data contains required fields
|
|
929
|
+
* 2. Extracts and parses the OpenPGP message from the log
|
|
930
|
+
* 3. Verifies the primary key fingerprint matches the declared one
|
|
931
|
+
* 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not
|
|
932
|
+
* revoked at the time of registration (uses the block timestamp)..
|
|
933
|
+
* 5. Validates all declared subkeys are present in the key
|
|
934
|
+
* 6. (if verifications are enabled) Verifies each subkey has a valid signature, is not expired and is not
|
|
935
|
+
* revoked at the time of registration (uses the block timestamp).
|
|
936
|
+
* 7. Prunes any extra subkeys not declared in the log
|
|
937
|
+
*
|
|
938
|
+
* Cryptographic verifications of the keys (steps 4 and 6) can be skipped by setting the `skipCryptographicVerifications`
|
|
939
|
+
* parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform
|
|
940
|
+
* custom validations or inspections in case the verification fails, is expected to fail or is performed by an external
|
|
941
|
+
* OpenPGP toolkit.
|
|
942
|
+
*
|
|
943
|
+
* @param log The KeyRegisteredLog event data from the blockchain
|
|
944
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of key and subkeys. Defaults to false.
|
|
945
|
+
* @returns The validated OpenPGP public key extracted from the log
|
|
946
|
+
*
|
|
947
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
948
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
949
|
+
* @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data
|
|
950
|
+
* @throws Web3PGPServiceValidationError if any declared subkey is missing from the extracted key
|
|
951
|
+
*
|
|
952
|
+
* @example
|
|
953
|
+
* ```typescript
|
|
954
|
+
* const logs = await web3pgp.searchKeyRegisteredLogs();
|
|
955
|
+
* for (const log of logs) {
|
|
956
|
+
* try {
|
|
957
|
+
* const publicKey = await service.extractFromKeyRegisteredLog(log);
|
|
958
|
+
* console.log(`Valid key: ${publicKey.getFingerprint()}`);
|
|
959
|
+
* } catch (err) {
|
|
960
|
+
* console.warn(`Invalid log data: ${err.message}`);
|
|
961
|
+
* }
|
|
962
|
+
* }
|
|
963
|
+
* ```
|
|
964
|
+
*/
|
|
965
|
+
extractFromKeyRegisteredLog(log: KeyRegisteredLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey>;
|
|
966
|
+
/**
|
|
967
|
+
* Validate and extract the updated public key from a KeyUpdatedLog event.
|
|
968
|
+
*
|
|
969
|
+
* @description
|
|
970
|
+
* This method:
|
|
971
|
+
* 1. Validates the log data contains required fields
|
|
972
|
+
* 2. Extracts and parses the OpenPGP message from the log
|
|
973
|
+
* 3. Verifies the primary key fingerprint matches the declared one
|
|
974
|
+
* 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not
|
|
975
|
+
* revoked at the time of update (uses the block timestamp).
|
|
976
|
+
*
|
|
977
|
+
* Cryptographic verifications of the key (step 4) can be skipped by setting the `skipCryptographicVerifications`
|
|
978
|
+
* parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform
|
|
979
|
+
* custom validations or inspections in case the verification fails, is expected to fail or is performed by an external
|
|
980
|
+
* OpenPGP toolkit.
|
|
981
|
+
*
|
|
982
|
+
* @param log The KeyUpdatedLog event data from the blockchain
|
|
983
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of key. Defaults to false.
|
|
984
|
+
* @returns The validated OpenPGP public key extracted from the log
|
|
985
|
+
*
|
|
986
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
987
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
988
|
+
* @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data
|
|
989
|
+
*
|
|
990
|
+
* @example
|
|
991
|
+
* ```typescript
|
|
992
|
+
* const logs = await web3pgp.searchKeyUpdatedLogs();
|
|
993
|
+
* for (const log of logs) {
|
|
994
|
+
* try {
|
|
995
|
+
* const publicKey = await service.extractFromKeyUpdatedLog(log);
|
|
996
|
+
* console.log(`Valid updated key: ${publicKey.getFingerprint()}`);
|
|
997
|
+
* } catch (err) {
|
|
998
|
+
* console.warn(`Invalid log data: ${err.message}`);
|
|
999
|
+
* }
|
|
1000
|
+
* }
|
|
1001
|
+
* ```
|
|
1002
|
+
*/
|
|
1003
|
+
extractFromKeyUpdatedLog(log: KeyUpdatedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Validate and extract the subkey from a SubkeyAddedLog event.
|
|
1006
|
+
*
|
|
1007
|
+
* @description
|
|
1008
|
+
* This method:
|
|
1009
|
+
* 1. Validates the log data contains required fields
|
|
1010
|
+
* 2. Extracts and parses the OpenPGP message from the log
|
|
1011
|
+
* 3. Verifies the primary key fingerprint matches the declared one
|
|
1012
|
+
* 4. Verifies the subkey fingerprint matches the declared one
|
|
1013
|
+
* 5. Prunes any extra subkeys and user ID packets, returning only the primary key and the added subkey
|
|
1014
|
+
* 6. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not
|
|
1015
|
+
* revoked at the time of subkey addition (uses the block timestamp).
|
|
1016
|
+
* 7. (if verifications are enabled) Verifies the subkey has a valid signature, is not expired and is not
|
|
1017
|
+
* revoked at the time of addition (uses the block timestamp).
|
|
1018
|
+
*
|
|
1019
|
+
* Cryptographic verifications of the keys (steps 6 and 7) can be skipped by setting the `skipCryptographicVerifications`
|
|
1020
|
+
* parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform
|
|
1021
|
+
* custom validations or inspections in case the verification fails, is expected to fail or is performed by an external
|
|
1022
|
+
* OpenPGP toolkit.
|
|
1023
|
+
*
|
|
1024
|
+
* @param log The SubkeyAddedLog event data from the blockchain
|
|
1025
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of key and subkey. Defaults to false.
|
|
1026
|
+
* @returns The validated OpenPGP public key containing the primary key and the added subkey
|
|
1027
|
+
*
|
|
1028
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
1029
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
1030
|
+
* @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data
|
|
1031
|
+
* @throws Web3PGPServiceValidationError if the subkey is missing from the extracted key
|
|
1032
|
+
*
|
|
1033
|
+
* @example
|
|
1034
|
+
* ```typescript
|
|
1035
|
+
* const logs = await web3pgp.searchSubkeyAddedLogs(primaryFingerprint);
|
|
1036
|
+
* let primaryKey = await service.getPublicKey(primaryFingerprint);
|
|
1037
|
+
* for (const log of logs) {
|
|
1038
|
+
* const subkey = await service.extractFromSubkeyAddedLog(log);
|
|
1039
|
+
* primaryKey = await primaryKey.update(subkey);
|
|
1040
|
+
* }
|
|
1041
|
+
* ```
|
|
1042
|
+
*/
|
|
1043
|
+
extractFromSubkeyAddedLog(log: SubkeyAddedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey>;
|
|
1044
|
+
/**
|
|
1045
|
+
* Validate and extract the revoked key or revocation certificate from a KeyRevokedLog event.
|
|
1046
|
+
*
|
|
1047
|
+
* @description
|
|
1048
|
+
* This method handles two types of revocation data:
|
|
1049
|
+
* 1. Key certificates: Full OpenPGP keys with revocation signatures
|
|
1050
|
+
* 2. Standalone revocation certificates: Revocation signature packets only
|
|
1051
|
+
*
|
|
1052
|
+
* The method:
|
|
1053
|
+
* 1. Validates the log data contains required fields
|
|
1054
|
+
* 2. Attempts to parse as a key certificate first
|
|
1055
|
+
* 3. If that fails, attempts to parse as a standalone revocation certificate and returns the armored certificate.
|
|
1056
|
+
* It is the user's responsibility to verify and apply the revocation certificate to the target key.
|
|
1057
|
+
* 4. For key certificates, validates the fingerprint matches the target key
|
|
1058
|
+
* 5. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is revoked
|
|
1059
|
+
* at the time of revocation (uses the block timestamp).
|
|
1060
|
+
* 6. Returns either the revoked key or the armored revocation certificate
|
|
1061
|
+
*
|
|
1062
|
+
* @param log The KeyRevokedLog event data from the blockchain
|
|
1063
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of the revoked key. Defaults to false.
|
|
1064
|
+
* @returns A tuple containing either:
|
|
1065
|
+
* - [revokedKey, undefined] if a valid key certificate was found
|
|
1066
|
+
* - [undefined, armoredCert] if a standalone revocation certificate was found
|
|
1067
|
+
*
|
|
1068
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
1069
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
1070
|
+
* @throws Web3PGPServiceValidationError if a key certificate does not effectively revoke the target key
|
|
1071
|
+
*
|
|
1072
|
+
* @example
|
|
1073
|
+
* ```typescript
|
|
1074
|
+
* const logs = await web3pgp.searchKeyRevokedLogs(fingerprint);
|
|
1075
|
+
* let publicKey = await service.getPublicKey(fingerprint);
|
|
1076
|
+
* for (const log of logs) {
|
|
1077
|
+
* const [revokedKey, revocationCert] = await service.extractFromKeyRevokedLog(log);
|
|
1078
|
+
* if (revokedKey) {
|
|
1079
|
+
* publicKey = await publicKey.update(revokedKey);
|
|
1080
|
+
* } else if (revocationCert) {
|
|
1081
|
+
* const result = await openpgp.revokeKey({
|
|
1082
|
+
* key: publicKey,
|
|
1083
|
+
* revocationCertificate: revocationCert
|
|
1084
|
+
* });
|
|
1085
|
+
* publicKey = result.publicKey;
|
|
1086
|
+
* }
|
|
1087
|
+
* }
|
|
1088
|
+
* ```
|
|
1089
|
+
*/
|
|
1090
|
+
extractFromKeyRevokedLog(log: KeyRevokedLog, skipCryptographicVerifications?: boolean): Promise<[openpgp.PublicKey | undefined, string | undefined]>;
|
|
1091
|
+
/**
|
|
1092
|
+
* Validate and extract the certified public key from a KeyCertifiedLog event.
|
|
1093
|
+
*
|
|
1094
|
+
* @description
|
|
1095
|
+
* This method:
|
|
1096
|
+
* 1. Validates the log data contains required fields
|
|
1097
|
+
* 2. Extracts and parses the OpenPGP message from the log
|
|
1098
|
+
* 3. Verifies the primary key fingerprint matches the declared one
|
|
1099
|
+
* 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not
|
|
1100
|
+
* revoked at the time of certification (uses the block timestamp).
|
|
1101
|
+
* 5. Validates that at least one certification signature made by the issuer over the target key is present
|
|
1102
|
+
*
|
|
1103
|
+
* Cryptographic verifications of the key (step 4) can be skipped by setting the `skipCryptographicVerifications`
|
|
1104
|
+
* parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform
|
|
1105
|
+
* custom validations or inspections in case the verification fails, is expected to fail or is performed by an external
|
|
1106
|
+
* OpenPGP toolkit.
|
|
1107
|
+
*
|
|
1108
|
+
* @param log The KeyCertifiedLog event data from the blockchain
|
|
1109
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of key. Defaults to false.
|
|
1110
|
+
* @returns The validated OpenPGP public key extracted from the log
|
|
1111
|
+
*
|
|
1112
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
1113
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
1114
|
+
* @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data
|
|
1115
|
+
* @throws Web3PGPServiceValidationError if no valid certification signature made by the issuer is found
|
|
1116
|
+
*
|
|
1117
|
+
* @example
|
|
1118
|
+
* ```typescript
|
|
1119
|
+
* const logs = await web3pgp.searchKeyCertifiedLogs(issuerFingerprint, targetFingerprint);
|
|
1120
|
+
* for (const log of logs) {
|
|
1121
|
+
* try {
|
|
1122
|
+
* const certifiedKey = await service.extractFromKeyCertifiedLog(log);
|
|
1123
|
+
* console.log(`Valid certified key: ${certifiedKey.getFingerprint()}`);
|
|
1124
|
+
* } catch (err) {
|
|
1125
|
+
* console.warn(`Invalid log data: ${err.message}`);
|
|
1126
|
+
* }
|
|
1127
|
+
* }
|
|
1128
|
+
* ```
|
|
1129
|
+
*/
|
|
1130
|
+
extractFromKeyCertifiedLog(log: KeyCertifiedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey>;
|
|
1131
|
+
/**
|
|
1132
|
+
* Validate and extract the revoked certification from a KeyCertificationRevokedLog event.
|
|
1133
|
+
*
|
|
1134
|
+
* @description
|
|
1135
|
+
* This method:
|
|
1136
|
+
* 1. Validates the log data contains required fields
|
|
1137
|
+
* 2. Extracts and parses the OpenPGP message from the log
|
|
1138
|
+
* 3. Verifies the primary key fingerprint matches the declared one
|
|
1139
|
+
* 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not
|
|
1140
|
+
* revoked at the time of certification revocation (uses the block timestamp).
|
|
1141
|
+
* 5. Validates that at least one certification revocation signature made by the issuer over the target key is present
|
|
1142
|
+
*
|
|
1143
|
+
* Cryptographic verifications of the key (step 4) can be skipped by setting the `skipCryptographicVerifications`
|
|
1144
|
+
* parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform
|
|
1145
|
+
* custom validations or inspections in case the verification fails, is expected to fail or is performed by an external
|
|
1146
|
+
* OpenPGP toolkit.
|
|
1147
|
+
*
|
|
1148
|
+
* @param log The KeyCertificationRevokedLog event data from the blockchain
|
|
1149
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of key. Defaults to false.
|
|
1150
|
+
* @returns The validated OpenPGP public key extracted from the log
|
|
1151
|
+
*
|
|
1152
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
1153
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
1154
|
+
* @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data
|
|
1155
|
+
* @throws Web3PGPServiceValidationError if no valid certification revocation signature made by the issuer is found
|
|
1156
|
+
*
|
|
1157
|
+
* @example
|
|
1158
|
+
* ```typescript
|
|
1159
|
+
* const logs = await web3pgp.searchKeyCertificationRevokedLogs(issuerFingerprint, targetFingerprint);
|
|
1160
|
+
* for (const log of logs) {
|
|
1161
|
+
* try {
|
|
1162
|
+
* const revokedCertificationKey = await service.extractFromKeyCertificationRevokedLog(log);
|
|
1163
|
+
* console.log(`Valid revoked certification key: ${revokedCertificationKey.getFingerprint()}`);
|
|
1164
|
+
* } catch (err) {
|
|
1165
|
+
* console.warn(`Invalid log data: ${err.message}`);
|
|
1166
|
+
* }
|
|
1167
|
+
* }
|
|
1168
|
+
* ```
|
|
1169
|
+
*/
|
|
1170
|
+
extractFromKeyCertificationRevokedLog(log: KeyCertificationRevokedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey>;
|
|
1171
|
+
/**
|
|
1172
|
+
* Extract the signature from an OwnershipChallengedLog event. The signature is not verified at this stage.
|
|
1173
|
+
*
|
|
1174
|
+
* @description
|
|
1175
|
+
* This method:
|
|
1176
|
+
* 1. Validates the log data contains required fields
|
|
1177
|
+
* 2. Extracts and parses the OpenPGP signature from the log
|
|
1178
|
+
*
|
|
1179
|
+
* @param log The OwnershipProvedLog event data from the blockchain
|
|
1180
|
+
* @returns The OpenPGP signature extracted from the log
|
|
1181
|
+
*
|
|
1182
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
1183
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP signature is invalid or corrupted
|
|
1184
|
+
*/
|
|
1185
|
+
extractFromOwnershipProvedLog(log: OwnershipProvedLog): Promise<openpgp.Signature>;
|
|
1186
|
+
/**
|
|
1187
|
+
* Searches for all key-related events within a specified block range. Optionally filters by fingerprints.
|
|
1188
|
+
*
|
|
1189
|
+
* Note: The fingerprints are the subjects of the events (i.e., the keys being registered, updated, revoked, certified, etc.).
|
|
1190
|
+
* Results will also include subkeys added, challenges, and proofs of ownership related to the listed fingerprints.
|
|
1191
|
+
*
|
|
1192
|
+
* @param fingerprints The fingerprint(s) of the keys to filter events for. Can be a single fingerprint or an array. Defaults to all keys if not provided.
|
|
1193
|
+
* @param fromBlock Starting block number (inclusive). Defaults to 'earliest' if not provided. 'pending' is not allowed.
|
|
1194
|
+
* @param toBlock Ending block number (inclusive). Defaults to 'latest' if not provided. 'pending' is not allowed.
|
|
1195
|
+
* @return An array of Web3PGPEventLog.
|
|
1196
|
+
*/
|
|
1197
|
+
searchKeyEvents(fingerprints?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<Web3PGPEventLog[]>;
|
|
1198
|
+
/*****************************************************************************************************************/
|
|
1199
|
+
/*****************************************************************************************************************/
|
|
1200
|
+
/**
|
|
1201
|
+
* Get the current block number of the connected blockchain.
|
|
1202
|
+
* @return The current block number as a bigint.
|
|
1203
|
+
*/
|
|
1204
|
+
getBlockNumber(): Promise<bigint>;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
declare class Web3PGP extends FlatFee implements IWeb3PGP {
|
|
1208
|
+
static readonly abi: readonly [{
|
|
1209
|
+
readonly type: "constructor";
|
|
1210
|
+
readonly inputs: readonly [];
|
|
1211
|
+
readonly stateMutability: "nonpayable";
|
|
1212
|
+
}, {
|
|
1213
|
+
readonly type: "receive";
|
|
1214
|
+
readonly stateMutability: "payable";
|
|
1215
|
+
}, {
|
|
1216
|
+
readonly type: "function";
|
|
1217
|
+
readonly name: "UPGRADE_INTERFACE_VERSION";
|
|
1218
|
+
readonly inputs: readonly [];
|
|
1219
|
+
readonly outputs: readonly [{
|
|
1220
|
+
readonly name: "";
|
|
1221
|
+
readonly type: "string";
|
|
1222
|
+
readonly internalType: "string";
|
|
1223
|
+
}];
|
|
1224
|
+
readonly stateMutability: "view";
|
|
1225
|
+
}, {
|
|
1226
|
+
readonly type: "function";
|
|
1227
|
+
readonly name: "addSubkey";
|
|
1228
|
+
readonly inputs: readonly [{
|
|
1229
|
+
readonly name: "primaryKeyFingerprint";
|
|
1230
|
+
readonly type: "bytes32";
|
|
1231
|
+
readonly internalType: "bytes32";
|
|
1232
|
+
}, {
|
|
1233
|
+
readonly name: "subkeyFingerprint";
|
|
1234
|
+
readonly type: "bytes32";
|
|
1235
|
+
readonly internalType: "bytes32";
|
|
1236
|
+
}, {
|
|
1237
|
+
readonly name: "openPGPMsg";
|
|
1238
|
+
readonly type: "bytes";
|
|
1239
|
+
readonly internalType: "bytes";
|
|
1240
|
+
}];
|
|
1241
|
+
readonly outputs: readonly [];
|
|
1242
|
+
readonly stateMutability: "payable";
|
|
1243
|
+
}, {
|
|
1244
|
+
readonly type: "function";
|
|
1245
|
+
readonly name: "authority";
|
|
1246
|
+
readonly inputs: readonly [];
|
|
1247
|
+
readonly outputs: readonly [{
|
|
1248
|
+
readonly name: "";
|
|
1249
|
+
readonly type: "address";
|
|
1250
|
+
readonly internalType: "address";
|
|
1251
|
+
}];
|
|
1252
|
+
readonly stateMutability: "view";
|
|
1253
|
+
}, {
|
|
1254
|
+
readonly type: "function";
|
|
1255
|
+
readonly name: "certifyKey";
|
|
1256
|
+
readonly inputs: readonly [{
|
|
1257
|
+
readonly name: "fingerprint";
|
|
1258
|
+
readonly type: "bytes32";
|
|
1259
|
+
readonly internalType: "bytes32";
|
|
1260
|
+
}, {
|
|
1261
|
+
readonly name: "issuerFingerprint";
|
|
1262
|
+
readonly type: "bytes32";
|
|
1263
|
+
readonly internalType: "bytes32";
|
|
1264
|
+
}, {
|
|
1265
|
+
readonly name: "keyCertificate";
|
|
1266
|
+
readonly type: "bytes";
|
|
1267
|
+
readonly internalType: "bytes";
|
|
1268
|
+
}];
|
|
1269
|
+
readonly outputs: readonly [];
|
|
1270
|
+
readonly stateMutability: "payable";
|
|
1271
|
+
}, {
|
|
1272
|
+
readonly type: "function";
|
|
1273
|
+
readonly name: "challengeOwnership";
|
|
1274
|
+
readonly inputs: readonly [{
|
|
1275
|
+
readonly name: "fingerprint";
|
|
1276
|
+
readonly type: "bytes32";
|
|
1277
|
+
readonly internalType: "bytes32";
|
|
1278
|
+
}, {
|
|
1279
|
+
readonly name: "challenge";
|
|
1280
|
+
readonly type: "bytes32";
|
|
1281
|
+
readonly internalType: "bytes32";
|
|
1282
|
+
}];
|
|
1283
|
+
readonly outputs: readonly [];
|
|
1284
|
+
readonly stateMutability: "payable";
|
|
1285
|
+
}, {
|
|
1286
|
+
readonly type: "function";
|
|
1287
|
+
readonly name: "exists";
|
|
1288
|
+
readonly inputs: readonly [{
|
|
1289
|
+
readonly name: "fingerprint";
|
|
1290
|
+
readonly type: "bytes32";
|
|
1291
|
+
readonly internalType: "bytes32";
|
|
1292
|
+
}];
|
|
1293
|
+
readonly outputs: readonly [{
|
|
1294
|
+
readonly name: "isUsed";
|
|
1295
|
+
readonly type: "bool";
|
|
1296
|
+
readonly internalType: "bool";
|
|
1297
|
+
}];
|
|
1298
|
+
readonly stateMutability: "view";
|
|
1299
|
+
}, {
|
|
1300
|
+
readonly type: "function";
|
|
1301
|
+
readonly name: "getKeyPublicationBlock";
|
|
1302
|
+
readonly inputs: readonly [{
|
|
1303
|
+
readonly name: "fingerprints";
|
|
1304
|
+
readonly type: "bytes32[]";
|
|
1305
|
+
readonly internalType: "bytes32[]";
|
|
1306
|
+
}];
|
|
1307
|
+
readonly outputs: readonly [{
|
|
1308
|
+
readonly name: "";
|
|
1309
|
+
readonly type: "uint256[]";
|
|
1310
|
+
readonly internalType: "uint256[]";
|
|
1311
|
+
}];
|
|
1312
|
+
readonly stateMutability: "view";
|
|
1313
|
+
}, {
|
|
1314
|
+
readonly type: "function";
|
|
1315
|
+
readonly name: "getKeyPublicationBlock";
|
|
1316
|
+
readonly inputs: readonly [{
|
|
1317
|
+
readonly name: "fingerprint";
|
|
1318
|
+
readonly type: "bytes32";
|
|
1319
|
+
readonly internalType: "bytes32";
|
|
1320
|
+
}];
|
|
1321
|
+
readonly outputs: readonly [{
|
|
1322
|
+
readonly name: "";
|
|
1323
|
+
readonly type: "uint256";
|
|
1324
|
+
readonly internalType: "uint256";
|
|
1325
|
+
}];
|
|
1326
|
+
readonly stateMutability: "view";
|
|
1327
|
+
}, {
|
|
1328
|
+
readonly type: "function";
|
|
1329
|
+
readonly name: "initialize";
|
|
1330
|
+
readonly inputs: readonly [{
|
|
1331
|
+
readonly name: "fee";
|
|
1332
|
+
readonly type: "uint256";
|
|
1333
|
+
readonly internalType: "uint256";
|
|
1334
|
+
}, {
|
|
1335
|
+
readonly name: "manager";
|
|
1336
|
+
readonly type: "address";
|
|
1337
|
+
readonly internalType: "address";
|
|
1338
|
+
}];
|
|
1339
|
+
readonly outputs: readonly [];
|
|
1340
|
+
readonly stateMutability: "nonpayable";
|
|
1341
|
+
}, {
|
|
1342
|
+
readonly type: "function";
|
|
1343
|
+
readonly name: "initializeUpgrade";
|
|
1344
|
+
readonly inputs: readonly [];
|
|
1345
|
+
readonly outputs: readonly [];
|
|
1346
|
+
readonly stateMutability: "nonpayable";
|
|
1347
|
+
}, {
|
|
1348
|
+
readonly type: "function";
|
|
1349
|
+
readonly name: "isConsumingScheduledOp";
|
|
1350
|
+
readonly inputs: readonly [];
|
|
1351
|
+
readonly outputs: readonly [{
|
|
1352
|
+
readonly name: "";
|
|
1353
|
+
readonly type: "bytes4";
|
|
1354
|
+
readonly internalType: "bytes4";
|
|
1355
|
+
}];
|
|
1356
|
+
readonly stateMutability: "view";
|
|
1357
|
+
}, {
|
|
1358
|
+
readonly type: "function";
|
|
1359
|
+
readonly name: "isSubKey";
|
|
1360
|
+
readonly inputs: readonly [{
|
|
1361
|
+
readonly name: "fingerprint";
|
|
1362
|
+
readonly type: "bytes32";
|
|
1363
|
+
readonly internalType: "bytes32";
|
|
1364
|
+
}];
|
|
1365
|
+
readonly outputs: readonly [{
|
|
1366
|
+
readonly name: "";
|
|
1367
|
+
readonly type: "bool";
|
|
1368
|
+
readonly internalType: "bool";
|
|
1369
|
+
}];
|
|
1370
|
+
readonly stateMutability: "view";
|
|
1371
|
+
}, {
|
|
1372
|
+
readonly type: "function";
|
|
1373
|
+
readonly name: "listCertificationRevocations";
|
|
1374
|
+
readonly inputs: readonly [{
|
|
1375
|
+
readonly name: "fingerprint";
|
|
1376
|
+
readonly type: "bytes32";
|
|
1377
|
+
readonly internalType: "bytes32";
|
|
1378
|
+
}, {
|
|
1379
|
+
readonly name: "start";
|
|
1380
|
+
readonly type: "uint256";
|
|
1381
|
+
readonly internalType: "uint256";
|
|
1382
|
+
}, {
|
|
1383
|
+
readonly name: "limit";
|
|
1384
|
+
readonly type: "uint256";
|
|
1385
|
+
readonly internalType: "uint256";
|
|
1386
|
+
}];
|
|
1387
|
+
readonly outputs: readonly [{
|
|
1388
|
+
readonly name: "";
|
|
1389
|
+
readonly type: "uint256[]";
|
|
1390
|
+
readonly internalType: "uint256[]";
|
|
1391
|
+
}];
|
|
1392
|
+
readonly stateMutability: "view";
|
|
1393
|
+
}, {
|
|
1394
|
+
readonly type: "function";
|
|
1395
|
+
readonly name: "listCertifications";
|
|
1396
|
+
readonly inputs: readonly [{
|
|
1397
|
+
readonly name: "fingerprint";
|
|
1398
|
+
readonly type: "bytes32";
|
|
1399
|
+
readonly internalType: "bytes32";
|
|
1400
|
+
}, {
|
|
1401
|
+
readonly name: "start";
|
|
1402
|
+
readonly type: "uint256";
|
|
1403
|
+
readonly internalType: "uint256";
|
|
1404
|
+
}, {
|
|
1405
|
+
readonly name: "limit";
|
|
1406
|
+
readonly type: "uint256";
|
|
1407
|
+
readonly internalType: "uint256";
|
|
1408
|
+
}];
|
|
1409
|
+
readonly outputs: readonly [{
|
|
1410
|
+
readonly name: "";
|
|
1411
|
+
readonly type: "uint256[]";
|
|
1412
|
+
readonly internalType: "uint256[]";
|
|
1413
|
+
}];
|
|
1414
|
+
readonly stateMutability: "view";
|
|
1415
|
+
}, {
|
|
1416
|
+
readonly type: "function";
|
|
1417
|
+
readonly name: "listKeyUpdates";
|
|
1418
|
+
readonly inputs: readonly [{
|
|
1419
|
+
readonly name: "fingerprint";
|
|
1420
|
+
readonly type: "bytes32";
|
|
1421
|
+
readonly internalType: "bytes32";
|
|
1422
|
+
}, {
|
|
1423
|
+
readonly name: "start";
|
|
1424
|
+
readonly type: "uint256";
|
|
1425
|
+
readonly internalType: "uint256";
|
|
1426
|
+
}, {
|
|
1427
|
+
readonly name: "limit";
|
|
1428
|
+
readonly type: "uint256";
|
|
1429
|
+
readonly internalType: "uint256";
|
|
1430
|
+
}];
|
|
1431
|
+
readonly outputs: readonly [{
|
|
1432
|
+
readonly name: "";
|
|
1433
|
+
readonly type: "uint256[]";
|
|
1434
|
+
readonly internalType: "uint256[]";
|
|
1435
|
+
}];
|
|
1436
|
+
readonly stateMutability: "view";
|
|
1437
|
+
}, {
|
|
1438
|
+
readonly type: "function";
|
|
1439
|
+
readonly name: "listRevocations";
|
|
1440
|
+
readonly inputs: readonly [{
|
|
1441
|
+
readonly name: "fingerprint";
|
|
1442
|
+
readonly type: "bytes32";
|
|
1443
|
+
readonly internalType: "bytes32";
|
|
1444
|
+
}, {
|
|
1445
|
+
readonly name: "start";
|
|
1446
|
+
readonly type: "uint256";
|
|
1447
|
+
readonly internalType: "uint256";
|
|
1448
|
+
}, {
|
|
1449
|
+
readonly name: "limit";
|
|
1450
|
+
readonly type: "uint256";
|
|
1451
|
+
readonly internalType: "uint256";
|
|
1452
|
+
}];
|
|
1453
|
+
readonly outputs: readonly [{
|
|
1454
|
+
readonly name: "";
|
|
1455
|
+
readonly type: "uint256[]";
|
|
1456
|
+
readonly internalType: "uint256[]";
|
|
1457
|
+
}];
|
|
1458
|
+
readonly stateMutability: "view";
|
|
1459
|
+
}, {
|
|
1460
|
+
readonly type: "function";
|
|
1461
|
+
readonly name: "listSubkeys";
|
|
1462
|
+
readonly inputs: readonly [{
|
|
1463
|
+
readonly name: "parentKeyFingerprint";
|
|
1464
|
+
readonly type: "bytes32";
|
|
1465
|
+
readonly internalType: "bytes32";
|
|
1466
|
+
}, {
|
|
1467
|
+
readonly name: "start";
|
|
1468
|
+
readonly type: "uint256";
|
|
1469
|
+
readonly internalType: "uint256";
|
|
1470
|
+
}, {
|
|
1471
|
+
readonly name: "limit";
|
|
1472
|
+
readonly type: "uint256";
|
|
1473
|
+
readonly internalType: "uint256";
|
|
1474
|
+
}];
|
|
1475
|
+
readonly outputs: readonly [{
|
|
1476
|
+
readonly name: "";
|
|
1477
|
+
readonly type: "bytes32[]";
|
|
1478
|
+
readonly internalType: "bytes32[]";
|
|
1479
|
+
}];
|
|
1480
|
+
readonly stateMutability: "view";
|
|
1481
|
+
}, {
|
|
1482
|
+
readonly type: "function";
|
|
1483
|
+
readonly name: "parentOf";
|
|
1484
|
+
readonly inputs: readonly [{
|
|
1485
|
+
readonly name: "subkeyFingerprint";
|
|
1486
|
+
readonly type: "bytes32";
|
|
1487
|
+
readonly internalType: "bytes32";
|
|
1488
|
+
}];
|
|
1489
|
+
readonly outputs: readonly [{
|
|
1490
|
+
readonly name: "";
|
|
1491
|
+
readonly type: "bytes32";
|
|
1492
|
+
readonly internalType: "bytes32";
|
|
1493
|
+
}];
|
|
1494
|
+
readonly stateMutability: "view";
|
|
1495
|
+
}, {
|
|
1496
|
+
readonly type: "function";
|
|
1497
|
+
readonly name: "proveOwnership";
|
|
1498
|
+
readonly inputs: readonly [{
|
|
1499
|
+
readonly name: "fingerprint";
|
|
1500
|
+
readonly type: "bytes32";
|
|
1501
|
+
readonly internalType: "bytes32";
|
|
1502
|
+
}, {
|
|
1503
|
+
readonly name: "challenge";
|
|
1504
|
+
readonly type: "bytes32";
|
|
1505
|
+
readonly internalType: "bytes32";
|
|
1506
|
+
}, {
|
|
1507
|
+
readonly name: "signature";
|
|
1508
|
+
readonly type: "bytes";
|
|
1509
|
+
readonly internalType: "bytes";
|
|
1510
|
+
}];
|
|
1511
|
+
readonly outputs: readonly [];
|
|
1512
|
+
readonly stateMutability: "payable";
|
|
1513
|
+
}, {
|
|
1514
|
+
readonly type: "function";
|
|
1515
|
+
readonly name: "proxiableUUID";
|
|
1516
|
+
readonly inputs: readonly [];
|
|
1517
|
+
readonly outputs: readonly [{
|
|
1518
|
+
readonly name: "";
|
|
1519
|
+
readonly type: "bytes32";
|
|
1520
|
+
readonly internalType: "bytes32";
|
|
1521
|
+
}];
|
|
1522
|
+
readonly stateMutability: "view";
|
|
1523
|
+
}, {
|
|
1524
|
+
readonly type: "function";
|
|
1525
|
+
readonly name: "register";
|
|
1526
|
+
readonly inputs: readonly [{
|
|
1527
|
+
readonly name: "primaryKeyFingerprint";
|
|
1528
|
+
readonly type: "bytes32";
|
|
1529
|
+
readonly internalType: "bytes32";
|
|
1530
|
+
}, {
|
|
1531
|
+
readonly name: "subkeyFingerprints";
|
|
1532
|
+
readonly type: "bytes32[]";
|
|
1533
|
+
readonly internalType: "bytes32[]";
|
|
1534
|
+
}, {
|
|
1535
|
+
readonly name: "openPGPMsg";
|
|
1536
|
+
readonly type: "bytes";
|
|
1537
|
+
readonly internalType: "bytes";
|
|
1538
|
+
}];
|
|
1539
|
+
readonly outputs: readonly [];
|
|
1540
|
+
readonly stateMutability: "payable";
|
|
1541
|
+
}, {
|
|
1542
|
+
readonly type: "function";
|
|
1543
|
+
readonly name: "requestedFee";
|
|
1544
|
+
readonly inputs: readonly [];
|
|
1545
|
+
readonly outputs: readonly [{
|
|
1546
|
+
readonly name: "";
|
|
1547
|
+
readonly type: "uint256";
|
|
1548
|
+
readonly internalType: "uint256";
|
|
1549
|
+
}];
|
|
1550
|
+
readonly stateMutability: "view";
|
|
1551
|
+
}, {
|
|
1552
|
+
readonly type: "function";
|
|
1553
|
+
readonly name: "revoke";
|
|
1554
|
+
readonly inputs: readonly [{
|
|
1555
|
+
readonly name: "fingerprint";
|
|
1556
|
+
readonly type: "bytes32";
|
|
1557
|
+
readonly internalType: "bytes32";
|
|
1558
|
+
}, {
|
|
1559
|
+
readonly name: "revocationCertificate";
|
|
1560
|
+
readonly type: "bytes";
|
|
1561
|
+
readonly internalType: "bytes";
|
|
1562
|
+
}];
|
|
1563
|
+
readonly outputs: readonly [];
|
|
1564
|
+
readonly stateMutability: "payable";
|
|
1565
|
+
}, {
|
|
1566
|
+
readonly type: "function";
|
|
1567
|
+
readonly name: "revokeCertification";
|
|
1568
|
+
readonly inputs: readonly [{
|
|
1569
|
+
readonly name: "fingerprint";
|
|
1570
|
+
readonly type: "bytes32";
|
|
1571
|
+
readonly internalType: "bytes32";
|
|
1572
|
+
}, {
|
|
1573
|
+
readonly name: "issuerFingerprint";
|
|
1574
|
+
readonly type: "bytes32";
|
|
1575
|
+
readonly internalType: "bytes32";
|
|
1576
|
+
}, {
|
|
1577
|
+
readonly name: "revocationSignature";
|
|
1578
|
+
readonly type: "bytes";
|
|
1579
|
+
readonly internalType: "bytes";
|
|
1580
|
+
}];
|
|
1581
|
+
readonly outputs: readonly [];
|
|
1582
|
+
readonly stateMutability: "payable";
|
|
1583
|
+
}, {
|
|
1584
|
+
readonly type: "function";
|
|
1585
|
+
readonly name: "setAuthority";
|
|
1586
|
+
readonly inputs: readonly [{
|
|
1587
|
+
readonly name: "newAuthority";
|
|
1588
|
+
readonly type: "address";
|
|
1589
|
+
readonly internalType: "address";
|
|
1590
|
+
}];
|
|
1591
|
+
readonly outputs: readonly [];
|
|
1592
|
+
readonly stateMutability: "nonpayable";
|
|
1593
|
+
}, {
|
|
1594
|
+
readonly type: "function";
|
|
1595
|
+
readonly name: "update";
|
|
1596
|
+
readonly inputs: readonly [{
|
|
1597
|
+
readonly name: "fingerprint";
|
|
1598
|
+
readonly type: "bytes32";
|
|
1599
|
+
readonly internalType: "bytes32";
|
|
1600
|
+
}, {
|
|
1601
|
+
readonly name: "openPGPMsg";
|
|
1602
|
+
readonly type: "bytes";
|
|
1603
|
+
readonly internalType: "bytes";
|
|
1604
|
+
}];
|
|
1605
|
+
readonly outputs: readonly [];
|
|
1606
|
+
readonly stateMutability: "payable";
|
|
1607
|
+
}, {
|
|
1608
|
+
readonly type: "function";
|
|
1609
|
+
readonly name: "updateRequestedFee";
|
|
1610
|
+
readonly inputs: readonly [{
|
|
1611
|
+
readonly name: "newFee";
|
|
1612
|
+
readonly type: "uint256";
|
|
1613
|
+
readonly internalType: "uint256";
|
|
1614
|
+
}];
|
|
1615
|
+
readonly outputs: readonly [];
|
|
1616
|
+
readonly stateMutability: "nonpayable";
|
|
1617
|
+
}, {
|
|
1618
|
+
readonly type: "function";
|
|
1619
|
+
readonly name: "upgradeToAndCall";
|
|
1620
|
+
readonly inputs: readonly [{
|
|
1621
|
+
readonly name: "newImplementation";
|
|
1622
|
+
readonly type: "address";
|
|
1623
|
+
readonly internalType: "address";
|
|
1624
|
+
}, {
|
|
1625
|
+
readonly name: "data";
|
|
1626
|
+
readonly type: "bytes";
|
|
1627
|
+
readonly internalType: "bytes";
|
|
1628
|
+
}];
|
|
1629
|
+
readonly outputs: readonly [];
|
|
1630
|
+
readonly stateMutability: "payable";
|
|
1631
|
+
}, {
|
|
1632
|
+
readonly type: "function";
|
|
1633
|
+
readonly name: "withdrawFees";
|
|
1634
|
+
readonly inputs: readonly [{
|
|
1635
|
+
readonly name: "to";
|
|
1636
|
+
readonly type: "address";
|
|
1637
|
+
readonly internalType: "address";
|
|
1638
|
+
}];
|
|
1639
|
+
readonly outputs: readonly [];
|
|
1640
|
+
readonly stateMutability: "nonpayable";
|
|
1641
|
+
}, {
|
|
1642
|
+
readonly type: "event";
|
|
1643
|
+
readonly name: "AuthorityUpdated";
|
|
1644
|
+
readonly inputs: readonly [{
|
|
1645
|
+
readonly name: "authority";
|
|
1646
|
+
readonly type: "address";
|
|
1647
|
+
readonly indexed: false;
|
|
1648
|
+
readonly internalType: "address";
|
|
1649
|
+
}];
|
|
1650
|
+
readonly anonymous: false;
|
|
1651
|
+
}, {
|
|
1652
|
+
readonly type: "event";
|
|
1653
|
+
readonly name: "FeesWithdrawn";
|
|
1654
|
+
readonly inputs: readonly [{
|
|
1655
|
+
readonly name: "to";
|
|
1656
|
+
readonly type: "address";
|
|
1657
|
+
readonly indexed: true;
|
|
1658
|
+
readonly internalType: "address";
|
|
1659
|
+
}, {
|
|
1660
|
+
readonly name: "amount";
|
|
1661
|
+
readonly type: "uint256";
|
|
1662
|
+
readonly indexed: false;
|
|
1663
|
+
readonly internalType: "uint256";
|
|
1664
|
+
}];
|
|
1665
|
+
readonly anonymous: false;
|
|
1666
|
+
}, {
|
|
1667
|
+
readonly type: "event";
|
|
1668
|
+
readonly name: "Initialized";
|
|
1669
|
+
readonly inputs: readonly [{
|
|
1670
|
+
readonly name: "version";
|
|
1671
|
+
readonly type: "uint64";
|
|
1672
|
+
readonly indexed: false;
|
|
1673
|
+
readonly internalType: "uint64";
|
|
1674
|
+
}];
|
|
1675
|
+
readonly anonymous: false;
|
|
1676
|
+
}, {
|
|
1677
|
+
readonly type: "event";
|
|
1678
|
+
readonly name: "KeyCertificationRevoked";
|
|
1679
|
+
readonly inputs: readonly [{
|
|
1680
|
+
readonly name: "fingerprint";
|
|
1681
|
+
readonly type: "bytes32";
|
|
1682
|
+
readonly indexed: true;
|
|
1683
|
+
readonly internalType: "bytes32";
|
|
1684
|
+
}, {
|
|
1685
|
+
readonly name: "issuer";
|
|
1686
|
+
readonly type: "bytes32";
|
|
1687
|
+
readonly indexed: true;
|
|
1688
|
+
readonly internalType: "bytes32";
|
|
1689
|
+
}, {
|
|
1690
|
+
readonly name: "revocationSignature";
|
|
1691
|
+
readonly type: "bytes";
|
|
1692
|
+
readonly indexed: false;
|
|
1693
|
+
readonly internalType: "bytes";
|
|
1694
|
+
}];
|
|
1695
|
+
readonly anonymous: false;
|
|
1696
|
+
}, {
|
|
1697
|
+
readonly type: "event";
|
|
1698
|
+
readonly name: "KeyCertified";
|
|
1699
|
+
readonly inputs: readonly [{
|
|
1700
|
+
readonly name: "fingerprint";
|
|
1701
|
+
readonly type: "bytes32";
|
|
1702
|
+
readonly indexed: true;
|
|
1703
|
+
readonly internalType: "bytes32";
|
|
1704
|
+
}, {
|
|
1705
|
+
readonly name: "issuer";
|
|
1706
|
+
readonly type: "bytes32";
|
|
1707
|
+
readonly indexed: true;
|
|
1708
|
+
readonly internalType: "bytes32";
|
|
1709
|
+
}, {
|
|
1710
|
+
readonly name: "keyCertificate";
|
|
1711
|
+
readonly type: "bytes";
|
|
1712
|
+
readonly indexed: false;
|
|
1713
|
+
readonly internalType: "bytes";
|
|
1714
|
+
}];
|
|
1715
|
+
readonly anonymous: false;
|
|
1716
|
+
}, {
|
|
1717
|
+
readonly type: "event";
|
|
1718
|
+
readonly name: "KeyRegistered";
|
|
1719
|
+
readonly inputs: readonly [{
|
|
1720
|
+
readonly name: "primaryKeyFingerprint";
|
|
1721
|
+
readonly type: "bytes32";
|
|
1722
|
+
readonly indexed: true;
|
|
1723
|
+
readonly internalType: "bytes32";
|
|
1724
|
+
}, {
|
|
1725
|
+
readonly name: "subkeyFingerprints";
|
|
1726
|
+
readonly type: "bytes32[]";
|
|
1727
|
+
readonly indexed: false;
|
|
1728
|
+
readonly internalType: "bytes32[]";
|
|
1729
|
+
}, {
|
|
1730
|
+
readonly name: "openPGPMsg";
|
|
1731
|
+
readonly type: "bytes";
|
|
1732
|
+
readonly indexed: false;
|
|
1733
|
+
readonly internalType: "bytes";
|
|
1734
|
+
}];
|
|
1735
|
+
readonly anonymous: false;
|
|
1736
|
+
}, {
|
|
1737
|
+
readonly type: "event";
|
|
1738
|
+
readonly name: "KeyRevoked";
|
|
1739
|
+
readonly inputs: readonly [{
|
|
1740
|
+
readonly name: "fingerprint";
|
|
1741
|
+
readonly type: "bytes32";
|
|
1742
|
+
readonly indexed: true;
|
|
1743
|
+
readonly internalType: "bytes32";
|
|
1744
|
+
}, {
|
|
1745
|
+
readonly name: "revocationCertificate";
|
|
1746
|
+
readonly type: "bytes";
|
|
1747
|
+
readonly indexed: false;
|
|
1748
|
+
readonly internalType: "bytes";
|
|
1749
|
+
}];
|
|
1750
|
+
readonly anonymous: false;
|
|
1751
|
+
}, {
|
|
1752
|
+
readonly type: "event";
|
|
1753
|
+
readonly name: "KeyUpdated";
|
|
1754
|
+
readonly inputs: readonly [{
|
|
1755
|
+
readonly name: "fingerprint";
|
|
1756
|
+
readonly type: "bytes32";
|
|
1757
|
+
readonly indexed: true;
|
|
1758
|
+
readonly internalType: "bytes32";
|
|
1759
|
+
}, {
|
|
1760
|
+
readonly name: "openPGPMsg";
|
|
1761
|
+
readonly type: "bytes";
|
|
1762
|
+
readonly indexed: false;
|
|
1763
|
+
readonly internalType: "bytes";
|
|
1764
|
+
}];
|
|
1765
|
+
readonly anonymous: false;
|
|
1766
|
+
}, {
|
|
1767
|
+
readonly type: "event";
|
|
1768
|
+
readonly name: "OwnershipChallenged";
|
|
1769
|
+
readonly inputs: readonly [{
|
|
1770
|
+
readonly name: "fingerprint";
|
|
1771
|
+
readonly type: "bytes32";
|
|
1772
|
+
readonly indexed: true;
|
|
1773
|
+
readonly internalType: "bytes32";
|
|
1774
|
+
}, {
|
|
1775
|
+
readonly name: "challenge";
|
|
1776
|
+
readonly type: "bytes32";
|
|
1777
|
+
readonly indexed: true;
|
|
1778
|
+
readonly internalType: "bytes32";
|
|
1779
|
+
}];
|
|
1780
|
+
readonly anonymous: false;
|
|
1781
|
+
}, {
|
|
1782
|
+
readonly type: "event";
|
|
1783
|
+
readonly name: "OwnershipProved";
|
|
1784
|
+
readonly inputs: readonly [{
|
|
1785
|
+
readonly name: "fingerprint";
|
|
1786
|
+
readonly type: "bytes32";
|
|
1787
|
+
readonly indexed: true;
|
|
1788
|
+
readonly internalType: "bytes32";
|
|
1789
|
+
}, {
|
|
1790
|
+
readonly name: "challenge";
|
|
1791
|
+
readonly type: "bytes32";
|
|
1792
|
+
readonly indexed: true;
|
|
1793
|
+
readonly internalType: "bytes32";
|
|
1794
|
+
}, {
|
|
1795
|
+
readonly name: "signature";
|
|
1796
|
+
readonly type: "bytes";
|
|
1797
|
+
readonly indexed: false;
|
|
1798
|
+
readonly internalType: "bytes";
|
|
1799
|
+
}];
|
|
1800
|
+
readonly anonymous: false;
|
|
1801
|
+
}, {
|
|
1802
|
+
readonly type: "event";
|
|
1803
|
+
readonly name: "RequestedFeeUpdated";
|
|
1804
|
+
readonly inputs: readonly [{
|
|
1805
|
+
readonly name: "oldFee";
|
|
1806
|
+
readonly type: "uint256";
|
|
1807
|
+
readonly indexed: false;
|
|
1808
|
+
readonly internalType: "uint256";
|
|
1809
|
+
}, {
|
|
1810
|
+
readonly name: "newFee";
|
|
1811
|
+
readonly type: "uint256";
|
|
1812
|
+
readonly indexed: false;
|
|
1813
|
+
readonly internalType: "uint256";
|
|
1814
|
+
}];
|
|
1815
|
+
readonly anonymous: false;
|
|
1816
|
+
}, {
|
|
1817
|
+
readonly type: "event";
|
|
1818
|
+
readonly name: "SubkeyAdded";
|
|
1819
|
+
readonly inputs: readonly [{
|
|
1820
|
+
readonly name: "primaryKeyFingerprint";
|
|
1821
|
+
readonly type: "bytes32";
|
|
1822
|
+
readonly indexed: true;
|
|
1823
|
+
readonly internalType: "bytes32";
|
|
1824
|
+
}, {
|
|
1825
|
+
readonly name: "subkeyFingerprint";
|
|
1826
|
+
readonly type: "bytes32";
|
|
1827
|
+
readonly indexed: true;
|
|
1828
|
+
readonly internalType: "bytes32";
|
|
1829
|
+
}, {
|
|
1830
|
+
readonly name: "openPGPMsg";
|
|
1831
|
+
readonly type: "bytes";
|
|
1832
|
+
readonly indexed: false;
|
|
1833
|
+
readonly internalType: "bytes";
|
|
1834
|
+
}];
|
|
1835
|
+
readonly anonymous: false;
|
|
1836
|
+
}, {
|
|
1837
|
+
readonly type: "event";
|
|
1838
|
+
readonly name: "Upgraded";
|
|
1839
|
+
readonly inputs: readonly [{
|
|
1840
|
+
readonly name: "implementation";
|
|
1841
|
+
readonly type: "address";
|
|
1842
|
+
readonly indexed: true;
|
|
1843
|
+
readonly internalType: "address";
|
|
1844
|
+
}];
|
|
1845
|
+
readonly anonymous: false;
|
|
1846
|
+
}, {
|
|
1847
|
+
readonly type: "error";
|
|
1848
|
+
readonly name: "AccessManagedInvalidAuthority";
|
|
1849
|
+
readonly inputs: readonly [{
|
|
1850
|
+
readonly name: "authority";
|
|
1851
|
+
readonly type: "address";
|
|
1852
|
+
readonly internalType: "address";
|
|
1853
|
+
}];
|
|
1854
|
+
}, {
|
|
1855
|
+
readonly type: "error";
|
|
1856
|
+
readonly name: "AccessManagedRequiredDelay";
|
|
1857
|
+
readonly inputs: readonly [{
|
|
1858
|
+
readonly name: "caller";
|
|
1859
|
+
readonly type: "address";
|
|
1860
|
+
readonly internalType: "address";
|
|
1861
|
+
}, {
|
|
1862
|
+
readonly name: "delay";
|
|
1863
|
+
readonly type: "uint32";
|
|
1864
|
+
readonly internalType: "uint32";
|
|
1865
|
+
}];
|
|
1866
|
+
}, {
|
|
1867
|
+
readonly type: "error";
|
|
1868
|
+
readonly name: "AccessManagedUnauthorized";
|
|
1869
|
+
readonly inputs: readonly [{
|
|
1870
|
+
readonly name: "caller";
|
|
1871
|
+
readonly type: "address";
|
|
1872
|
+
readonly internalType: "address";
|
|
1873
|
+
}];
|
|
1874
|
+
}, {
|
|
1875
|
+
readonly type: "error";
|
|
1876
|
+
readonly name: "AddressEmptyCode";
|
|
1877
|
+
readonly inputs: readonly [{
|
|
1878
|
+
readonly name: "target";
|
|
1879
|
+
readonly type: "address";
|
|
1880
|
+
readonly internalType: "address";
|
|
1881
|
+
}];
|
|
1882
|
+
}, {
|
|
1883
|
+
readonly type: "error";
|
|
1884
|
+
readonly name: "AlreadyRegistered";
|
|
1885
|
+
readonly inputs: readonly [{
|
|
1886
|
+
readonly name: "fingerprint";
|
|
1887
|
+
readonly type: "bytes32";
|
|
1888
|
+
readonly internalType: "bytes32";
|
|
1889
|
+
}];
|
|
1890
|
+
}, {
|
|
1891
|
+
readonly type: "error";
|
|
1892
|
+
readonly name: "ERC1967InvalidImplementation";
|
|
1893
|
+
readonly inputs: readonly [{
|
|
1894
|
+
readonly name: "implementation";
|
|
1895
|
+
readonly type: "address";
|
|
1896
|
+
readonly internalType: "address";
|
|
1897
|
+
}];
|
|
1898
|
+
}, {
|
|
1899
|
+
readonly type: "error";
|
|
1900
|
+
readonly name: "ERC1967NonPayable";
|
|
1901
|
+
readonly inputs: readonly [];
|
|
1902
|
+
}, {
|
|
1903
|
+
readonly type: "error";
|
|
1904
|
+
readonly name: "FailedCall";
|
|
1905
|
+
readonly inputs: readonly [];
|
|
1906
|
+
}, {
|
|
1907
|
+
readonly type: "error";
|
|
1908
|
+
readonly name: "FeeRequired";
|
|
1909
|
+
readonly inputs: readonly [{
|
|
1910
|
+
readonly name: "provided";
|
|
1911
|
+
readonly type: "uint256";
|
|
1912
|
+
readonly internalType: "uint256";
|
|
1913
|
+
}, {
|
|
1914
|
+
readonly name: "required";
|
|
1915
|
+
readonly type: "uint256";
|
|
1916
|
+
readonly internalType: "uint256";
|
|
1917
|
+
}];
|
|
1918
|
+
}, {
|
|
1919
|
+
readonly type: "error";
|
|
1920
|
+
readonly name: "FeesWithdrawalFailed";
|
|
1921
|
+
readonly inputs: readonly [];
|
|
1922
|
+
}, {
|
|
1923
|
+
readonly type: "error";
|
|
1924
|
+
readonly name: "InvalidInitialization";
|
|
1925
|
+
readonly inputs: readonly [];
|
|
1926
|
+
}, {
|
|
1927
|
+
readonly type: "error";
|
|
1928
|
+
readonly name: "NoDirectPaymentsAllowed";
|
|
1929
|
+
readonly inputs: readonly [];
|
|
1930
|
+
}, {
|
|
1931
|
+
readonly type: "error";
|
|
1932
|
+
readonly name: "NoFeesToWithdraw";
|
|
1933
|
+
readonly inputs: readonly [];
|
|
1934
|
+
}, {
|
|
1935
|
+
readonly type: "error";
|
|
1936
|
+
readonly name: "NotInitializing";
|
|
1937
|
+
readonly inputs: readonly [];
|
|
1938
|
+
}, {
|
|
1939
|
+
readonly type: "error";
|
|
1940
|
+
readonly name: "NotRegistered";
|
|
1941
|
+
readonly inputs: readonly [{
|
|
1942
|
+
readonly name: "fingerprint";
|
|
1943
|
+
readonly type: "bytes32";
|
|
1944
|
+
readonly internalType: "bytes32";
|
|
1945
|
+
}];
|
|
1946
|
+
}, {
|
|
1947
|
+
readonly type: "error";
|
|
1948
|
+
readonly name: "ReentrancyGuardReentrantCall";
|
|
1949
|
+
readonly inputs: readonly [];
|
|
1950
|
+
}, {
|
|
1951
|
+
readonly type: "error";
|
|
1952
|
+
readonly name: "SelfCertificationNotAllowed";
|
|
1953
|
+
readonly inputs: readonly [];
|
|
1954
|
+
}, {
|
|
1955
|
+
readonly type: "error";
|
|
1956
|
+
readonly name: "TargetIsASubkey";
|
|
1957
|
+
readonly inputs: readonly [{
|
|
1958
|
+
readonly name: "fingerprint";
|
|
1959
|
+
readonly type: "bytes32";
|
|
1960
|
+
readonly internalType: "bytes32";
|
|
1961
|
+
}];
|
|
1962
|
+
}, {
|
|
1963
|
+
readonly type: "error";
|
|
1964
|
+
readonly name: "UUPSUnauthorizedCallContext";
|
|
1965
|
+
readonly inputs: readonly [];
|
|
1966
|
+
}, {
|
|
1967
|
+
readonly type: "error";
|
|
1968
|
+
readonly name: "UUPSUnsupportedProxiableUUID";
|
|
1969
|
+
readonly inputs: readonly [{
|
|
1970
|
+
readonly name: "slot";
|
|
1971
|
+
readonly type: "bytes32";
|
|
1972
|
+
readonly internalType: "bytes32";
|
|
1973
|
+
}];
|
|
1974
|
+
}];
|
|
1975
|
+
private static readonly KEY_REGISTERED_EVENT;
|
|
1976
|
+
private static readonly SUBKEY_ADDED_EVENT;
|
|
1977
|
+
private static readonly KEY_REVOKED_EVENT;
|
|
1978
|
+
private static readonly KEY_UPDATED_EVENT;
|
|
1979
|
+
private static readonly OWNERSHIP_CHALLENGED_EVENT;
|
|
1980
|
+
private static readonly OWNERSHIP_PROVED_EVENT;
|
|
1981
|
+
private static readonly KEY_CERTIFIED_EVENT;
|
|
1982
|
+
private static readonly KEY_CERTIFICATION_REVOKED_EVENT;
|
|
1983
|
+
constructor(address: `0x${string}`, client: PublicClient, walletClient?: WalletClient);
|
|
1984
|
+
/*****************************************************************************************************************/
|
|
1985
|
+
/*****************************************************************************************************************/
|
|
1986
|
+
/**
|
|
1987
|
+
* Check if a given fingerprint has been used to register a key in the contract.
|
|
1988
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
1989
|
+
* @return True if the fingerprint has been used to register a key in the contract, false otherwise.
|
|
1990
|
+
*/
|
|
1991
|
+
exists(fingerprint: `0x${string}`): Promise<boolean>;
|
|
1992
|
+
/**
|
|
1993
|
+
* Check if a given fingerprint corresponds to a key registered as a subkey in the contract.
|
|
1994
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
1995
|
+
* @return True if the key is a subkey, false otherwise.
|
|
1996
|
+
*/
|
|
1997
|
+
isSubKey(fingerprint: `0x${string}`): Promise<boolean>;
|
|
1998
|
+
/**
|
|
1999
|
+
* Get the fingerprint of the parent key for a given subkey.
|
|
2000
|
+
* @param subkeyFingerprint The fingerprint of the subkey.
|
|
2001
|
+
* @return The fingerprint of the parent key or zero bytes if there is no parent.
|
|
2002
|
+
*/
|
|
2003
|
+
parentOf(subkeyFingerprint: `0x${string}`): Promise<`0x${string}`>;
|
|
2004
|
+
/**
|
|
2005
|
+
* Get the block number when a key was published.
|
|
2006
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
2007
|
+
* @return The block number when the key was published, or 0 if not published.
|
|
2008
|
+
*/
|
|
2009
|
+
getKeyPublicationBlock(fingerprint: `0x${string}`): Promise<bigint>;
|
|
2010
|
+
/**
|
|
2011
|
+
* Get the block numbers when multiple keys were published.
|
|
2012
|
+
* @param fingerprints The fingerprints of the keys to check.
|
|
2013
|
+
* @return An array of block numbers corresponding to each fingerprint in the order they were provided.
|
|
2014
|
+
*/
|
|
2015
|
+
getKeyPublicationBlockBatch(fingerprints: `0x${string}`[]): Promise<bigint[]>;
|
|
2016
|
+
/**
|
|
2017
|
+
* List the block numbers when updates were published for the given fingerprint.
|
|
2018
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
2019
|
+
* @param start The starting index in the list of updates.
|
|
2020
|
+
* @param limit The maximum number of results to return.
|
|
2021
|
+
* @return An array of block numbers when updates were published.
|
|
2022
|
+
*/
|
|
2023
|
+
listKeyUpdates(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
2024
|
+
/**
|
|
2025
|
+
* List the block numbers when revocation certificates were published for the given fingerprint.
|
|
2026
|
+
* @param fingerprint The fingerprint of the key to check.
|
|
2027
|
+
* @param start The starting index in the list of revocations.
|
|
2028
|
+
* @param limit The maximum number of results to return.
|
|
2029
|
+
* @return An array of block numbers when revocation certificates were published.
|
|
2030
|
+
*/
|
|
2031
|
+
listRevocations(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
2032
|
+
/**
|
|
2033
|
+
* List the fingerprints of subkeys registered under a given parent key.
|
|
2034
|
+
* @param parentKeyFingerprint The fingerprint of the parent key to check.
|
|
2035
|
+
* @param start The starting index in the list of subkeys.
|
|
2036
|
+
* @param limit The maximum number of results to return.
|
|
2037
|
+
* @return An array of subkey fingerprints.
|
|
2038
|
+
*/
|
|
2039
|
+
listSubkeys(parentKeyFingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<`0x${string}`[]>;
|
|
2040
|
+
/**
|
|
2041
|
+
* List the block numbers when key certifications were issued for a given key.
|
|
2042
|
+
* @param fingerprint The fingerprint of the key.
|
|
2043
|
+
* @param start The starting index in the list of certifications.
|
|
2044
|
+
* @param limit The maximum number of results to return.
|
|
2045
|
+
* @return An array of block numbers when certifications were issued.
|
|
2046
|
+
*/
|
|
2047
|
+
listCertifications(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
2048
|
+
/**
|
|
2049
|
+
* List the block numbers when key certification revocations were issued for a given key.
|
|
2050
|
+
* @param fingerprint The fingerprint of the key.
|
|
2051
|
+
* @param start The starting index in the list of revocations.
|
|
2052
|
+
* @param limit The maximum number of results to return.
|
|
2053
|
+
* @return An array of block numbers when certification revocations were issued.
|
|
2054
|
+
*/
|
|
2055
|
+
listCertificationRevocations(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
2056
|
+
/*****************************************************************************************************************/
|
|
2057
|
+
/*****************************************************************************************************************/
|
|
2058
|
+
/**
|
|
2059
|
+
* Register a new primary public key and its optional subkeys.
|
|
2060
|
+
* @param primaryKeyFingerprint The declared fingerprint of the primary public key.
|
|
2061
|
+
* @param subkeyFingerprints Optional array of declared fingerprints of the subkeys attached to the primary key.
|
|
2062
|
+
* @param openPGPMsg A binary OpenPGP message containing the primary key, binding signature, metadata, and subkeys.
|
|
2063
|
+
* @return Transaction receipt after registration.
|
|
2064
|
+
*/
|
|
2065
|
+
register(primaryKeyFingerprint: `0x${string}`, subkeyFingerprints: `0x${string}`[], openPGPMsg: `0x${string}`): Promise<TransactionReceipt>;
|
|
2066
|
+
/**
|
|
2067
|
+
* Update an existing key with new OpenPGP metadata.
|
|
2068
|
+
* @param fingerprint The fingerprint of the key to update.
|
|
2069
|
+
* @param openPGPMsg A binary OpenPGP message containing updated key material and signatures.
|
|
2070
|
+
* @return Transaction receipt after updating the key.
|
|
2071
|
+
*/
|
|
2072
|
+
update(fingerprint: `0x${string}`, openPGPMsg: `0x${string}`): Promise<TransactionReceipt>;
|
|
2073
|
+
/**
|
|
2074
|
+
* Add a new subkey to an already registered primary key.
|
|
2075
|
+
* @param primaryKeyFingerprint The fingerprint of the primary key to which to attach the subkey.
|
|
2076
|
+
* @param subkeyFingerprint The fingerprint of the subkey.
|
|
2077
|
+
* @param openPGPMsg A binary OpenPGP message containing the subkey and its key binding signatures.
|
|
2078
|
+
* @return Transaction receipt after adding the subkey.
|
|
2079
|
+
*/
|
|
2080
|
+
addSubkey(primaryKeyFingerprint: `0x${string}`, subkeyFingerprint: `0x${string}`, openPGPMsg: `0x${string}`): Promise<TransactionReceipt>;
|
|
2081
|
+
/**
|
|
2082
|
+
* Publish a key revocation certificate for a target public key.
|
|
2083
|
+
* @param fingerprint The fingerprint of the key to be revoked.
|
|
2084
|
+
* @param revocationCertificate The binary OpenPGP message containing the key revocation certificate.
|
|
2085
|
+
* @return Transaction receipt after publishing the revocation.
|
|
2086
|
+
*/
|
|
2087
|
+
revoke(fingerprint: `0x${string}`, revocationCertificate: `0x${string}`): Promise<TransactionReceipt>;
|
|
2088
|
+
/**
|
|
2089
|
+
* Certify a key by issuing a key certification signature.
|
|
2090
|
+
* @param fingerprint The fingerprint of the key being certified.
|
|
2091
|
+
* @param issuerFingerprint The fingerprint of the key issuing the certification.
|
|
2092
|
+
* @param keyCertificate A binary OpenPGP signature constituting the key certification.
|
|
2093
|
+
* @return Transaction receipt after publishing the certification.
|
|
2094
|
+
*/
|
|
2095
|
+
certifyKey(fingerprint: `0x${string}`, issuerFingerprint: `0x${string}`, keyCertificate: `0x${string}`): Promise<TransactionReceipt>;
|
|
2096
|
+
/**
|
|
2097
|
+
* Revoke a key certification.
|
|
2098
|
+
* @param fingerprint The fingerprint of the key whose certification is being revoked.
|
|
2099
|
+
* @param issuerFingerprint The fingerprint of the issuer of the certification to revoke.
|
|
2100
|
+
* @param revocationSignature A signature constituting the revocation of the certification.
|
|
2101
|
+
* @return Transaction receipt after publishing the revocation.
|
|
2102
|
+
*/
|
|
2103
|
+
revokeCertification(fingerprint: `0x${string}`, issuerFingerprint: `0x${string}`, revocationSignature: `0x${string}`): Promise<TransactionReceipt>;
|
|
2104
|
+
/**
|
|
2105
|
+
* Challenge ownership of a public key.
|
|
2106
|
+
* @param fingerprint The fingerprint of the key to challenge.
|
|
2107
|
+
* @param challengeHash The keccak256 hash of the challenge data sent to the user for signing.
|
|
2108
|
+
* @return Transaction receipt after issuing the challenge.
|
|
2109
|
+
*/
|
|
2110
|
+
challengeOwnership(fingerprint: `0x${string}`, challengeHash: `0x${string}`): Promise<TransactionReceipt>;
|
|
2111
|
+
/**
|
|
2112
|
+
* Prove ownership of a public key by responding to a challenge.
|
|
2113
|
+
* @param fingerprint The fingerprint of the key.
|
|
2114
|
+
* @param challengeHash The keccak256 hash of the challenge data.
|
|
2115
|
+
* @param signature A signature made over the challenge data.
|
|
2116
|
+
* @return Transaction receipt after proving ownership.
|
|
2117
|
+
*/
|
|
2118
|
+
proveOwnership(fingerprint: `0x${string}`, challengeHash: `0x${string}`, signature: `0x${string}`): Promise<TransactionReceipt>;
|
|
2119
|
+
/*****************************************************************************************************************/
|
|
2120
|
+
/*****************************************************************************************************************/
|
|
2121
|
+
/**
|
|
2122
|
+
* Get the log of a key registration event using the provided primary key fingerprint and block number.
|
|
2123
|
+
*
|
|
2124
|
+
* @param primaryKeyFingerprint The fingerprint of the primary key to retrieve the log for.
|
|
2125
|
+
* @param blockNumber The block number where the event was emitted.
|
|
2126
|
+
* @throws Error if the event log cannot be found.
|
|
2127
|
+
* @return The KeyRegisteredLog object containing event details.
|
|
2128
|
+
*/
|
|
2129
|
+
getKeyRegisteredLog(primaryKeyFingerprint: `0x${string}`, blockNumber: bigint): Promise<KeyRegisteredLog>;
|
|
2130
|
+
/**
|
|
2131
|
+
* Search for KeyRegistered event logs.
|
|
2132
|
+
*
|
|
2133
|
+
* @param primaryKeyFingerprint The fingerprint(s) of the primary key to search logs for. Default to all keys.
|
|
2134
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.
|
|
2135
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.
|
|
2136
|
+
* @return An array of KeyRegisteredLog objects matching the search criteria.
|
|
2137
|
+
*/
|
|
2138
|
+
searchKeyRegisteredLogs(primaryKeyFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyRegisteredLog[]>;
|
|
2139
|
+
/**
|
|
2140
|
+
* Search for KeyUpdated event logs.
|
|
2141
|
+
* @param fingerprint The fingerprint(s) of the key to search logs for. Default to all keys.
|
|
2142
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default.
|
|
2143
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default.
|
|
2144
|
+
* @return An array of KeyUpdatedLog objects matching the search criteria.
|
|
2145
|
+
*/
|
|
2146
|
+
searchKeyUpdatedLogs(fingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyUpdatedLog[]>;
|
|
2147
|
+
/**
|
|
2148
|
+
* Get the log of a subkey addition event using the provided primary key fingerprint, subkey fingerprint, and block number.
|
|
2149
|
+
* @param primaryKeyFingerprint The fingerprint of the primary key.
|
|
2150
|
+
* @param subkeyFingerprint The fingerprint of the subkey.
|
|
2151
|
+
* @param blockNumber The block number where the event was emitted.
|
|
2152
|
+
* @throws Error if the event log cannot be found.
|
|
2153
|
+
* @return The SubkeyAddedLog object containing event details.
|
|
2154
|
+
*/
|
|
2155
|
+
getSubkeyAddedLog(primaryKeyFingerprint: `0x${string}`, subkeyFingerprint: `0x${string}`, blockNumber: bigint): Promise<SubkeyAddedLog>;
|
|
2156
|
+
/**
|
|
2157
|
+
* Search for SubkeyAdded event logs.
|
|
2158
|
+
* @param primaryKeyFingerprint The fingerprint(s) of the primary key to search logs for. Default to all keys.
|
|
2159
|
+
* @param subkeyFingerprint The fingerprint(s) of the subkey to search logs for. Default to all subkeys.
|
|
2160
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.
|
|
2161
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.
|
|
2162
|
+
* @return An array of SubkeyAddedLog objects matching the search criteria.
|
|
2163
|
+
*/
|
|
2164
|
+
searchSubkeyAddedLogs(primaryKeyFingerprint?: `0x${string}` | `0x${string}`[], subkeyFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<SubkeyAddedLog[]>;
|
|
2165
|
+
/**
|
|
2166
|
+
* Search for KeyRevoked event logs.
|
|
2167
|
+
* @param fingerprint The fingerprint(s) of the key to search logs for. Default to all keys.
|
|
2168
|
+
* @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.
|
|
2169
|
+
* @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.
|
|
2170
|
+
* @return An array of KeyRevokedLog objects matching the search criteria.
|
|
2171
|
+
*/
|
|
2172
|
+
searchKeyRevokedLogs(fingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyRevokedLog[]>;
|
|
2173
|
+
/**
|
|
2174
|
+
* Search for OwnershipProved event logs.
|
|
2175
|
+
* @param fingerprint The fingerprint(s) of the key whose ownership proofs to search for. Default to all keys.
|
|
2176
|
+
* @param challenge The challenge(s) whose ownership proofs to search for. Default to all challenges.
|
|
2177
|
+
* @param fromBlock Starting block number (inclusive). 'earliest' block is used if not provided. 'pending' is not allowed.
|
|
2178
|
+
* @param toBlock Ending block number (inclusive). 'latest' block is used if not provided. 'pending' is not allowed.
|
|
2179
|
+
* @returns An array of OwnershipProvedLog objects matching the search criteria.
|
|
2180
|
+
*/
|
|
2181
|
+
searchOwnershipChallengedLogs(fingerprint?: `0x${string}` | `0x${string}`[], challenge?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<OwnershipChallengedLog[]>;
|
|
2182
|
+
/**
|
|
2183
|
+
* Search for OwnershipProved event logs.
|
|
2184
|
+
* @param fingerprint The fingerprint(s) of the key whose ownership proofs to search for. Default to all keys.
|
|
2185
|
+
* @param challenge The challenge(s) associated with the ownership proofs. Default to all challenges.
|
|
2186
|
+
* @param fromBlock Starting block number (inclusive). 'earliest' block is used if not provided. 'pending' is not allowed.
|
|
2187
|
+
* @param toBlock Ending block number (inclusive). 'latest' block is used if not provided. 'pending' is not allowed.
|
|
2188
|
+
* @returns An array of OwnershipProvedLog objects matching the search criteria.
|
|
2189
|
+
*/
|
|
2190
|
+
searchOwnershipProvedLogs(fingerprint?: `0x${string}` | `0x${string}`[], challenge?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<OwnershipProvedLog[]>;
|
|
2191
|
+
/**
|
|
2192
|
+
* Search for KeyCertified event logs.
|
|
2193
|
+
*
|
|
2194
|
+
* @param fingerprint The fingerprint(s) of the key being certified. Default to all keys.
|
|
2195
|
+
* @param issuerFingerprint The fingerprint(s) of the issuer of the certification. Default to all issuers.
|
|
2196
|
+
* @param fromBlock Starting block number (inclusive). 'earliest' block is used if not provided. 'pending' is not allowed.
|
|
2197
|
+
* @param toBlock Ending block number (inclusive). 'latest' block is used if not provided. 'pending' is not allowed.
|
|
2198
|
+
* @returns An array of KeyCertifiedLog objects matching the search criteria.
|
|
2199
|
+
*/
|
|
2200
|
+
searchKeyCertifiedLogs(fingerprint?: `0x${string}` | `0x${string}`[], issuerFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyCertifiedLog[]>;
|
|
2201
|
+
/**
|
|
2202
|
+
* Search for KeyCertificationRevoked event logs.
|
|
2203
|
+
*
|
|
2204
|
+
* @param fingerprint The fingerprint(s) of the key whose certification revocations to search for. Default to all keys.
|
|
2205
|
+
* @param issuerFingerprint The fingerprint(s) of the issuers whose certification revocations to search for. Default to all issuers.
|
|
2206
|
+
* @param fromBlock Starting block number (inclusive). 'earliest' block is used if not provided. 'pending' is not allowed.
|
|
2207
|
+
* @param toBlock Ending block number (inclusive). 'latest' block is used if not provided. 'pending' is not allowed.
|
|
2208
|
+
* @returns An array of KeyCertificationRevokedLog objects matching the search criteria.
|
|
2209
|
+
*/
|
|
2210
|
+
searchKeyCertificationRevokedLogs(fingerprint?: `0x${string}` | `0x${string}`[], issuerFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyCertificationRevokedLog[]>;
|
|
2211
|
+
/**
|
|
2212
|
+
* Searches for all key-related events within a specified block range. Optionally filters by fingerprints.
|
|
2213
|
+
*
|
|
2214
|
+
* Note: The fingerprints are the subjects of the events (i.e., the keys being registered, updated, revoked, certified, etc.).
|
|
2215
|
+
* Results will also include subkeys added, challenges, and proofs of ownership related to the listed fingerprints.
|
|
2216
|
+
*
|
|
2217
|
+
* @param fingerprints The fingerprint(s) of the keys to filter events for. Can be a single fingerprint or an array. Defaults to all keys if not provided.
|
|
2218
|
+
* @param fromBlock Starting block number (inclusive). Defaults to 'earliest' if not provided. 'pending' is not allowed.
|
|
2219
|
+
* @param toBlock Ending block number (inclusive). Defaults to 'latest' if not provided. 'pending' is not allowed.
|
|
2220
|
+
* @return An array of Web3PGPEventLog.
|
|
2221
|
+
*/
|
|
2222
|
+
searchKeyEvents(fingerprints?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<Web3PGPEventLog[]>;
|
|
2223
|
+
/**
|
|
2224
|
+
* Extract KeyRegistered event logs from a transaction receipt.
|
|
2225
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
2226
|
+
* @returns An array of KeyRegisteredLog objects extracted from the receipt.
|
|
2227
|
+
*/
|
|
2228
|
+
extractKeyRegisteredLog(receipt: TransactionReceipt): Promise<KeyRegisteredLog[]>;
|
|
2229
|
+
/**
|
|
2230
|
+
* Extract KeyUpdated event logs from a transaction receipt.
|
|
2231
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
2232
|
+
* @returns An array of KeyUpdatedLog objects extracted from the receipt.
|
|
2233
|
+
*/
|
|
2234
|
+
extractKeyUpdatedLog(receipt: TransactionReceipt): Promise<KeyUpdatedLog[]>;
|
|
2235
|
+
/**
|
|
2236
|
+
* Extract SubkeyAdded event logs from a transaction receipt.
|
|
2237
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
2238
|
+
* @returns An array of SubkeyAddedLog objects extracted from the receipt.
|
|
2239
|
+
*/
|
|
2240
|
+
extractSubkeyAddedLog(receipt: TransactionReceipt): Promise<SubkeyAddedLog[]>;
|
|
2241
|
+
/**
|
|
2242
|
+
* Extract KeyRevoked event logs from a transaction receipt.
|
|
2243
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
2244
|
+
* @returns An array of KeyRevokedLog objects extracted from the receipt.
|
|
2245
|
+
*/
|
|
2246
|
+
extractKeyRevokedLog(receipt: TransactionReceipt): Promise<KeyRevokedLog[]>;
|
|
2247
|
+
/**
|
|
2248
|
+
* Extract OwnershipChallenged event logs from a transaction receipt.
|
|
2249
|
+
*
|
|
2250
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
2251
|
+
* @returns An array of OwnershipChallengedLog objects extracted from the receipt.
|
|
2252
|
+
*/
|
|
2253
|
+
extractOwnershipChallengedLog(receipt: TransactionReceipt): Promise<OwnershipChallengedLog[]>;
|
|
2254
|
+
/**
|
|
2255
|
+
* Extract OwnershipProved event logs from a transaction receipt.
|
|
2256
|
+
*
|
|
2257
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
2258
|
+
* @returns An array of OwnershipProvedLog objects extracted from the receipt.
|
|
2259
|
+
*/
|
|
2260
|
+
extractOwnershipProvedLog(receipt: TransactionReceipt): Promise<OwnershipProvedLog[]>;
|
|
2261
|
+
/**
|
|
2262
|
+
* Extract KeyCertified event logs from a transaction receipt.
|
|
2263
|
+
*
|
|
2264
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
2265
|
+
* @returns An array of KeyCertifiedLog objects extracted from the receipt.
|
|
2266
|
+
*/
|
|
2267
|
+
extractKeyCertifiedLog(receipt: TransactionReceipt): Promise<KeyCertifiedLog[]>;
|
|
2268
|
+
/**
|
|
2269
|
+
* Extract KeyCertificationRevoked event logs from a transaction receipt.
|
|
2270
|
+
*
|
|
2271
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
2272
|
+
* @returns An array of KeyCertificationRevokedLog objects extracted from the receipt.
|
|
2273
|
+
*/
|
|
2274
|
+
extractKeyCertificationRevokedLog(receipt: TransactionReceipt): Promise<KeyCertificationRevokedLog[]>;
|
|
2275
|
+
/*****************************************************************************************************************/
|
|
2276
|
+
/*****************************************************************************************************************/
|
|
2277
|
+
/**
|
|
2278
|
+
* Get the current block number of the connected blockchain.
|
|
2279
|
+
* @return The current block number as a bigint.
|
|
2280
|
+
*/
|
|
2281
|
+
getBlockNumber(): Promise<bigint>;
|
|
2282
|
+
/**
|
|
2283
|
+
* Helper to efficiently fetch timestamps for a list of logs.
|
|
2284
|
+
* Deduplicates block lookups to minimize RPC calls.
|
|
2285
|
+
*/
|
|
2286
|
+
private getBlockTimestamps;
|
|
2287
|
+
}
|
|
2288
|
+
|
|
2289
|
+
/*****************************************************************************************************************/
|
|
2290
|
+
/*****************************************************************************************************************/
|
|
2291
|
+
/**
|
|
2292
|
+
* Base error class for Web3PGPService errors.
|
|
2293
|
+
*/
|
|
2294
|
+
declare class Web3PGPServiceError extends Error {
|
|
2295
|
+
constructor(message: string);
|
|
2296
|
+
}
|
|
2297
|
+
/**
|
|
2298
|
+
* Error thrown when a critical failure occurs during service operations.
|
|
2299
|
+
*
|
|
2300
|
+
* This error indicates a serious problem that prevents the operation from continuing such as network failures and others has occurred.
|
|
2301
|
+
*/
|
|
2302
|
+
declare class Web3PGPServiceCriticalError extends Web3PGPServiceError {
|
|
2303
|
+
readonly cause?: Error | undefined;
|
|
2304
|
+
constructor(message: string, cause?: Error | undefined);
|
|
2305
|
+
}
|
|
2306
|
+
/**
|
|
2307
|
+
* Error thrown when key or blockchain data validation fails.
|
|
2308
|
+
*
|
|
2309
|
+
* This can happen because the smart contract does not validate the data it stores, they
|
|
2310
|
+
* have to be verified by the client application. Furthermore, as anyone can provide keys,
|
|
2311
|
+
* malformed or invalid keys may be submitted by malicious actors.
|
|
2312
|
+
*/
|
|
2313
|
+
declare class Web3PGPServiceValidationError extends Web3PGPServiceError {
|
|
2314
|
+
constructor(message: string);
|
|
2315
|
+
}
|
|
2316
|
+
/*****************************************************************************************************************/
|
|
2317
|
+
/*****************************************************************************************************************/
|
|
2318
|
+
/**
|
|
2319
|
+
* Configuration options for Web3PGPService.
|
|
2320
|
+
*/
|
|
2321
|
+
interface Web3PGPServiceOptions {
|
|
2322
|
+
/**
|
|
2323
|
+
* Maximum number of concurrent operations performed when retrieving, reconstructing and verifying keys from
|
|
2324
|
+
* the blockchain.
|
|
2325
|
+
*
|
|
2326
|
+
* This limit helps prevent resource exhaustion and rate-limiting issues when interacting with RPC endpoints or
|
|
2327
|
+
* when processing large numbers of keys.
|
|
2328
|
+
*
|
|
2329
|
+
* @default 10
|
|
2330
|
+
*/
|
|
2331
|
+
concurrencyLimit?: number;
|
|
2332
|
+
}
|
|
2333
|
+
/**
|
|
2334
|
+
* High-level service for managing OpenPGP keys on the blockchain.
|
|
2335
|
+
*
|
|
2336
|
+
* This service provides a user-friendly API for working with OpenPGP keys on the Web3PGP contract,
|
|
2337
|
+
* handling all the complexity of key validation, serialization, fingerprint extraction, and event parsing.
|
|
2338
|
+
*
|
|
2339
|
+
* @remarks
|
|
2340
|
+
* Built on top of the low-level Web3PGP contract bindings, this service abstracts away the details
|
|
2341
|
+
* of working with raw bytes and blockchain events, allowing developers to work directly with
|
|
2342
|
+
* OpenPGP.js key objects.
|
|
2343
|
+
*/
|
|
2344
|
+
declare class Web3PGPService implements IWeb3PGPService {
|
|
2345
|
+
private readonly web3pgp;
|
|
2346
|
+
/**
|
|
2347
|
+
* Limiter to control concurrent operations.
|
|
2348
|
+
*
|
|
2349
|
+
* Prevents overwhelming the RPC provider with too many simultaneous requests. Also prevents
|
|
2350
|
+
* excessive CPU and memory usage when processing large numbers of keys.
|
|
2351
|
+
*/
|
|
2352
|
+
private readonly concurrencyLimit;
|
|
2353
|
+
/**
|
|
2354
|
+
* Create a new Web3PGPService instance.
|
|
2355
|
+
*
|
|
2356
|
+
* @param web3pgp The low-level Web3PGP contract instance to use for blockchain interactions
|
|
2357
|
+
*
|
|
2358
|
+
* @example
|
|
2359
|
+
* ```typescript
|
|
2360
|
+
* import { Web3PGP } from './web3pgp';
|
|
2361
|
+
* import { Web3PGPService } from './web3pgp.service';
|
|
2362
|
+
*
|
|
2363
|
+
* const web3pgp = new Web3PGP(contractAddress, publicClient, walletClient);
|
|
2364
|
+
* const service = new Web3PGPService(web3pgp);
|
|
2365
|
+
*
|
|
2366
|
+
* // Now use the high-level service
|
|
2367
|
+
* const receipt = await service.register(publicKey);
|
|
2368
|
+
* ```
|
|
2369
|
+
*/
|
|
2370
|
+
constructor(web3pgp: IWeb3PGP, options?: Web3PGPServiceOptions);
|
|
2371
|
+
/**
|
|
2372
|
+
* Get the underlying Web3PGP contract instance.
|
|
2373
|
+
*
|
|
2374
|
+
* @returns The low-level Web3PGP contract instance
|
|
2375
|
+
*
|
|
2376
|
+
* @remarks
|
|
2377
|
+
* Exposed for advanced use cases where direct contract access is needed.
|
|
2378
|
+
*/
|
|
2379
|
+
get contract(): IWeb3PGP;
|
|
2380
|
+
/*****************************************************************************************************************/
|
|
2381
|
+
/*****************************************************************************************************************/
|
|
2382
|
+
/**
|
|
2383
|
+
* Register a new OpenPGP public key (primary key with optional subkeys) on the blockchain.
|
|
2384
|
+
*
|
|
2385
|
+
* @description
|
|
2386
|
+
* This method:
|
|
2387
|
+
* 1. Verifies the provided public key and subkeys have a valid signature, are not expired and not revoked.
|
|
2388
|
+
* 2. Extracts the primary key fingerprint and subkey fingerprints
|
|
2389
|
+
* 3. Ensures the key and its subkeys are not registered on-chain (enforced by smart contract).
|
|
2390
|
+
* 4. Serializes the key into the OpenPGP binary format.
|
|
2391
|
+
* 5. Registers the key on-chain via the Web3PGP contract
|
|
2392
|
+
*
|
|
2393
|
+
* @param key The OpenPGP public key to register (may include subkeys)
|
|
2394
|
+
* @returns Transaction receipt after successful registration
|
|
2395
|
+
*
|
|
2396
|
+
* @throws Error if the key or one of its subkeys are invalid
|
|
2397
|
+
* @throws Error if the key or one of its subkeys are already registered on-chain
|
|
2398
|
+
* @throws Error if wallet client is not configured
|
|
2399
|
+
* @throws Error if transaction fails
|
|
2400
|
+
*
|
|
2401
|
+
* @example
|
|
2402
|
+
* ```typescript
|
|
2403
|
+
* const armoredKey = '-----BEGIN PGP PUBLIC KEY BLOCK-----...';
|
|
2404
|
+
* const publicKey = await openpgp.readKey({ armoredKey });
|
|
2405
|
+
* const receipt = await service.register(publicKey);
|
|
2406
|
+
* console.log(`Key registered at block ${receipt.blockNumber}`);
|
|
2407
|
+
* ```
|
|
2408
|
+
*/
|
|
2409
|
+
register(key: openpgp.PublicKey): Promise<TransactionReceipt>;
|
|
2410
|
+
/**
|
|
2411
|
+
* Update an existing OpenPGP public key on the blockchain to add or revoke user ID packets,
|
|
2412
|
+
* change preferences or update key expiration.
|
|
2413
|
+
*
|
|
2414
|
+
* @description
|
|
2415
|
+
* This method:
|
|
2416
|
+
* 1. Verifies the provided public key has a valid signature, is not expired and is not revoked.
|
|
2417
|
+
* 2. Prunes subkeys from the key (isolating the primary key for metadata updates).
|
|
2418
|
+
* 3. Extracts the primary key fingerprint.
|
|
2419
|
+
* 4. Ensures the key is registered on-chain (enforced by smart contract).
|
|
2420
|
+
* 5. Serializes the key into the OpenPGP binary format.
|
|
2421
|
+
* 6. Calls the update function of the Web3PGP contract to store the updated key on-chain.
|
|
2422
|
+
*
|
|
2423
|
+
* @param key The OpenPGP public key to update (must include primary key).
|
|
2424
|
+
* @returns Transaction receipt after successful update.
|
|
2425
|
+
*
|
|
2426
|
+
* @throws Error if the key is invalid.
|
|
2427
|
+
* @throws Error if the key is not already registered on-chain.
|
|
2428
|
+
* @throws Error if wallet client is not configured.
|
|
2429
|
+
* @throws Error if the transaction fails.
|
|
2430
|
+
*
|
|
2431
|
+
* @example
|
|
2432
|
+
* ```typescript
|
|
2433
|
+
* const armoredKey = '-----BEGIN PGP PUBLIC KEY BLOCK-----...';
|
|
2434
|
+
* const publicKey = await openpgp.readKey({ armoredKey });
|
|
2435
|
+
* const receipt = await service.update(publicKey);
|
|
2436
|
+
* console.log(`Key updated at block ${receipt.blockNumber}`);
|
|
2437
|
+
* ```
|
|
2438
|
+
*/
|
|
2439
|
+
update(key: openpgp.PublicKey): Promise<TransactionReceipt>;
|
|
2440
|
+
/**
|
|
2441
|
+
* Add a new subkey to a primary key registered on the blockchain.
|
|
2442
|
+
*
|
|
2443
|
+
* This method:
|
|
2444
|
+
* 1. Validates the provided key contains the specified subkey
|
|
2445
|
+
* 2. Removes extra subkeys.
|
|
2446
|
+
* 3. Verifies the primary key is registered on-chain (enforced by smart contract)
|
|
2447
|
+
* 4. Verifies the subkey is not registered on-chain (enforced by smart contract)
|
|
2448
|
+
* 5. Extracts the primary key fingerprint
|
|
2449
|
+
* 6. Verifies the provided key and subkey have valid signatures, are not expired and not revoked.
|
|
2450
|
+
* 7. Serializes the key and its subkey into the OpenPGP binary format.
|
|
2451
|
+
* 8. Adds the subkey on-chain via the Web3PGP contract
|
|
2452
|
+
*
|
|
2453
|
+
* @param key The OpenPGP public key containing both the primary key and the new subkey
|
|
2454
|
+
* @param subkeyFingerprint The fingerprint of the specific subkey to add (must exist in the key)
|
|
2455
|
+
* @returns Transaction receipt after successful subkey addition
|
|
2456
|
+
*
|
|
2457
|
+
* @throws Error if the key is invalid or doesn't contain the specified subkey
|
|
2458
|
+
* @throws Error if the primary key is not registered on-chain
|
|
2459
|
+
* @throws Error if the subkey is already registered on-chain
|
|
2460
|
+
* @throws Error if wallet client is not configured
|
|
2461
|
+
* @throws Error if transaction fails
|
|
2462
|
+
*
|
|
2463
|
+
* @example
|
|
2464
|
+
* ```typescript
|
|
2465
|
+
* const armoredKey = '-----BEGIN PGP PUBLIC KEY BLOCK-----...';
|
|
2466
|
+
* const publicKey = await openpgp.readKey({ armoredKey });
|
|
2467
|
+
* const subkeyFp = '0x' + publicKey.subkeys[0].getFingerprint();
|
|
2468
|
+
* const receipt = await service.addSubkey(publicKey, subkeyFp);
|
|
2469
|
+
* ```
|
|
2470
|
+
*/
|
|
2471
|
+
addSubkey(key: openpgp.PublicKey, subkeyFingerprint: `0x${string}`): Promise<TransactionReceipt>;
|
|
2472
|
+
/**
|
|
2473
|
+
* Publish a key revocation certificate on the blockchain.
|
|
2474
|
+
*
|
|
2475
|
+
* @description
|
|
2476
|
+
* This method allows users who have revoked their key using standard OpenPGP tools to publish the key revocation
|
|
2477
|
+
* certificate on-chain and inform others that the key is no longer valid.
|
|
2478
|
+
*
|
|
2479
|
+
* The method accepts either a key object with the revocation signature or a standalone revocation certificate
|
|
2480
|
+
* in armored format. In the later case, the method will download and verify the public key from the blockchain
|
|
2481
|
+
* using the provided fingerprint as ID, apply the revocation certificate, verify the key is revoked at present time
|
|
2482
|
+
* and publish the revoked key on-chain.
|
|
2483
|
+
*
|
|
2484
|
+
* When a revoked key is provided, the method will verify the target key or subkey, identified by the provided
|
|
2485
|
+
* fingerprint, is indeed revoked in the key object at the present time and will publish the revoked key on-chain.
|
|
2486
|
+
*
|
|
2487
|
+
* @param keyOrCertificate The revoked OpenPGP public key or a revocation certificate
|
|
2488
|
+
* @param fingerprint The fingerprint of the key being revoked (primary key or subkey)
|
|
2489
|
+
* @returns Transaction receipt after successful revocation publication
|
|
2490
|
+
*
|
|
2491
|
+
* @throws Error if the key doesn't contain a valid revocation signature at the present time
|
|
2492
|
+
* @throws Error if the fingerprint doesn't match any key in the provided key object
|
|
2493
|
+
* @throws Error if the target key is not registered on-chain
|
|
2494
|
+
* @throws Error if wallet client is not configured
|
|
2495
|
+
* @throws Error if transaction fails
|
|
2496
|
+
*
|
|
2497
|
+
* @example
|
|
2498
|
+
* ```typescript
|
|
2499
|
+
* // After revoking the key with OpenPGP tools
|
|
2500
|
+
* const revokedKey = await openpgp.readKey({ armoredKey: revokedArmoredKey });
|
|
2501
|
+
* const fingerprint = '0x' + revokedKey.getFingerprint();
|
|
2502
|
+
* const receipt = await service.revoke(revokedKey, fingerprint);
|
|
2503
|
+
* ```
|
|
2504
|
+
*/
|
|
2505
|
+
revoke(keyOrCertificate: openpgp.PublicKey | string, fingerprint: `0x${string}`): Promise<TransactionReceipt>;
|
|
2506
|
+
/**
|
|
2507
|
+
* Revoke a key or subkey using a key object containing the revocation signature.
|
|
2508
|
+
*
|
|
2509
|
+
* The method will verify the target key or subkey, identified by the provided fingerprint, is indeed revoked
|
|
2510
|
+
* in the key object at the present time and publish the revoked key on-chain.
|
|
2511
|
+
*
|
|
2512
|
+
* @param key The OpenPGP public key containing the revocation signature
|
|
2513
|
+
* @param fingerprint The fingerprint of the key being revoked
|
|
2514
|
+
* @returns Transaction receipt after successful revocation publication
|
|
2515
|
+
*/
|
|
2516
|
+
private revokeWithKey;
|
|
2517
|
+
/**
|
|
2518
|
+
* Revoke a key or subkey using a standalone revocation certificate.
|
|
2519
|
+
*
|
|
2520
|
+
* The method will download and verify the public key from the blockchain using the provided fingerprint as ID,
|
|
2521
|
+
* apply the revocation certificate, verify the key is revoked at present time and publish the revoked key on-chain.
|
|
2522
|
+
*
|
|
2523
|
+
* @param certificate The armored revocation certificate
|
|
2524
|
+
* @param fingerprint The fingerprint of the key being revoked
|
|
2525
|
+
* @returns Transaction receipt after successful revocation publication
|
|
2526
|
+
*/
|
|
2527
|
+
private revokeWithCertificate;
|
|
2528
|
+
/**
|
|
2529
|
+
* Initiate a challenge to prove ownership of an OpenPGP key registered on-chain.
|
|
2530
|
+
*
|
|
2531
|
+
* This method submits a hash of a random challenge generated by the user to the blockchain. The owner
|
|
2532
|
+
* of the private key corresponding to the public key must later sign the original challenge off-chain
|
|
2533
|
+
* and submit the signature using the `proveOwnership` method to complete the ownership proof process.
|
|
2534
|
+
*
|
|
2535
|
+
* @param fingerprint The fingerprint of the key to challenge ownership for (primary key or subkey)
|
|
2536
|
+
* @param challengeHash The keccak256 hash of the random challenge generated and hashed by the user (32 bytes hex string)
|
|
2537
|
+
* @returns Transaction receipt after successful challenge submission
|
|
2538
|
+
*
|
|
2539
|
+
* @throws Error if the key is not registered on-chain
|
|
2540
|
+
* @throws Error if wallet client is not configured
|
|
2541
|
+
* @throws Error if transaction fails
|
|
2542
|
+
*/
|
|
2543
|
+
challengeOwnership(fingerprint: `0x${string}`, challengeHash: `0x${string}`): Promise<TransactionReceipt>;
|
|
2544
|
+
/**
|
|
2545
|
+
* Prove ownership of an OpenPGP key by submitting a signature of a previously issued challenge.
|
|
2546
|
+
*
|
|
2547
|
+
* This method verifies the provided signature against the challenge associated with the specified
|
|
2548
|
+
* key fingerprint on-chain. If the signature is valid, ownership is proven.
|
|
2549
|
+
*
|
|
2550
|
+
* The method:
|
|
2551
|
+
* 1. Fetches the up-to-date public key from the blockchain using the provided fingerprint
|
|
2552
|
+
* 2. Verifies the signature of the challenge (the bytes of the hash) using the public key
|
|
2553
|
+
* 3. Submits the ownership proof on-chain via the Web3PGP contract
|
|
2554
|
+
*
|
|
2555
|
+
* @param fingerprint The fingerprint of the key to prove ownership for (primary key or subkey)
|
|
2556
|
+
* @param challengeHash The keccak256 hash of the original challenge that was issued
|
|
2557
|
+
* @param signature The signature of the challenge created using the private key corresponding to the public key
|
|
2558
|
+
* @returns Transaction receipt after successful ownership proof submission
|
|
2559
|
+
*
|
|
2560
|
+
* @throws Error if the key is not registered on-chain
|
|
2561
|
+
* @throws Error if the signature is invalid or the key is revoked or expired at present time
|
|
2562
|
+
* @throws Error if wallet client is not configured
|
|
2563
|
+
* @throws Error if transaction fails
|
|
2564
|
+
*/
|
|
2565
|
+
proveOwnership(fingerprint: `0x${string}`, challengeHash: `0x${string}`, signature: openpgp.Signature): Promise<TransactionReceipt>;
|
|
2566
|
+
/**
|
|
2567
|
+
* Publish a third-party certification of an OpenPGP key on the blockchain.
|
|
2568
|
+
*
|
|
2569
|
+
* This method allows a user (the issuer) to certify another user's OpenPGP public key by publishing
|
|
2570
|
+
* the certification on-chain. The certified key is an OpenPGP public key that contains a certification
|
|
2571
|
+
* signature made by the issuer over the target key.
|
|
2572
|
+
*
|
|
2573
|
+
* @description
|
|
2574
|
+
* This method:
|
|
2575
|
+
* 1. Verifies the target key is registered on-chain (enforced by smart contract)
|
|
2576
|
+
* 2. Extracts and verifies the certification signature in the certified key
|
|
2577
|
+
* 3. Serializes the certified key into the OpenPGP binary format.
|
|
2578
|
+
* 4. Publishes the certification on-chain via the Web3PGP contract.
|
|
2579
|
+
*
|
|
2580
|
+
* @param issuer The OpenPGP public key of the issuer certifying the target key
|
|
2581
|
+
* @param certifiedKey The public key containing the certification signature made by the issuer
|
|
2582
|
+
* @returns Transaction receipt after successful certification publication
|
|
2583
|
+
*
|
|
2584
|
+
* @throws Error if the target key is not registered on-chain
|
|
2585
|
+
* @throws Error if the fingerprint doesn't match the fingerprint of the primary key
|
|
2586
|
+
* @throws Error if the certification signature is invalid or not made by the issuer
|
|
2587
|
+
* @throws Error if wallet client is not configured
|
|
2588
|
+
* @throws Error if transaction fails
|
|
2589
|
+
*/
|
|
2590
|
+
certify(issuer: openpgp.PublicKey, certifiedKey: openpgp.PublicKey): Promise<TransactionReceipt>;
|
|
2591
|
+
/**
|
|
2592
|
+
* Revoke a third-party certification of an OpenPGP key on the blockchain.
|
|
2593
|
+
*
|
|
2594
|
+
* This method allows a user (the issuer) to revoke a previously published certification of another user's
|
|
2595
|
+
* OpenPGP public key by publishing a revocation on-chain. The revoked key is an OpenPGP public key that
|
|
2596
|
+
* contains a revocation signature made by the issuer over the target key.
|
|
2597
|
+
*
|
|
2598
|
+
* @description
|
|
2599
|
+
* This method:
|
|
2600
|
+
* 1. Verifies the target key is registered on-chain (enforced by smart contract)
|
|
2601
|
+
* 2. Extracts and verifies the revoked third-party signature in the key.
|
|
2602
|
+
* 3. Serializes the certified key into the OpenPGP binary format.
|
|
2603
|
+
* 4. Publishes the certification revocation on-chain via the Web3PGP contract.
|
|
2604
|
+
*
|
|
2605
|
+
* @param issuer The OpenPGP public key of the issuer revoking the certification
|
|
2606
|
+
* @param keyWithRevokedCertification The public key containing the revocation signature made by the issuer
|
|
2607
|
+
* @returns Transaction receipt after successful revocation publication
|
|
2608
|
+
*
|
|
2609
|
+
* @throws Error if the target key is not registered on-chain
|
|
2610
|
+
* @throws Error if the fingerprint doesn't match the fingerprint of the primary key
|
|
2611
|
+
* @throws Error if the revocation signature is invalid or not made by the issuer
|
|
2612
|
+
* @throws Error if wallet client is not configured
|
|
2613
|
+
* @throws Error if transaction fails
|
|
2614
|
+
*/
|
|
2615
|
+
revokeCertification(issuer: openpgp.PublicKey, keyWithRevokedCertification: openpgp.PublicKey): Promise<TransactionReceipt>;
|
|
2616
|
+
/*****************************************************************************************************************/
|
|
2617
|
+
/*****************************************************************************************************************/
|
|
2618
|
+
/**
|
|
2619
|
+
* Validate and extract the public key from a KeyRegisteredLog event.
|
|
2620
|
+
*
|
|
2621
|
+
* @description
|
|
2622
|
+
*
|
|
2623
|
+
* This method:
|
|
2624
|
+
* 1. Validates the log data contains required fields
|
|
2625
|
+
* 2. Extracts and parses the OpenPGP message from the log
|
|
2626
|
+
* 3. Verifies the primary key fingerprint matches the declared one
|
|
2627
|
+
* 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not
|
|
2628
|
+
* revoked at the time of registration (uses the block timestamp)..
|
|
2629
|
+
* 5. Validates all declared subkeys are present in the key
|
|
2630
|
+
* 6. (if verifications are enabled) Verifies each subkey has a valid signature, is not expired and is not
|
|
2631
|
+
* revoked at the time of registration (uses the block timestamp).
|
|
2632
|
+
* 7. Prunes any extra subkeys not declared in the log
|
|
2633
|
+
*
|
|
2634
|
+
* Cryptographic verifications of the keys (steps 4 and 6) can be skipped by setting the `skipCryptographicVerifications`
|
|
2635
|
+
* parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform
|
|
2636
|
+
* custom validations or inspections in case the verification fails, is expected to fail or is performed by an external
|
|
2637
|
+
* OpenPGP toolkit.
|
|
2638
|
+
*
|
|
2639
|
+
* @param log The KeyRegisteredLog event data from the blockchain
|
|
2640
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of key and subkeys. Defaults to false.
|
|
2641
|
+
* @returns The validated OpenPGP public key extracted from the log
|
|
2642
|
+
*
|
|
2643
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
2644
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
2645
|
+
* @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data
|
|
2646
|
+
* @throws Web3PGPServiceValidationError if any declared subkey is missing from the extracted key
|
|
2647
|
+
*
|
|
2648
|
+
* @example
|
|
2649
|
+
* ```typescript
|
|
2650
|
+
* const logs = await web3pgp.searchKeyRegisteredLogs();
|
|
2651
|
+
* for (const log of logs) {
|
|
2652
|
+
* try {
|
|
2653
|
+
* const publicKey = await service.extractFromKeyRegisteredLog(log);
|
|
2654
|
+
* console.log(`Valid key: ${publicKey.getFingerprint()}`);
|
|
2655
|
+
* } catch (err) {
|
|
2656
|
+
* console.warn(`Invalid log data: ${err.message}`);
|
|
2657
|
+
* }
|
|
2658
|
+
* }
|
|
2659
|
+
* ```
|
|
2660
|
+
*/
|
|
2661
|
+
extractFromKeyRegisteredLog(log: KeyRegisteredLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey>;
|
|
2662
|
+
/**
|
|
2663
|
+
* Validate and extract the subkey from a SubkeyAddedLog event.
|
|
2664
|
+
*
|
|
2665
|
+
* @description
|
|
2666
|
+
* This method:
|
|
2667
|
+
* 1. Validates the log data contains required fields
|
|
2668
|
+
* 2. Extracts and parses the OpenPGP message from the log
|
|
2669
|
+
* 3. Verifies the primary key fingerprint matches the declared one
|
|
2670
|
+
* 4. Verifies the subkey fingerprint matches the declared one
|
|
2671
|
+
* 5. Prunes any extra subkeys and user ID packets, returning only the primary key and the added subkey
|
|
2672
|
+
* 6. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not
|
|
2673
|
+
* revoked at the time of subkey addition (uses the block timestamp).
|
|
2674
|
+
* 7. (if verifications are enabled) Verifies the subkey has a valid signature, is not expired and is not
|
|
2675
|
+
* revoked at the time of addition (uses the block timestamp).
|
|
2676
|
+
*
|
|
2677
|
+
* Cryptographic verifications of the keys (steps 6 and 7) can be skipped by setting the `skipCryptographicVerifications`
|
|
2678
|
+
* parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform
|
|
2679
|
+
* custom validations or inspections in case the verification fails, is expected to fail or is performed by an external
|
|
2680
|
+
* OpenPGP toolkit.
|
|
2681
|
+
*
|
|
2682
|
+
* @param log The SubkeyAddedLog event data from the blockchain
|
|
2683
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of key and subkey. Defaults to false.
|
|
2684
|
+
* @returns The validated OpenPGP public key containing the primary key and the added subkey
|
|
2685
|
+
*
|
|
2686
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
2687
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
2688
|
+
* @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data
|
|
2689
|
+
* @throws Web3PGPServiceValidationError if the subkey is missing from the extracted key
|
|
2690
|
+
*
|
|
2691
|
+
* @example
|
|
2692
|
+
* ```typescript
|
|
2693
|
+
* const logs = await web3pgp.searchSubkeyAddedLogs(primaryFingerprint);
|
|
2694
|
+
* let primaryKey = await service.getPublicKey(primaryFingerprint);
|
|
2695
|
+
* for (const log of logs) {
|
|
2696
|
+
* const subkey = await service.extractFromSubkeyAddedLog(log);
|
|
2697
|
+
* primaryKey = await primaryKey.update(subkey);
|
|
2698
|
+
* }
|
|
2699
|
+
* ```
|
|
2700
|
+
*/
|
|
2701
|
+
extractFromSubkeyAddedLog(log: SubkeyAddedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey>;
|
|
2702
|
+
/**
|
|
2703
|
+
* Validate and extract the revoked key or revocation certificate from a KeyRevokedLog event.
|
|
2704
|
+
*
|
|
2705
|
+
* @description
|
|
2706
|
+
* This method handles two types of revocation data:
|
|
2707
|
+
* 1. Key certificates: Full OpenPGP keys with revocation signatures
|
|
2708
|
+
* 2. Standalone revocation certificates: Revocation signature packets only
|
|
2709
|
+
*
|
|
2710
|
+
* The method:
|
|
2711
|
+
* 1. Validates the log data contains required fields
|
|
2712
|
+
* 2. Attempts to parse as a key certificate first
|
|
2713
|
+
* 3. If that fails, attempts to parse as a standalone revocation certificate and returns the armored certificate.
|
|
2714
|
+
* It is the user's responsibility to verify and apply the revocation certificate to the target key.
|
|
2715
|
+
* 4. For key certificates, validates the fingerprint matches the target key
|
|
2716
|
+
* 5. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is revoked
|
|
2717
|
+
* at the time of revocation (uses the block timestamp).
|
|
2718
|
+
* 6. Returns either the revoked key or the armored revocation certificate
|
|
2719
|
+
*
|
|
2720
|
+
* @param log The KeyRevokedLog event data from the blockchain
|
|
2721
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of the revoked key. Defaults to false.
|
|
2722
|
+
* @returns A tuple containing either:
|
|
2723
|
+
* - [revokedKey, undefined] if a valid key certificate was found
|
|
2724
|
+
* - [undefined, armoredCert] if a standalone revocation certificate was found
|
|
2725
|
+
*
|
|
2726
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
2727
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
2728
|
+
* @throws Web3PGPServiceValidationError if a key certificate does not effectively revoke the target key
|
|
2729
|
+
*
|
|
2730
|
+
* @example
|
|
2731
|
+
* ```typescript
|
|
2732
|
+
* const logs = await web3pgp.searchKeyRevokedLogs(fingerprint);
|
|
2733
|
+
* let publicKey = await service.getPublicKey(fingerprint);
|
|
2734
|
+
* for (const log of logs) {
|
|
2735
|
+
* const [revokedKey, revocationCert] = await service.extractFromKeyRevokedLog(log);
|
|
2736
|
+
* if (revokedKey) {
|
|
2737
|
+
* publicKey = await publicKey.update(revokedKey);
|
|
2738
|
+
* } else if (revocationCert) {
|
|
2739
|
+
* const result = await openpgp.revokeKey({
|
|
2740
|
+
* key: publicKey,
|
|
2741
|
+
* revocationCertificate: revocationCert
|
|
2742
|
+
* });
|
|
2743
|
+
* publicKey = result.publicKey;
|
|
2744
|
+
* }
|
|
2745
|
+
* }
|
|
2746
|
+
* ```
|
|
2747
|
+
*/
|
|
2748
|
+
extractFromKeyRevokedLog(log: KeyRevokedLog, skipCryptographicVerifications?: boolean): Promise<[openpgp.PublicKey | undefined, string | undefined]>;
|
|
2749
|
+
/**
|
|
2750
|
+
* Validate and extract the updated public key from a KeyUpdatedLog event.
|
|
2751
|
+
*
|
|
2752
|
+
* @description
|
|
2753
|
+
* This method:
|
|
2754
|
+
* 1. Validates the log data contains required fields
|
|
2755
|
+
* 2. Extracts and parses the OpenPGP message from the log
|
|
2756
|
+
* 3. Verifies the primary key fingerprint matches the declared one
|
|
2757
|
+
* 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not
|
|
2758
|
+
* revoked at the time of update (uses the block timestamp).
|
|
2759
|
+
*
|
|
2760
|
+
* Cryptographic verifications of the key (step 4) can be skipped by setting the `skipCryptographicVerifications`
|
|
2761
|
+
* parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform
|
|
2762
|
+
* custom validations or inspections in case the verification fails, is expected to fail or is performed by an external
|
|
2763
|
+
* OpenPGP toolkit.
|
|
2764
|
+
*
|
|
2765
|
+
* @param log The KeyUpdatedLog event data from the blockchain
|
|
2766
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of key. Defaults to false.
|
|
2767
|
+
* @returns The validated OpenPGP public key extracted from the log
|
|
2768
|
+
*
|
|
2769
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
2770
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
2771
|
+
* @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data
|
|
2772
|
+
*
|
|
2773
|
+
* @example
|
|
2774
|
+
* ```typescript
|
|
2775
|
+
* const logs = await web3pgp.searchKeyUpdatedLogs();
|
|
2776
|
+
* for (const log of logs) {
|
|
2777
|
+
* try {
|
|
2778
|
+
* const publicKey = await service.extractFromKeyUpdatedLog(log);
|
|
2779
|
+
* console.log(`Valid updated key: ${publicKey.getFingerprint()}`);
|
|
2780
|
+
* } catch (err) {
|
|
2781
|
+
* console.warn(`Invalid log data: ${err.message}`);
|
|
2782
|
+
* }
|
|
2783
|
+
* }
|
|
2784
|
+
* ```
|
|
2785
|
+
*/
|
|
2786
|
+
extractFromKeyUpdatedLog(log: KeyUpdatedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey>;
|
|
2787
|
+
/**
|
|
2788
|
+
* Validate and extract the certified public key from a KeyCertifiedLog event.
|
|
2789
|
+
*
|
|
2790
|
+
* @description
|
|
2791
|
+
* This method:
|
|
2792
|
+
* 1. Validates the log data contains required fields
|
|
2793
|
+
* 2. Extracts and parses the OpenPGP message from the log
|
|
2794
|
+
* 3. Verifies the primary key fingerprint matches the declared one
|
|
2795
|
+
* 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not
|
|
2796
|
+
* revoked at the time of certification (uses the block timestamp).
|
|
2797
|
+
* 5. Validates that at least one certification signature made by the issuer over the target key is present
|
|
2798
|
+
*
|
|
2799
|
+
* Cryptographic verifications of the key (step 4) can be skipped by setting the `skipCryptographicVerifications`
|
|
2800
|
+
* parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform
|
|
2801
|
+
* custom validations or inspections in case the verification fails, is expected to fail or is performed by an external
|
|
2802
|
+
* OpenPGP toolkit.
|
|
2803
|
+
*
|
|
2804
|
+
* @param log The KeyCertifiedLog event data from the blockchain
|
|
2805
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of key. Defaults to false.
|
|
2806
|
+
* @returns The validated OpenPGP public key extracted from the log
|
|
2807
|
+
*
|
|
2808
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
2809
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
2810
|
+
* @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data
|
|
2811
|
+
* @throws Web3PGPServiceValidationError if no valid certification signature made by the issuer is found
|
|
2812
|
+
*
|
|
2813
|
+
* @example
|
|
2814
|
+
* ```typescript
|
|
2815
|
+
* const logs = await web3pgp.searchKeyCertifiedLogs(issuerFingerprint, targetFingerprint);
|
|
2816
|
+
* for (const log of logs) {
|
|
2817
|
+
* try {
|
|
2818
|
+
* const certifiedKey = await service.extractFromKeyCertifiedLog(log);
|
|
2819
|
+
* console.log(`Valid certified key: ${certifiedKey.getFingerprint()}`);
|
|
2820
|
+
* } catch (err) {
|
|
2821
|
+
* console.warn(`Invalid log data: ${err.message}`);
|
|
2822
|
+
* }
|
|
2823
|
+
* }
|
|
2824
|
+
* ```
|
|
2825
|
+
*/
|
|
2826
|
+
extractFromKeyCertifiedLog(log: KeyCertifiedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey>;
|
|
2827
|
+
/**
|
|
2828
|
+
* Validate and extract the revoked certification from a KeyCertificationRevokedLog event.
|
|
2829
|
+
*
|
|
2830
|
+
* @description
|
|
2831
|
+
* This method:
|
|
2832
|
+
* 1. Validates the log data contains required fields
|
|
2833
|
+
* 2. Extracts and parses the OpenPGP message from the log
|
|
2834
|
+
* 3. Verifies the primary key fingerprint matches the declared one
|
|
2835
|
+
* 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not
|
|
2836
|
+
* revoked at the time of certification revocation (uses the block timestamp).
|
|
2837
|
+
* 5. Validates that at least one certification revocation signature made by the issuer over the target key is present
|
|
2838
|
+
*
|
|
2839
|
+
* Cryptographic verifications of the key (step 4) can be skipped by setting the `skipCryptographicVerifications`
|
|
2840
|
+
* parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform
|
|
2841
|
+
* custom validations or inspections in case the verification fails, is expected to fail or is performed by an external
|
|
2842
|
+
* OpenPGP toolkit.
|
|
2843
|
+
*
|
|
2844
|
+
* @param log The KeyCertificationRevokedLog event data from the blockchain
|
|
2845
|
+
* @param skipCryptographicVerifications If true, skips cryptographic verifications of key. Defaults to false.
|
|
2846
|
+
* @returns The validated OpenPGP public key extracted from the log
|
|
2847
|
+
*
|
|
2848
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
2849
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted
|
|
2850
|
+
* @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data
|
|
2851
|
+
* @throws Web3PGPServiceValidationError if no valid certification revocation signature made by the issuer is found
|
|
2852
|
+
*
|
|
2853
|
+
* @example
|
|
2854
|
+
* ```typescript
|
|
2855
|
+
* const logs = await web3pgp.searchKeyCertificationRevokedLogs(issuerFingerprint, targetFingerprint);
|
|
2856
|
+
* for (const log of logs) {
|
|
2857
|
+
* try {
|
|
2858
|
+
* const revokedCertificationKey = await service.extractFromKeyCertificationRevokedLog(log);
|
|
2859
|
+
* console.log(`Valid revoked certification key: ${revokedCertificationKey.getFingerprint()}`);
|
|
2860
|
+
* } catch (err) {
|
|
2861
|
+
* console.warn(`Invalid log data: ${err.message}`);
|
|
2862
|
+
* }
|
|
2863
|
+
* }
|
|
2864
|
+
* ```
|
|
2865
|
+
*/
|
|
2866
|
+
extractFromKeyCertificationRevokedLog(log: KeyCertificationRevokedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey>;
|
|
2867
|
+
/**
|
|
2868
|
+
* Extract the signature from an OwnershipChallengedLog event. The signature is not verified at this stage.
|
|
2869
|
+
*
|
|
2870
|
+
* @description
|
|
2871
|
+
* This method:
|
|
2872
|
+
* 1. Validates the log data contains required fields
|
|
2873
|
+
* 2. Extracts and parses the OpenPGP signature from the log
|
|
2874
|
+
*
|
|
2875
|
+
* @param log The OwnershipProvedLog event data from the blockchain
|
|
2876
|
+
* @returns The OpenPGP signature extracted from the log
|
|
2877
|
+
*
|
|
2878
|
+
* @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields
|
|
2879
|
+
* @throws Web3PGPServiceValidationError if the extracted OpenPGP signature is invalid or corrupted
|
|
2880
|
+
*/
|
|
2881
|
+
extractFromOwnershipProvedLog(log: OwnershipProvedLog): Promise<openpgp.Signature>;
|
|
2882
|
+
/*****************************************************************************************************************/
|
|
2883
|
+
/*****************************************************************************************************************/
|
|
2884
|
+
/**
|
|
2885
|
+
* Retrieve and reconstruct an OpenPGP public key from the blockchain by its fingerprint.
|
|
2886
|
+
*
|
|
2887
|
+
* @param fingerprint The fingerprint of the key to retrieve (primary key or subkey)
|
|
2888
|
+
* @returns The reconstructed and validated OpenPGP public key, with revocations applied if any
|
|
2889
|
+
*
|
|
2890
|
+
* @throws Error if the key is not registered on-chain
|
|
2891
|
+
* @throws Error if the key data cannot be retrieved from blockchain events
|
|
2892
|
+
* @throws Error if the retrieved OpenPGP message is invalid or corrupted
|
|
2893
|
+
*/
|
|
2894
|
+
getPublicKey(fingerprint: `0x${string}`): Promise<openpgp.PublicKey>;
|
|
2895
|
+
/**
|
|
2896
|
+
* Searches for all key-related events within a specified block range. Optionally filters by fingerprints.
|
|
2897
|
+
*
|
|
2898
|
+
* Note: The fingerprints are the subjects of the events (i.e., the keys being registered, updated, revoked, certified, etc.).
|
|
2899
|
+
* Results will also include subkeys added, challenges, and proofs of ownership related to the listed fingerprints.
|
|
2900
|
+
*
|
|
2901
|
+
* @param fingerprints The fingerprint(s) of the keys to filter events for. Can be a single fingerprint or an array. Defaults to all keys if not provided.
|
|
2902
|
+
* @param fromBlock Starting block number (inclusive). Defaults to 'earliest' if not provided. 'pending' is not allowed.
|
|
2903
|
+
* @param toBlock Ending block number (inclusive). Defaults to 'latest' if not provided. 'pending' is not allowed.
|
|
2904
|
+
* @return An array of Web3PGPEventLog.
|
|
2905
|
+
*/
|
|
2906
|
+
searchKeyEvents(fingerprints?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<Web3PGPEventLog[]>;
|
|
2907
|
+
/**
|
|
2908
|
+
* Get the current block number of the connected blockchain.
|
|
2909
|
+
* @return The current block number as a bigint.
|
|
2910
|
+
*/
|
|
2911
|
+
getBlockNumber(): Promise<bigint>;
|
|
2912
|
+
/*****************************************************************************************************************/
|
|
2913
|
+
/*****************************************************************************************************************/
|
|
2914
|
+
/**
|
|
2915
|
+
* Helper method to fetch all items from a paginated contract method.
|
|
2916
|
+
* @param fetchFn The paginated fetch function to call
|
|
2917
|
+
* @param limit The number of items to fetch per page
|
|
2918
|
+
* @param maxItems The maximum number of items to fetch in total (safety limit)
|
|
2919
|
+
* @returns An array containing all fetched items
|
|
2920
|
+
*/
|
|
2921
|
+
private fetchAllPaginated;
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
/**
|
|
2925
|
+
* This struct is used to describe the recipient of a document and indicate if the recipient is requested to
|
|
2926
|
+
* sign the document.
|
|
2927
|
+
*
|
|
2928
|
+
* @property fingerprint The fingerprint of the recipient's key.
|
|
2929
|
+
* @property signatureRequested Indicates whether a signature from this recipient has been requested.
|
|
2930
|
+
*/
|
|
2931
|
+
type Recipient = {
|
|
2932
|
+
fingerprint: `0x${string}`;
|
|
2933
|
+
signatureRequested: boolean;
|
|
2934
|
+
};
|
|
2935
|
+
/**
|
|
2936
|
+
* Enum used by Notification events to help users understand what kind of event is related to the notification.
|
|
2937
|
+
*/
|
|
2938
|
+
declare enum EventType {
|
|
2939
|
+
DOCUMENT = 0,// The notification is caused by a user sending a document to peers (Document).
|
|
2940
|
+
COPY = 1
|
|
2941
|
+
}
|
|
2942
|
+
/**
|
|
2943
|
+
* Constants representing the different event types emitted by the Web3Doc smart contract.
|
|
2944
|
+
*/
|
|
2945
|
+
declare const Web3DocEvents: {
|
|
2946
|
+
readonly Document: "Document";
|
|
2947
|
+
readonly Copy: "Copy";
|
|
2948
|
+
readonly Notification: "Notification";
|
|
2949
|
+
readonly Signature: "Signature";
|
|
2950
|
+
readonly Timestamp: "Timestamp";
|
|
2951
|
+
readonly SignatureRevocation: "SignatureRevocation";
|
|
2952
|
+
};
|
|
2953
|
+
/**
|
|
2954
|
+
* Type representing a Document event emitted when a user sends a document to peers.
|
|
2955
|
+
*
|
|
2956
|
+
* @property id Unique ID generated by the smart contract.
|
|
2957
|
+
* @property emitter The fingerprint of the key used to produce the signature.
|
|
2958
|
+
* @property dochash The keccak256 hash of the document.
|
|
2959
|
+
* @property signature An OpenPGP message which contains the detached signature made over the document.
|
|
2960
|
+
* @property document An optional OpenPGP message which contains the (encrypted) document.
|
|
2961
|
+
* @property uri An optional URI which can be used to download the document from an off-chain storage like IPFS, S3, SFTP, ...
|
|
2962
|
+
* @property mimeType Optional, The MIME type of the document and additional attributes (RFC6838)
|
|
2963
|
+
*/
|
|
2964
|
+
type DocumentLog = BaseLog & {
|
|
2965
|
+
type: typeof Web3DocEvents.Document;
|
|
2966
|
+
id: bigint;
|
|
2967
|
+
emitter: `0x${string}`;
|
|
2968
|
+
dochash: `0x${string}`;
|
|
2969
|
+
signature: `0x${string}`;
|
|
2970
|
+
document: `0x${string}`;
|
|
2971
|
+
uri: string;
|
|
2972
|
+
mimeType: string;
|
|
2973
|
+
};
|
|
2974
|
+
/**
|
|
2975
|
+
* Type representing a Copy event emitted when a user sends a certified copy of a document.
|
|
2976
|
+
*
|
|
2977
|
+
* @property copy The unique ID assigned to the copy by the smart contract.
|
|
2978
|
+
* @property original The ID of the original document assigned by the smart contract.
|
|
2979
|
+
* @property emitter The fingerprint of the key used by the emitter.
|
|
2980
|
+
* @property document The binary OpenPGP message containing the document itself.
|
|
2981
|
+
* @property uri The URI which can be used to download the binary OpenPGP message containing the document from an off-chain storage.
|
|
2982
|
+
*/
|
|
2983
|
+
type CopyLog = BaseLog & {
|
|
2984
|
+
type: typeof Web3DocEvents.Copy;
|
|
2985
|
+
copy: bigint;
|
|
2986
|
+
original: bigint;
|
|
2987
|
+
emitter: `0x${string}`;
|
|
2988
|
+
document: `0x${string}`;
|
|
2989
|
+
uri: string;
|
|
2990
|
+
};
|
|
2991
|
+
/**
|
|
2992
|
+
* Type representing a Notification event emitted to warn recipients that a new document has been sent to them.
|
|
2993
|
+
*
|
|
2994
|
+
* @property id The unique ID of the document that has been sent.
|
|
2995
|
+
* @property emitter The fingerprint of the key used by the emitter.
|
|
2996
|
+
* @property recipient The fingerprint of the key of the recipient.
|
|
2997
|
+
* @property source The type of event that has caused this notification (publication, response or copy).
|
|
2998
|
+
* @property signatureRequested If true, the recipient is prompted by the emitter to sign the document.
|
|
2999
|
+
*/
|
|
3000
|
+
type NotificationLog = BaseLog & {
|
|
3001
|
+
type: typeof Web3DocEvents.Notification;
|
|
3002
|
+
id: bigint;
|
|
3003
|
+
emitter: `0x${string}`;
|
|
3004
|
+
recipient: `0x${string}`;
|
|
3005
|
+
source: EventType;
|
|
3006
|
+
signatureRequested: boolean;
|
|
3007
|
+
};
|
|
3008
|
+
/**
|
|
3009
|
+
* Type representing a Signature event emitted when a user signs a document.
|
|
3010
|
+
*
|
|
3011
|
+
* @property id The unique ID of the document being signed.
|
|
3012
|
+
* @property emitter The fingerprint of the key used to create the signature.
|
|
3013
|
+
* @property signatureHash The keccak256 hash of the signature created over the document (hashed by the smart contract).
|
|
3014
|
+
* @property signature The binary OpenPGP message which contains the detached signature over the document.
|
|
3015
|
+
*/
|
|
3016
|
+
type SignatureLog = BaseLog & {
|
|
3017
|
+
type: typeof Web3DocEvents.Signature;
|
|
3018
|
+
id: bigint;
|
|
3019
|
+
emitter: `0x${string}`;
|
|
3020
|
+
signatureHash: `0x${string}`;
|
|
3021
|
+
signature: `0x${string}`;
|
|
3022
|
+
};
|
|
3023
|
+
/**
|
|
3024
|
+
* Type representing a SignatureRevocation event emitted when a user revokes a previously published signature.
|
|
3025
|
+
*
|
|
3026
|
+
* @property id The unique ID of the document whose signature is being revoked.
|
|
3027
|
+
* @property emitter The fingerprint of the key that created the signature being revoked.
|
|
3028
|
+
* @property signatureHash The keccak256 hash of the signature being revoked.
|
|
3029
|
+
* @property signature A detached binary OpenPGP signature created over the signature hash.
|
|
3030
|
+
*/
|
|
3031
|
+
type SignatureRevocationLog = BaseLog & {
|
|
3032
|
+
type: typeof Web3DocEvents.SignatureRevocation;
|
|
3033
|
+
id: bigint;
|
|
3034
|
+
emitter: `0x${string}`;
|
|
3035
|
+
signatureHash: `0x${string}`;
|
|
3036
|
+
signature: `0x${string}`;
|
|
3037
|
+
};
|
|
3038
|
+
/**
|
|
3039
|
+
* Type representing a Timestamp event emitted when a user timestamps a document.
|
|
3040
|
+
*
|
|
3041
|
+
* @property id A unique ID generated by the smart contract for this timestamp event.
|
|
3042
|
+
* @property emitter The fingerprint of the public key used to create the signature.
|
|
3043
|
+
* @property dochash The keccak256 hash of the document used to look up the timestamp and to verify the document's integrity.
|
|
3044
|
+
* @property signature A detached binary OpenPGP signature created over the keccak256 hash of the document.
|
|
3045
|
+
*/
|
|
3046
|
+
type TimestampLog = BaseLog & {
|
|
3047
|
+
type: typeof Web3DocEvents.Timestamp;
|
|
3048
|
+
id: bigint;
|
|
3049
|
+
emitter: `0x${string}`;
|
|
3050
|
+
dochash: `0x${string}`;
|
|
3051
|
+
signature: `0x${string}`;
|
|
3052
|
+
};
|
|
3053
|
+
|
|
3054
|
+
/**
|
|
3055
|
+
* TypeScript interface for the Web3Doc smart contract.
|
|
3056
|
+
*
|
|
3057
|
+
* This interface provides low-level bindings to interact with the Web3Doc contract deployed on the blockchain.
|
|
3058
|
+
*/
|
|
3059
|
+
interface IWeb3Doc extends IFlatFee {
|
|
3060
|
+
/*****************************************************************************************************************/
|
|
3061
|
+
/*****************************************************************************************************************/
|
|
3062
|
+
/**
|
|
3063
|
+
* Sends a document and its detached signature on-chain and notifies the specified recipients.
|
|
3064
|
+
*
|
|
3065
|
+
* @param emitter The fingerprint of the key used by the emitter to produce the signature.
|
|
3066
|
+
* @param recipients The list of recipients to notify and optionally prompt to sign the document.
|
|
3067
|
+
* @param dochash The declared keccak256 hash of the document.
|
|
3068
|
+
* @param signature A detached binary OpenPGP signature of the document.
|
|
3069
|
+
* @param document The binary OpenPGP message which contains the document.
|
|
3070
|
+
* @param mimeType Optional, The MIME type of the document and additional attributes (RFC6838)
|
|
3071
|
+
*/
|
|
3072
|
+
sendOnChain(emitter: `0x${string}`, recipients: Recipient[], dochash: `0x${string}`, signature: `0x${string}`, document: `0x${string}`, mimeType: string): Promise<TransactionReceipt>;
|
|
3073
|
+
/**
|
|
3074
|
+
* Sends a document using an off-chain channel, publishes its detached signature on-chain and notifies the specified recipients.
|
|
3075
|
+
*
|
|
3076
|
+
* @param emitter The fingerprint of the key used to produce the signature.
|
|
3077
|
+
* @param recipients The list of recipients to notify and optionally prompt to sign the document.
|
|
3078
|
+
* @param dochash The declared keccak256 hash of the document.
|
|
3079
|
+
* @param signature A detached binary OpenPGP signature of the document.
|
|
3080
|
+
* @param uri A URI which can be used to download the OpenPGP message (compressed and encrypted) which contains the document.
|
|
3081
|
+
* @param mimeType Optional, The MIME type of the document and additional attributes (RFC6838)
|
|
3082
|
+
*/
|
|
3083
|
+
sendOffChain(emitter: `0x${string}`, recipients: Recipient[], dochash: `0x${string}`, signature: `0x${string}`, uri: string, mimeType: string): Promise<TransactionReceipt>;
|
|
3084
|
+
/**
|
|
3085
|
+
* Send a certified copy of a document on-chain.
|
|
3086
|
+
*
|
|
3087
|
+
* @param original The ID of the original document that is the subject of the copy.
|
|
3088
|
+
* @param emitter The fingerprint of the emitter's public key.
|
|
3089
|
+
* @param recipients The list of recipient key fingerprints to be notified and, optionally, be prompted for a signature.
|
|
3090
|
+
* @param document The binary OpenPGP message containing the copy of the original document.
|
|
3091
|
+
*/
|
|
3092
|
+
copyOnChain(original: bigint, emitter: `0x${string}`, recipients: Recipient[], document: `0x${string}`): Promise<TransactionReceipt>;
|
|
3093
|
+
/**
|
|
3094
|
+
* Send a certified copy of a document using an off-chain storage.
|
|
3095
|
+
*
|
|
3096
|
+
* @param original The ID of the original document being copied. Must reference a valid, non-copy document.
|
|
3097
|
+
* @param emitter The fingerprint of the key used to produce the signature.
|
|
3098
|
+
* @param recipients The list of recipient key fingerprints to be notified and, optionally, be prompted for a signature.
|
|
3099
|
+
* @param uri A URI which can be used to download the OpenPGP message containing the (compressed, encrypted and signed) document itself.
|
|
3100
|
+
*/
|
|
3101
|
+
copyOffChain(original: bigint, emitter: `0x${string}`, recipients: Recipient[], uri: string): Promise<TransactionReceipt>;
|
|
3102
|
+
/**
|
|
3103
|
+
* Publishes a binary detached OpenPGP signature of a document made with the emitter's key.
|
|
3104
|
+
*
|
|
3105
|
+
* @param id The unique ID of the document that has been signed.
|
|
3106
|
+
* @param emitter The fingerprint of the key used to produce the signature.
|
|
3107
|
+
* @param signature The detached binary OpenPGP signature made over the document.
|
|
3108
|
+
*/
|
|
3109
|
+
sign(id: bigint, emitter: `0x${string}`, signature: `0x${string}`): Promise<TransactionReceipt>;
|
|
3110
|
+
/**
|
|
3111
|
+
* Timestamps a document by publishing a detached signature of the hash of the document on-chain.
|
|
3112
|
+
*
|
|
3113
|
+
* @param emitter The fingerprint of the key used to produce the signature.
|
|
3114
|
+
* @param dochash The keccak256 hash of the document used to find the timestamp from the document and verify their integrity.
|
|
3115
|
+
* @param signature A detached binary OpenPGP signature made over the raw bytes of the keccak256 hash of the document.
|
|
3116
|
+
*/
|
|
3117
|
+
timestamp(emitter: `0x${string}`, dochash: `0x${string}`, signature: `0x${string}`): Promise<TransactionReceipt>;
|
|
3118
|
+
/**
|
|
3119
|
+
* Revokes a previously published signature on a document.
|
|
3120
|
+
*
|
|
3121
|
+
* @param id The unique ID of the document for which the signature is being revoked.
|
|
3122
|
+
* @param emitter The fingerprint of the key used to create the signature.
|
|
3123
|
+
* @param signatureHash The keccak256 hash of the signature being revoked.
|
|
3124
|
+
* @param signature The binary detached OpenPGP signature over the signatureHash.
|
|
3125
|
+
* @returns A transaction receipt.
|
|
3126
|
+
*/
|
|
3127
|
+
revokeSignature(id: bigint, emitter: `0x${string}`, signatureHash: `0x${string}`, signature: `0x${string}`): Promise<TransactionReceipt>;
|
|
3128
|
+
/*****************************************************************************************************************/
|
|
3129
|
+
/*****************************************************************************************************************/
|
|
3130
|
+
/**
|
|
3131
|
+
* Get the address of the Web3PGP contract used as a global public key registry.
|
|
3132
|
+
*
|
|
3133
|
+
* @return The address of the Web3PGP contract used by this contract.
|
|
3134
|
+
*/
|
|
3135
|
+
getWeb3PGPAddress(): Promise<Address>;
|
|
3136
|
+
/**
|
|
3137
|
+
* Returns the ID of the original document that the given document is a copy of.
|
|
3138
|
+
*
|
|
3139
|
+
* @param id The ID of a document that may be a copy of another previously published document.
|
|
3140
|
+
* @return The ID of the original document if the given document is a copy, or 0 if it is not a copy.
|
|
3141
|
+
*/
|
|
3142
|
+
isCopyOf(id: bigint): Promise<bigint>;
|
|
3143
|
+
/**
|
|
3144
|
+
* Returns the block number in which the document or timestamps with the given ID was published.
|
|
3145
|
+
*
|
|
3146
|
+
* @param id The ID of the document whose block number is to be retrieved.
|
|
3147
|
+
* @return The block number in which the document was published. 0 if the document does not exist.
|
|
3148
|
+
*/
|
|
3149
|
+
getDocumentBlockNumberByID(id: bigint): Promise<bigint>;
|
|
3150
|
+
/**
|
|
3151
|
+
* Returns the block numbers in which the documents or timestamps with the given IDs were published.
|
|
3152
|
+
*
|
|
3153
|
+
* @param ids The IDs of the documents whose block numbers are to be retrieved.
|
|
3154
|
+
* @return The block numbers in which the documents were published.
|
|
3155
|
+
*/
|
|
3156
|
+
getDocumentBlockNumberByIDBatch(ids: bigint[]): Promise<bigint[]>;
|
|
3157
|
+
/**
|
|
3158
|
+
* Lists the block numbers when were published the signatures associated with the given document.
|
|
3159
|
+
*
|
|
3160
|
+
* @param id The ID of the document whose signatures are to be listed.
|
|
3161
|
+
* @param start The starting index from which to list signatures (0-based).
|
|
3162
|
+
* @param limit The maximum number of signatures to list.
|
|
3163
|
+
* @return An array of signature IDs associated with the document.
|
|
3164
|
+
*/
|
|
3165
|
+
listSignatures(id: bigint, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
3166
|
+
/**
|
|
3167
|
+
* Returns the block number in which the signature with the given hash was published.
|
|
3168
|
+
*
|
|
3169
|
+
* @param signatureHash The keccak256 hash of the signature.
|
|
3170
|
+
* @returns The block number in which the signature was published. Returns 0 if not found.
|
|
3171
|
+
*/
|
|
3172
|
+
getSignatureBlockNumberByHash(signatureHash: `0x${string}`): Promise<bigint>;
|
|
3173
|
+
/**
|
|
3174
|
+
* Returns the block numbers in which the signatures with the given hashes were published.
|
|
3175
|
+
*
|
|
3176
|
+
* @param signatureHashes The keccak256 hashes of the signatures.
|
|
3177
|
+
* @returns The block numbers in which the signatures were published.
|
|
3178
|
+
*/
|
|
3179
|
+
getSignatureBlockNumberByHashBatch(signatureHashes: `0x${string}`[]): Promise<bigint[]>;
|
|
3180
|
+
/**
|
|
3181
|
+
* Lists document IDs related to a document hash (with pagination).
|
|
3182
|
+
*
|
|
3183
|
+
* @param dochash The keccak256 hash of the document.
|
|
3184
|
+
* @param start The starting index for pagination (0-based).
|
|
3185
|
+
* @param limit The maximum number of results to return.
|
|
3186
|
+
* @returns An array of document IDs associated with the document hash.
|
|
3187
|
+
*/
|
|
3188
|
+
listDocumentIdsByHash(dochash: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
3189
|
+
/**
|
|
3190
|
+
* Lists block numbers when revocations were published for a signature (with pagination).
|
|
3191
|
+
*
|
|
3192
|
+
* @param signatureHash The keccak256 hash of the signature.
|
|
3193
|
+
* @param start The starting index for pagination (0-based).
|
|
3194
|
+
* @param limit The maximum number of results to return.
|
|
3195
|
+
* @returns An array of block numbers when revocations were published.
|
|
3196
|
+
*/
|
|
3197
|
+
listSignatureRevocationsBlockNumbers(signatureHash: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
3198
|
+
/*****************************************************************************************************************/
|
|
3199
|
+
/*****************************************************************************************************************/
|
|
3200
|
+
/**
|
|
3201
|
+
* Searches for Document events emitted by the smart contract, filtered by the provided criteria.
|
|
3202
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
3203
|
+
*
|
|
3204
|
+
* @param ids Filter by document IDs. IDs uniqueness is guaranteed by the smart contract.
|
|
3205
|
+
* @param emitters Filter by emitter fingerprints.
|
|
3206
|
+
* @param dochashes Filter by document hashes.
|
|
3207
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
3208
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
3209
|
+
* @returns The list of DocumentLog matching the provided filters.
|
|
3210
|
+
*/
|
|
3211
|
+
searchDocumentLogs(ids?: bigint[], emitters?: `0x${string}`[], dochashes?: `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<DocumentLog[]>;
|
|
3212
|
+
/**
|
|
3213
|
+
* Retrieves a Document event by its unique ID.
|
|
3214
|
+
*
|
|
3215
|
+
* @param id The unique ID of the document.
|
|
3216
|
+
* @param blockNumber The block number where to search for the document.
|
|
3217
|
+
* @returns The DocumentLog if found, otherwise undefined.
|
|
3218
|
+
* @example
|
|
3219
|
+
* ```typescript
|
|
3220
|
+
* const targetID = 1n;
|
|
3221
|
+
* const blockNumber = await web3Doc.getDocumentBlockNumberByID(targetID);
|
|
3222
|
+
* const documentLog = await web3Doc.getDocumentLogByID(targetID, blockNumber);
|
|
3223
|
+
* ```
|
|
3224
|
+
*/
|
|
3225
|
+
getDocumentLogByID(id: bigint, blockNumber: bigint): Promise<DocumentLog | undefined>;
|
|
3226
|
+
/**
|
|
3227
|
+
* Searches for Copy events emitted by the smart contract, filtered by the provided criteria.
|
|
3228
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
3229
|
+
*
|
|
3230
|
+
* @param copies Filter by copy IDs. Copy IDs uniqueness is guaranteed by the smart contract.
|
|
3231
|
+
* @param originals Filter by original document IDs.
|
|
3232
|
+
* @param emitters Filter by emitter fingerprints.
|
|
3233
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
3234
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
3235
|
+
* @returns The list of CopyLog matching the provided filters.
|
|
3236
|
+
*/
|
|
3237
|
+
searchCopyLogs(copies?: bigint[], originals?: bigint[], emitters?: `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<CopyLog[]>;
|
|
3238
|
+
/**
|
|
3239
|
+
* Retrieves a Copy event by its unique ID.
|
|
3240
|
+
*
|
|
3241
|
+
* @param copy The unique ID of the copy.
|
|
3242
|
+
* @param blockNumber The block number where to search for the copy.
|
|
3243
|
+
* @returns The CopyLog if found, otherwise undefined.
|
|
3244
|
+
* @exampletypescript
|
|
3245
|
+
* ```typescript
|
|
3246
|
+
* const targetCopyID = 1n;
|
|
3247
|
+
* const blockNumber = await web3Doc.getDocumentBlockNumberByID(targetCopyID);
|
|
3248
|
+
* const copyLog = await web3Doc.getCopyLogByID(targetCopyID, blockNumber);
|
|
3249
|
+
* ```
|
|
3250
|
+
*/
|
|
3251
|
+
getCopyLogByID(copy: bigint, blockNumber: bigint): Promise<CopyLog | undefined>;
|
|
3252
|
+
/**
|
|
3253
|
+
* Searches for Notification events emitted by the smart contract, filtered by the provided criteria.
|
|
3254
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
3255
|
+
*
|
|
3256
|
+
* @param ids Filter by document IDs. Document IDs uniqueness is guaranteed by the smart contract.
|
|
3257
|
+
* @param recipients Filter by recipient fingerprints.
|
|
3258
|
+
* @param signatureRequested Filter by whether a signature was requested or not.
|
|
3259
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
3260
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
3261
|
+
* @returns The list of NotificationLog matching the provided filters.
|
|
3262
|
+
*/
|
|
3263
|
+
searchNotificationLogs(ids?: bigint[], recipients?: `0x${string}`[], signatureRequested?: boolean, fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<NotificationLog[]>;
|
|
3264
|
+
/**
|
|
3265
|
+
* Retrieves a Notification event by its document ID and recipient.
|
|
3266
|
+
* @param id The unique ID of the document.
|
|
3267
|
+
* @param recipient The fingerprint of the recipient's key.
|
|
3268
|
+
* @param blockNumber The block number where to search for the notification.
|
|
3269
|
+
* @returns The NotificationLog if found, otherwise undefined.
|
|
3270
|
+
* @example
|
|
3271
|
+
* ```typescript
|
|
3272
|
+
* const targetID = 1n;
|
|
3273
|
+
* const recipient = '0xABCDEF...'; // recipient fingerprint
|
|
3274
|
+
* const blockNumber = await web3Doc.getDocumentBlockNumberByID(targetID);
|
|
3275
|
+
* const notificationLog = await web3Doc.getNotificationLog(targetID, recipient, blockNumber);
|
|
3276
|
+
* ```
|
|
3277
|
+
*/
|
|
3278
|
+
getNotificationLog(id: bigint, recipient: `0x${string}`, blockNumber: bigint): Promise<NotificationLog | undefined>;
|
|
3279
|
+
/**
|
|
3280
|
+
* Searches for Signature events emitted by the smart contract, filtered by the provided criteria.
|
|
3281
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
3282
|
+
*
|
|
3283
|
+
* @param ids Filter by signature IDs. Signature IDs uniqueness is guaranteed by the smart contract.
|
|
3284
|
+
* @param emitters Filter by emitter fingerprints.
|
|
3285
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
3286
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
3287
|
+
* @returns The list of SignatureLog matching the provided filters.
|
|
3288
|
+
*/
|
|
3289
|
+
searchSignatureLogs(ids?: bigint[], emitters?: `0x${string}`[], signatureHashes?: `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<SignatureLog[]>;
|
|
3290
|
+
/**
|
|
3291
|
+
* Retireve signature revocation events emitted by the smart contract, filtered by the provided criteria.
|
|
3292
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
3293
|
+
*
|
|
3294
|
+
* @param ids Filter by signature IDs. Signature IDs uniqueness is guaranteed by the smart contract.
|
|
3295
|
+
* @param emitters Filter by emitter fingerprints.
|
|
3296
|
+
* @param signatureHashes Filter by signature hashes.
|
|
3297
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
3298
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
3299
|
+
* @returns The list of SignatureRevocationLog matching the provided filters.
|
|
3300
|
+
*/
|
|
3301
|
+
searchSignatureRevocationLogs(ids?: bigint[], emitters?: `0x${string}`[], signatureHashes?: `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<SignatureRevocationLog[]>;
|
|
3302
|
+
/**
|
|
3303
|
+
* Retries Timestamp events emitted by the smart contract, filtered by the provided criteria.
|
|
3304
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
3305
|
+
*
|
|
3306
|
+
* @param ids Filter by timestamp IDs. Timestamp IDs uniqueness is guaranteed by the smart contract.
|
|
3307
|
+
* @param emitters Filter by emitter fingerprints.
|
|
3308
|
+
* @param dochashes Filter by document hashes.
|
|
3309
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
3310
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
3311
|
+
* @returns The list of TimestampLog matching the provided filters.
|
|
3312
|
+
*/
|
|
3313
|
+
searchTimestampLogs(ids?: bigint[], emitters?: `0x${string}`[], dochashes?: `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<TimestampLog[]>;
|
|
3314
|
+
/**
|
|
3315
|
+
* Retrieves a Timestamp event by its unique ID.
|
|
3316
|
+
* @param id The unique ID of the timestamp.
|
|
3317
|
+
* @param blockNumber The block number where to search for the timestamp.
|
|
3318
|
+
* @returns The TimestampLog if found, otherwise undefined.
|
|
3319
|
+
*/
|
|
3320
|
+
getTimestampLogByID(id: bigint, blockNumber: bigint): Promise<TimestampLog | undefined>;
|
|
3321
|
+
/**
|
|
3322
|
+
* Retrieves Timestamp events by document hash.
|
|
3323
|
+
* @param dochash The keccak256 hash of the document.
|
|
3324
|
+
* @returns An array of TimestampLog entries associated with the document hash.
|
|
3325
|
+
*/
|
|
3326
|
+
getTimestampLogsByHash(dochash: `0x${string}`): Promise<TimestampLog[]>;
|
|
3327
|
+
/*****************************************************************************************************************/
|
|
3328
|
+
/*****************************************************************************************************************/
|
|
3329
|
+
/**
|
|
3330
|
+
* Extracts DocumentLog entries from a given transaction receipt.
|
|
3331
|
+
*
|
|
3332
|
+
* @param receipt The transaction receipt containing the logs to be parsed.
|
|
3333
|
+
* @param timestamp Optional timestamp to assign to all extracted logs. This is useful when the receipt is from a transaction included in the latest block or in a block that has not been indexed yet.
|
|
3334
|
+
* @returns A promise that resolves to an array of DocumentLog entries extracted from the transaction receipt.
|
|
3335
|
+
*/
|
|
3336
|
+
extractDocumentLog(receipt: TransactionReceipt, timestamp?: Date): Promise<DocumentLog[]>;
|
|
3337
|
+
/**
|
|
3338
|
+
* Extracts CopyLog entries from a given transaction receipt.
|
|
3339
|
+
*
|
|
3340
|
+
* @param receipt The transaction receipt containing the logs to be parsed.
|
|
3341
|
+
* @param timestamp Optional timestamp to assign to all extracted logs. This is useful when the receipt is from a transaction included in the latest block or in a block that has not been indexed yet.
|
|
3342
|
+
* @returns A promise that resolves to an array of CopyLog entries extracted from the transaction receipt.
|
|
3343
|
+
*/
|
|
3344
|
+
extractCopyLog(receipt: TransactionReceipt, timestamp?: Date): Promise<CopyLog[]>;
|
|
3345
|
+
/**
|
|
3346
|
+
* Extracts SignatureLog entries from a given transaction receipt.
|
|
3347
|
+
*
|
|
3348
|
+
* @param receipt The transaction receipt containing the logs to be parsed.
|
|
3349
|
+
* @param timestamp Optional timestamp to assign to all extracted logs. This is useful when the receipt is from a transaction included in the latest block or in a block that has not been indexed yet.
|
|
3350
|
+
* @returns A promise that resolves to an array of SignatureLog entries extracted from the transaction receipt.
|
|
3351
|
+
*/
|
|
3352
|
+
extractSignatureLog(receipt: TransactionReceipt, timestamp?: Date): Promise<SignatureLog[]>;
|
|
3353
|
+
/**
|
|
3354
|
+
* Extracts SignatureRevocationLog entries from a given transaction receipt.
|
|
3355
|
+
*
|
|
3356
|
+
* @param receipt The transaction receipt containing the logs to be parsed.
|
|
3357
|
+
* @param timestamp Optional timestamp to assign to all extracted logs. This is useful when the receipt is from a transaction included in the latest block or in a block that has not been indexed yet.
|
|
3358
|
+
* @returns A promise that resolves to an array of SignatureRevocationLog entries extracted from the transaction receipt.
|
|
3359
|
+
*/
|
|
3360
|
+
extractSignatureRevocationLog(receipt: TransactionReceipt, timestamp?: Date): Promise<SignatureRevocationLog[]>;
|
|
3361
|
+
/**
|
|
3362
|
+
* Extracts TimestampLog entries from a given transaction receipt.
|
|
3363
|
+
*
|
|
3364
|
+
* @param receipt The transaction receipt containing the logs to be parsed.
|
|
3365
|
+
* @param timestamp Optional timestamp to assign to all extracted logs. This is useful when the receipt is from a transaction included in the latest block or in a block that has not been indexed yet.
|
|
3366
|
+
* @returns A promise that resolves to an array of TimestampLog entries extracted from the transaction receipt.
|
|
3367
|
+
*/
|
|
3368
|
+
extractTimestampLog(receipt: TransactionReceipt, timestamp?: Date): Promise<TimestampLog[]>;
|
|
3369
|
+
/**
|
|
3370
|
+
* Extracts NotificationLog entries from a given transaction receipt.
|
|
3371
|
+
*
|
|
3372
|
+
* @param receipt The transaction receipt containing the logs to be parsed.
|
|
3373
|
+
* @param timestamp Optional timestamp to assign to all extracted logs. This is useful when the receipt is from a transaction included in the latest block or in a block that has not been indexed yet.
|
|
3374
|
+
* @returns A promise that resolves to an array of NotificationLog entries extracted from the transaction receipt.
|
|
3375
|
+
*/
|
|
3376
|
+
extractNotificationLog(receipt: TransactionReceipt, timestamp?: Date): Promise<NotificationLog[]>;
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
/**
|
|
3380
|
+
* Interface representing the Web3Doc service for managing documents on the blockchain.
|
|
3381
|
+
*
|
|
3382
|
+
* Higher order bindings are provided and involve OpenPGP operations in order to ease the overall developer experience.
|
|
3383
|
+
*
|
|
3384
|
+
* @todo Add methods for document exchange (sendDocument, sendCopy, notifyRecipients, ...)
|
|
3385
|
+
*/
|
|
3386
|
+
interface IWeb3DocService {
|
|
3387
|
+
/*****************************************************************************************************************/
|
|
3388
|
+
/*****************************************************************************************************************/
|
|
3389
|
+
/**
|
|
3390
|
+
* This function allows submitting the data needed to timestamp a document to the Web3Doc smart contract.
|
|
3391
|
+
*
|
|
3392
|
+
* The function will download and verify the emitter's public key using the Web3PGP contract and then it will verify
|
|
3393
|
+
* the provided detached signature over the keccak256 hash of the document. If the signature is valid, it will submit
|
|
3394
|
+
* the hash and the signature to the smart contract for timestamping.
|
|
3395
|
+
*
|
|
3396
|
+
* The service is expected to be configured with a Web3PGP service instance to enable automatic public key retrieval based
|
|
3397
|
+
* on their fingerprint.
|
|
3398
|
+
*
|
|
3399
|
+
* @param hash The keccak256 hash of the document to be timestamped, provided as a Uint8Array.
|
|
3400
|
+
* @param signature The detached OpenPGP signature over the document hash.
|
|
3401
|
+
* @param emitter The fingerprint of the public key used to create the signature. Will be used to download the public key from Web3PGP.
|
|
3402
|
+
* @return A promise that resolves to the ID assigned to the new timestamp and the transaction receipt.
|
|
3403
|
+
*/
|
|
3404
|
+
timestamp(hash: Uint8Array, signature: openpgp.Signature, emitter: `0x${string}`): Promise<[bigint, TransactionReceipt]>;
|
|
3405
|
+
/**
|
|
3406
|
+
* Verifies a timestamp entry on the blockchain by its ID. The function retrieves the timestamp data from the
|
|
3407
|
+
* Web3Doc smart contract and verifies the detached signature over the document hash using the emitter's public key.
|
|
3408
|
+
*
|
|
3409
|
+
* The function returns the document hash, the signature, and the public key used for verification.
|
|
3410
|
+
*
|
|
3411
|
+
* The user can then compare the hash received from this function with the keccak256 hash they compute from their
|
|
3412
|
+
* document to ensure integrity.
|
|
3413
|
+
*
|
|
3414
|
+
* @param id The ID of the timestamp entry to verify.
|
|
3415
|
+
* @returns A promise that resolves to an object containing the document hash, signature, the public key, the transaction hash and the date of the timestamp.
|
|
3416
|
+
*/
|
|
3417
|
+
verifyTimestamp(id: bigint): Promise<{
|
|
3418
|
+
documentHash: Uint8Array;
|
|
3419
|
+
signature: openpgp.Signature;
|
|
3420
|
+
publicKey: openpgp.PublicKey;
|
|
3421
|
+
tx: `0x${string}`;
|
|
3422
|
+
date: Date;
|
|
3423
|
+
}>;
|
|
3424
|
+
/**
|
|
3425
|
+
* Finds all timestamp IDs associated with a given document hash. Timestamp IDs can be used to retrieve and verify
|
|
3426
|
+
* timestamp entries on the blockchain.
|
|
3427
|
+
*
|
|
3428
|
+
* @param hash The keccak256 hash of the document to search for.
|
|
3429
|
+
* @returns A promise that resolves to an array of timestamp IDs associated with the provided document hash.
|
|
3430
|
+
*/
|
|
3431
|
+
findTimestampsByHash(hash: Uint8Array): Promise<bigint[]>;
|
|
3432
|
+
}
|
|
3433
|
+
|
|
3434
|
+
/**
|
|
3435
|
+
* Implementation of the Web3Doc contract interface.
|
|
3436
|
+
*
|
|
3437
|
+
* This class provides low-level bindings to interact with the Web3Doc contract deployed on the blockchain.
|
|
3438
|
+
* Extends FlatFee to inherit fee management and access control functionality.
|
|
3439
|
+
*/
|
|
3440
|
+
declare class Web3Doc extends FlatFee implements IWeb3Doc {
|
|
3441
|
+
static readonly abi: readonly [{
|
|
3442
|
+
readonly type: "constructor";
|
|
3443
|
+
readonly inputs: readonly [];
|
|
3444
|
+
readonly stateMutability: "nonpayable";
|
|
3445
|
+
}, {
|
|
3446
|
+
readonly type: "receive";
|
|
3447
|
+
readonly stateMutability: "payable";
|
|
3448
|
+
}, {
|
|
3449
|
+
readonly type: "function";
|
|
3450
|
+
readonly name: "UPGRADE_INTERFACE_VERSION";
|
|
3451
|
+
readonly inputs: readonly [];
|
|
3452
|
+
readonly outputs: readonly [{
|
|
3453
|
+
readonly name: "";
|
|
3454
|
+
readonly type: "string";
|
|
3455
|
+
readonly internalType: "string";
|
|
3456
|
+
}];
|
|
3457
|
+
readonly stateMutability: "view";
|
|
3458
|
+
}, {
|
|
3459
|
+
readonly type: "function";
|
|
3460
|
+
readonly name: "authority";
|
|
3461
|
+
readonly inputs: readonly [];
|
|
3462
|
+
readonly outputs: readonly [{
|
|
3463
|
+
readonly name: "";
|
|
3464
|
+
readonly type: "address";
|
|
3465
|
+
readonly internalType: "address";
|
|
3466
|
+
}];
|
|
3467
|
+
readonly stateMutability: "view";
|
|
3468
|
+
}, {
|
|
3469
|
+
readonly type: "function";
|
|
3470
|
+
readonly name: "copyOffChain";
|
|
3471
|
+
readonly inputs: readonly [{
|
|
3472
|
+
readonly name: "original";
|
|
3473
|
+
readonly type: "uint256";
|
|
3474
|
+
readonly internalType: "uint256";
|
|
3475
|
+
}, {
|
|
3476
|
+
readonly name: "emitter";
|
|
3477
|
+
readonly type: "bytes32";
|
|
3478
|
+
readonly internalType: "bytes32";
|
|
3479
|
+
}, {
|
|
3480
|
+
readonly name: "recipients";
|
|
3481
|
+
readonly type: "tuple[]";
|
|
3482
|
+
readonly internalType: "struct IWeb3Doc.Recipient[]";
|
|
3483
|
+
readonly components: readonly [{
|
|
3484
|
+
readonly name: "fingerprint";
|
|
3485
|
+
readonly type: "bytes32";
|
|
3486
|
+
readonly internalType: "bytes32";
|
|
3487
|
+
}, {
|
|
3488
|
+
readonly name: "signatureRequested";
|
|
3489
|
+
readonly type: "bool";
|
|
3490
|
+
readonly internalType: "bool";
|
|
3491
|
+
}];
|
|
3492
|
+
}, {
|
|
3493
|
+
readonly name: "uri";
|
|
3494
|
+
readonly type: "string";
|
|
3495
|
+
readonly internalType: "string";
|
|
3496
|
+
}];
|
|
3497
|
+
readonly outputs: readonly [];
|
|
3498
|
+
readonly stateMutability: "payable";
|
|
3499
|
+
}, {
|
|
3500
|
+
readonly type: "function";
|
|
3501
|
+
readonly name: "copyOnChain";
|
|
3502
|
+
readonly inputs: readonly [{
|
|
3503
|
+
readonly name: "original";
|
|
3504
|
+
readonly type: "uint256";
|
|
3505
|
+
readonly internalType: "uint256";
|
|
3506
|
+
}, {
|
|
3507
|
+
readonly name: "emitter";
|
|
3508
|
+
readonly type: "bytes32";
|
|
3509
|
+
readonly internalType: "bytes32";
|
|
3510
|
+
}, {
|
|
3511
|
+
readonly name: "recipients";
|
|
3512
|
+
readonly type: "tuple[]";
|
|
3513
|
+
readonly internalType: "struct IWeb3Doc.Recipient[]";
|
|
3514
|
+
readonly components: readonly [{
|
|
3515
|
+
readonly name: "fingerprint";
|
|
3516
|
+
readonly type: "bytes32";
|
|
3517
|
+
readonly internalType: "bytes32";
|
|
3518
|
+
}, {
|
|
3519
|
+
readonly name: "signatureRequested";
|
|
3520
|
+
readonly type: "bool";
|
|
3521
|
+
readonly internalType: "bool";
|
|
3522
|
+
}];
|
|
3523
|
+
}, {
|
|
3524
|
+
readonly name: "document";
|
|
3525
|
+
readonly type: "bytes";
|
|
3526
|
+
readonly internalType: "bytes";
|
|
3527
|
+
}];
|
|
3528
|
+
readonly outputs: readonly [];
|
|
3529
|
+
readonly stateMutability: "payable";
|
|
3530
|
+
}, {
|
|
3531
|
+
readonly type: "function";
|
|
3532
|
+
readonly name: "getDocumentBlockNumberByID";
|
|
3533
|
+
readonly inputs: readonly [{
|
|
3534
|
+
readonly name: "id";
|
|
3535
|
+
readonly type: "uint256";
|
|
3536
|
+
readonly internalType: "uint256";
|
|
3537
|
+
}];
|
|
3538
|
+
readonly outputs: readonly [{
|
|
3539
|
+
readonly name: "";
|
|
3540
|
+
readonly type: "uint256";
|
|
3541
|
+
readonly internalType: "uint256";
|
|
3542
|
+
}];
|
|
3543
|
+
readonly stateMutability: "view";
|
|
3544
|
+
}, {
|
|
3545
|
+
readonly type: "function";
|
|
3546
|
+
readonly name: "getDocumentBlockNumberByIDBatch";
|
|
3547
|
+
readonly inputs: readonly [{
|
|
3548
|
+
readonly name: "ids";
|
|
3549
|
+
readonly type: "uint256[]";
|
|
3550
|
+
readonly internalType: "uint256[]";
|
|
3551
|
+
}];
|
|
3552
|
+
readonly outputs: readonly [{
|
|
3553
|
+
readonly name: "";
|
|
3554
|
+
readonly type: "uint256[]";
|
|
3555
|
+
readonly internalType: "uint256[]";
|
|
3556
|
+
}];
|
|
3557
|
+
readonly stateMutability: "view";
|
|
3558
|
+
}, {
|
|
3559
|
+
readonly type: "function";
|
|
3560
|
+
readonly name: "getSignatureBlockNumberByHash";
|
|
3561
|
+
readonly inputs: readonly [{
|
|
3562
|
+
readonly name: "signatureHash";
|
|
3563
|
+
readonly type: "bytes32";
|
|
3564
|
+
readonly internalType: "bytes32";
|
|
3565
|
+
}];
|
|
3566
|
+
readonly outputs: readonly [{
|
|
3567
|
+
readonly name: "";
|
|
3568
|
+
readonly type: "uint256";
|
|
3569
|
+
readonly internalType: "uint256";
|
|
3570
|
+
}];
|
|
3571
|
+
readonly stateMutability: "view";
|
|
3572
|
+
}, {
|
|
3573
|
+
readonly type: "function";
|
|
3574
|
+
readonly name: "getSignatureBlockNumberByHashBatch";
|
|
3575
|
+
readonly inputs: readonly [{
|
|
3576
|
+
readonly name: "signatureHashes";
|
|
3577
|
+
readonly type: "bytes32[]";
|
|
3578
|
+
readonly internalType: "bytes32[]";
|
|
3579
|
+
}];
|
|
3580
|
+
readonly outputs: readonly [{
|
|
3581
|
+
readonly name: "";
|
|
3582
|
+
readonly type: "uint256[]";
|
|
3583
|
+
readonly internalType: "uint256[]";
|
|
3584
|
+
}];
|
|
3585
|
+
readonly stateMutability: "view";
|
|
3586
|
+
}, {
|
|
3587
|
+
readonly type: "function";
|
|
3588
|
+
readonly name: "getWeb3PGPAddress";
|
|
3589
|
+
readonly inputs: readonly [];
|
|
3590
|
+
readonly outputs: readonly [{
|
|
3591
|
+
readonly name: "";
|
|
3592
|
+
readonly type: "address";
|
|
3593
|
+
readonly internalType: "address";
|
|
3594
|
+
}];
|
|
3595
|
+
readonly stateMutability: "view";
|
|
3596
|
+
}, {
|
|
3597
|
+
readonly type: "function";
|
|
3598
|
+
readonly name: "initialize";
|
|
3599
|
+
readonly inputs: readonly [{
|
|
3600
|
+
readonly name: "fee";
|
|
3601
|
+
readonly type: "uint256";
|
|
3602
|
+
readonly internalType: "uint256";
|
|
3603
|
+
}, {
|
|
3604
|
+
readonly name: "manager";
|
|
3605
|
+
readonly type: "address";
|
|
3606
|
+
readonly internalType: "address";
|
|
3607
|
+
}, {
|
|
3608
|
+
readonly name: "web3pgp";
|
|
3609
|
+
readonly type: "address";
|
|
3610
|
+
readonly internalType: "address";
|
|
3611
|
+
}];
|
|
3612
|
+
readonly outputs: readonly [];
|
|
3613
|
+
readonly stateMutability: "nonpayable";
|
|
3614
|
+
}, {
|
|
3615
|
+
readonly type: "function";
|
|
3616
|
+
readonly name: "initializeUpgrade";
|
|
3617
|
+
readonly inputs: readonly [];
|
|
3618
|
+
readonly outputs: readonly [];
|
|
3619
|
+
readonly stateMutability: "nonpayable";
|
|
3620
|
+
}, {
|
|
3621
|
+
readonly type: "function";
|
|
3622
|
+
readonly name: "isConsumingScheduledOp";
|
|
3623
|
+
readonly inputs: readonly [];
|
|
3624
|
+
readonly outputs: readonly [{
|
|
3625
|
+
readonly name: "";
|
|
3626
|
+
readonly type: "bytes4";
|
|
3627
|
+
readonly internalType: "bytes4";
|
|
3628
|
+
}];
|
|
3629
|
+
readonly stateMutability: "view";
|
|
3630
|
+
}, {
|
|
3631
|
+
readonly type: "function";
|
|
3632
|
+
readonly name: "isCopyOf";
|
|
3633
|
+
readonly inputs: readonly [{
|
|
3634
|
+
readonly name: "id";
|
|
3635
|
+
readonly type: "uint256";
|
|
3636
|
+
readonly internalType: "uint256";
|
|
3637
|
+
}];
|
|
3638
|
+
readonly outputs: readonly [{
|
|
3639
|
+
readonly name: "";
|
|
3640
|
+
readonly type: "uint256";
|
|
3641
|
+
readonly internalType: "uint256";
|
|
3642
|
+
}];
|
|
3643
|
+
readonly stateMutability: "view";
|
|
3644
|
+
}, {
|
|
3645
|
+
readonly type: "function";
|
|
3646
|
+
readonly name: "listDocumentIdsByHash";
|
|
3647
|
+
readonly inputs: readonly [{
|
|
3648
|
+
readonly name: "dochash";
|
|
3649
|
+
readonly type: "bytes32";
|
|
3650
|
+
readonly internalType: "bytes32";
|
|
3651
|
+
}, {
|
|
3652
|
+
readonly name: "start";
|
|
3653
|
+
readonly type: "uint256";
|
|
3654
|
+
readonly internalType: "uint256";
|
|
3655
|
+
}, {
|
|
3656
|
+
readonly name: "limit";
|
|
3657
|
+
readonly type: "uint256";
|
|
3658
|
+
readonly internalType: "uint256";
|
|
3659
|
+
}];
|
|
3660
|
+
readonly outputs: readonly [{
|
|
3661
|
+
readonly name: "";
|
|
3662
|
+
readonly type: "uint256[]";
|
|
3663
|
+
readonly internalType: "uint256[]";
|
|
3664
|
+
}];
|
|
3665
|
+
readonly stateMutability: "view";
|
|
3666
|
+
}, {
|
|
3667
|
+
readonly type: "function";
|
|
3668
|
+
readonly name: "listSignatureRevocationsBlockNumbers";
|
|
3669
|
+
readonly inputs: readonly [{
|
|
3670
|
+
readonly name: "signatureHash";
|
|
3671
|
+
readonly type: "bytes32";
|
|
3672
|
+
readonly internalType: "bytes32";
|
|
3673
|
+
}, {
|
|
3674
|
+
readonly name: "start";
|
|
3675
|
+
readonly type: "uint256";
|
|
3676
|
+
readonly internalType: "uint256";
|
|
3677
|
+
}, {
|
|
3678
|
+
readonly name: "limit";
|
|
3679
|
+
readonly type: "uint256";
|
|
3680
|
+
readonly internalType: "uint256";
|
|
3681
|
+
}];
|
|
3682
|
+
readonly outputs: readonly [{
|
|
3683
|
+
readonly name: "";
|
|
3684
|
+
readonly type: "uint256[]";
|
|
3685
|
+
readonly internalType: "uint256[]";
|
|
3686
|
+
}];
|
|
3687
|
+
readonly stateMutability: "view";
|
|
3688
|
+
}, {
|
|
3689
|
+
readonly type: "function";
|
|
3690
|
+
readonly name: "listSignatures";
|
|
3691
|
+
readonly inputs: readonly [{
|
|
3692
|
+
readonly name: "id";
|
|
3693
|
+
readonly type: "uint256";
|
|
3694
|
+
readonly internalType: "uint256";
|
|
3695
|
+
}, {
|
|
3696
|
+
readonly name: "start";
|
|
3697
|
+
readonly type: "uint256";
|
|
3698
|
+
readonly internalType: "uint256";
|
|
3699
|
+
}, {
|
|
3700
|
+
readonly name: "limit";
|
|
3701
|
+
readonly type: "uint256";
|
|
3702
|
+
readonly internalType: "uint256";
|
|
3703
|
+
}];
|
|
3704
|
+
readonly outputs: readonly [{
|
|
3705
|
+
readonly name: "";
|
|
3706
|
+
readonly type: "uint256[]";
|
|
3707
|
+
readonly internalType: "uint256[]";
|
|
3708
|
+
}];
|
|
3709
|
+
readonly stateMutability: "view";
|
|
3710
|
+
}, {
|
|
3711
|
+
readonly type: "function";
|
|
3712
|
+
readonly name: "proxiableUUID";
|
|
3713
|
+
readonly inputs: readonly [];
|
|
3714
|
+
readonly outputs: readonly [{
|
|
3715
|
+
readonly name: "";
|
|
3716
|
+
readonly type: "bytes32";
|
|
3717
|
+
readonly internalType: "bytes32";
|
|
3718
|
+
}];
|
|
3719
|
+
readonly stateMutability: "view";
|
|
3720
|
+
}, {
|
|
3721
|
+
readonly type: "function";
|
|
3722
|
+
readonly name: "requestedFee";
|
|
3723
|
+
readonly inputs: readonly [];
|
|
3724
|
+
readonly outputs: readonly [{
|
|
3725
|
+
readonly name: "";
|
|
3726
|
+
readonly type: "uint256";
|
|
3727
|
+
readonly internalType: "uint256";
|
|
3728
|
+
}];
|
|
3729
|
+
readonly stateMutability: "view";
|
|
3730
|
+
}, {
|
|
3731
|
+
readonly type: "function";
|
|
3732
|
+
readonly name: "revokeSignature";
|
|
3733
|
+
readonly inputs: readonly [{
|
|
3734
|
+
readonly name: "id";
|
|
3735
|
+
readonly type: "uint256";
|
|
3736
|
+
readonly internalType: "uint256";
|
|
3737
|
+
}, {
|
|
3738
|
+
readonly name: "emitter";
|
|
3739
|
+
readonly type: "bytes32";
|
|
3740
|
+
readonly internalType: "bytes32";
|
|
3741
|
+
}, {
|
|
3742
|
+
readonly name: "signatureHash";
|
|
3743
|
+
readonly type: "bytes32";
|
|
3744
|
+
readonly internalType: "bytes32";
|
|
3745
|
+
}, {
|
|
3746
|
+
readonly name: "signature";
|
|
3747
|
+
readonly type: "bytes";
|
|
3748
|
+
readonly internalType: "bytes";
|
|
3749
|
+
}];
|
|
3750
|
+
readonly outputs: readonly [];
|
|
3751
|
+
readonly stateMutability: "payable";
|
|
3752
|
+
}, {
|
|
3753
|
+
readonly type: "function";
|
|
3754
|
+
readonly name: "sendOffChain";
|
|
3755
|
+
readonly inputs: readonly [{
|
|
3756
|
+
readonly name: "emitter";
|
|
3757
|
+
readonly type: "bytes32";
|
|
3758
|
+
readonly internalType: "bytes32";
|
|
3759
|
+
}, {
|
|
3760
|
+
readonly name: "recipients";
|
|
3761
|
+
readonly type: "tuple[]";
|
|
3762
|
+
readonly internalType: "struct IWeb3Doc.Recipient[]";
|
|
3763
|
+
readonly components: readonly [{
|
|
3764
|
+
readonly name: "fingerprint";
|
|
3765
|
+
readonly type: "bytes32";
|
|
3766
|
+
readonly internalType: "bytes32";
|
|
3767
|
+
}, {
|
|
3768
|
+
readonly name: "signatureRequested";
|
|
3769
|
+
readonly type: "bool";
|
|
3770
|
+
readonly internalType: "bool";
|
|
3771
|
+
}];
|
|
3772
|
+
}, {
|
|
3773
|
+
readonly name: "dochash";
|
|
3774
|
+
readonly type: "bytes32";
|
|
3775
|
+
readonly internalType: "bytes32";
|
|
3776
|
+
}, {
|
|
3777
|
+
readonly name: "signature";
|
|
3778
|
+
readonly type: "bytes";
|
|
3779
|
+
readonly internalType: "bytes";
|
|
3780
|
+
}, {
|
|
3781
|
+
readonly name: "uri";
|
|
3782
|
+
readonly type: "string";
|
|
3783
|
+
readonly internalType: "string";
|
|
3784
|
+
}, {
|
|
3785
|
+
readonly name: "mimeType";
|
|
3786
|
+
readonly type: "string";
|
|
3787
|
+
readonly internalType: "string";
|
|
3788
|
+
}];
|
|
3789
|
+
readonly outputs: readonly [];
|
|
3790
|
+
readonly stateMutability: "payable";
|
|
3791
|
+
}, {
|
|
3792
|
+
readonly type: "function";
|
|
3793
|
+
readonly name: "sendOnChain";
|
|
3794
|
+
readonly inputs: readonly [{
|
|
3795
|
+
readonly name: "emitter";
|
|
3796
|
+
readonly type: "bytes32";
|
|
3797
|
+
readonly internalType: "bytes32";
|
|
3798
|
+
}, {
|
|
3799
|
+
readonly name: "recipients";
|
|
3800
|
+
readonly type: "tuple[]";
|
|
3801
|
+
readonly internalType: "struct IWeb3Doc.Recipient[]";
|
|
3802
|
+
readonly components: readonly [{
|
|
3803
|
+
readonly name: "fingerprint";
|
|
3804
|
+
readonly type: "bytes32";
|
|
3805
|
+
readonly internalType: "bytes32";
|
|
3806
|
+
}, {
|
|
3807
|
+
readonly name: "signatureRequested";
|
|
3808
|
+
readonly type: "bool";
|
|
3809
|
+
readonly internalType: "bool";
|
|
3810
|
+
}];
|
|
3811
|
+
}, {
|
|
3812
|
+
readonly name: "dochash";
|
|
3813
|
+
readonly type: "bytes32";
|
|
3814
|
+
readonly internalType: "bytes32";
|
|
3815
|
+
}, {
|
|
3816
|
+
readonly name: "signature";
|
|
3817
|
+
readonly type: "bytes";
|
|
3818
|
+
readonly internalType: "bytes";
|
|
3819
|
+
}, {
|
|
3820
|
+
readonly name: "document";
|
|
3821
|
+
readonly type: "bytes";
|
|
3822
|
+
readonly internalType: "bytes";
|
|
3823
|
+
}, {
|
|
3824
|
+
readonly name: "mimeType";
|
|
3825
|
+
readonly type: "string";
|
|
3826
|
+
readonly internalType: "string";
|
|
3827
|
+
}];
|
|
3828
|
+
readonly outputs: readonly [];
|
|
3829
|
+
readonly stateMutability: "payable";
|
|
3830
|
+
}, {
|
|
3831
|
+
readonly type: "function";
|
|
3832
|
+
readonly name: "setAuthority";
|
|
3833
|
+
readonly inputs: readonly [{
|
|
3834
|
+
readonly name: "newAuthority";
|
|
3835
|
+
readonly type: "address";
|
|
3836
|
+
readonly internalType: "address";
|
|
3837
|
+
}];
|
|
3838
|
+
readonly outputs: readonly [];
|
|
3839
|
+
readonly stateMutability: "nonpayable";
|
|
3840
|
+
}, {
|
|
3841
|
+
readonly type: "function";
|
|
3842
|
+
readonly name: "sign";
|
|
3843
|
+
readonly inputs: readonly [{
|
|
3844
|
+
readonly name: "id";
|
|
3845
|
+
readonly type: "uint256";
|
|
3846
|
+
readonly internalType: "uint256";
|
|
3847
|
+
}, {
|
|
3848
|
+
readonly name: "emitter";
|
|
3849
|
+
readonly type: "bytes32";
|
|
3850
|
+
readonly internalType: "bytes32";
|
|
3851
|
+
}, {
|
|
3852
|
+
readonly name: "signature";
|
|
3853
|
+
readonly type: "bytes";
|
|
3854
|
+
readonly internalType: "bytes";
|
|
3855
|
+
}];
|
|
3856
|
+
readonly outputs: readonly [];
|
|
3857
|
+
readonly stateMutability: "payable";
|
|
3858
|
+
}, {
|
|
3859
|
+
readonly type: "function";
|
|
3860
|
+
readonly name: "timestamp";
|
|
3861
|
+
readonly inputs: readonly [{
|
|
3862
|
+
readonly name: "emitter";
|
|
3863
|
+
readonly type: "bytes32";
|
|
3864
|
+
readonly internalType: "bytes32";
|
|
3865
|
+
}, {
|
|
3866
|
+
readonly name: "dochash";
|
|
3867
|
+
readonly type: "bytes32";
|
|
3868
|
+
readonly internalType: "bytes32";
|
|
3869
|
+
}, {
|
|
3870
|
+
readonly name: "signature";
|
|
3871
|
+
readonly type: "bytes";
|
|
3872
|
+
readonly internalType: "bytes";
|
|
3873
|
+
}];
|
|
3874
|
+
readonly outputs: readonly [];
|
|
3875
|
+
readonly stateMutability: "payable";
|
|
3876
|
+
}, {
|
|
3877
|
+
readonly type: "function";
|
|
3878
|
+
readonly name: "updateRequestedFee";
|
|
3879
|
+
readonly inputs: readonly [{
|
|
3880
|
+
readonly name: "newFee";
|
|
3881
|
+
readonly type: "uint256";
|
|
3882
|
+
readonly internalType: "uint256";
|
|
3883
|
+
}];
|
|
3884
|
+
readonly outputs: readonly [];
|
|
3885
|
+
readonly stateMutability: "nonpayable";
|
|
3886
|
+
}, {
|
|
3887
|
+
readonly type: "function";
|
|
3888
|
+
readonly name: "upgradeToAndCall";
|
|
3889
|
+
readonly inputs: readonly [{
|
|
3890
|
+
readonly name: "newImplementation";
|
|
3891
|
+
readonly type: "address";
|
|
3892
|
+
readonly internalType: "address";
|
|
3893
|
+
}, {
|
|
3894
|
+
readonly name: "data";
|
|
3895
|
+
readonly type: "bytes";
|
|
3896
|
+
readonly internalType: "bytes";
|
|
3897
|
+
}];
|
|
3898
|
+
readonly outputs: readonly [];
|
|
3899
|
+
readonly stateMutability: "payable";
|
|
3900
|
+
}, {
|
|
3901
|
+
readonly type: "function";
|
|
3902
|
+
readonly name: "withdrawFees";
|
|
3903
|
+
readonly inputs: readonly [{
|
|
3904
|
+
readonly name: "to";
|
|
3905
|
+
readonly type: "address";
|
|
3906
|
+
readonly internalType: "address";
|
|
3907
|
+
}];
|
|
3908
|
+
readonly outputs: readonly [];
|
|
3909
|
+
readonly stateMutability: "nonpayable";
|
|
3910
|
+
}, {
|
|
3911
|
+
readonly type: "event";
|
|
3912
|
+
readonly name: "AuthorityUpdated";
|
|
3913
|
+
readonly inputs: readonly [{
|
|
3914
|
+
readonly name: "authority";
|
|
3915
|
+
readonly type: "address";
|
|
3916
|
+
readonly indexed: false;
|
|
3917
|
+
readonly internalType: "address";
|
|
3918
|
+
}];
|
|
3919
|
+
readonly anonymous: false;
|
|
3920
|
+
}, {
|
|
3921
|
+
readonly type: "event";
|
|
3922
|
+
readonly name: "Copy";
|
|
3923
|
+
readonly inputs: readonly [{
|
|
3924
|
+
readonly name: "copy";
|
|
3925
|
+
readonly type: "uint256";
|
|
3926
|
+
readonly indexed: true;
|
|
3927
|
+
readonly internalType: "uint256";
|
|
3928
|
+
}, {
|
|
3929
|
+
readonly name: "original";
|
|
3930
|
+
readonly type: "uint256";
|
|
3931
|
+
readonly indexed: true;
|
|
3932
|
+
readonly internalType: "uint256";
|
|
3933
|
+
}, {
|
|
3934
|
+
readonly name: "emitter";
|
|
3935
|
+
readonly type: "bytes32";
|
|
3936
|
+
readonly indexed: true;
|
|
3937
|
+
readonly internalType: "bytes32";
|
|
3938
|
+
}, {
|
|
3939
|
+
readonly name: "document";
|
|
3940
|
+
readonly type: "bytes";
|
|
3941
|
+
readonly indexed: false;
|
|
3942
|
+
readonly internalType: "bytes";
|
|
3943
|
+
}, {
|
|
3944
|
+
readonly name: "uri";
|
|
3945
|
+
readonly type: "string";
|
|
3946
|
+
readonly indexed: false;
|
|
3947
|
+
readonly internalType: "string";
|
|
3948
|
+
}];
|
|
3949
|
+
readonly anonymous: false;
|
|
3950
|
+
}, {
|
|
3951
|
+
readonly type: "event";
|
|
3952
|
+
readonly name: "Document";
|
|
3953
|
+
readonly inputs: readonly [{
|
|
3954
|
+
readonly name: "id";
|
|
3955
|
+
readonly type: "uint256";
|
|
3956
|
+
readonly indexed: true;
|
|
3957
|
+
readonly internalType: "uint256";
|
|
3958
|
+
}, {
|
|
3959
|
+
readonly name: "emitter";
|
|
3960
|
+
readonly type: "bytes32";
|
|
3961
|
+
readonly indexed: true;
|
|
3962
|
+
readonly internalType: "bytes32";
|
|
3963
|
+
}, {
|
|
3964
|
+
readonly name: "dochash";
|
|
3965
|
+
readonly type: "bytes32";
|
|
3966
|
+
readonly indexed: true;
|
|
3967
|
+
readonly internalType: "bytes32";
|
|
3968
|
+
}, {
|
|
3969
|
+
readonly name: "signature";
|
|
3970
|
+
readonly type: "bytes";
|
|
3971
|
+
readonly indexed: false;
|
|
3972
|
+
readonly internalType: "bytes";
|
|
3973
|
+
}, {
|
|
3974
|
+
readonly name: "document";
|
|
3975
|
+
readonly type: "bytes";
|
|
3976
|
+
readonly indexed: false;
|
|
3977
|
+
readonly internalType: "bytes";
|
|
3978
|
+
}, {
|
|
3979
|
+
readonly name: "uri";
|
|
3980
|
+
readonly type: "string";
|
|
3981
|
+
readonly indexed: false;
|
|
3982
|
+
readonly internalType: "string";
|
|
3983
|
+
}, {
|
|
3984
|
+
readonly name: "mimeType";
|
|
3985
|
+
readonly type: "string";
|
|
3986
|
+
readonly indexed: false;
|
|
3987
|
+
readonly internalType: "string";
|
|
3988
|
+
}];
|
|
3989
|
+
readonly anonymous: false;
|
|
3990
|
+
}, {
|
|
3991
|
+
readonly type: "event";
|
|
3992
|
+
readonly name: "FeesWithdrawn";
|
|
3993
|
+
readonly inputs: readonly [{
|
|
3994
|
+
readonly name: "to";
|
|
3995
|
+
readonly type: "address";
|
|
3996
|
+
readonly indexed: true;
|
|
3997
|
+
readonly internalType: "address";
|
|
3998
|
+
}, {
|
|
3999
|
+
readonly name: "amount";
|
|
4000
|
+
readonly type: "uint256";
|
|
4001
|
+
readonly indexed: false;
|
|
4002
|
+
readonly internalType: "uint256";
|
|
4003
|
+
}];
|
|
4004
|
+
readonly anonymous: false;
|
|
4005
|
+
}, {
|
|
4006
|
+
readonly type: "event";
|
|
4007
|
+
readonly name: "Initialized";
|
|
4008
|
+
readonly inputs: readonly [{
|
|
4009
|
+
readonly name: "version";
|
|
4010
|
+
readonly type: "uint64";
|
|
4011
|
+
readonly indexed: false;
|
|
4012
|
+
readonly internalType: "uint64";
|
|
4013
|
+
}];
|
|
4014
|
+
readonly anonymous: false;
|
|
4015
|
+
}, {
|
|
4016
|
+
readonly type: "event";
|
|
4017
|
+
readonly name: "Notification";
|
|
4018
|
+
readonly inputs: readonly [{
|
|
4019
|
+
readonly name: "id";
|
|
4020
|
+
readonly type: "uint256";
|
|
4021
|
+
readonly indexed: true;
|
|
4022
|
+
readonly internalType: "uint256";
|
|
4023
|
+
}, {
|
|
4024
|
+
readonly name: "emitter";
|
|
4025
|
+
readonly type: "bytes32";
|
|
4026
|
+
readonly indexed: false;
|
|
4027
|
+
readonly internalType: "bytes32";
|
|
4028
|
+
}, {
|
|
4029
|
+
readonly name: "recipient";
|
|
4030
|
+
readonly type: "bytes32";
|
|
4031
|
+
readonly indexed: true;
|
|
4032
|
+
readonly internalType: "bytes32";
|
|
4033
|
+
}, {
|
|
4034
|
+
readonly name: "source";
|
|
4035
|
+
readonly type: "uint8";
|
|
4036
|
+
readonly indexed: false;
|
|
4037
|
+
readonly internalType: "enum IWeb3Doc.EventType";
|
|
4038
|
+
}, {
|
|
4039
|
+
readonly name: "signatureRequested";
|
|
4040
|
+
readonly type: "bool";
|
|
4041
|
+
readonly indexed: true;
|
|
4042
|
+
readonly internalType: "bool";
|
|
4043
|
+
}];
|
|
4044
|
+
readonly anonymous: false;
|
|
4045
|
+
}, {
|
|
4046
|
+
readonly type: "event";
|
|
4047
|
+
readonly name: "RequestedFeeUpdated";
|
|
4048
|
+
readonly inputs: readonly [{
|
|
4049
|
+
readonly name: "oldFee";
|
|
4050
|
+
readonly type: "uint256";
|
|
4051
|
+
readonly indexed: false;
|
|
4052
|
+
readonly internalType: "uint256";
|
|
4053
|
+
}, {
|
|
4054
|
+
readonly name: "newFee";
|
|
4055
|
+
readonly type: "uint256";
|
|
4056
|
+
readonly indexed: false;
|
|
4057
|
+
readonly internalType: "uint256";
|
|
4058
|
+
}];
|
|
4059
|
+
readonly anonymous: false;
|
|
4060
|
+
}, {
|
|
4061
|
+
readonly type: "event";
|
|
4062
|
+
readonly name: "Signature";
|
|
4063
|
+
readonly inputs: readonly [{
|
|
4064
|
+
readonly name: "id";
|
|
4065
|
+
readonly type: "uint256";
|
|
4066
|
+
readonly indexed: true;
|
|
4067
|
+
readonly internalType: "uint256";
|
|
4068
|
+
}, {
|
|
4069
|
+
readonly name: "emitter";
|
|
4070
|
+
readonly type: "bytes32";
|
|
4071
|
+
readonly indexed: true;
|
|
4072
|
+
readonly internalType: "bytes32";
|
|
4073
|
+
}, {
|
|
4074
|
+
readonly name: "signatureHash";
|
|
4075
|
+
readonly type: "bytes32";
|
|
4076
|
+
readonly indexed: true;
|
|
4077
|
+
readonly internalType: "bytes32";
|
|
4078
|
+
}, {
|
|
4079
|
+
readonly name: "signature";
|
|
4080
|
+
readonly type: "bytes";
|
|
4081
|
+
readonly indexed: false;
|
|
4082
|
+
readonly internalType: "bytes";
|
|
4083
|
+
}];
|
|
4084
|
+
readonly anonymous: false;
|
|
4085
|
+
}, {
|
|
4086
|
+
readonly type: "event";
|
|
4087
|
+
readonly name: "SignatureRevocation";
|
|
4088
|
+
readonly inputs: readonly [{
|
|
4089
|
+
readonly name: "id";
|
|
4090
|
+
readonly type: "uint256";
|
|
4091
|
+
readonly indexed: true;
|
|
4092
|
+
readonly internalType: "uint256";
|
|
4093
|
+
}, {
|
|
4094
|
+
readonly name: "emitter";
|
|
4095
|
+
readonly type: "bytes32";
|
|
4096
|
+
readonly indexed: true;
|
|
4097
|
+
readonly internalType: "bytes32";
|
|
4098
|
+
}, {
|
|
4099
|
+
readonly name: "signatureHash";
|
|
4100
|
+
readonly type: "bytes32";
|
|
4101
|
+
readonly indexed: true;
|
|
4102
|
+
readonly internalType: "bytes32";
|
|
4103
|
+
}, {
|
|
4104
|
+
readonly name: "signature";
|
|
4105
|
+
readonly type: "bytes";
|
|
4106
|
+
readonly indexed: false;
|
|
4107
|
+
readonly internalType: "bytes";
|
|
4108
|
+
}];
|
|
4109
|
+
readonly anonymous: false;
|
|
4110
|
+
}, {
|
|
4111
|
+
readonly type: "event";
|
|
4112
|
+
readonly name: "Timestamp";
|
|
4113
|
+
readonly inputs: readonly [{
|
|
4114
|
+
readonly name: "id";
|
|
4115
|
+
readonly type: "uint256";
|
|
4116
|
+
readonly indexed: true;
|
|
4117
|
+
readonly internalType: "uint256";
|
|
4118
|
+
}, {
|
|
4119
|
+
readonly name: "emitter";
|
|
4120
|
+
readonly type: "bytes32";
|
|
4121
|
+
readonly indexed: true;
|
|
4122
|
+
readonly internalType: "bytes32";
|
|
4123
|
+
}, {
|
|
4124
|
+
readonly name: "dochash";
|
|
4125
|
+
readonly type: "bytes32";
|
|
4126
|
+
readonly indexed: true;
|
|
4127
|
+
readonly internalType: "bytes32";
|
|
4128
|
+
}, {
|
|
4129
|
+
readonly name: "signature";
|
|
4130
|
+
readonly type: "bytes";
|
|
4131
|
+
readonly indexed: false;
|
|
4132
|
+
readonly internalType: "bytes";
|
|
4133
|
+
}];
|
|
4134
|
+
readonly anonymous: false;
|
|
4135
|
+
}, {
|
|
4136
|
+
readonly type: "event";
|
|
4137
|
+
readonly name: "Upgraded";
|
|
4138
|
+
readonly inputs: readonly [{
|
|
4139
|
+
readonly name: "implementation";
|
|
4140
|
+
readonly type: "address";
|
|
4141
|
+
readonly indexed: true;
|
|
4142
|
+
readonly internalType: "address";
|
|
4143
|
+
}];
|
|
4144
|
+
readonly anonymous: false;
|
|
4145
|
+
}, {
|
|
4146
|
+
readonly type: "error";
|
|
4147
|
+
readonly name: "AccessManagedInvalidAuthority";
|
|
4148
|
+
readonly inputs: readonly [{
|
|
4149
|
+
readonly name: "authority";
|
|
4150
|
+
readonly type: "address";
|
|
4151
|
+
readonly internalType: "address";
|
|
4152
|
+
}];
|
|
4153
|
+
}, {
|
|
4154
|
+
readonly type: "error";
|
|
4155
|
+
readonly name: "AccessManagedRequiredDelay";
|
|
4156
|
+
readonly inputs: readonly [{
|
|
4157
|
+
readonly name: "caller";
|
|
4158
|
+
readonly type: "address";
|
|
4159
|
+
readonly internalType: "address";
|
|
4160
|
+
}, {
|
|
4161
|
+
readonly name: "delay";
|
|
4162
|
+
readonly type: "uint32";
|
|
4163
|
+
readonly internalType: "uint32";
|
|
4164
|
+
}];
|
|
4165
|
+
}, {
|
|
4166
|
+
readonly type: "error";
|
|
4167
|
+
readonly name: "AccessManagedUnauthorized";
|
|
4168
|
+
readonly inputs: readonly [{
|
|
4169
|
+
readonly name: "caller";
|
|
4170
|
+
readonly type: "address";
|
|
4171
|
+
readonly internalType: "address";
|
|
4172
|
+
}];
|
|
4173
|
+
}, {
|
|
4174
|
+
readonly type: "error";
|
|
4175
|
+
readonly name: "AddressEmptyCode";
|
|
4176
|
+
readonly inputs: readonly [{
|
|
4177
|
+
readonly name: "target";
|
|
4178
|
+
readonly type: "address";
|
|
4179
|
+
readonly internalType: "address";
|
|
4180
|
+
}];
|
|
4181
|
+
}, {
|
|
4182
|
+
readonly type: "error";
|
|
4183
|
+
readonly name: "DocumentIsACopy";
|
|
4184
|
+
readonly inputs: readonly [{
|
|
4185
|
+
readonly name: "id";
|
|
4186
|
+
readonly type: "uint256";
|
|
4187
|
+
readonly internalType: "uint256";
|
|
4188
|
+
}];
|
|
4189
|
+
}, {
|
|
4190
|
+
readonly type: "error";
|
|
4191
|
+
readonly name: "DocumentNotFound";
|
|
4192
|
+
readonly inputs: readonly [{
|
|
4193
|
+
readonly name: "id";
|
|
4194
|
+
readonly type: "uint256";
|
|
4195
|
+
readonly internalType: "uint256";
|
|
4196
|
+
}];
|
|
4197
|
+
}, {
|
|
4198
|
+
readonly type: "error";
|
|
4199
|
+
readonly name: "ERC1967InvalidImplementation";
|
|
4200
|
+
readonly inputs: readonly [{
|
|
4201
|
+
readonly name: "implementation";
|
|
4202
|
+
readonly type: "address";
|
|
4203
|
+
readonly internalType: "address";
|
|
4204
|
+
}];
|
|
4205
|
+
}, {
|
|
4206
|
+
readonly type: "error";
|
|
4207
|
+
readonly name: "ERC1967NonPayable";
|
|
4208
|
+
readonly inputs: readonly [];
|
|
4209
|
+
}, {
|
|
4210
|
+
readonly type: "error";
|
|
4211
|
+
readonly name: "EmitterNotFound";
|
|
4212
|
+
readonly inputs: readonly [{
|
|
4213
|
+
readonly name: "fingerprint";
|
|
4214
|
+
readonly type: "bytes32";
|
|
4215
|
+
readonly internalType: "bytes32";
|
|
4216
|
+
}];
|
|
4217
|
+
}, {
|
|
4218
|
+
readonly type: "error";
|
|
4219
|
+
readonly name: "FailedCall";
|
|
4220
|
+
readonly inputs: readonly [];
|
|
4221
|
+
}, {
|
|
4222
|
+
readonly type: "error";
|
|
4223
|
+
readonly name: "FeeRequired";
|
|
4224
|
+
readonly inputs: readonly [{
|
|
4225
|
+
readonly name: "provided";
|
|
4226
|
+
readonly type: "uint256";
|
|
4227
|
+
readonly internalType: "uint256";
|
|
4228
|
+
}, {
|
|
4229
|
+
readonly name: "required";
|
|
4230
|
+
readonly type: "uint256";
|
|
4231
|
+
readonly internalType: "uint256";
|
|
4232
|
+
}];
|
|
4233
|
+
}, {
|
|
4234
|
+
readonly type: "error";
|
|
4235
|
+
readonly name: "FeesWithdrawalFailed";
|
|
4236
|
+
readonly inputs: readonly [];
|
|
4237
|
+
}, {
|
|
4238
|
+
readonly type: "error";
|
|
4239
|
+
readonly name: "InvalidInitialization";
|
|
4240
|
+
readonly inputs: readonly [];
|
|
4241
|
+
}, {
|
|
4242
|
+
readonly type: "error";
|
|
4243
|
+
readonly name: "NoDirectPaymentsAllowed";
|
|
4244
|
+
readonly inputs: readonly [];
|
|
4245
|
+
}, {
|
|
4246
|
+
readonly type: "error";
|
|
4247
|
+
readonly name: "NoFeesToWithdraw";
|
|
4248
|
+
readonly inputs: readonly [];
|
|
4249
|
+
}, {
|
|
4250
|
+
readonly type: "error";
|
|
4251
|
+
readonly name: "NotInitializing";
|
|
4252
|
+
readonly inputs: readonly [];
|
|
4253
|
+
}, {
|
|
4254
|
+
readonly type: "error";
|
|
4255
|
+
readonly name: "RecipientNotFound";
|
|
4256
|
+
readonly inputs: readonly [{
|
|
4257
|
+
readonly name: "fingerprint";
|
|
4258
|
+
readonly type: "bytes32";
|
|
4259
|
+
readonly internalType: "bytes32";
|
|
4260
|
+
}];
|
|
4261
|
+
}, {
|
|
4262
|
+
readonly type: "error";
|
|
4263
|
+
readonly name: "ReentrancyGuardReentrantCall";
|
|
4264
|
+
readonly inputs: readonly [];
|
|
4265
|
+
}, {
|
|
4266
|
+
readonly type: "error";
|
|
4267
|
+
readonly name: "SignatureNotFound";
|
|
4268
|
+
readonly inputs: readonly [{
|
|
4269
|
+
readonly name: "signatureHash";
|
|
4270
|
+
readonly type: "bytes32";
|
|
4271
|
+
readonly internalType: "bytes32";
|
|
4272
|
+
}];
|
|
4273
|
+
}, {
|
|
4274
|
+
readonly type: "error";
|
|
4275
|
+
readonly name: "UUPSUnauthorizedCallContext";
|
|
4276
|
+
readonly inputs: readonly [];
|
|
4277
|
+
}, {
|
|
4278
|
+
readonly type: "error";
|
|
4279
|
+
readonly name: "UUPSUnsupportedProxiableUUID";
|
|
4280
|
+
readonly inputs: readonly [{
|
|
4281
|
+
readonly name: "slot";
|
|
4282
|
+
readonly type: "bytes32";
|
|
4283
|
+
readonly internalType: "bytes32";
|
|
4284
|
+
}];
|
|
4285
|
+
}];
|
|
4286
|
+
private static readonly DOCUMENT_EVENT;
|
|
4287
|
+
private static readonly COPY_EVENT;
|
|
4288
|
+
private static readonly NOTIFICATION_EVENT;
|
|
4289
|
+
private static readonly SIGNATURE_EVENT;
|
|
4290
|
+
private static readonly SIGNATURE_REVOCATION_EVENT;
|
|
4291
|
+
private static readonly TIMESTAMP_EVENT;
|
|
4292
|
+
/**
|
|
4293
|
+
* Creates a new Web3Doc instance.
|
|
4294
|
+
*
|
|
4295
|
+
* @param address The address of the Web3Doc smart contract.
|
|
4296
|
+
* @param web3pgp An instance implementing the IWeb3PGP interface for public key operations.
|
|
4297
|
+
* @param client A Viem public client for interacting with the blockchain.
|
|
4298
|
+
* @param walletClient Optional Viem wallet client for signing transactions.
|
|
4299
|
+
*/
|
|
4300
|
+
constructor(address: Address, web3pgp: IWeb3PGP, client: PublicClient, walletClient?: WalletClient);
|
|
4301
|
+
/*****************************************************************************************************************/
|
|
4302
|
+
/*****************************************************************************************************************/
|
|
4303
|
+
/**
|
|
4304
|
+
* Sends a document and its detached signature on-chain and notifies the specified recipients.
|
|
4305
|
+
*
|
|
4306
|
+
* @param emitter The fingerprint of the key used by the emitter to produce the signature.
|
|
4307
|
+
* @param recipients The list of recipients to notify and optionally prompt to sign the document.
|
|
4308
|
+
* @param dochash The declared keccak256 hash of the document.
|
|
4309
|
+
* @param signature A detached binary OpenPGP signature of the document.
|
|
4310
|
+
* @param document The binary OpenPGP message which contains the document.
|
|
4311
|
+
* @param mimeType Optional, The MIME type of the document and additional attributes (RFC6838)
|
|
4312
|
+
*/
|
|
4313
|
+
sendOnChain(emitter: `0x${string}`, recipients: Recipient[], dochash: `0x${string}`, signature: `0x${string}`, document: `0x${string}`, mimeType: string): Promise<TransactionReceipt>;
|
|
4314
|
+
/**
|
|
4315
|
+
* Sends a document using an off-chain channel, publishes its detached signature on-chain and notifies the specified recipients.
|
|
4316
|
+
*
|
|
4317
|
+
* @param emitter The fingerprint of the key used to produce the signature.
|
|
4318
|
+
* @param recipients The list of recipients to notify and optionally prompt to sign the document.
|
|
4319
|
+
* @param dochash The declared keccak256 hash of the document.
|
|
4320
|
+
* @param signature A detached binary OpenPGP signature of the document.
|
|
4321
|
+
* @param uri A URI which can be used to download the OpenPGP message (compressed and encrypted) which contains the document.
|
|
4322
|
+
* @param mimeType Optional, The MIME type of the document and additional attributes (RFC6838)
|
|
4323
|
+
*/
|
|
4324
|
+
sendOffChain(emitter: `0x${string}`, recipients: Recipient[], dochash: `0x${string}`, signature: `0x${string}`, uri: string, mimeType: string): Promise<TransactionReceipt>;
|
|
4325
|
+
/**
|
|
4326
|
+
* Send a certified copy of a document on-chain.
|
|
4327
|
+
*
|
|
4328
|
+
* @param original The ID of the original document that is the subject of the copy.
|
|
4329
|
+
* @param emitter The fingerprint of the emitter's public key.
|
|
4330
|
+
* @param recipients The list of recipient key fingerprints to be notified and, optionally, be prompted for a signature.
|
|
4331
|
+
* @param document The binary OpenPGP message containing the copy of the original document.
|
|
4332
|
+
*/
|
|
4333
|
+
copyOnChain(original: bigint, emitter: `0x${string}`, recipients: Recipient[], document: `0x${string}`): Promise<TransactionReceipt>;
|
|
4334
|
+
/**
|
|
4335
|
+
* Send a certified copy of a document using an off-chain storage.
|
|
4336
|
+
*
|
|
4337
|
+
* @param original The ID of the original document being copied. Must reference a valid, non-copy document.
|
|
4338
|
+
* @param emitter The fingerprint of the key used to produce the signature.
|
|
4339
|
+
* @param recipients The list of recipient key fingerprints to be notified and, optionally, be prompted for a signature.
|
|
4340
|
+
* @param uri A URI which can be used to download the OpenPGP message containing the (compressed, encrypted and signed) document itself.
|
|
4341
|
+
*/
|
|
4342
|
+
copyOffChain(original: bigint, emitter: `0x${string}`, recipients: Recipient[], uri: string): Promise<TransactionReceipt>;
|
|
4343
|
+
/**
|
|
4344
|
+
* Publishes a binary detached OpenPGP signature of a document made with the emitter's key.
|
|
4345
|
+
*
|
|
4346
|
+
* @param id The unique ID of the document that has been signed.
|
|
4347
|
+
* @param emitter The fingerprint of the key used to produce the signature.
|
|
4348
|
+
* @param signature The detached binary OpenPGP signature made over the document.
|
|
4349
|
+
*/
|
|
4350
|
+
sign(id: bigint, emitter: `0x${string}`, signature: `0x${string}`): Promise<TransactionReceipt>;
|
|
4351
|
+
/**
|
|
4352
|
+
* Timestamps a document by publishing a detached signature of the hash of the document on-chain.
|
|
4353
|
+
*
|
|
4354
|
+
* @param emitter The fingerprint of the key used to produce the signature.
|
|
4355
|
+
* @param dochash The keccak256 hash of the document used to find the timestamp from the document and verify their integrity.
|
|
4356
|
+
* @param signature A detached binary OpenPGP signature made over the raw bytes of the keccak256 hash of the document.
|
|
4357
|
+
*/
|
|
4358
|
+
timestamp(emitter: `0x${string}`, dochash: `0x${string}`, signature: `0x${string}`): Promise<TransactionReceipt>;
|
|
4359
|
+
/**
|
|
4360
|
+
* Revokes a signature previously published on-chain.
|
|
4361
|
+
*
|
|
4362
|
+
* @param id The ID of the document associated with the signature.
|
|
4363
|
+
* @param emitter The fingerprint of the key that made the signature.
|
|
4364
|
+
* @param signatureHash The hash of the signature to revoke.
|
|
4365
|
+
* @param signature A detached binary OpenPGP signature made over the raw bytes of the signature hash.
|
|
4366
|
+
*/
|
|
4367
|
+
revokeSignature(id: bigint, emitter: `0x${string}`, signatureHash: `0x${string}`, signature: `0x${string}`): Promise<TransactionReceipt>;
|
|
4368
|
+
/*****************************************************************************************************************/
|
|
4369
|
+
/*****************************************************************************************************************/
|
|
4370
|
+
/**
|
|
4371
|
+
* Get the address of the Web3PGP contract used as a global public key registry.
|
|
4372
|
+
*
|
|
4373
|
+
* @return The address of the Web3PGP contract used by this contract.
|
|
4374
|
+
*/
|
|
4375
|
+
getWeb3PGPAddress(): Promise<Address>;
|
|
4376
|
+
/**
|
|
4377
|
+
* Returns the ID of the original document that the given document is a copy of.
|
|
4378
|
+
*
|
|
4379
|
+
* @param id The ID of a document that may be a copy of another previously published document.
|
|
4380
|
+
* @return The ID of the original document if the given document is a copy, or 0 if it is not a copy.
|
|
4381
|
+
*/
|
|
4382
|
+
isCopyOf(id: bigint): Promise<bigint>;
|
|
4383
|
+
/**
|
|
4384
|
+
* Returns the block number in which the document or timestamps with the given ID was published.
|
|
4385
|
+
*
|
|
4386
|
+
* @param id The ID of the document whose block number is to be retrieved.
|
|
4387
|
+
* @return The block number in which the document was published. 0 if the document does not exist.
|
|
4388
|
+
*/
|
|
4389
|
+
getDocumentBlockNumberByID(id: bigint): Promise<bigint>;
|
|
4390
|
+
/**
|
|
4391
|
+
* Returns the block numbers in which the documents or timestamps with the given IDs were published.
|
|
4392
|
+
*
|
|
4393
|
+
* @param ids The IDs of the documents whose block numbers are to be retrieved.
|
|
4394
|
+
* @return The block numbers in which the documents were published.
|
|
4395
|
+
*/
|
|
4396
|
+
getDocumentBlockNumberByIDBatch(ids: bigint[]): Promise<bigint[]>;
|
|
4397
|
+
/**
|
|
4398
|
+
* Lists the block numbers when were published the signatures associated with the given document.
|
|
4399
|
+
*
|
|
4400
|
+
* @param id The ID of the document whose signatures are to be listed.
|
|
4401
|
+
* @param start The starting index from which to list signatures (0-based).
|
|
4402
|
+
* @param limit The maximum number of signatures to list.
|
|
4403
|
+
* @return An array of signature IDs associated with the document.
|
|
4404
|
+
*/
|
|
4405
|
+
listSignatures(id: bigint, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
4406
|
+
/**
|
|
4407
|
+
* Returns the block number in which the signature with the given hash was created or 0 if the signature does not exist.
|
|
4408
|
+
*
|
|
4409
|
+
* @param signatureHash The hash of the signature.
|
|
4410
|
+
* @return The block number in which the signature was created, or 0 if the signature does not exist.
|
|
4411
|
+
*/
|
|
4412
|
+
getSignatureBlockNumberByHash(signatureHash: `0x${string}`): Promise<bigint>;
|
|
4413
|
+
/**
|
|
4414
|
+
* Returns the block numbers in which the signatures with the given hashes were created.
|
|
4415
|
+
*
|
|
4416
|
+
* @param signatureHashes The hashes of the signatures.
|
|
4417
|
+
* @return The block numbers in which the signatures were created.
|
|
4418
|
+
*/
|
|
4419
|
+
getSignatureBlockNumberByHashBatch(signatureHashes: `0x${string}`[]): Promise<bigint[]>;
|
|
4420
|
+
/**
|
|
4421
|
+
* Lists the document IDs by the given document hash.
|
|
4422
|
+
*
|
|
4423
|
+
* @param dochash The hash of the document.
|
|
4424
|
+
* @param start The starting index from which to list documents (0-based).
|
|
4425
|
+
* @param limit The maximum number of documents to list.
|
|
4426
|
+
* @return An array of document IDs with the given hash.
|
|
4427
|
+
*/
|
|
4428
|
+
listDocumentIdsByHash(dochash: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
4429
|
+
/**
|
|
4430
|
+
* Lists the block numbers of signature revocations for the given signature hash.
|
|
4431
|
+
*
|
|
4432
|
+
* @param signatureHash The hash of the signature.
|
|
4433
|
+
* @param start The starting index from which to list revocations (0-based).
|
|
4434
|
+
* @param limit The maximum number of revocations to list.
|
|
4435
|
+
* @return An array of block numbers where the signature was revoked.
|
|
4436
|
+
*/
|
|
4437
|
+
listSignatureRevocationsBlockNumbers(signatureHash: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>;
|
|
4438
|
+
/*****************************************************************************************************************/
|
|
4439
|
+
/*****************************************************************************************************************/
|
|
4440
|
+
/**
|
|
4441
|
+
* Searches for Document events emitted by the smart contract, filtered by the provided criteria.
|
|
4442
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
4443
|
+
*
|
|
4444
|
+
* @param ids Filter by document IDs. IDs uniqueness is guaranteed by the smart contract.
|
|
4445
|
+
* @param emitters Filter by emitter fingerprints.
|
|
4446
|
+
* @param dochashes Filter by document hashes.
|
|
4447
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
4448
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
4449
|
+
* @returns The list of DocumentLog matching the provided filters.
|
|
4450
|
+
*/
|
|
4451
|
+
searchDocumentLogs(ids?: bigint[], emitters?: `0x${string}`[], dochashes?: `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<DocumentLog[]>;
|
|
4452
|
+
/**
|
|
4453
|
+
* Retrieves a Document event by its unique ID.
|
|
4454
|
+
*
|
|
4455
|
+
* @param id The unique ID of the document.
|
|
4456
|
+
* @param blockNumber The block number where to search for the document.
|
|
4457
|
+
* @returns The DocumentLog if found, otherwise undefined.
|
|
4458
|
+
* @example
|
|
4459
|
+
* ```typescript
|
|
4460
|
+
* const targetID = 1n;
|
|
4461
|
+
* const blockNumber = await web3Doc.getDocumentBlockNumberByID(targetID);
|
|
4462
|
+
* const documentLog = await web3Doc.getDocumentLogByID(targetID, blockNumber);
|
|
4463
|
+
* ```
|
|
4464
|
+
*/
|
|
4465
|
+
getDocumentLogByID(id: bigint, blockNumber: bigint): Promise<DocumentLog | undefined>;
|
|
4466
|
+
/**
|
|
4467
|
+
* Searches for Copy events emitted by the smart contract, filtered by the provided criteria.
|
|
4468
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
4469
|
+
*
|
|
4470
|
+
* @param copies Filter by copy IDs. Copy IDs uniqueness is guaranteed by the smart contract.
|
|
4471
|
+
* @param originals Filter by original document IDs.
|
|
4472
|
+
* @param emitters Filter by emitter fingerprints.
|
|
4473
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
4474
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
4475
|
+
* @returns The list of CopyLog matching the provided filters.
|
|
4476
|
+
*/
|
|
4477
|
+
searchCopyLogs(copies?: bigint[], originals?: bigint[], emitters?: `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<CopyLog[]>;
|
|
4478
|
+
/**
|
|
4479
|
+
* Retrieves a Copy event by its unique ID.
|
|
4480
|
+
*
|
|
4481
|
+
* @param copy The unique ID of the copy.
|
|
4482
|
+
* @param blockNumber The block number where to search for the copy.
|
|
4483
|
+
* @returns The CopyLog if found, otherwise undefined.
|
|
4484
|
+
* @example
|
|
4485
|
+
* ```typescript
|
|
4486
|
+
* const targetCopyID = 1n;
|
|
4487
|
+
* const blockNumber = await web3Doc.getDocumentBlockNumberByID(targetCopyID);
|
|
4488
|
+
* const copyLog = await web3Doc.getCopyLogByID(targetCopyID, blockNumber);
|
|
4489
|
+
* ```
|
|
4490
|
+
*/
|
|
4491
|
+
getCopyLogByID(copy: bigint, blockNumber: bigint): Promise<CopyLog | undefined>;
|
|
4492
|
+
/**
|
|
4493
|
+
* Searches for Notification events emitted by the smart contract, filtered by the provided criteria.
|
|
4494
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
4495
|
+
*
|
|
4496
|
+
* @param ids Filter by document IDs. Document IDs uniqueness is guaranteed by the smart contract.
|
|
4497
|
+
* @param recipients Filter by recipient fingerprints.
|
|
4498
|
+
* @param signatureRequested Filter by whether a signature was requested or not.
|
|
4499
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
4500
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
4501
|
+
* @returns The list of NotificationLog matching the provided filters.
|
|
4502
|
+
*/
|
|
4503
|
+
searchNotificationLogs(ids?: bigint[], recipients?: `0x${string}`[], signatureRequested?: boolean, fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<NotificationLog[]>;
|
|
4504
|
+
/**
|
|
4505
|
+
* Retrieves a Notification event by its unique ID and recipient.
|
|
4506
|
+
*
|
|
4507
|
+
* @param id The unique ID of the document that is the subject of the notification.
|
|
4508
|
+
* @param recipient The fingerprint of the recipient who received the notification.
|
|
4509
|
+
* @param blockNumber The block number where to search for the notification.
|
|
4510
|
+
* @returns The NotificationLog if found, otherwise undefined.
|
|
4511
|
+
* @example
|
|
4512
|
+
* ```typescript
|
|
4513
|
+
* const targetID = 1n;
|
|
4514
|
+
* const recipientFingerprint = '0x...';
|
|
4515
|
+
* const blockNumber = await web3Doc.getDocumentBlockNumberByID(targetID);
|
|
4516
|
+
* const notificationLog = await web3Doc.getNotificationLog(targetID, recipientFingerprint, blockNumber);
|
|
4517
|
+
* ```
|
|
4518
|
+
*/
|
|
4519
|
+
getNotificationLog(id: bigint, recipient: `0x${string}`, blockNumber: bigint): Promise<NotificationLog | undefined>;
|
|
4520
|
+
/**
|
|
4521
|
+
* Searches for Signature events emitted by the smart contract, filtered by the provided criteria.
|
|
4522
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
4523
|
+
*
|
|
4524
|
+
* @param ids Filter by signature IDs. Signature IDs uniqueness is guaranteed by the smart contract.
|
|
4525
|
+
* @param emitters Filter by emitter fingerprints.
|
|
4526
|
+
* @param signatureHashes Filter by signature hashes.
|
|
4527
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
4528
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
4529
|
+
* @returns The list of SignatureLog matching the provided filters.
|
|
4530
|
+
*/
|
|
4531
|
+
searchSignatureLogs(ids?: bigint[], emitters?: `0x${string}`[], signatureHashes?: `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<SignatureLog[]>;
|
|
4532
|
+
/**
|
|
4533
|
+
* Retrieves Timestamp events emitted by the smart contract, filtered by the provided criteria.
|
|
4534
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
4535
|
+
*
|
|
4536
|
+
* @param ids Filter by timestamp IDs. Timestamp IDs uniqueness is guaranteed by the smart contract.
|
|
4537
|
+
* @param emitters Filter by emitter fingerprints.
|
|
4538
|
+
* @param dochashes Filter by document hashes.
|
|
4539
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
4540
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
4541
|
+
* @returns The list of TimestampLog matching the provided filters.
|
|
4542
|
+
*/
|
|
4543
|
+
searchTimestampLogs(ids?: bigint[], emitters?: `0x${string}`[], dochashes?: `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<TimestampLog[]>;
|
|
4544
|
+
/**
|
|
4545
|
+
* Retrieves a Timestamp event by its unique ID.
|
|
4546
|
+
* @param id The unique ID of the timestamp.
|
|
4547
|
+
* @param blockNumber The block number where to search for the timestamp.
|
|
4548
|
+
* @returns The TimestampLog if found, otherwise undefined.
|
|
4549
|
+
*/
|
|
4550
|
+
getTimestampLogByID(id: bigint, blockNumber: bigint): Promise<TimestampLog | undefined>;
|
|
4551
|
+
/**
|
|
4552
|
+
* Extracts Document logs from a transaction receipt.
|
|
4553
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
4554
|
+
* @param timestamp Optional timestamp to assign to all extracted logs. This is useful when the receipt is from a transaction included in the latest block or in a block that has not been indexed yet.
|
|
4555
|
+
* @returns A promise that resolves to an array of DocumentLog objects.
|
|
4556
|
+
*/
|
|
4557
|
+
extractDocumentLog(receipt: TransactionReceipt, timestamp?: Date): Promise<DocumentLog[]>;
|
|
4558
|
+
/**
|
|
4559
|
+
* Extracts Copy logs from a transaction receipt.
|
|
4560
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
4561
|
+
* @returns A promise that resolves to an array of CopyLog objects.
|
|
4562
|
+
* @returns A promise that resolves to an array of CopyLog objects.
|
|
4563
|
+
*/
|
|
4564
|
+
extractCopyLog(receipt: TransactionReceipt, timestamp?: Date): Promise<CopyLog[]>;
|
|
4565
|
+
/**
|
|
4566
|
+
* Extracts Signature logs from a transaction receipt.
|
|
4567
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
4568
|
+
* @param timestamp Optional timestamp to assign to all extracted logs. This is useful when the receipt is from a transaction included in the latest block or in a block that has not been indexed yet.
|
|
4569
|
+
* @returns A promise that resolves to an array of SignatureLog objects.
|
|
4570
|
+
*/
|
|
4571
|
+
extractSignatureLog(receipt: TransactionReceipt, timestamp?: Date): Promise<SignatureLog[]>;
|
|
4572
|
+
/**
|
|
4573
|
+
* Extracts Timestamp logs from a transaction receipt.
|
|
4574
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
4575
|
+
* @param timestamp Optional timestamp to assign to all extracted logs. This is useful when the receipt is from a transaction included in the latest block or in a block that has not been indexed yet.
|
|
4576
|
+
* @returns A promise that resolves to an array of TimestampLog objects.
|
|
4577
|
+
*/
|
|
4578
|
+
extractTimestampLog(receipt: TransactionReceipt, timestamp?: Date): Promise<TimestampLog[]>;
|
|
4579
|
+
/**
|
|
4580
|
+
* Extracts Notification logs from a transaction receipt.
|
|
4581
|
+
* @param receipt The transaction receipt to extract logs from.
|
|
4582
|
+
* @param timestamp Optional timestamp to assign to all extracted logs. This is useful when the receipt is from a transaction included in the latest block or in a block that has not been indexed yet.
|
|
4583
|
+
* @returns A promise that resolves to an array of NotificationLog objects.
|
|
4584
|
+
*/
|
|
4585
|
+
extractNotificationLog(receipt: TransactionReceipt, timestamp?: Date): Promise<NotificationLog[]>;
|
|
4586
|
+
/**
|
|
4587
|
+
* Retireve signature revocation events emitted by the smart contract, filtered by the provided criteria.
|
|
4588
|
+
* Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.
|
|
4589
|
+
*
|
|
4590
|
+
* @param ids Filter by signature IDs. Signature IDs uniqueness is guaranteed by the smart contract.
|
|
4591
|
+
* @param emitters Filter by emitter fingerprints.
|
|
4592
|
+
* @param signatureHashes Filter by signature hashes.
|
|
4593
|
+
* @param fromBlock Filter events from this block number. Genesis block if not specified.
|
|
4594
|
+
* @param toBlock Filter events up to this block number. Latest block if not specified.
|
|
4595
|
+
* @returns The list of SignatureRevocationLog matching the provided filters.
|
|
4596
|
+
*/
|
|
4597
|
+
searchSignatureRevocationLogs(ids?: bigint[], emitters?: `0x${string}`[], signatureHashes?: `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<SignatureRevocationLog[]>;
|
|
4598
|
+
/**
|
|
4599
|
+
* Retrieves Timestamp events by document hash.
|
|
4600
|
+
* @param dochash The keccak256 hash of the document.
|
|
4601
|
+
* @returns An array of TimestampLog entries associated with the document hash.
|
|
4602
|
+
*/
|
|
4603
|
+
getTimestampLogsByHash(dochash: `0x${string}`): Promise<TimestampLog[]>;
|
|
4604
|
+
extractSignatureRevocationLog(receipt: TransactionReceipt, timestamp?: Date): Promise<SignatureRevocationLog[]>;
|
|
4605
|
+
/*****************************************************************************************************************/
|
|
4606
|
+
/*****************************************************************************************************************/
|
|
4607
|
+
/**
|
|
4608
|
+
* Helper method to fetch all items from a paginated contract method.
|
|
4609
|
+
* @param fetchFn The paginated fetch function to call
|
|
4610
|
+
* @param limit The number of items to fetch per page
|
|
4611
|
+
* @param maxItems The maximum number of items to fetch in total (safety limit)
|
|
4612
|
+
* @returns An array containing all fetched items
|
|
4613
|
+
*/
|
|
4614
|
+
private fetchAllPaginated;
|
|
4615
|
+
}
|
|
4616
|
+
|
|
4617
|
+
/*****************************************************************************************************************/
|
|
4618
|
+
/*****************************************************************************************************************/
|
|
4619
|
+
/**
|
|
4620
|
+
* Base error class for Web3DocService errors.
|
|
4621
|
+
*/
|
|
4622
|
+
declare class Web3DocServiceError extends Error {
|
|
4623
|
+
constructor(message: string);
|
|
4624
|
+
}
|
|
4625
|
+
/**
|
|
4626
|
+
* Error thrown when a critical failure occurs during service operations.
|
|
4627
|
+
*
|
|
4628
|
+
* This error indicates a serious problem that prevents the operation from continuing such as network failures and others has occurred.
|
|
4629
|
+
*/
|
|
4630
|
+
declare class Web3DocServiceCriticalError extends Web3DocServiceError {
|
|
4631
|
+
readonly cause?: Error | undefined;
|
|
4632
|
+
constructor(message: string, cause?: Error | undefined);
|
|
4633
|
+
}
|
|
4634
|
+
/**
|
|
4635
|
+
* Error thrown when document or blockchain data validation fails.
|
|
4636
|
+
*
|
|
4637
|
+
* This can happen because the smart contract does not validate the data it stores, they
|
|
4638
|
+
* have to be verified by the client application. Furthermore, as anyone can submit documents,
|
|
4639
|
+
* malformed or invalid data may be submitted by malicious actors.
|
|
4640
|
+
*/
|
|
4641
|
+
declare class Web3DocServiceValidationError extends Web3DocServiceError {
|
|
4642
|
+
readonly cause?: Error | undefined;
|
|
4643
|
+
constructor(message: string, cause?: Error | undefined);
|
|
4644
|
+
}
|
|
4645
|
+
/*****************************************************************************************************************/
|
|
4646
|
+
/*****************************************************************************************************************/
|
|
4647
|
+
/**
|
|
4648
|
+
* Configuration options for Web3DocService.
|
|
4649
|
+
*/
|
|
4650
|
+
interface Web3DocServiceOptions {
|
|
4651
|
+
/**
|
|
4652
|
+
* Maximum number of concurrent operations performed when processing documents and verifying signatures.
|
|
4653
|
+
*
|
|
4654
|
+
* This limit helps prevent resource exhaustion and rate-limiting issues when interacting with RPC endpoints or
|
|
4655
|
+
* when processing large numbers of documents.
|
|
4656
|
+
*
|
|
4657
|
+
* @default 10
|
|
4658
|
+
*/
|
|
4659
|
+
concurrencyLimit?: number;
|
|
4660
|
+
}
|
|
4661
|
+
/**
|
|
4662
|
+
* Implementation of the Web3Doc service interface.
|
|
4663
|
+
*
|
|
4664
|
+
* This service provides high-level functions for managing documents on the blockchain with integrated
|
|
4665
|
+
* OpenPGP operations to ease developer experience.
|
|
4666
|
+
*/
|
|
4667
|
+
declare class Web3DocService implements IWeb3DocService {
|
|
4668
|
+
private _web3pgpService;
|
|
4669
|
+
private _web3doc;
|
|
4670
|
+
private _options;
|
|
4671
|
+
/**
|
|
4672
|
+
* Creates a new Web3DocService instance.
|
|
4673
|
+
*
|
|
4674
|
+
* @param web3doc An instance implementing the IWeb3Doc interface.
|
|
4675
|
+
* @param options Optional configuration options for the service.
|
|
4676
|
+
*/
|
|
4677
|
+
constructor(web3doc: IWeb3Doc, web3pgpService: IWeb3PGPService, options?: Web3DocServiceOptions);
|
|
4678
|
+
/**
|
|
4679
|
+
* Gets the Web3Doc instance.
|
|
4680
|
+
*/
|
|
4681
|
+
get web3doc(): IWeb3Doc;
|
|
4682
|
+
/**
|
|
4683
|
+
* Sets the Web3Doc instance.
|
|
4684
|
+
*/
|
|
4685
|
+
set web3doc(value: IWeb3Doc);
|
|
4686
|
+
/**
|
|
4687
|
+
* Gets the Web3PGP service instance.
|
|
4688
|
+
*/
|
|
4689
|
+
get web3pgpService(): IWeb3PGPService;
|
|
4690
|
+
/**
|
|
4691
|
+
* Sets the Web3PGP service instance.
|
|
4692
|
+
*/
|
|
4693
|
+
set web3pgpService(value: IWeb3PGPService);
|
|
4694
|
+
/**
|
|
4695
|
+
* Gets the service configuration options.
|
|
4696
|
+
*/
|
|
4697
|
+
get options(): Required<Web3DocServiceOptions>;
|
|
4698
|
+
/**
|
|
4699
|
+
* Sets the service configuration options.
|
|
4700
|
+
*/
|
|
4701
|
+
set options(value: Required<Web3DocServiceOptions>);
|
|
4702
|
+
/*****************************************************************************************************************/
|
|
4703
|
+
/*****************************************************************************************************************/
|
|
4704
|
+
/**
|
|
4705
|
+
* This function allows submitting the data needed to timestamp a document to the Web3Doc smart contract.
|
|
4706
|
+
*
|
|
4707
|
+
* The function will download and verify the emitter's public key using the Web3PGP contract and then it will verify
|
|
4708
|
+
* the provided detached signature over the keccak256 hash of the document. If the signature is valid, it will submit
|
|
4709
|
+
* the hash and the signature to the smart contract for timestamping.
|
|
4710
|
+
*
|
|
4711
|
+
* The service is expected to be configured with a Web3PGP service instance to enable automatic public key retrieval based
|
|
4712
|
+
* on their fingerprint.
|
|
4713
|
+
*
|
|
4714
|
+
* @param hash The keccak256 hash of the document to be timestamped, provided as a Uint8Array.
|
|
4715
|
+
* @param signature The detached OpenPGP signature over the document hash.
|
|
4716
|
+
* @param emitter The fingerprint of the public key used to create the signature. Will be used to download the public key from Web3PGP.
|
|
4717
|
+
* @return A promise that resolves to the ID assigned to the new timestamp and the transaction receipt.
|
|
4718
|
+
*/
|
|
4719
|
+
timestamp(hash: Uint8Array, signature: openpgp.Signature, emitter: `0x${string}`): Promise<[bigint, TransactionReceipt]>;
|
|
4720
|
+
/**
|
|
4721
|
+
* Verifies a timestamp entry on the blockchain by its ID. The function retrieves the timestamp data from the
|
|
4722
|
+
* Web3Doc smart contract and verifies the detached signature over the document hash using the emitter's public key.
|
|
4723
|
+
*
|
|
4724
|
+
* The function returns the document hash, the signature, and the public key used for verification.
|
|
4725
|
+
*
|
|
4726
|
+
* The user can then compare the hash received from this function with the keccak256 hash they compute from their
|
|
4727
|
+
* document to ensure integrity.
|
|
4728
|
+
*
|
|
4729
|
+
* @param id The ID of the timestamp entry to verify.
|
|
4730
|
+
* @returns A promise that resolves to an object containing the document hash, signature, the public key, the transaction hash and the date of the timestamp.
|
|
4731
|
+
*/
|
|
4732
|
+
verifyTimestamp(id: bigint): Promise<{
|
|
4733
|
+
documentHash: Uint8Array;
|
|
4734
|
+
signature: openpgp.Signature;
|
|
4735
|
+
publicKey: openpgp.PublicKey;
|
|
4736
|
+
tx: `0x${string}`;
|
|
4737
|
+
date: Date;
|
|
4738
|
+
}>;
|
|
4739
|
+
/**
|
|
4740
|
+
* Finds all timestamp IDs associated with a given document hash. Timestamp IDs can be used to retrieve and verify
|
|
4741
|
+
* timestamp entries on the blockchain.
|
|
4742
|
+
*
|
|
4743
|
+
* @param hash The keccak256 hash of the document to search for.
|
|
4744
|
+
* @returns A promise that resolves to an array of timestamp IDs associated with the provided document hash.
|
|
4745
|
+
*/
|
|
4746
|
+
findTimestampsByHash(hash: Uint8Array): Promise<bigint[]>;
|
|
4747
|
+
}
|
|
4748
|
+
|
|
4749
|
+
export { BYTES32_ZERO, type CopyLog, type DocumentLog, EventType, type FeesWithdrawnLog, FlatFee, HexTooLongError, type IFlatFee, type IWeb3Doc, type IWeb3DocService, type IWeb3PGP, type IWeb3PGPService, InvalidHexError, type KeyCertificationRevokedLog, type KeyCertifiedLog, type KeyRegisteredLog, type KeyRevokedLog, type KeyUpdatedLog, type NotificationLog, type OwnershipChallengedLog, type OwnershipProvedLog, type Recipient, type RequestedFeeUpdatedLog, type SignatureLog, type SignatureRevocationLog, type SubkeyAddedLog, type TimestampLog, Web3Doc, Web3DocEvents, Web3DocService, Web3DocServiceCriticalError, Web3DocServiceError, type Web3DocServiceOptions, Web3DocServiceValidationError, Web3PGP, type Web3PGPEventLog, Web3PGPEvents, Web3PGPService, Web3PGPServiceCriticalError, Web3PGPServiceError, type Web3PGPServiceOptions, Web3PGPServiceValidationError, to0x, toBytes32 };
|