@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/0xstr.ts","../src/abis/FlatFee.ts","../src/utils/viemutils.ts","../src/flatfee/flatefee.ts","../src/web3pgp/types/types.ts","../src/abis/Web3PGP.ts","../src/web3pgp/web3pgp.ts","../src/utils/openpgp.ts","../src/web3pgp/web3pgp.service.ts","../src/web3doc/types/types.ts","../src/abis/Web3Doc.ts","../src/web3doc/types/errors.ts","../src/web3doc/web3doc.ts","../src/web3doc/web3doc.service.ts"],"names":["isHex","padHex","FlatFee","parseEventLogs","toEventSelector","Web3PGP","openpgp","pLimit","toHex","openpgp2","toBytes","logs","EventType","Web3Doc","openpgp3","hexToBytes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAM,eAAA,GAAN,cAA8B,KAAA,CAAM;AAAA,EAIvC,YAAY,KAAA,EAAe;AACvB,IAAA,KAAA,CAAM,CAAA,qBAAA,EAAwB,KAAK,CAAA,CAAA,CAAG,CAAA;AAJ1C,IAAA,IAAA,CAAgB,IAAA,GAAO,aAAA;AAKnB,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACjB;AACJ;AAEO,IAAM,eAAA,GAAN,cAA8B,KAAA,CAAM;AAAA,EAIvC,YAAY,KAAA,EAAe;AACvB,IAAA,KAAA,CAAM,CAAA,wCAAA,EAA2C,KAAK,CAAA,CAAA,CAAG,CAAA;AAJ7D,IAAA,IAAA,CAAgB,IAAA,GAAO,cAAA;A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QACX,IAAI,SAAA,CAAU,eAAA;AAAA,QACd,MAAM,SAAA,CAAU;AAAA,OACpB;AAAA,IACA,SAAS,KAAA,EAAO;AACZ,MAAA,IAAI,iBAAiB,6BAAA,EAA+B;AAEhD,QAAA,MAAM,IAAI,6BAAA,CAA8B,CAAA,4BAAA,CAAA,EAAgC,KAAK,CAAA;AAAA,MACjF;AACA,MAAA,MAAM,IAAI,2BAAA,CAA4B,4CAAA,EAA8C,KAAA,YAAiB,KAAA,GAAQ,QAAQ,MAAS,CAAA;AAAA,IAClI;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAa,qBAAqB,IAAA,EAAqC;AACnE,IAAA,MAAM,aAAa,MAAM,IAAA,CAAK,QAAQ,sBAAA,CAAuBP,UAAAA,CAAM,IAAI,CAAC,CAAA;AACxE,IAAA,OAAO,UAAA,CAAW,GAAA,CAAI,CAAA,CAAA,KAAK,CAAA,CAAE,EAAE,CAAA;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAOJ","file":"index.js","sourcesContent":["import { isHex, padHex } from \"viem\"\n\nexport class InvalidHexError extends Error {\n public readonly code = 'INVALID_HEX';\n public readonly input: string;\n\n constructor(input: string) {\n super(`Invalid hex string: \"${input}\"`);\n this.name = 'InvalidHexError';\n this.input = input;\n }\n}\n\nexport class HexTooLongError extends Error {\n public readonly code = 'HEX_TOO_LONG';\n public readonly input: string;\n\n constructor(input: string) {\n super(`Hex string too long to fit in bytes32: \"${input}\"`);\n this.name = 'HexTooLongError';\n this.input = input;\n }\n}\n\nexport const BYTES32_ZERO = '0x' + '00'.repeat(32) as `0x${string}`;\n\n/**\n * Normalize a hex fingerprint into a valid bytes32.\n * Pads left with zeros if it's shorter than 32 bytes.\n * \n * @param hex The hex string to normalize.\n * @returns The normalized bytes32 hex string.\n * @throws HexTooLongError If the input hex string is longer than 32 bytes.\n */\nexport function toBytes32(hex: `0x${string}`): `0x${string}` {\n if (!isHex(hex, {strict: true}) || hex.length > 66) { // 2 for \"0x\" + 64 for 32 bytes\n throw new HexTooLongError(hex);\n }\n return padHex(hex, { dir: \"left\", size: 32 });\n}\n\n/**\n * Converts a hex string to a 0x-prefixed hex string.\n * \n * @param hexstr The hex string to convert.\n * @returns The 0x-prefixed hex string.\n * @throws InvalidHexError If the input is not a valid hex string.\n */\nexport function to0x(hexstr: string): `0x${string}` {\n const s = hexstr.trim().toLowerCase().startsWith(\"0x\")\n ? hexstr.trim().toLowerCase()\n : (\"0x\" + hexstr.trim().toLowerCase());\n if (!isHex(s, { strict: true })) {\n throw new InvalidHexError(hexstr);\n }\n return s as `0x${string}`;\n}\n","/**\n * ABI for FlatFee\n * Auto-generated from Foundry build artifacts\n */\nexport const FlatFee = [{\"type\":\"receive\",\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"authority\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isConsumingScheduledOp\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"requestedFee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"setAuthority\",\"inputs\":[{\"name\":\"newAuthority\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"updateRequestedFee\",\"inputs\":[{\"name\":\"newFee\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawFees\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AuthorityUpdated\",\"inputs\":[{\"name\":\"authority\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"FeesWithdrawn\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RequestedFeeUpdated\",\"inputs\":[{\"name\":\"oldFee\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"newFee\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"AccessManagedInvalidAuthority\",\"inputs\":[{\"name\":\"authority\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"AccessManagedRequiredDelay\",\"inputs\":[{\"name\":\"caller\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"delay\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]},{\"type\":\"error\",\"name\":\"AccessManagedUnauthorized\",\"inputs\":[{\"name\":\"caller\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"FeeRequired\",\"inputs\":[{\"name\":\"provided\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"required\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"FeesWithdrawalFailed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidInitialization\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NoDirectPaymentsAllowed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NoFeesToWithdraw\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotInitializing\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ReentrancyGuardReentrantCall\",\"inputs\":[]}] as const;\n\nexport default FlatFee;\n","import { PublicClient } from 'viem';\n\n/**\n * Gets the timestamp of a specific block number.\n * @param client The Viem public client to interact with the blockchain.\n * @param blockNumber The block number to get the timestamp for.\n * @returns The timestamp of the block as a Date object.\n */\nexport async function getBlockTimestamp(client: PublicClient, blockNumber: bigint): Promise<Date> {\n const block = await client.getBlock({ blockNumber });\n return new Date(Number(block.timestamp) * 1000);\n}","import { Address, TransactionReceipt, PublicClient, WalletClient, parseEventLogs } from 'viem';\nimport { IFlatFee } from './flatefee.interface';\nimport { RequestedFeeUpdatedLog, FeesWithdrawnLog } from './types/types';\nimport { FlatFee as FlatFeeABI } from '../abis/FlatFee';\nimport { getBlockTimestamp } from '../utils/viemutils';\n\n/**\n * Implementation of the FlatFee contract interface.\n * \n * This class provides low-level bindings to interact with contracts implementing the IFlatFee interface.\n */\nexport class FlatFee implements IFlatFee {\n\n // Address of the FlatFee contract\n private _address: Address;\n // Viem public client instance used to read from the blockchain\n private _client: PublicClient;\n // Viem wallet client instance used to sign transactions\n private _walletClient: WalletClient | undefined;\n\n /**\n * Creates a new FlatFee instance.\n * \n * @param address The address of the contract implementing IFlatFee.\n * @param client A Viem public client for interacting with the blockchain.\n * @param walletClient Optional Viem wallet client for signing transactions.\n */\n constructor(address: Address, client: PublicClient, walletClient?: WalletClient) {\n this._address = address;\n this._client = client;\n this._walletClient = walletClient;\n }\n\n /*****************************************************************************************************************/\n /* GETTERS AND SETTERS */\n /*****************************************************************************************************************/\n\n /**\n * Gets the contract address.\n */\n get address(): Address {\n return this._address;\n }\n\n /**\n * Sets the contract address.\n */\n set address(value: Address) {\n this._address = value;\n }\n\n /**\n * Gets the Viem public client.\n */\n get client(): PublicClient {\n return this._client;\n }\n\n /**\n * Sets the Viem public client.\n */\n set client(client: PublicClient) {\n this._client = client;\n }\n\n /**\n * Gets the Viem wallet client.\n */\n get walletClient(): WalletClient | undefined {\n return this._walletClient;\n }\n\n /**\n * Sets the Viem wallet client.\n */\n set walletClient(value: WalletClient | undefined) {\n this._walletClient = value;\n }\n\n /**\n * Validate that a wallet client is available for write operations.\n * @throws Error if wallet client is not configured\n */\n protected ensureWalletClient(): void {\n if (!this._walletClient) {\n throw new Error('WalletClient is required for write operations. Please set walletClient before calling this method.');\n }\n }\n\n /*****************************************************************************************************************/\n /* WRITE FUNCTIONS */\n /*****************************************************************************************************************/\n\n /**\n * Updates the requested service fee.\n * \n * @param newFee The new requested fee to be set.\n * @returns The transaction receipt of the update operation.\n */\n public async updateRequestedFee(newFee: bigint): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Simulate client call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: FlatFeeABI,\n functionName: 'updateRequestedFee',\n args: [\n newFee\n ],\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Withdraws the full contract balance to the specified address.\n * @param to The address to which the fees are withdrawn.\n * @dev This function should be restricted to authorized users.\n */\n public async withdrawFees(to: Address): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Simulate client call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: FlatFeeABI,\n functionName: 'withdrawFees',\n args: [\n to\n ],\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /*****************************************************************************************************************/\n /* READ FUNCTIONS */\n /*****************************************************************************************************************/\n\n /**\n * Indicate the fee requested by the smart contract to perform its operations.\n * @returns The requested fee in wei.\n */\n public async requestedFee(): Promise<bigint> {\n return this.client.readContract({\n address: this.address,\n abi: FlatFeeABI,\n functionName: 'requestedFee',\n });\n }\n\n /*****************************************************************************************************************/\n /* LOG SEARCH FUNCTIONS */\n /*****************************************************************************************************************/\n\n /**\n * Searches for RequestedFeeUpdated events emitted by the smart contract.\n * \n * @param fromBlock Filter events from this block number. Genesis block if not specified.\n * @param toBlock Filter events up to this block number. Latest block if not specified.\n * @returns The list of RequestedFeeUpdatedLog matching the provided filters.\n */\n public async searchRequestedFeeUpdatedLogs(\n fromBlock?: bigint,\n toBlock?: bigint\n ): Promise<RequestedFeeUpdatedLog[]> {\n // Use default values: fromBlock = 0n, toBlock = latest block\n const from = fromBlock ?? 0n;\n const to = toBlock ?? await this.client.getBlockNumber();\n\n const logs = await this.client.getLogs({\n address: this.address,\n event: FlatFeeABI.find(item => item.type === 'event' && item.name === 'RequestedFeeUpdated')!,\n fromBlock: from,\n toBlock: to,\n });\n \n return Promise.all(logs.map(async log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: await getBlockTimestamp(this.client, log.blockNumber),\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n oldFee: log.args.oldFee,\n newFee: log.args.newFee\n })));\n }\n\n /**\n * Searches for FeesWithdrawn events emitted by the smart contract.\n * \n * @param recipients Filter by recipient addresses.\n * @param fromBlock Filter events from this block number. Genesis block if not specified.\n * @param toBlock Filter events up to this block number. Latest block if not specified.\n * @returns The list of FeesWithdrawnLog matching the provided filters.\n */\n public async searchFeesWithdrawnLogs(\n recipients?: Address[],\n fromBlock?: bigint,\n toBlock?: bigint\n ): Promise<FeesWithdrawnLog[]> {\n // Use default values: fromBlock = 0n, toBlock = latest block\n const from = fromBlock ?? 0n;\n const to = toBlock ?? await this.client.getBlockNumber();\n\n // Build args filter if recipients are provided\n const args = recipients ? { to: recipients } : undefined;\n\n const logs = await this.client.getLogs({\n address: this.address,\n event: FlatFeeABI.find(item => item.type === 'event' && item.name === 'FeesWithdrawn')!,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n \n return Promise.all(logs.map(async log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: await getBlockTimestamp(this.client, log.blockNumber),\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n to: log.args.to,\n amount: log.args.amount\n })));\n }\n\n /**\n * Extracts FeesWithdrawnLog entries from a transaction receipt.\n * @param receipt The transaction receipt to extract logs from.\n * @returns The list of FeesWithdrawnLog extracted from the receipt.\n */\n public async extractFeesWithdrawnLog(receipt: TransactionReceipt): Promise<FeesWithdrawnLog[]> {\n\n const parsed = parseEventLogs({\n logs: receipt.logs,\n abi: FlatFeeABI,\n eventName: 'FeesWithdrawn'\n });\n\n return Promise.all(parsed.map(async log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: await getBlockTimestamp(this.client, log.blockNumber),\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n to: log.args.to,\n amount: log.args.amount\n })));\n }\n\n /**\n * Extracts RequestedFeeUpdatedLog entries from a transaction receipt.\n * @param receipt The transaction receipt to extract logs from.\n * @returns The list of RequestedFeeUpdatedLog extracted from the receipt.\n */\n public async extractRequestedFeeUpdatedLog(receipt: TransactionReceipt): Promise<RequestedFeeUpdatedLog[]> {\n\n const parsed = parseEventLogs({\n logs: receipt.logs,\n abi: FlatFeeABI,\n eventName: 'RequestedFeeUpdated'\n });\n\n return Promise.all(parsed.map(async log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: await getBlockTimestamp(this.client, log.blockNumber),\n transactionHash: log.transactionHash,\n oldFee: log.args.oldFee,\n newFee: log.args.newFee,\n logIndex: log.logIndex\n })));\n }\n}\n","import { BaseLog } from \"../../common/types/types\";\n\nexport const Web3PGPEvents = {\n KeyRegistered: \"KeyRegistered\",\n KeyUpdated: \"KeyUpdated\",\n SubkeyAdded: \"SubkeyAdded\",\n KeyRevoked: \"KeyRevoked\",\n KeyCertified: \"KeyCertified\",\n KeyCertificationRevoked: \"KeyCertificationRevoked\",\n OwnershipChallenged: \"OwnershipChallenged\",\n OwnershipProved: \"OwnershipProved\",\n} as const;\n\n/**\n * Type representing a KeyRegistered event log emitted by the Web3PGP smart contract.\n * \n * This log contains technical details about the blockchain event as well as the data that were recorded on-chain.\n * The log data are not validated by the smart contract and must be verified by the client application using a\n * OpenPGP implementation.\n */\nexport type KeyRegisteredLog = BaseLog & {\n type: typeof Web3PGPEvents.KeyRegistered;\n // The declared fingerprint of the registered key as bytes32 hex string\n primaryKeyFingerprint: `0x${string}`;\n // The declared fingerprints of any subkeys associated with the registered key as bytes32 hex strings\n subkeyFingerprints: readonly `0x${string}`[];\n // Hex-encoded OpenPGP binary message published on-chain which should contain the public key data\n openPGPMsg: `0x${string}`;\n};\n\n/**\n * Type representing a KeyUpdated event log emitted by the Web3PGP smart contract.\n * \n * This log contains technical details about the blockchain event as well as the data that were recorded on-chain.\n * The log data are not validated by the smart contract and must be verified by the client application using a\n * OpenPGP implementation.\n */\nexport type KeyUpdatedLog = BaseLog & {\n type: typeof Web3PGPEvents.KeyUpdated;\n // The declared fingerprint of the updated key as bytes32 hex string\n fingerprint: `0x${string}`;\n // Hex-encoded OpenPGP binary message published on-chain which should contain the updated public key data\n openPGPMsg: `0x${string}`;\n};\n\n/**\n * Type representing a SubkeyAdded event log emitted by the Web3PGP smart contract.\n * \n * This log contains technical details about the blockchain event as well as the data that were recorded on-chain.\n * The log data are not validated by the smart contract and must be verified by the client application using a\n * OpenPGP implementation.\n */\nexport type SubkeyAddedLog = BaseLog & {\n type: typeof Web3PGPEvents.SubkeyAdded;\n // The declared fingerprint of the primary key to which the subkey was added as bytes32 hex string\n primaryKeyFingerprint: `0x${string}`;\n // The declared fingerprint of the added subkey as bytes32 hex string\n subkeyFingerprint: `0x${string}`;\n // Hex-encoded OpenPGP binary message published on-chain which should contain the public key data\n openPGPMsg: `0x${string}`;\n};\n\n/**\n * Type representing a KeyRevoked event log emitted by the Web3PGP smart contract.\n * \n * This log contains technical details about the blockchain event as well as the data that were recorded on-chain.\n * The log data are not validated by the smart contract and must be verified by the client application using a\n * OpenPGP implementation.\n */\nexport type KeyRevokedLog = BaseLog & {\n type: typeof Web3PGPEvents.KeyRevoked;\n // The declared fingerprint of the revoked key as bytes32 hex string\n fingerprint: `0x${string}`;\n // Hex-encoded OpenPGP binary message published on-chain which should contain the revocation certificate\n revocationCertificate: `0x${string}`;\n};\n\n/**\n * Type representing a KeyCertified event log emitted by the Web3PGP smart contract.\n * \n * This log contains technical details about the blockchain event as well as the data that were recorded on-chain.\n */\nexport type KeyCertifiedLog = BaseLog & {\n type: typeof Web3PGPEvents.KeyCertified;\n // The fingerprint of the certified key as bytes32 hex string\n fingerprint: `0x${string}`;\n // The fingerprint of the issuer that certified the key as bytes32 hex string\n issuerFingerprint: `0x${string}`;\n // Hex-encoded OpenPGP signature that constitutes the key certification\n keyCertificate: `0x${string}`;\n};\n\n/**\n * Type representing a KeyCertificationRevoked event log emitted by the Web3PGP smart contract.\n * \n * This log contains technical details about the blockchain event as well as the data that were recorded on-chain.\n */\nexport type KeyCertificationRevokedLog = BaseLog & {\n type: typeof Web3PGPEvents.KeyCertificationRevoked;\n // The fingerprint of the key whose certification was revoked as bytes32 hex string\n fingerprint: `0x${string}`;\n // The fingerprint of the issuer of the certification as bytes32 hex string\n issuerFingerprint: `0x${string}`;\n // Hex-encoded OpenPGP signature that constitutes the revocation\n revocationSignature: `0x${string}`;\n};\n\n/**\n * Type representing an OwnershipChallenged event log emitted by the Web3PGP smart contract.\n * \n * This log contains technical details about the blockchain event as well as the data that were recorded on-chain.\n */\nexport type OwnershipChallengedLog = BaseLog & {\n type: typeof Web3PGPEvents.OwnershipChallenged;\n // The fingerprint of the challenged key as bytes32 hex string\n fingerprint: `0x${string}`;\n // The challenge data sent to the key owner for signing as bytes32 hex string which is the keccak256 hash of a\n // random nonce\n challenge: `0x${string}`;\n};\n\n/**\n * Type representing an OwnershipProved event log emitted by the Web3PGP smart contract.\n * \n * This log contains technical details about the blockchain event as well as the data that were recorded on-chain.\n */\nexport type OwnershipProvedLog = BaseLog & {\n type: typeof Web3PGPEvents.OwnershipProved;\n // The fingerprint of the key whose ownership was proved as bytes32 hex string\n fingerprint: `0x${string}`;\n // The original challenge data (keccak256 hash of a random nonce) as bytes32 hex string\n challenge: `0x${string}`;\n // Hex-encoded OpenPGP signature made over the challenge data\n signature: `0x${string}`;\n};\n\n/**\n * Union type representing all possible Web3PGP event logs.\n */\nexport type Web3PGPEventLog = KeyRegisteredLog | KeyUpdatedLog | SubkeyAddedLog | KeyRevokedLog | KeyCertifiedLog | KeyCertificationRevokedLog | OwnershipChallengedLog | OwnershipProvedLog;","/**\n * ABI for Web3PGP\n * Auto-generated from Foundry build artifacts\n */\nexport const Web3PGP = [{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"receive\",\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"UPGRADE_INTERFACE_VERSION\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"addSubkey\",\"inputs\":[{\"name\":\"primaryKeyFingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"subkeyFingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"openPGPMsg\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"authority\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"certifyKey\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"issuerFingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"keyCertificate\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"challengeOwnership\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"challenge\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"exists\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"isUsed\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getKeyPublicationBlock\",\"inputs\":[{\"name\":\"fingerprints\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getKeyPublicationBlock\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initialize\",\"inputs\":[{\"name\":\"fee\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"manager\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"initializeUpgrade\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"isConsumingScheduledOp\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isSubKey\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"listCertificationRevocations\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"start\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"limit\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"listCertifications\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"start\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"limit\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"listKeyUpdates\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"start\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"limit\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"listRevocations\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"start\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"limit\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"listSubkeys\",\"inputs\":[{\"name\":\"parentKeyFingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"start\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"limit\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"parentOf\",\"inputs\":[{\"name\":\"subkeyFingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proveOwnership\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"challenge\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"proxiableUUID\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"register\",\"inputs\":[{\"name\":\"primaryKeyFingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"subkeyFingerprints\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"openPGPMsg\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"requestedFee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"revoke\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"revocationCertificate\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"revokeCertification\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"issuerFingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"revocationSignature\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"setAuthority\",\"inputs\":[{\"name\":\"newAuthority\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"update\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"openPGPMsg\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"updateRequestedFee\",\"inputs\":[{\"name\":\"newFee\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeToAndCall\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"withdrawFees\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AuthorityUpdated\",\"inputs\":[{\"name\":\"authority\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"FeesWithdrawn\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"KeyCertificationRevoked\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"issuer\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"revocationSignature\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"KeyCertified\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"issuer\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"keyCertificate\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"KeyRegistered\",\"inputs\":[{\"name\":\"primaryKeyFingerprint\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"subkeyFingerprints\",\"type\":\"bytes32[]\",\"indexed\":false,\"internalType\":\"bytes32[]\"},{\"name\":\"openPGPMsg\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"KeyRevoked\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"revocationCertificate\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"KeyUpdated\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"openPGPMsg\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipChallenged\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"challenge\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipProved\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"challenge\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"signature\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RequestedFeeUpdated\",\"inputs\":[{\"name\":\"oldFee\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"newFee\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SubkeyAdded\",\"inputs\":[{\"name\":\"primaryKeyFingerprint\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"subkeyFingerprint\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"openPGPMsg\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Upgraded\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"AccessManagedInvalidAuthority\",\"inputs\":[{\"name\":\"authority\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"AccessManagedRequiredDelay\",\"inputs\":[{\"name\":\"caller\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"delay\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]},{\"type\":\"error\",\"name\":\"AccessManagedUnauthorized\",\"inputs\":[{\"name\":\"caller\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"AddressEmptyCode\",\"inputs\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"AlreadyRegistered\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"ERC1967InvalidImplementation\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC1967NonPayable\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FailedCall\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FeeRequired\",\"inputs\":[{\"name\":\"provided\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"required\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"FeesWithdrawalFailed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidInitialization\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NoDirectPaymentsAllowed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NoFeesToWithdraw\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotInitializing\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotRegistered\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"ReentrancyGuardReentrantCall\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SelfCertificationNotAllowed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"TargetIsASubkey\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"UUPSUnauthorizedCallContext\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UUPSUnsupportedProxiableUUID\",\"inputs\":[{\"name\":\"slot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]}] as const;\n\nexport default Web3PGP;\n","import { Web3PGP as Web3PGPABI } from '../abis/Web3PGP';\nimport { toBytes32 } from '../utils/0xstr';\nimport { BlockTag, PublicClient, TransactionReceipt, WalletClient, parseEventLogs, toEventSelector } from 'viem';\nimport { IWeb3PGP } from './web3pgp.interface';\nimport { KeyRegisteredLog, SubkeyAddedLog, KeyRevokedLog, KeyCertificationRevokedLog, KeyCertifiedLog, KeyUpdatedLog, OwnershipChallengedLog, OwnershipProvedLog, Web3PGPEvents, Web3PGPEventLog } from './types/types';\nimport { FlatFee } from '../flatfee/flatefee';\nimport { getBlockTimestamp } from '../utils/viemutils';\n\nexport class Web3PGP extends FlatFee implements IWeb3PGP {\n\n static readonly abi = Web3PGPABI;\n\n // Pre-computed event definitions for efficient log queries\n private static readonly KEY_REGISTERED_EVENT = Web3PGPABI.find(item => item.type === 'event' && item.name === 'KeyRegistered')!;\n private static readonly SUBKEY_ADDED_EVENT = Web3PGPABI.find(item => item.type === 'event' && item.name === 'SubkeyAdded')!;\n private static readonly KEY_REVOKED_EVENT = Web3PGPABI.find(item => item.type === 'event' && item.name === 'KeyRevoked')!;\n private static readonly KEY_UPDATED_EVENT = Web3PGPABI.find(item => item.type === 'event' && item.name === 'KeyUpdated')!;\n private static readonly OWNERSHIP_CHALLENGED_EVENT = Web3PGPABI.find(item => item.type === 'event' && item.name === 'OwnershipChallenged')!;\n private static readonly OWNERSHIP_PROVED_EVENT = Web3PGPABI.find(item => item.type === 'event' && item.name === 'OwnershipProved')!;\n private static readonly KEY_CERTIFIED_EVENT = Web3PGPABI.find(item => item.type === 'event' && item.name === 'KeyCertified')!;\n private static readonly KEY_CERTIFICATION_REVOKED_EVENT = Web3PGPABI.find(item => item.type === 'event' && item.name === 'KeyCertificationRevoked')!;\n\n constructor(address: `0x${string}`, client: PublicClient, walletClient?: WalletClient) {\n super(address, client, walletClient);\n }\n\n /*****************************************************************************************************************/\n /* READ FUNCTIONS */\n /*****************************************************************************************************************/\n\n /**\n * Check if a given fingerprint has been used to register a key in the contract.\n * @param fingerprint The fingerprint of the key to check.\n * @return True if the fingerprint has been used to register a key in the contract, false otherwise.\n */\n public exists(fingerprint: `0x${string}`): Promise<boolean> {\n return this.client.readContract({\n address: this.address,\n abi: Web3PGPABI,\n functionName: 'exists',\n args: [toBytes32(fingerprint)],\n });\n }\n\n /**\n * Check if a given fingerprint corresponds to a key registered as a subkey in the contract.\n * @param fingerprint The fingerprint of the key to check.\n * @return True if the key is a subkey, false otherwise.\n */\n public isSubKey(fingerprint: `0x${string}`): Promise<boolean> {\n return this.client.readContract({\n address: this.address,\n abi: Web3PGPABI,\n functionName: 'isSubKey',\n args: [toBytes32(fingerprint)],\n });\n }\n\n /**\n * Get the fingerprint of the parent key for a given subkey.\n * @param subkeyFingerprint The fingerprint of the subkey.\n * @return The fingerprint of the parent key or zero bytes if there is no parent.\n */\n public parentOf(subkeyFingerprint: `0x${string}`): Promise<`0x${string}`> {\n return this.client.readContract({\n address: this.address,\n abi: Web3PGPABI,\n functionName: 'parentOf',\n args: [toBytes32(subkeyFingerprint)],\n });\n }\n\n /**\n * Get the block number when a key was published.\n * @param fingerprint The fingerprint of the key to check.\n * @return The block number when the key was published, or 0 if not published.\n */\n public getKeyPublicationBlock(fingerprint: `0x${string}`): Promise<bigint> {\n return this.client.readContract({\n address: this.address,\n abi: Web3PGPABI,\n functionName: 'getKeyPublicationBlock',\n args: [toBytes32(fingerprint)],\n });\n }\n\n /**\n * Get the block numbers when multiple keys were published.\n * @param fingerprints The fingerprints of the keys to check.\n * @return An array of block numbers corresponding to each fingerprint in the order they were provided.\n */\n public getKeyPublicationBlockBatch(fingerprints: `0x${string}`[]): Promise<bigint[]> {\n return this.client.readContract({\n address: this.address,\n abi: Web3PGPABI,\n functionName: 'getKeyPublicationBlock',\n args: [fingerprints.map(fp => toBytes32(fp))],\n }) as Promise<bigint[]>;\n }\n\n /**\n * List the block numbers when updates were published for the given fingerprint.\n * @param fingerprint The fingerprint of the key to check.\n * @param start The starting index in the list of updates.\n * @param limit The maximum number of results to return.\n * @return An array of block numbers when updates were published.\n */\n listKeyUpdates(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]>{\n return this.client.readContract({\n address: this.address,\n abi: Web3PGPABI,\n functionName: 'listKeyUpdates',\n args: [toBytes32(fingerprint), start, limit],\n }) as Promise<bigint[]>;\n }\n\n /**\n * List the block numbers when revocation certificates were published for the given fingerprint.\n * @param fingerprint The fingerprint of the key to check.\n * @param start The starting index in the list of revocations.\n * @param limit The maximum number of results to return.\n * @return An array of block numbers when revocation certificates were published.\n */\n public listRevocations(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]> {\n return this.client.readContract({\n address: this.address,\n abi: Web3PGPABI,\n functionName: 'listRevocations',\n args: [toBytes32(fingerprint), start, limit],\n }) as Promise<bigint[]>;\n }\n\n /**\n * List the fingerprints of subkeys registered under a given parent key.\n * @param parentKeyFingerprint The fingerprint of the parent key to check.\n * @param start The starting index in the list of subkeys.\n * @param limit The maximum number of results to return.\n * @return An array of subkey fingerprints.\n */\n public listSubkeys(parentKeyFingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<`0x${string}`[]> {\n return this.client.readContract({\n address: this.address,\n abi: Web3PGPABI,\n functionName: 'listSubkeys',\n args: [toBytes32(parentKeyFingerprint), start, limit],\n }) as Promise<`0x${string}`[]>;\n }\n\n /**\n * List the block numbers when key certifications were issued for a given key.\n * @param fingerprint The fingerprint of the key.\n * @param start The starting index in the list of certifications.\n * @param limit The maximum number of results to return.\n * @return An array of block numbers when certifications were issued.\n */\n public listCertifications(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]> {\n return this.client.readContract({\n address: this.address,\n abi: Web3PGPABI,\n functionName: 'listCertifications',\n args: [toBytes32(fingerprint), start, limit],\n }) as Promise<bigint[]>;\n }\n\n /**\n * List the block numbers when key certification revocations were issued for a given key.\n * @param fingerprint The fingerprint of the key.\n * @param start The starting index in the list of revocations.\n * @param limit The maximum number of results to return.\n * @return An array of block numbers when certification revocations were issued.\n */\n public listCertificationRevocations(fingerprint: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]> {\n return this.client.readContract({\n address: this.address,\n abi: Web3PGPABI,\n functionName: 'listCertificationRevocations',\n args: [toBytes32(fingerprint), start, limit],\n }) as Promise<bigint[]>;\n }\n\n /*****************************************************************************************************************/\n /* WRITE FUNCTIONS (PAYABLE) */\n /*****************************************************************************************************************/\n\n /**\n * Register a new primary public key and its optional subkeys.\n * @param primaryKeyFingerprint The declared fingerprint of the primary public key.\n * @param subkeyFingerprints Optional array of declared fingerprints of the subkeys attached to the primary key.\n * @param openPGPMsg A binary OpenPGP message containing the primary key, binding signature, metadata, and subkeys.\n * @return Transaction receipt after registration.\n */\n public async register(\n primaryKeyFingerprint: `0x${string}`,\n subkeyFingerprints: `0x${string}`[],\n openPGPMsg: `0x${string}`\n ): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the required fee for registration\n const fee = await this.requestedFee();\n // Simulate the contract call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3PGPABI,\n functionName: 'register',\n args: [\n toBytes32(primaryKeyFingerprint),\n subkeyFingerprints.map(fp => toBytes32(fp)),\n openPGPMsg\n ],\n value: fee\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Update an existing key with new OpenPGP metadata.\n * @param fingerprint The fingerprint of the key to update.\n * @param openPGPMsg A binary OpenPGP message containing updated key material and signatures.\n * @return Transaction receipt after updating the key.\n */\n public async update(fingerprint: `0x${string}`, openPGPMsg: `0x${string}`): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n const fee = await this.requestedFee();\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3PGPABI,\n functionName: 'update',\n args: [toBytes32(fingerprint), openPGPMsg],\n value: fee\n });\n const txhash = await this.walletClient!.writeContract(request);\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Add a new subkey to an already registered primary key.\n * @param primaryKeyFingerprint The fingerprint of the primary key to which to attach the subkey.\n * @param subkeyFingerprint The fingerprint of the subkey.\n * @param openPGPMsg A binary OpenPGP message containing the subkey and its key binding signatures.\n * @return Transaction receipt after adding the subkey.\n */\n public async addSubkey(\n primaryKeyFingerprint: `0x${string}`,\n subkeyFingerprint: `0x${string}`,\n openPGPMsg: `0x${string}`\n ): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the required fee for adding a subkey\n const fee = await this.requestedFee();\n // Simulate the contract call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3PGPABI,\n functionName: 'addSubkey',\n args: [\n toBytes32(primaryKeyFingerprint),\n toBytes32(subkeyFingerprint),\n openPGPMsg\n ],\n value: fee\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Publish a key revocation certificate for a target public key.\n * @param fingerprint The fingerprint of the key to be revoked.\n * @param revocationCertificate The binary OpenPGP message containing the key revocation certificate.\n * @return Transaction receipt after publishing the revocation.\n */\n public async revoke(fingerprint: `0x${string}`, revocationCertificate: `0x${string}`): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the required fee for revocation\n const fee = await this.requestedFee();\n // Simulate the contract call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3PGPABI,\n functionName: 'revoke',\n args: [\n toBytes32(fingerprint),\n revocationCertificate\n ],\n value: fee\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Certify a key by issuing a key certification signature.\n * @param fingerprint The fingerprint of the key being certified.\n * @param issuerFingerprint The fingerprint of the key issuing the certification.\n * @param keyCertificate A binary OpenPGP signature constituting the key certification.\n * @return Transaction receipt after publishing the certification.\n */\n public async certifyKey(\n fingerprint: `0x${string}`,\n issuerFingerprint: `0x${string}`,\n keyCertificate: `0x${string}`\n ): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the required fee for certification\n const fee = await this.requestedFee();\n // Simulate the contract call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3PGPABI,\n functionName: 'certifyKey',\n args: [\n toBytes32(fingerprint),\n toBytes32(issuerFingerprint),\n keyCertificate\n ],\n value: fee\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Revoke a key certification.\n * @param fingerprint The fingerprint of the key whose certification is being revoked.\n * @param issuerFingerprint The fingerprint of the issuer of the certification to revoke.\n * @param revocationSignature A signature constituting the revocation of the certification.\n * @return Transaction receipt after publishing the revocation.\n */\n public async revokeCertification(\n fingerprint: `0x${string}`,\n issuerFingerprint: `0x${string}`,\n revocationSignature: `0x${string}`\n ): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the required fee for revocation\n const fee = await this.requestedFee();\n // Simulate the contract call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3PGPABI,\n functionName: 'revokeCertification',\n args: [\n toBytes32(fingerprint),\n toBytes32(issuerFingerprint),\n revocationSignature\n ],\n value: fee\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Challenge ownership of a public key.\n * @param fingerprint The fingerprint of the key to challenge.\n * @param challengeHash The keccak256 hash of the challenge data sent to the user for signing.\n * @return Transaction receipt after issuing the challenge.\n */\n public async challengeOwnership(\n fingerprint: `0x${string}`,\n challengeHash: `0x${string}`\n ): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the required fee for challenge\n const fee = await this.requestedFee();\n // Simulate the contract call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3PGPABI,\n functionName: 'challengeOwnership',\n args: [\n toBytes32(fingerprint),\n toBytes32(challengeHash)\n ],\n value: fee\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Prove ownership of a public key by responding to a challenge.\n * @param fingerprint The fingerprint of the key.\n * @param challengeHash The keccak256 hash of the challenge data.\n * @param signature A signature made over the challenge data.\n * @return Transaction receipt after proving ownership.\n */\n public async proveOwnership(\n fingerprint: `0x${string}`,\n challengeHash: `0x${string}`,\n signature: `0x${string}`\n ): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the required fee for proof\n const fee = await this.requestedFee();\n // Simulate the contract call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3PGPABI,\n functionName: 'proveOwnership',\n args: [\n toBytes32(fingerprint),\n toBytes32(challengeHash),\n signature\n ],\n value: fee\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /*****************************************************************************************************************/\n /* LOGS FUNCTIONS */\n /*****************************************************************************************************************/\n\n /**\n * Get the log of a key registration event using the provided primary key fingerprint and block number.\n *\n * @param primaryKeyFingerprint The fingerprint of the primary key to retrieve the log for.\n * @param blockNumber The block number where the event was emitted.\n * @throws Error if the event log cannot be found.\n * @return The KeyRegisteredLog object containing event details.\n */\n public async getKeyRegisteredLog(primaryKeyFingerprint: `0x${string}`, blockNumber: bigint): Promise<KeyRegisteredLog> {\n const logs = await this.searchKeyRegisteredLogs(primaryKeyFingerprint, blockNumber, blockNumber);\n if (logs.length === 1) return logs[0]!;\n if (logs.length === 0) throw new Error(`KeyRegistered event log not found for primaryKeyFingerprint ${primaryKeyFingerprint} at block ${blockNumber}`);\n throw new Error(`Multiple KeyRegistered logs found for primaryKeyFingerprint ${primaryKeyFingerprint} at block ${blockNumber}`);\n }\n\n /**\n * Search for KeyRegistered event logs.\n *\n * @param primaryKeyFingerprint The fingerprint(s) of the primary key to search logs for. Default to all keys.\n * @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.\n * @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.\n * @return An array of KeyRegisteredLog objects matching the search criteria.\n */\n public async searchKeyRegisteredLogs(primaryKeyFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyRegisteredLog[]> {\n \n // Reject pending block tags for fromBlock/toBlock\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n // Use default values: fromBlock = 0n, toBlock = latest block\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n // Build args only if primaryKeyFingerprint is provided\n const args = primaryKeyFingerprint !== undefined ? {\n primaryKeyFingerprint: Array.isArray(primaryKeyFingerprint) ? primaryKeyFingerprint.map(toBytes32) : toBytes32(primaryKeyFingerprint)\n } : undefined;\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3PGP.KEY_REGISTERED_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n \n // Batch fetch timestamps for unique block numbers\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return logs.map(log => ({\n type: Web3PGPEvents.KeyRegistered,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n primaryKeyFingerprint: log.args.primaryKeyFingerprint,\n subkeyFingerprints: log.args.subkeyFingerprints,\n openPGPMsg: log.args.openPGPMsg\n }));\n }\n\n /**\n * Search for KeyUpdated event logs.\n * @param fingerprint The fingerprint(s) of the key to search logs for. Default to all keys.\n * @param fromBlock The starting block number of the search range. 'earliest' is used by default.\n * @param toBlock The ending block number of the search range. 'latest' is used by default.\n * @return An array of KeyUpdatedLog objects matching the search criteria.\n */\n public async searchKeyUpdatedLogs(fingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyUpdatedLog[]> {\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n const args = fingerprint !== undefined ? {\n fingerprint: Array.isArray(fingerprint) ? fingerprint.map(toBytes32) : toBytes32(fingerprint)\n } : undefined;\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3PGP.KEY_UPDATED_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return logs.map(log => ({\n type: Web3PGPEvents.KeyUpdated,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n openPGPMsg: log.args.openPGPMsg\n }));\n }\n\n /**\n * Get the log of a subkey addition event using the provided primary key fingerprint, subkey fingerprint, and block number.\n * @param primaryKeyFingerprint The fingerprint of the primary key.\n * @param subkeyFingerprint The fingerprint of the subkey.\n * @param blockNumber The block number where the event was emitted.\n * @throws Error if the event log cannot be found.\n * @return The SubkeyAddedLog object containing event details.\n */\n public async getSubkeyAddedLog(primaryKeyFingerprint: `0x${string}`, subkeyFingerprint: `0x${string}`, blockNumber: bigint): Promise<SubkeyAddedLog> {\n const logs = await this.searchSubkeyAddedLogs(primaryKeyFingerprint, subkeyFingerprint, blockNumber, blockNumber);\n if (logs.length === 1) return logs[0]!;\n if (logs.length === 0) throw new Error(`SubkeyAdded event log not found for primaryKeyFingerprint ${primaryKeyFingerprint}, subkeyFingerprint ${subkeyFingerprint} at block ${blockNumber}`);\n throw new Error(`Multiple SubkeyAdded logs found for primaryKeyFingerprint ${primaryKeyFingerprint}, subkeyFingerprint ${subkeyFingerprint} at block ${blockNumber}`);\n }\n\n /**\n * Search for SubkeyAdded event logs.\n * @param primaryKeyFingerprint The fingerprint(s) of the primary key to search logs for. Default to all keys.\n * @param subkeyFingerprint The fingerprint(s) of the subkey to search logs for. Default to all subkeys.\n * @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.\n * @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.\n * @return An array of SubkeyAddedLog objects matching the search criteria.\n */\n public async searchSubkeyAddedLogs(primaryKeyFingerprint?: `0x${string}` | `0x${string}`[], subkeyFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<SubkeyAddedLog[]> {\n \n /// Reject pending block tags for fromBlock/toBlock\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n // Use default values: fromBlock = 0n, toBlock = latest block\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n // Build args object, including only defined properties\n let args: any = undefined;\n if (primaryKeyFingerprint !== undefined || subkeyFingerprint !== undefined) {\n args = {};\n if (primaryKeyFingerprint !== undefined) {\n args.primaryKeyFingerprint = Array.isArray(primaryKeyFingerprint) ? primaryKeyFingerprint.map(toBytes32) : toBytes32(primaryKeyFingerprint);\n }\n if (subkeyFingerprint !== undefined) {\n args.subkeyFingerprint = Array.isArray(subkeyFingerprint) ? subkeyFingerprint.map(toBytes32) : toBytes32(subkeyFingerprint);\n }\n }\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3PGP.SUBKEY_ADDED_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n \n // Batch fetch timestamps for unique block numbers\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return logs.map(log => ({\n type: Web3PGPEvents.SubkeyAdded,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n primaryKeyFingerprint: log.args.primaryKeyFingerprint,\n subkeyFingerprint: log.args.subkeyFingerprint,\n openPGPMsg: log.args.openPGPMsg\n }));\n }\n\n /**\n * Search for KeyRevoked event logs.\n * @param fingerprint The fingerprint(s) of the key to search logs for. Default to all keys.\n * @param fromBlock The starting block number of the search range. 'earliest' is used by default. 'pending' is not allowed.\n * @param toBlock The ending block number of the search range. 'latest' is used by default. 'pending' is not allowed.\n * @return An array of KeyRevokedLog objects matching the search criteria.\n */\n public async searchKeyRevokedLogs(fingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyRevokedLog[]> {\n /// Reject pending block tags for fromBlock/toBlock\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n // Use default values: fromBlock = earliest, toBlock = latest \n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n // Build args only if fingerprint is provided\n const args = fingerprint !== undefined ? {\n fingerprint: Array.isArray(fingerprint) ? fingerprint.map(toBytes32) : toBytes32(fingerprint)\n } : undefined;\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3PGP.KEY_REVOKED_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n \n // Batch fetch timestamps for unique block numbers\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return logs.map(log => ({\n type: Web3PGPEvents.KeyRevoked,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n revocationCertificate: log.args.revocationCertificate\n }));\n }\n\n /**\n * Search for OwnershipProved event logs.\n * @param fingerprint The fingerprint(s) of the key whose ownership proofs to search for. Default to all keys.\n * @param challenge The challenge(s) whose ownership proofs to search for. Default to all challenges.\n * @param fromBlock Starting block number (inclusive). 'earliest' block is used if not provided. 'pending' is not allowed.\n * @param toBlock Ending block number (inclusive). 'latest' block is used if not provided. 'pending' is not allowed.\n * @returns An array of OwnershipProvedLog objects matching the search criteria.\n */\n public async searchOwnershipChallengedLogs(fingerprint?: `0x${string}` | `0x${string}`[], challenge?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<OwnershipChallengedLog[]> {\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n let args: any = undefined;\n if (fingerprint !== undefined || challenge !== undefined) {\n args = {};\n if (fingerprint !== undefined) {\n args.fingerprint = Array.isArray(fingerprint) ? fingerprint.map(toBytes32) : toBytes32(fingerprint);\n }\n if (challenge !== undefined) {\n args.challenge = Array.isArray(challenge) ? challenge.map(toBytes32) : toBytes32(challenge);\n }\n }\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3PGP.OWNERSHIP_CHALLENGED_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return logs.map(log => ({\n type: Web3PGPEvents.OwnershipChallenged,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n challenge: log.args.challenge\n }));\n }\n\n /**\n * Search for OwnershipProved event logs.\n * @param fingerprint The fingerprint(s) of the key whose ownership proofs to search for. Default to all keys.\n * @param challenge The challenge(s) associated with the ownership proofs. Default to all challenges.\n * @param fromBlock Starting block number (inclusive). 'earliest' block is used if not provided. 'pending' is not allowed.\n * @param toBlock Ending block number (inclusive). 'latest' block is used if not provided. 'pending' is not allowed.\n * @returns An array of OwnershipProvedLog objects matching the search criteria.\n */\n public async searchOwnershipProvedLogs(fingerprint?: `0x${string}` | `0x${string}`[], challenge?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<OwnershipProvedLog[]> {\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n let args: any = undefined;\n if (fingerprint !== undefined || challenge !== undefined) {\n args = {};\n if (fingerprint !== undefined) {\n args.fingerprint = Array.isArray(fingerprint) ? fingerprint.map(toBytes32) : toBytes32(fingerprint);\n }\n if (challenge !== undefined) {\n args.challenge = Array.isArray(challenge) ? challenge.map(toBytes32) : toBytes32(challenge);\n }\n }\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3PGP.OWNERSHIP_PROVED_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return logs.map(log => ({\n type: Web3PGPEvents.OwnershipProved,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n challenge: log.args.challenge,\n signature: log.args.signature\n }));\n }\n\n /**\n * Search for KeyCertified event logs.\n * \n * @param fingerprint The fingerprint(s) of the key being certified. Default to all keys.\n * @param issuerFingerprint The fingerprint(s) of the issuer of the certification. Default to all issuers.\n * @param fromBlock Starting block number (inclusive). 'earliest' block is used if not provided. 'pending' is not allowed.\n * @param toBlock Ending block number (inclusive). 'latest' block is used if not provided. 'pending' is not allowed.\n * @returns An array of KeyCertifiedLog objects matching the search criteria.\n */\n public async searchKeyCertifiedLogs(fingerprint?: `0x${string}` | `0x${string}`[], issuerFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyCertifiedLog[]> {\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n let args: any = undefined;\n if (fingerprint !== undefined || issuerFingerprint !== undefined) {\n args = {};\n if (fingerprint !== undefined) {\n args.fingerprint = Array.isArray(fingerprint) ? fingerprint.map(toBytes32) : toBytes32(fingerprint);\n }\n if (issuerFingerprint !== undefined) {\n args.issuerFingerprint = Array.isArray(issuerFingerprint) ? issuerFingerprint.map(toBytes32) : toBytes32(issuerFingerprint);\n }\n }\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3PGP.KEY_CERTIFIED_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return logs.map(log => ({\n type: Web3PGPEvents.KeyCertified,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n issuerFingerprint: log.args.issuer,\n keyCertificate: log.args.keyCertificate\n }));\n }\n\n /**\n * Search for KeyCertificationRevoked event logs.\n * \n * @param fingerprint The fingerprint(s) of the key whose certification revocations to search for. Default to all keys.\n * @param issuerFingerprint The fingerprint(s) of the issuers whose certification revocations to search for. Default to all issuers.\n * @param fromBlock Starting block number (inclusive). 'earliest' block is used if not provided. 'pending' is not allowed.\n * @param toBlock Ending block number (inclusive). 'latest' block is used if not provided. 'pending' is not allowed.\n * @returns An array of KeyCertificationRevokedLog objects matching the search criteria.\n */\n public async searchKeyCertificationRevokedLogs(fingerprint?: `0x${string}` | `0x${string}`[], issuerFingerprint?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<KeyCertificationRevokedLog[]> {\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n let args: any = undefined;\n if (fingerprint !== undefined || issuerFingerprint !== undefined) {\n args = {};\n if (fingerprint !== undefined) {\n args.fingerprint = Array.isArray(fingerprint) ? fingerprint.map(toBytes32) : toBytes32(fingerprint);\n }\n if (issuerFingerprint !== undefined) {\n args.issuerFingerprint = Array.isArray(issuerFingerprint) ? issuerFingerprint.map(toBytes32) : toBytes32(issuerFingerprint);\n }\n }\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3PGP.KEY_CERTIFICATION_REVOKED_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return logs.map(log => ({\n type: Web3PGPEvents.KeyCertificationRevoked,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n issuerFingerprint: log.args.issuer,\n revocationSignature: log.args.revocationSignature\n }));\n }\n\n /**\n * Searches for all key-related events within a specified block range. Optionally filters by fingerprints.\n * \n * Note: The fingerprints are the subjects of the events (i.e., the keys being registered, updated, revoked, certified, etc.).\n * Results will also include subkeys added, challenges, and proofs of ownership related to the listed fingerprints.\n * \n * @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.\n * @param fromBlock Starting block number (inclusive). Defaults to 'earliest' if not provided. 'pending' is not allowed.\n * @param toBlock Ending block number (inclusive). Defaults to 'latest' if not provided. 'pending' is not allowed.\n * @return An array of Web3PGPEventLog.\n */\n public async searchKeyEvents(fingerprints?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<Web3PGPEventLog[]> {\n \n // Reject pending block tags for fromBlock/toBlock\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n \n // Use default values: fromBlock = earliest, toBlock = latest\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n // Prepare event selectors for all key-related events (topic 0)\n const eventSelectors = [\n Web3PGP.KEY_REGISTERED_EVENT,\n Web3PGP.SUBKEY_ADDED_EVENT,\n Web3PGP.KEY_REVOKED_EVENT,\n Web3PGP.KEY_UPDATED_EVENT,\n Web3PGP.OWNERSHIP_CHALLENGED_EVENT,\n Web3PGP.OWNERSHIP_PROVED_EVENT,\n Web3PGP.KEY_CERTIFIED_EVENT,\n Web3PGP.KEY_CERTIFICATION_REVOKED_EVENT\n ].map(abi => toEventSelector(abi));\n\n // Prepare topic 1 if fingerprints are provided\n const fingerprintsArray = fingerprints !== undefined ? (Array.isArray(fingerprints) ? fingerprints.map(fp => toBytes32(fp)) : [toBytes32(fingerprints)]) : undefined;\n\n // Use low-level eth_getLogs to fetch all relevant logs in one call\n const rawLogs = await this.client.request({ \n method: 'eth_getLogs',\n params: [{\n address: this.address,\n fromBlock: typeof from === 'bigint' ? `0x${from.toString(16)}` : from,\n toBlock: typeof to === 'bigint' ? `0x${to.toString(16)}` : to,\n topics: fingerprintsArray !== undefined ? [eventSelectors, fingerprintsArray] : [eventSelectors]\n }]\n });\n\n // Parse the raw logs using the ABI\n const parsedLogs = parseEventLogs({\n abi: Web3PGPABI,\n logs: rawLogs,\n strict: true\n });\n\n // Batch fetch timestamps for unique block numbers\n // Ensure blockNumbers are bigint (convert from hex strings if needed)\n const uniqueBlocks = [...new Set(parsedLogs.map(l => {\n const blockNum = l.blockNumber;\n return typeof blockNum === 'string' ? BigInt(blockNum) : blockNum;\n }))];\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return parsedLogs.map(log => {\n // Convert blockNumber to bigint if it's a string\n const blockNumber = typeof log.blockNumber === 'string' ? BigInt(log.blockNumber) : log.blockNumber;\n \n const baseLog = {\n blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(blockNumber)!,\n transactionHash: log.transactionHash\n };\n\n switch (log.eventName) {\n case 'KeyRegistered':\n return {\n ...baseLog,\n type: Web3PGPEvents.KeyRegistered,\n primaryKeyFingerprint: log.args.primaryKeyFingerprint,\n subkeyFingerprints: log.args.subkeyFingerprints,\n openPGPMsg: log.args.openPGPMsg\n } as KeyRegisteredLog;\n case 'SubkeyAdded':\n return {\n ...baseLog,\n type: Web3PGPEvents.SubkeyAdded,\n primaryKeyFingerprint: log.args.primaryKeyFingerprint,\n subkeyFingerprint: log.args.subkeyFingerprint,\n openPGPMsg: log.args.openPGPMsg\n } as SubkeyAddedLog;\n case 'KeyRevoked':\n return {\n ...baseLog,\n type: Web3PGPEvents.KeyRevoked,\n fingerprint: log.args.fingerprint,\n revocationCertificate: log.args.revocationCertificate\n } as KeyRevokedLog;\n case 'KeyUpdated':\n return {\n ...baseLog,\n type: Web3PGPEvents.KeyUpdated,\n fingerprint: log.args.fingerprint,\n openPGPMsg: log.args.openPGPMsg\n } as KeyUpdatedLog;\n case 'OwnershipChallenged':\n return {\n ...baseLog,\n type: Web3PGPEvents.OwnershipChallenged,\n fingerprint: log.args.fingerprint,\n challenge: log.args.challenge\n } as OwnershipChallengedLog;\n case 'OwnershipProved':\n return {\n ...baseLog,\n type: Web3PGPEvents.OwnershipProved,\n fingerprint: log.args.fingerprint,\n challenge: log.args.challenge,\n signature: log.args.signature\n } as OwnershipProvedLog;\n case 'KeyCertified':\n return {\n ...baseLog,\n type: Web3PGPEvents.KeyCertified,\n fingerprint: log.args.fingerprint,\n issuerFingerprint: log.args.issuer,\n keyCertificate: log.args.keyCertificate\n } as KeyCertifiedLog;\n case 'KeyCertificationRevoked':\n return {\n ...baseLog,\n type: Web3PGPEvents.KeyCertificationRevoked,\n fingerprint: log.args.fingerprint,\n issuerFingerprint: log.args.issuer,\n revocationSignature: log.args.revocationSignature\n } as KeyCertificationRevokedLog;\n default:\n // This should never happen due to strict parsing\n throw new Error(`Unhandled event type: ${log.eventName}`);\n }\n });\n }\n\n /**\n * Extract KeyRegistered event logs from a transaction receipt.\n * @param receipt The transaction receipt to extract logs from.\n * @returns An array of KeyRegisteredLog objects extracted from the receipt.\n */\n public async extractKeyRegisteredLog(receipt: TransactionReceipt): Promise<KeyRegisteredLog[]> {\n let parsedLogs = parseEventLogs({\n abi: Web3PGPABI,\n eventName: 'KeyRegistered',\n logs: receipt.logs\n });\n\n const uniqueBlocks = Array.from(new Set(parsedLogs.map(log => log.blockNumber)));\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return parsedLogs.map(log => ({\n type: Web3PGPEvents.KeyRegistered,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n primaryKeyFingerprint: log.args.primaryKeyFingerprint,\n subkeyFingerprints: log.args.subkeyFingerprints,\n openPGPMsg: log.args.openPGPMsg\n }));\n }\n\n /**\n * Extract KeyUpdated event logs from a transaction receipt.\n * @param receipt The transaction receipt to extract logs from.\n * @returns An array of KeyUpdatedLog objects extracted from the receipt.\n */\n public async extractKeyUpdatedLog(receipt: TransactionReceipt): Promise<KeyUpdatedLog[]> {\n let parsedLogs = parseEventLogs({\n abi: Web3PGPABI,\n eventName: 'KeyUpdated',\n logs: receipt.logs\n });\n\n const uniqueBlocks = Array.from(new Set(parsedLogs.map(log => log.blockNumber)));\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return parsedLogs.map(log => ({\n type: Web3PGPEvents.KeyUpdated,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n openPGPMsg: log.args.openPGPMsg\n }));\n }\n\n /**\n * Extract SubkeyAdded event logs from a transaction receipt.\n * @param receipt The transaction receipt to extract logs from.\n * @returns An array of SubkeyAddedLog objects extracted from the receipt.\n */\n public async extractSubkeyAddedLog(receipt: TransactionReceipt): Promise<SubkeyAddedLog[]> {\n let parsedLogs = parseEventLogs({\n abi: Web3PGPABI,\n eventName: 'SubkeyAdded',\n logs: receipt.logs\n });\n\n const uniqueBlocks = Array.from(new Set(parsedLogs.map(log => log.blockNumber)));\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return parsedLogs.map(log => ({\n type: Web3PGPEvents.SubkeyAdded,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n primaryKeyFingerprint: log.args.primaryKeyFingerprint,\n subkeyFingerprint: log.args.subkeyFingerprint,\n openPGPMsg: log.args.openPGPMsg\n }));\n }\n\n /**\n * Extract KeyRevoked event logs from a transaction receipt.\n * @param receipt The transaction receipt to extract logs from.\n * @returns An array of KeyRevokedLog objects extracted from the receipt.\n */\n public async extractKeyRevokedLog(receipt: TransactionReceipt): Promise<KeyRevokedLog[]> {\n let parsedLogs = parseEventLogs({\n abi: Web3PGPABI,\n eventName: 'KeyRevoked',\n logs: receipt.logs\n });\n\n const uniqueBlocks = Array.from(new Set(parsedLogs.map(log => log.blockNumber)));\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return parsedLogs.map(log => ({\n type: Web3PGPEvents.KeyRevoked,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n revocationCertificate: log.args.revocationCertificate\n }));\n }\n\n /**\n * Extract OwnershipChallenged event logs from a transaction receipt.\n * \n * @param receipt The transaction receipt to extract logs from.\n * @returns An array of OwnershipChallengedLog objects extracted from the receipt.\n */\n public async extractOwnershipChallengedLog(receipt: TransactionReceipt): Promise<OwnershipChallengedLog[]> {\n let parsedLogs = parseEventLogs({\n abi: Web3PGPABI,\n eventName: 'OwnershipChallenged',\n logs: receipt.logs\n });\n\n const uniqueBlocks = Array.from(new Set(parsedLogs.map(log => log.blockNumber)));\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return parsedLogs.map(log => ({\n type: Web3PGPEvents.OwnershipChallenged,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n challenge: log.args.challenge\n }));\n }\n\n /**\n * Extract OwnershipProved event logs from a transaction receipt.\n * \n * @param receipt The transaction receipt to extract logs from.\n * @returns An array of OwnershipProvedLog objects extracted from the receipt.\n */\n public async extractOwnershipProvedLog(receipt: TransactionReceipt): Promise<OwnershipProvedLog[]> {\n let parsedLogs = parseEventLogs({\n abi: Web3PGPABI,\n eventName: 'OwnershipProved',\n logs: receipt.logs\n });\n\n const uniqueBlocks = Array.from(new Set(parsedLogs.map(log => log.blockNumber)));\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return parsedLogs.map(log => ({\n type: Web3PGPEvents.OwnershipProved,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n challenge: log.args.challenge,\n signature: log.args.signature\n }));\n }\n\n /**\n * Extract KeyCertified event logs from a transaction receipt.\n * \n * @param receipt The transaction receipt to extract logs from.\n * @returns An array of KeyCertifiedLog objects extracted from the receipt.\n */\n public async extractKeyCertifiedLog(receipt: TransactionReceipt): Promise<KeyCertifiedLog[]> {\n let parsedLogs = parseEventLogs({\n abi: Web3PGPABI,\n eventName: 'KeyCertified',\n logs: receipt.logs\n });\n\n const uniqueBlocks = Array.from(new Set(parsedLogs.map(log => log.blockNumber)));\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return parsedLogs.map(log => ({\n type: Web3PGPEvents.KeyCertified,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n issuerFingerprint: log.args.issuer,\n keyCertificate: log.args.keyCertificate\n }));\n }\n\n /**\n * Extract KeyCertificationRevoked event logs from a transaction receipt.\n * \n * @param receipt The transaction receipt to extract logs from.\n * @returns An array of KeyCertificationRevokedLog objects extracted from the receipt.\n */\n public async extractKeyCertificationRevokedLog(receipt: TransactionReceipt): Promise<KeyCertificationRevokedLog[]> {\n let parsedLogs = parseEventLogs({\n abi: Web3PGPABI,\n eventName: 'KeyCertificationRevoked',\n logs: receipt.logs\n });\n\n const uniqueBlocks = Array.from(new Set(parsedLogs.map(log => log.blockNumber)));\n const blockTimestamps = await this.getBlockTimestamps(uniqueBlocks);\n\n return parsedLogs.map(log => ({\n type: Web3PGPEvents.KeyCertificationRevoked,\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n logIndex: log.logIndex,\n transactionHash: log.transactionHash,\n fingerprint: log.args.fingerprint,\n issuerFingerprint: log.args.issuer,\n revocationSignature: log.args.revocationSignature\n }));\n }\n\n /*****************************************************************************************************************/\n /* UTILITY FUNCTIONS */\n /*****************************************************************************************************************/\n\n /**\n * Get the current block number of the connected blockchain.\n * @return The current block number as a bigint.\n */\n public getBlockNumber(): Promise<bigint> {\n return this.client.getBlockNumber();\n }\n\n /**\n * Helper to efficiently fetch timestamps for a list of logs.\n * Deduplicates block lookups to minimize RPC calls.\n */\n private async getBlockTimestamps(blockNumbers: bigint[]): Promise<Map<bigint, Date>> {\n const uniqueBlocks = [...new Set(blockNumbers)];\n return new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n }\n}","import * as openpgp from 'openpgp';\nimport { to0x, toBytes32 } from './0xstr';\n\n/**\n * Utility functions for OpenPGP operations\n */\nexport class OpenPGPUtils {\n\n /**\n * Verify the validity of an OpenPGP public key, including its primary key and all subkeys.\n *\n * This checks that the keys are properly signed, not expired and not revoked as of the given date.\n *\n * @param key The OpenPGP public key to verify\n * @param date The date to verify against (defaults to now)\n * @param config Optional OpenPGP configuration\n * \n * @throws - Error if the primary key or any subkey is invalid\n */\n static async verifyKey(key: openpgp.PublicKey, date?: Date, config?: openpgp.Config): Promise<void> {\n // Verify the primary key\n await key.verifyPrimaryKey(date, undefined, config);\n // Verify each subkey\n for (const subkey of key.getSubkeys()) {\n await subkey.verify(date, config);\n }\n }\n\n /**\n * Prepare a primary key for blockchain publication by creating a copy of its without\n * private key material and subkeys. The resulting certificate contains only the primary\n * key with its user IDs for identity verification.\n *\n * Can also be used to sanitize certificates retrieved from blockchain: The smart contract\n * only validates fingerprint uniqueness but not OpenPGP certificate validity and content.\n *\n * @param key The key to prepare (can be private or public)\n * @returns A sanitized primary key certificate ready for blockchain storage\n */\n static async sanitizePrimaryKey(key: openpgp.Key): Promise<openpgp.Key> {\n // Create a copy of the public key and remove subkeys\n const clonedKey = await openpgp.readKey({ binaryKey: key.toPublic().write() }); ;\n clonedKey.subkeys = [];\n return clonedKey;\n }\n\n /**\n * Prepare a specific subkey for blockchain publication by isolating it and removing\n * user IDs to prevent identity collisions.\n * \n * @description\n *\n * The resulting certificate contains the primary key (for signature verification\n * interoperability) plus exactly one subkey.\n *\n * This creates a \"subkey certificate\" that can be combined with the primary\n * key certificate using key.update() for full key reconstruction.\n *\n * Can also be used to sanitize certificates retrieved from blockchain for security,\n * as the smart contract only validates fingerprint uniqueness but not OpenPGP\n * certificate validity. While cryptographic verification of subkeys provides\n * inherent security, this sanitization ensures clean certificate reconstruction.\n * \n * The function does not verify the subkey's validity (signatures, expiration, revocation).\n *\n * @param key The key containing the target subkey\n * @param fingerprint The subkey fingerprint that will be padded (bytes32 format, with or without 0x prefix)\n * @returns A sanitized subkey certificate ready for blockchain storage\n * @throws - Error if the specified subkey fingerprint is not found\n */\n static async sanitizeSubkey(key: openpgp.Key, fingerprint: `0x${string}`): Promise<openpgp.Key> {\n // Convert and validate fingerprint format\n const targetFingerprint = toBytes32(to0x(fingerprint));\n\n // Create a copy of the public key\n const publicKey = key.toPublic();\n\n // Find target subkey\n const targetSubkey = publicKey.subkeys.find(\n sub => toBytes32(to0x(sub.getFingerprint())) === targetFingerprint\n );\n\n if (!targetSubkey) {\n throw new Error(`No subkey with fingerprint ${fingerprint} found in the provided key`);\n }\n\n // Keep only the target subkey and remove user IDs to prevent identity collision\n publicKey.subkeys = [targetSubkey];\n return publicKey;\n }\n\n /**\n * Check if a subkey is revoked by verifying its revocation certificates.\n *\n * @param sub The subkey to check\n * @param primaryKey The primary key that may have issued the revocation\n * @param date The date to check against (defaults to now)\n * \n * @returns True if the subkey is revoked, false otherwise\n */\n static async isSubkeyRevoked(sub: openpgp.Subkey, primaryKey: openpgp.Key, date: Date = new Date()): Promise<boolean> {\n\n // Check if subkey belongs to the primary key\n if (primaryKey.getFingerprint() !== sub.mainKey.getFingerprint()) {\n throw new Error('The provided primary key does not own the specified subkey');\n }\n\n // Check if the primary key is revoked\n if (await primaryKey.isRevoked(undefined, undefined, date)) {\n return true; // Subkey is revoked because primary is revoked\n }\n\n // Check if subkey has revocation signatures\n if (sub.revocationSignatures.length === 0) {\n return false;\n }\n\n // Get the primary key's public key for verification\n const primaryPublicKey = primaryKey.toPublic();\n\n // Verify each revocation signature\n for (const revocationSig of sub.revocationSignatures) {\n try {\n // Verify the revocation signature\n // OpenPGP.js signature verification requires signature type and other parameters\n await revocationSig.verify(\n primaryPublicKey.keyPacket, // verification key\n openpgp.enums.signature.subkeyRevocation, // signature type\n { key: primaryPublicKey.keyPacket, bind: sub.keyPacket }, // subkey revocation context\n date // verification date\n );\n\n // If verification succeeds without throwing, the subkey is revoked\n return true;\n\n } catch (error) {\n // Signature verification failed, try next one\n continue;\n }\n }\n\n // No valid revocation signature found, subkey is not revoked\n return false;\n }\n\n /**\n * Check if a key contains private key material, including subkeys.\n * This checks for the presence of private keys regardless of whether the primary key\n * has private material or only subkeys do.\n * \n * @param key The key to check\n * @returns True if the key or any subkey contains private key material, false otherwise\n */\n static containsPrivateKeyMaterial(key: openpgp.Key): boolean {\n if (key.isPrivate()) {\n return true;\n } else {\n for (const subkey of key.getSubkeys()) {\n if (subkey.keyPacket instanceof openpgp.SecretSubkeyPacket) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * List all fingerprints of keys that contain private key material.\n * Includes the primary key if it has private material, and any subkeys with private material.\n * \n * @param key The key to analyze\n * @returns Array of fingerprints for keys containing private material\n */\n static listPrivateKeyFingerprints(key: openpgp.Key): string[] {\n const fingerprints: string[] = [];\n\n // Check primary key\n if (key.isPrivate()) {\n fingerprints.push(key.getFingerprint());\n }\n\n // Check subkeys\n for (const subkey of key.getSubkeys()) {\n if (subkey.keyPacket instanceof openpgp.SecretSubkeyPacket) {\n fingerprints.push(subkey.getFingerprint());\n }\n }\n\n return fingerprints;\n }\n\n /**\n * List all fingerprints of a key, including subkeys\n * \n * @param key The key to list fingerprints from\n * @returns An array of fingerprints\n */\n static listAllFingerprints(key: openpgp.Key): string[] {\n return [key.getFingerprint(), ...key.getSubkeys().map(sub => sub.getFingerprint())];\n }\n}\n\n","import { TransactionReceipt, toHex, toBytes, BlockTag } from 'viem';\nimport * as openpgp from 'openpgp';\nimport { IWeb3PGPService } from './web3pgp.service.interface';\nimport { IWeb3PGP } from './web3pgp.interface';\nimport { BYTES32_ZERO, to0x, toBytes32 } from '../utils/0xstr';\nimport { OpenPGPUtils } from '../utils/openpgp';\nimport { KeyCertificationRevokedLog, KeyCertifiedLog, KeyRegisteredLog, KeyRevokedLog, KeyUpdatedLog, OwnershipProvedLog, SubkeyAddedLog, Web3PGPEventLog, Web3PGPEvents } from './types/types';\nimport pLimit from 'p-limit';\nimport { PacketList } from 'openpgp';\n\n/*****************************************************************************************************************/\n/* CUSTOM ERRORS */\n/*****************************************************************************************************************/\n\n/**\n * Base error class for Web3PGPService errors.\n */\nexport class Web3PGPServiceError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'Web3PGPServiceError';\n }\n}\n\n/**\n * Error thrown when a critical failure occurs during service operations.\n *\n * This error indicates a serious problem that prevents the operation from continuing such as network failures and others has occurred.\n */\nexport class Web3PGPServiceCriticalError extends Web3PGPServiceError {\n constructor(message: string, public readonly cause?: Error) {\n super(message);\n this.name = 'Web3PGPServiceCriticalError';\n }\n}\n\n/**\n * Error thrown when key or blockchain data validation fails.\n * \n * This can happen because the smart contract does not validate the data it stores, they\n * have to be verified by the client application. Furthermore, as anyone can provide keys,\n * malformed or invalid keys may be submitted by malicious actors. \n */\nexport class Web3PGPServiceValidationError extends Web3PGPServiceError {\n constructor(message: string) {\n super(message);\n this.name = 'Web3PGPServiceValidationError';\n }\n}\n\n/*****************************************************************************************************************/\n/* SERVICE IMPLEMENTATION */\n/*****************************************************************************************************************/\n\n/**\n * Configuration options for Web3PGPService.\n */\nexport interface Web3PGPServiceOptions {\n /**\n * Maximum number of concurrent operations performed when retrieving, reconstructing and verifying keys from \n * the blockchain.\n * \n * This limit helps prevent resource exhaustion and rate-limiting issues when interacting with RPC endpoints or\n * when processing large numbers of keys.\n * \n * @default 10\n */\n concurrencyLimit?: number;\n}\n\n/**\n * High-level service for managing OpenPGP keys on the blockchain.\n * \n * This service provides a user-friendly API for working with OpenPGP keys on the Web3PGP contract,\n * handling all the complexity of key validation, serialization, fingerprint extraction, and event parsing.\n * \n * @remarks\n * Built on top of the low-level Web3PGP contract bindings, this service abstracts away the details\n * of working with raw bytes and blockchain events, allowing developers to work directly with\n * OpenPGP.js key objects.\n */\nexport class Web3PGPService implements IWeb3PGPService {\n\n // Low-level Web3PGP contract instance\n private readonly web3pgp: IWeb3PGP;\n\n /**\n * Limiter to control concurrent operations.\n * \n * Prevents overwhelming the RPC provider with too many simultaneous requests. Also prevents\n * excessive CPU and memory usage when processing large numbers of keys.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private readonly concurrencyLimit: any;\n\n /**\n * Create a new Web3PGPService instance.\n * \n * @param web3pgp The low-level Web3PGP contract instance to use for blockchain interactions\n * \n * @example\n * ```typescript\n * import { Web3PGP } from './web3pgp';\n * import { Web3PGPService } from './web3pgp.service';\n * \n * const web3pgp = new Web3PGP(contractAddress, publicClient, walletClient);\n * const service = new Web3PGPService(web3pgp);\n * \n * // Now use the high-level service\n * const receipt = await service.register(publicKey);\n * ```\n */\n constructor(web3pgp: IWeb3PGP, options?: Web3PGPServiceOptions) {\n this.web3pgp = web3pgp;\n this.concurrencyLimit = pLimit(options?.concurrencyLimit ?? 10);\n }\n\n /**\n * Get the underlying Web3PGP contract instance.\n * \n * @returns The low-level Web3PGP contract instance\n * \n * @remarks\n * Exposed for advanced use cases where direct contract access is needed.\n */\n public get contract(): IWeb3PGP {\n return this.web3pgp;\n }\n\n /*****************************************************************************************************************/\n /* WRITE OPERATIONS */\n /*****************************************************************************************************************/\n\n /**\n * Register a new OpenPGP public key (primary key with optional subkeys) on the blockchain.\n * \n * @description\n * This method:\n * 1. Verifies the provided public key and subkeys have a valid signature, are not expired and not revoked.\n * 2. Extracts the primary key fingerprint and subkey fingerprints\n * 3. Ensures the key and its subkeys are not registered on-chain (enforced by smart contract).\n * 4. Serializes the key into the OpenPGP binary format.\n * 5. Registers the key on-chain via the Web3PGP contract\n * \n * @param key The OpenPGP public key to register (may include subkeys)\n * @returns Transaction receipt after successful registration\n * \n * @throws Error if the key or one of its subkeys are invalid\n * @throws Error if the key or one of its subkeys are already registered on-chain\n * @throws Error if wallet client is not configured\n * @throws Error if transaction fails\n * \n * @example\n * ```typescript\n * const armoredKey = '-----BEGIN PGP PUBLIC KEY BLOCK-----...';\n * const publicKey = await openpgp.readKey({ armoredKey });\n * const receipt = await service.register(publicKey);\n * console.log(`Key registered at block ${receipt.blockNumber}`);\n * ```\n */\n public async register(key: openpgp.PublicKey): Promise<TransactionReceipt> {\n try {\n // Verify the key and its subkeys\n await OpenPGPUtils.verifyKey(key, new Date());\n // Publish the key and its subkeys on-chain\n return this.web3pgp.register(\n toBytes32(to0x(key.getFingerprint())),\n key.subkeys.map(subkey => toBytes32(to0x(subkey.getFingerprint()))),\n toHex(key.toPublic().write())\n )\n } catch (err) {\n // Wrap and rethrow errors\n throw new Web3PGPServiceError(`Failed to register the OpenPGP key: ${err}`);\n }\n }\n\n /**\n * Update an existing OpenPGP public key on the blockchain to add or revoke user ID packets,\n * change preferences or update key expiration.\n * \n * @description\n * This method:\n * 1. Verifies the provided public key has a valid signature, is not expired and is not revoked.\n * 2. Prunes subkeys from the key (isolating the primary key for metadata updates).\n * 3. Extracts the primary key fingerprint.\n * 4. Ensures the key is registered on-chain (enforced by smart contract).\n * 5. Serializes the key into the OpenPGP binary format.\n * 6. Calls the update function of the Web3PGP contract to store the updated key on-chain.\n * \n * @param key The OpenPGP public key to update (must include primary key).\n * @returns Transaction receipt after successful update.\n * \n * @throws Error if the key is invalid.\n * @throws Error if the key is not already registered on-chain.\n * @throws Error if wallet client is not configured.\n * @throws Error if the transaction fails.\n * \n * @example\n * ```typescript\n * const armoredKey = '-----BEGIN PGP PUBLIC KEY BLOCK-----...';\n * const publicKey = await openpgp.readKey({ armoredKey });\n * const receipt = await service.update(publicKey);\n * console.log(`Key updated at block ${receipt.blockNumber}`);\n * ```\n */\n public async update(key: openpgp.PublicKey): Promise<TransactionReceipt> {\n try {\n // Remove extra subkey\n const pk = await OpenPGPUtils.sanitizePrimaryKey(key);\n // Verify the key\n await OpenPGPUtils.verifyKey(key, new Date());\n // Publish the updated key\n return this.web3pgp.update(\n toBytes32(to0x(pk.getFingerprint())),\n toHex(pk.toPublic().write())\n );\n } catch (err) {\n // Wrap and rethrow errors\n throw new Web3PGPServiceError(`Failed to update the OpenPGP key: ${err}`);\n }\n }\n\n /**\n * Add a new subkey to a primary key registered on the blockchain.\n * \n * This method:\n * 1. Validates the provided key contains the specified subkey\n * 2. Removes extra subkeys.\n * 3. Verifies the primary key is registered on-chain (enforced by smart contract)\n * 4. Verifies the subkey is not registered on-chain (enforced by smart contract)\n * 5. Extracts the primary key fingerprint\n * 6. Verifies the provided key and subkey have valid signatures, are not expired and not revoked.\n * 7. Serializes the key and its subkey into the OpenPGP binary format.\n * 8. Adds the subkey on-chain via the Web3PGP contract\n * \n * @param key The OpenPGP public key containing both the primary key and the new subkey\n * @param subkeyFingerprint The fingerprint of the specific subkey to add (must exist in the key)\n * @returns Transaction receipt after successful subkey addition\n * \n * @throws Error if the key is invalid or doesn't contain the specified subkey\n * @throws Error if the primary key is not registered on-chain\n * @throws Error if the subkey is already registered on-chain\n * @throws Error if wallet client is not configured\n * @throws Error if transaction fails\n * \n * @example\n * ```typescript\n * const armoredKey = '-----BEGIN PGP PUBLIC KEY BLOCK-----...';\n * const publicKey = await openpgp.readKey({ armoredKey });\n * const subkeyFp = '0x' + publicKey.subkeys[0].getFingerprint();\n * const receipt = await service.addSubkey(publicKey, subkeyFp);\n * ```\n */\n public async addSubkey(key: openpgp.PublicKey, subkeyFingerprint: `0x${string}`): Promise<TransactionReceipt> {\n try {\n // Sanitize the key to only include the primary key and the specified subkey\n const pk = await OpenPGPUtils.sanitizeSubkey(key, subkeyFingerprint);\n const sk = pk.getSubkeys()[0];\n const now = new Date();\n // Verify the sanitized key\n await OpenPGPUtils.verifyKey(pk, now);\n // Publish the sanitized key\n return this.web3pgp.addSubkey(\n toBytes32(to0x(pk.getFingerprint())),\n toBytes32(to0x(subkeyFingerprint)),\n toHex(pk.toPublic().write())\n );\n } catch (err) {\n // Wrap and rethrow errors\n throw new Web3PGPServiceError(`Failed to add the subkey: ${err}`);\n }\n }\n\n /**\n * Publish a key revocation certificate on the blockchain.\n * \n * @description\n * This method allows users who have revoked their key using standard OpenPGP tools to publish the key revocation\n * certificate on-chain and inform others that the key is no longer valid.\n * \n * The method accepts either a key object with the revocation signature or a standalone revocation certificate \n * in armored format. In the later case, the method will download and verify the public key from the blockchain \n * using the provided fingerprint as ID, apply the revocation certificate, verify the key is revoked at present time\n * and publish the revoked key on-chain.\n * \n * When a revoked key is provided, the method will verify the target key or subkey, identified by the provided \n * fingerprint, is indeed revoked in the key object at the present time and will publish the revoked key on-chain. \n * \n * @param keyOrCertificate The revoked OpenPGP public key or a revocation certificate\n * @param fingerprint The fingerprint of the key being revoked (primary key or subkey)\n * @returns Transaction receipt after successful revocation publication\n * \n * @throws Error if the key doesn't contain a valid revocation signature at the present time\n * @throws Error if the fingerprint doesn't match any key in the provided key object\n * @throws Error if the target key is not registered on-chain\n * @throws Error if wallet client is not configured\n * @throws Error if transaction fails\n * \n * @example\n * ```typescript\n * // After revoking the key with OpenPGP tools\n * const revokedKey = await openpgp.readKey({ armoredKey: revokedArmoredKey });\n * const fingerprint = '0x' + revokedKey.getFingerprint();\n * const receipt = await service.revoke(revokedKey, fingerprint);\n * ```\n */\n public async revoke(keyOrCertificate: openpgp.PublicKey | string, fingerprint: `0x${string}`): Promise<TransactionReceipt> {\n if (typeof keyOrCertificate === 'string') {\n return this.revokeWithCertificate(keyOrCertificate, fingerprint);\n } else {\n return this.revokeWithKey(keyOrCertificate, fingerprint);\n }\n }\n\n /**\n * Revoke a key or subkey using a key object containing the revocation signature.\n * \n * The method will verify the target key or subkey, identified by the provided fingerprint, is indeed revoked\n * in the key object at the present time and publish the revoked key on-chain.\n * \n * @param key The OpenPGP public key containing the revocation signature \n * @param fingerprint The fingerprint of the key being revoked\n * @returns Transaction receipt after successful revocation publication\n */\n private async revokeWithKey(key: openpgp.PublicKey, fingerprint: `0x${string}`): Promise<TransactionReceipt> {\n // Check the provided key has a key with the given fingerprint\n const normalizedFingerprint = toBytes32(to0x(fingerprint));\n if (toBytes32(to0x(key.getFingerprint())) === normalizedFingerprint) {\n // Sanitize primary key\n const revoked = await OpenPGPUtils.sanitizePrimaryKey(key);\n // Check the provided key is revoked\n if (await revoked.isRevoked()) {\n // Publish the revoked primary key\n return this.web3pgp.revoke(normalizedFingerprint, toHex(revoked.toPublic().write()));\n } else {\n throw new Web3PGPServiceValidationError('The provided key does not contain a valid revocation signature.');\n }\n }\n else {\n // Must be a subkey\n const pk = await OpenPGPUtils.sanitizeSubkey(key, fingerprint);\n // Check subkey is revoked\n if (await OpenPGPUtils.isSubkeyRevoked(\n pk.subkeys[0]!, // We are sure this exists from sanitizeSubkey\n key\n )) {\n // Publish the revoked subkey\n return this.web3pgp.revoke(normalizedFingerprint, toHex(pk.toPublic().write()));\n } else {\n throw new Web3PGPServiceValidationError('The specified subkey does not contain a valid revocation signature.');\n }\n }\n }\n\n /**\n * Revoke a key or subkey using a standalone revocation certificate.\n * \n * The method will download and verify the public key from the blockchain using the provided fingerprint as ID,\n * apply the revocation certificate, verify the key is revoked at present time and publish the revoked key on-chain.\n * \n * @param certificate The armored revocation certificate\n * @param fingerprint The fingerprint of the key being revoked\n * @returns Transaction receipt after successful revocation publication\n */\n private async revokeWithCertificate(certificate: string, fingerprint: `0x${string}`): Promise<TransactionReceipt> {\n // Download the public key from the blockchain to verify revocation\n const normalizedFingerprint = toBytes32(to0x(fingerprint));\n const publicKey = await this.getPublicKey(normalizedFingerprint);\n // Apply the revocation certificate to the public key\n const revocationCheckDate = new Date()\n const revoked = await openpgp.revokeKey({\n key: publicKey,\n revocationCertificate: certificate,\n date: revocationCheckDate, // To be explicit\n format: 'object'\n });\n if (toBytes32(to0x(revoked.publicKey.getFingerprint())) === normalizedFingerprint) {\n // This is a primary key\n const pk = await OpenPGPUtils.sanitizePrimaryKey(revoked.publicKey);\n // Check the primary key is revoked\n if (await pk.isRevoked()) {\n // Publish the revoked primary key\n return this.web3pgp.revoke(normalizedFingerprint, toHex(pk.toPublic().write()));\n } else {\n throw new Web3PGPServiceValidationError('The provided key does not contain a valid revocation signature.');\n }\n } else {\n // Must be a subkey\n const pk = await OpenPGPUtils.sanitizeSubkey(revoked.publicKey, normalizedFingerprint);\n // Check subkey is revoked\n if (await OpenPGPUtils.isSubkeyRevoked(pk.subkeys[0]!, pk, revocationCheckDate)) {\n // Publish the subkey\n return this.web3pgp.revoke(normalizedFingerprint, toHex(pk.write()));\n } else {\n throw new Web3PGPServiceValidationError('The specified subkey does not contain a valid revocation signature.');\n }\n }\n }\n\n /**\n * Initiate a challenge to prove ownership of an OpenPGP key registered on-chain.\n * \n * This method submits a hash of a random challenge generated by the user to the blockchain. The owner\n * of the private key corresponding to the public key must later sign the original challenge off-chain\n * and submit the signature using the `proveOwnership` method to complete the ownership proof process.\n * \n * @param fingerprint The fingerprint of the key to challenge ownership for (primary key or subkey)\n * @param challengeHash The keccak256 hash of the random challenge generated and hashed by the user (32 bytes hex string)\n * @returns Transaction receipt after successful challenge submission\n * \n * @throws Error if the key is not registered on-chain\n * @throws Error if wallet client is not configured\n * @throws Error if transaction fails\n */\n public async challengeOwnership(fingerprint: `0x${string}`, challengeHash: `0x${string}`): Promise<TransactionReceipt> {\n return this.web3pgp.challengeOwnership(fingerprint, challengeHash);\n }\n\n /**\n * Prove ownership of an OpenPGP key by submitting a signature of a previously issued challenge.\n * \n * This method verifies the provided signature against the challenge associated with the specified\n * key fingerprint on-chain. If the signature is valid, ownership is proven.\n * \n * The method:\n * 1. Fetches the up-to-date public key from the blockchain using the provided fingerprint\n * 2. Verifies the signature of the challenge (the bytes of the hash) using the public key\n * 3. Submits the ownership proof on-chain via the Web3PGP contract\n * \n * @param fingerprint The fingerprint of the key to prove ownership for (primary key or subkey)\n * @param challengeHash The keccak256 hash of the original challenge that was issued\n * @param signature The signature of the challenge created using the private key corresponding to the public key\n * @returns Transaction receipt after successful ownership proof submission\n * \n * @throws Error if the key is not registered on-chain\n * @throws Error if the signature is invalid or the key is revoked or expired at present time\n * @throws Error if wallet client is not configured\n * @throws Error if transaction fails\n */\n public async proveOwnership(fingerprint: `0x${string}`, challengeHash: `0x${string}`, signature: openpgp.Signature): Promise<TransactionReceipt> {\n try {\n // Fetch the public key from the blockchain\n const publicKey = await this.getPublicKey(fingerprint);\n // Verify the signature of the challenge hash\n const verificationResult = await openpgp.verify({\n message: await openpgp.createMessage({ binary: toBytes(challengeHash) }),\n verificationKeys: publicKey,\n signature: signature,\n });\n let isValid = false;\n for (const sig of verificationResult.signatures) {\n try {\n await sig.verified;\n isValid = true;\n break;\n } catch (e) {\n // Invalid signature - Loop to check next signature\n console.debug(`[WEB3PGP SERVICE] Invalid ownership proof signature found and skipped: ${e}`);\n }\n }\n if (!isValid) {\n throw new Web3PGPServiceValidationError('The provided signature is invalid.');\n }\n // Submit the ownership proof on-chain\n return this.web3pgp.proveOwnership(fingerprint, challengeHash, toHex(signature.write()));\n } catch (err) {\n // Wrap and rethrow errors\n throw new Web3PGPServiceError(`Failed to prove ownership of the OpenPGP key: ${err}`);\n }\n }\n\n /**\n * Publish a third-party certification of an OpenPGP key on the blockchain.\n * \n * This method allows a user (the issuer) to certify another user's OpenPGP public key by publishing\n * the certification on-chain. The certified key is an OpenPGP public key that contains a certification\n * signature made by the issuer over the target key.\n * \n * @description\n * This method:\n * 1. Verifies the target key is registered on-chain (enforced by smart contract)\n * 2. Extracts and verifies the certification signature in the certified key\n * 3. Serializes the certified key into the OpenPGP binary format.\n * 4. Publishes the certification on-chain via the Web3PGP contract.\n * \n * @param issuer The OpenPGP public key of the issuer certifying the target key\n * @param certifiedKey The public key containing the certification signature made by the issuer\n * @returns Transaction receipt after successful certification publication\n * \n * @throws Error if the target key is not registered on-chain\n * @throws Error if the fingerprint doesn't match the fingerprint of the primary key\n * @throws Error if the certification signature is invalid or not made by the issuer\n * @throws Error if wallet client is not configured\n * @throws Error if transaction fails\n */\n public async certify(issuer: openpgp.PublicKey, certifiedKey: openpgp.PublicKey): Promise<TransactionReceipt> {\n try {\n // 1. Sanity Check\n if (issuer.getFingerprint() === certifiedKey.getFingerprint()) {\n throw new Web3PGPServiceValidationError('The issuer key must be different from the certified key.');\n }\n\n // 2. Remove extra subkeys\n const pk = await OpenPGPUtils.sanitizePrimaryKey(certifiedKey);\n\n // 3. Keep only valid certifications made by the issuer\n let hasValidCertification = false;\n for (const user of pk.users) {\n // Verify each certification signature using the issuer public key\n console.debug(`[WEB3PGP SERVICE] Verifying ${user.otherCertifications.length} certifications for user ID \"${user.userID?.toString()}\"...`);\n const validCertifications: openpgp.SignaturePacket[] = [];\n for (const cert of user.otherCertifications) {\n try {\n console.debug(`[WEB3PGP SERVICE] Verifying certification made by ${cert.issuerFingerprint ? toHex(cert.issuerFingerprint) : cert.issuerKeyID.toHex()}...`);\n const verified = await user.verifyCertificate(cert, [issuer]);\n if (verified) {\n validCertifications.push(cert);\n hasValidCertification = true;\n } else {\n console.debug(`[WEB3PGP SERVICE] Invalid certification signature found and skipped.`);\n }\n } catch (e) {\n console.debug(`[WEB3PGP SERVICE] Invalid certification signature found and skipped: ${e}`);\n }\n }\n\n // C. Update the user with only valid certifications\n user.otherCertifications = validCertifications;\n }\n\n if (!hasValidCertification) {\n throw new Web3PGPServiceValidationError('The certified key does not contain a valid certification signature made by the issuer.');\n }\n\n // 4. Filter out users without valid certifications\n pk.users = pk.users.filter(user => user.otherCertifications.length > 0);\n\n // 5. Publication\n return this.web3pgp.certifyKey(\n toBytes32(to0x(pk.getFingerprint())),\n toBytes32(to0x(issuer.getFingerprint())),\n toHex(pk.toPublic().write())\n );\n\n } catch (err) {\n throw new Web3PGPServiceError(`Failed to certify the OpenPGP key: ${err}`);\n }\n }\n\n /**\n * Revoke a third-party certification of an OpenPGP key on the blockchain.\n * \n * This method allows a user (the issuer) to revoke a previously published certification of another user's\n * OpenPGP public key by publishing a revocation on-chain. The revoked key is an OpenPGP public key that\n * contains a revocation signature made by the issuer over the target key.\n * \n * @description\n * This method:\n * 1. Verifies the target key is registered on-chain (enforced by smart contract)\n * 2. Extracts and verifies the revoked third-party signature in the key.\n * 3. Serializes the certified key into the OpenPGP binary format.\n * 4. Publishes the certification revocation on-chain via the Web3PGP contract.\n * \n * @param issuer The OpenPGP public key of the issuer revoking the certification\n * @param keyWithRevokedCertification The public key containing the revocation signature made by the issuer\n * @returns Transaction receipt after successful revocation publication\n * \n * @throws Error if the target key is not registered on-chain\n * @throws Error if the fingerprint doesn't match the fingerprint of the primary key\n * @throws Error if the revocation signature is invalid or not made by the issuer\n * @throws Error if wallet client is not configured\n * @throws Error if transaction fails\n */\n public async revokeCertification(issuer: openpgp.PublicKey, keyWithRevokedCertification: openpgp.PublicKey): Promise<TransactionReceipt> {\n try {\n // 1. Sanity Check\n if (issuer.getFingerprint() === keyWithRevokedCertification.getFingerprint()) {\n throw new Web3PGPServiceValidationError('Issuer must be different from the target key.');\n }\n const now = new Date();\n //const pk = await OpenPGPUtils.sanitizePrimaryKey(keyWithRevokedCertification); \n //pk.users = keyWithRevokedCertification.users; \n const pk = keyWithRevokedCertification;\n // BUGFIX - TODO: Deep copy users as serializing/deserializing lose some context needed for verification\n // but modifying the users have side effect on the original key\n\n // 2. Keep only valid revocation signatures made by the issuer (there may be multiple users and certifications)\n let hasValidRevocation = false;\n for (const user of pk.users) {\n // Verify each certification signature using the issuer public key\n console.debug(`[WEB3PGP SERVICE] Verifying ${user.revocationSignatures.length} revocation signatures for user ID \"${user.userID?.toString()}\"...`);\n const revokedCertifications: openpgp.SignaturePacket[] = [];\n const validRevocations: openpgp.SignaturePacket[] = [];\n for (const revSig of user.revocationSignatures) {\n try {\n // Find the key packets needed for verification\n //\n // Although revocation signatures are normally made with the issuer's primary key,\n // OpenPGP allows using any key of the issuer, so we must find the correct one.\n const issuerKeyPacket = issuer.getKeys().find(k => k.getKeyID().equals(revSig.issuerKeyID));\n if (!issuerKeyPacket) {\n throw new Web3PGPServiceValidationError(`Issuer key packet with Key ID ${revSig.issuerKeyID.toHex()} not found in issuer key.`);\n }\n console.debug(`[WEB3PGP SERVICE] Verifying revocation signature made by ${revSig.issuerFingerprint ? toHex(revSig.issuerFingerprint) : revSig.issuerKeyID.toHex()}...`);\n // BUGFIX - TODO: Re-enable verification - currently signature verification fails due to missing context in the key packets\n // await revSig.verify(\n // issuerKeyPacket.keyPacket, \n // revSig.signatureType ?? openpgp.enums.signature.certRevocation,\n // {\n // key: keyWithRevokedCertification.keyPacket,\n // userId: user.userID,\n // userAttribute: user.userAttribute\n // },\n // now,\n // );\n console.debug(`[WEB3PGP SERVICE] Valid revocation signature found.`);\n validRevocations.push(revSig);\n hasValidRevocation = true;\n } catch (e) {\n console.debug(`[WEB3PGP SERVICE] Invalid revocation signature found and skipped: ${e}`);\n continue;\n }\n }\n // Find all certifications being revoked. Use the creation date of the revocation signature as upper bound.\n for (const cert of user.otherCertifications) {\n for (const revSig of validRevocations) {\n if (cert.issuerKeyID.equals(revSig.issuerKeyID)) {\n // Mark the certification as revoked if one of the revocation signatures was created after the certification\n cert.revoked = cert.revoked || (cert.created || now) <= (revSig.created || now);\n if (cert.revoked) {\n revokedCertifications.push(cert);\n break; // No need to check other revocation signatures\n }\n } \n }\n }\n \n // C. Update the user with only valid revocations and remove revoked certifications\n user.revocationSignatures = validRevocations;\n user.otherCertifications = revokedCertifications;\n }\n if (!hasValidRevocation) {\n throw new Web3PGPServiceValidationError('No valid certification revocation signature made by the issuer was found on the target key.');\n }\n\n // 3. Publication\n return this.web3pgp.revokeCertification(\n toBytes32(to0x(pk.getFingerprint())),\n toBytes32(to0x(issuer.getFingerprint())),\n toHex(pk.toPublic().write())\n );\n } catch (err) {\n throw new Web3PGPServiceError(`Failed to revoke certification: ${err}`);\n }\n }\n\n /*****************************************************************************************************************/\n /* LOG VALIDATION AND EXTRACTION FUNCTIONS */\n /*****************************************************************************************************************/\n\n /**\n * Validate and extract the public key from a KeyRegisteredLog event.\n * \n * @description\n * \n * This method:\n * 1. Validates the log data contains required fields\n * 2. Extracts and parses the OpenPGP message from the log\n * 3. Verifies the primary key fingerprint matches the declared one\n * 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not \n * revoked at the time of registration (uses the block timestamp)..\n * 5. Validates all declared subkeys are present in the key\n * 6. (if verifications are enabled) Verifies each subkey has a valid signature, is not expired and is not \n * revoked at the time of registration (uses the block timestamp).\n * 7. Prunes any extra subkeys not declared in the log\n * \n * Cryptographic verifications of the keys (steps 4 and 6) can be skipped by setting the `skipCryptographicVerifications`\n * parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform\n * custom validations or inspections in case the verification fails, is expected to fail or is performed by an external\n * OpenPGP toolkit.\n * \n * @param log The KeyRegisteredLog event data from the blockchain\n * @param skipCryptographicVerifications If true, skips cryptographic verifications of key and subkeys. Defaults to false.\n * @returns The validated OpenPGP public key extracted from the log\n * \n * @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields\n * @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted\n * @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data\n * @throws Web3PGPServiceValidationError if any declared subkey is missing from the extracted key\n * \n * @example\n * ```typescript\n * const logs = await web3pgp.searchKeyRegisteredLogs();\n * for (const log of logs) {\n * try {\n * const publicKey = await service.extractFromKeyRegisteredLog(log);\n * console.log(`Valid key: ${publicKey.getFingerprint()}`);\n * } catch (err) {\n * console.warn(`Invalid log data: ${err.message}`);\n * }\n * }\n * ```\n */\n public async extractFromKeyRegisteredLog(log: KeyRegisteredLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey> {\n try {\n // Validate required data are present\n if (!log.openPGPMsg || !log.primaryKeyFingerprint) {\n throw new Web3PGPServiceValidationError(`The KeyRegisteredLog event is missing the data needed to extract and validate the public key.`);\n }\n // Read the primary key using the hex-encoded binary openPGP message from the log data\n const primaryKey = await openpgp.readKey({ binaryKey: toBytes(log.openPGPMsg) });\n // Verify the primary key has a valid signature and was not expired/revoked at the time of the block in which it was registered\n if (skipCryptographicVerifications !== true) {\n await primaryKey.verifyPrimaryKey(log.blockTimestamp);\n }\n // Validate the key fingerprint matches the declared one\n if (toBytes32(to0x(primaryKey.getFingerprint())) !== toBytes32(to0x(log.primaryKeyFingerprint))) {\n throw new Web3PGPServiceValidationError(`The fingerprint of the retrieved primary key does not match the declared fingerprint in the KeyRegisteredLog event.`);\n }\n // Verify the key contains the declared subkeys and prune the extra ones\n // Payload should match the on-chain data but extra subkeys may exist and should be ignored (not a critical error)\n let subkeys: openpgp.Subkey[] = [];\n for (const subkeyFingerprint of log.subkeyFingerprints || []) {\n const normalizedSubkeyFingerprint = toBytes32(to0x(subkeyFingerprint));\n const subkey = primaryKey.subkeys.find(sk => toBytes32(to0x(sk.getFingerprint())) === normalizedSubkeyFingerprint);\n if (subkey) {\n // Verify the subkey has a valid signature and was not expired/revoked at the time of the block in which it was registered\n if (skipCryptographicVerifications !== true) {\n await subkey.verify(log.blockTimestamp);\n }\n subkeys.push(subkey);\n } else {\n // A declared subkey is missing from the key data - critical error\n throw new Web3PGPServiceValidationError(`The primary key does not contain the declared subkey with fingerprint ${subkeyFingerprint} from the KeyRegisteredLog event.`);\n }\n }\n // Prune extra subkeys\n primaryKey.subkeys = subkeys;\n console.debug(`[Web3PGP - Service] Successfully extracted primary key ${log.primaryKeyFingerprint} with ${subkeys.length} subkeys from KeyRegisteredLog event`);\n return primaryKey.toPublic();\n } catch (err) {\n if (err instanceof Web3PGPServiceValidationError) {\n // Rethrow validation errors\n throw err;\n }\n // Wrap other errors\n throw new Web3PGPServiceValidationError(`Failed to read the OpenPGP message from the KeyRegisteredLog event: ${err}`);\n }\n }\n\n /**\n * Validate and extract the subkey from a SubkeyAddedLog event.\n * \n * @description\n * This method:\n * 1. Validates the log data contains required fields\n * 2. Extracts and parses the OpenPGP message from the log\n * 3. Verifies the primary key fingerprint matches the declared one\n * 4. Verifies the subkey fingerprint matches the declared one\n * 5. Prunes any extra subkeys and user ID packets, returning only the primary key and the added subkey\n * 6. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not \n * revoked at the time of subkey addition (uses the block timestamp).\n * 7. (if verifications are enabled) Verifies the subkey has a valid signature, is not expired and is not \n * revoked at the time of addition (uses the block timestamp).\n * \n * Cryptographic verifications of the keys (steps 6 and 7) can be skipped by setting the `skipCryptographicVerifications`\n * parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform\n * custom validations or inspections in case the verification fails, is expected to fail or is performed by an external\n * OpenPGP toolkit.\n * \n * @param log The SubkeyAddedLog event data from the blockchain\n * @param skipCryptographicVerifications If true, skips cryptographic verifications of key and subkey. Defaults to false.\n * @returns The validated OpenPGP public key containing the primary key and the added subkey\n * \n * @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields\n * @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted\n * @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data\n * @throws Web3PGPServiceValidationError if the subkey is missing from the extracted key\n * \n * @example\n * ```typescript\n * const logs = await web3pgp.searchSubkeyAddedLogs(primaryFingerprint);\n * let primaryKey = await service.getPublicKey(primaryFingerprint);\n * for (const log of logs) {\n * const subkey = await service.extractFromSubkeyAddedLog(log);\n * primaryKey = await primaryKey.update(subkey);\n * }\n * ```\n */\n public async extractFromSubkeyAddedLog(log: SubkeyAddedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey> {\n try {\n // Read and verify the subkey using the hex-encoded binary openPGP message from the log data\n let pk: openpgp.Key;\n try {\n pk = await openpgp.readKey({ binaryKey: toBytes(log.openPGPMsg) });\n // Sanitize to only include primary key and the subkey\n pk = await OpenPGPUtils.sanitizeSubkey(pk, log.subkeyFingerprint);\n // Verify the sanitized key\n if (skipCryptographicVerifications !== true) {\n await OpenPGPUtils.verifyKey(pk, log.blockTimestamp);\n }\n } catch (err) {\n throw new Web3PGPServiceValidationError(`Failed to read and sanitize the OpenPGP message for subkey with fingerprint ${log.subkeyFingerprint} from SubkeyAddedLog event: ${err}`);\n }\n // Validate the primary key fingerprint matches the declared one\n if (toBytes32(to0x(pk.getFingerprint())) !== toBytes32(to0x(log.primaryKeyFingerprint))) {\n throw new Web3PGPServiceValidationError(`The primary key fingerprint ${pk.getFingerprint()} does not match the declared primary key fingerprint ${log.primaryKeyFingerprint} in SubkeyAddedLog event.`);\n }\n return pk.toPublic();\n } catch (err) {\n if (err instanceof Web3PGPServiceValidationError) {\n // Rethrow service errors\n throw err;\n }\n // Wrap other errors\n throw new Web3PGPServiceValidationError(`Failed to read the OpenPGP message from the SubkeyAddedLog event: ${err}`);\n }\n }\n\n /**\n * Validate and extract the revoked key or revocation certificate from a KeyRevokedLog event.\n * \n * @description\n * This method handles two types of revocation data:\n * 1. Key certificates: Full OpenPGP keys with revocation signatures\n * 2. Standalone revocation certificates: Revocation signature packets only\n * \n * The method:\n * 1. Validates the log data contains required fields\n * 2. Attempts to parse as a key certificate first\n * 3. If that fails, attempts to parse as a standalone revocation certificate and returns the armored certificate.\n * It is the user's responsibility to verify and apply the revocation certificate to the target key.\n * 4. For key certificates, validates the fingerprint matches the target key\n * 5. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is revoked\n * at the time of revocation (uses the block timestamp).\n * 6. Returns either the revoked key or the armored revocation certificate\n * \n * @param log The KeyRevokedLog event data from the blockchain\n * @param skipCryptographicVerifications If true, skips cryptographic verifications of the revoked key. Defaults to false.\n * @returns A tuple containing either:\n * - [revokedKey, undefined] if a valid key certificate was found\n * - [undefined, armoredCert] if a standalone revocation certificate was found\n * \n * @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields\n * @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted\n * @throws Web3PGPServiceValidationError if a key certificate does not effectively revoke the target key\n * \n * @example\n * ```typescript\n * const logs = await web3pgp.searchKeyRevokedLogs(fingerprint);\n * let publicKey = await service.getPublicKey(fingerprint);\n * for (const log of logs) {\n * const [revokedKey, revocationCert] = await service.extractFromKeyRevokedLog(log);\n * if (revokedKey) {\n * publicKey = await publicKey.update(revokedKey);\n * } else if (revocationCert) {\n * const result = await openpgp.revokeKey({ \n * key: publicKey, \n * revocationCertificate: revocationCert \n * });\n * publicKey = result.publicKey;\n * }\n * }\n * ```\n */\n public async extractFromKeyRevokedLog(log: KeyRevokedLog, skipCryptographicVerifications?: boolean): Promise<[openpgp.PublicKey | undefined, string | undefined]> {\n try {\n // Validate required data are present\n if (!log.fingerprint || !log.revocationCertificate) {\n throw new Web3PGPServiceValidationError(`The KeyRevokedLog event is missing the data needed to extract and validate the revocation.`);\n }\n\n let revokedKey: openpgp.Key;\n try {\n // Try to parse the revocation certificate as a key certificate\n revokedKey = await openpgp.readKey({ binaryKey: toBytes(log.revocationCertificate) });\n } catch (err) {\n // Fallback - Try to read as a standalone revocation certificate\n const cert = await openpgp.readMessage({ \n binaryMessage: toBytes(log.revocationCertificate),\n config: {\n // Standalone revocation certs do not have public keys needed to verify the revocations signature\n // This causes OpenPGP.js to throw an error unless we allow unauthenticated messages\n allowMissingKeyFlags: true,\n allowUnauthenticatedMessages: true \n }\n });\n // Return the armored standalone revocation certificate - We cannot check if the key is actually revoked without the public key\n console.debug(`[Web3PGP - Service] Successfully extracted revocation certificate for key ${log.fingerprint} from KeyRevokedLog event`);\n return [undefined, cert.armor()];\n }\n\n // Check the fingerprint matches either the primary key or a subkey\n if (toBytes32(to0x(revokedKey.getFingerprint())) === toBytes32(to0x(log.fingerprint))) {\n // Sanitize primary key\n const pk = await OpenPGPUtils.sanitizePrimaryKey(revokedKey);\n // Check the primary key is revoked\n if (skipCryptographicVerifications !== true && !await pk.isRevoked(undefined, undefined, log.blockTimestamp)) {\n throw new Web3PGPServiceValidationError(`The primary key with fingerprint ${pk.getFingerprint()} is not revoked as expected in the KeyRevokedLog event.`);\n }\n // Return the revoked key and no standalone revocation certificate\n console.debug(`[Web3PGP - Service] Successfully extracted revocation for primary key ${log.fingerprint} from KeyRevokedLog event`);\n return [pk.toPublic(), undefined];\n } else {\n // Sanitize to keep only the target subkey - Will throw an error if not found\n const pk = await OpenPGPUtils.sanitizeSubkey(revokedKey, log.fingerprint);\n // Check subkey is revoked\n if (skipCryptographicVerifications !== true && !await OpenPGPUtils.isSubkeyRevoked(pk.subkeys[0]!, pk, log.blockTimestamp)) {\n throw new Web3PGPServiceValidationError(`The subkey with fingerprint ${log.fingerprint} is not revoked as expected in the KeyRevokedLog event.`);\n }\n // Return the revoked key and no standalone revocation certificate\n console.debug(`[Web3PGP - Service] Successfully extracted revocation for subkey ${log.fingerprint} from KeyRevokedLog event`);\n return [pk.toPublic(), undefined];\n }\n } catch (err) {\n if (err instanceof Web3PGPServiceValidationError) {\n // Rethrow service errors\n throw err;\n }\n // Wrap other errors\n throw new Web3PGPServiceValidationError(`Failed to read the OpenPGP message from the KeyRevokedLog event: ${err}`);\n }\n }\n\n /**\n * Validate and extract the updated public key from a KeyUpdatedLog event.\n * \n * @description\n * This method:\n * 1. Validates the log data contains required fields\n * 2. Extracts and parses the OpenPGP message from the log\n * 3. Verifies the primary key fingerprint matches the declared one\n * 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not \n * revoked at the time of update (uses the block timestamp).\n * \n * Cryptographic verifications of the key (step 4) can be skipped by setting the `skipCryptographicVerifications`\n * parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform\n * custom validations or inspections in case the verification fails, is expected to fail or is performed by an external\n * OpenPGP toolkit.\n * \n * @param log The KeyUpdatedLog event data from the blockchain\n * @param skipCryptographicVerifications If true, skips cryptographic verifications of key. Defaults to false.\n * @returns The validated OpenPGP public key extracted from the log\n * \n * @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields\n * @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted\n * @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data\n * \n * @example\n * ```typescript\n * const logs = await web3pgp.searchKeyUpdatedLogs();\n * for (const log of logs) {\n * try {\n * const publicKey = await service.extractFromKeyUpdatedLog(log);\n * console.log(`Valid updated key: ${publicKey.getFingerprint()}`);\n * } catch (err) {\n * console.warn(`Invalid log data: ${err.message}`);\n * }\n * }\n * ```\n */\n public async extractFromKeyUpdatedLog(log: KeyUpdatedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey> {\n try {\n // Read the OpenPGP message using the hex-encoded binary openPGP message from the log data\n let pk = await openpgp.readKey({ binaryKey: toBytes(log.openPGPMsg) });\n const pkFp = toBytes32(to0x(pk.getFingerprint()));\n // Verify the fingerprint matches the declared one\n if (pkFp !== toBytes32(to0x(log.fingerprint))) {\n throw new Web3PGPServiceValidationError(`The fingerprint of the retrieved primary key ${pkFp} does not match the declared fingerprint in the KeyUpdatedLog event ${log.fingerprint}`);\n }\n // Remove extra subkeys\n pk = await OpenPGPUtils.sanitizePrimaryKey(pk);\n // Verify the key if needed\n if (skipCryptographicVerifications !== true) {\n await OpenPGPUtils.verifyKey(pk, log.blockTimestamp);\n }\n console.debug(`[Web3PGP - Service] Successfully extracted updated key ${pk.getFingerprint()} from KeyUpdatedLog event`);\n return pk.toPublic();\n } catch (err) {\n if (err instanceof Web3PGPServiceValidationError) {\n // Rethrow validation errors\n throw err;\n }\n // Wrap other errors\n throw new Web3PGPServiceValidationError(`Failed to extract the public key form the OpenPGP message in the KeyUpdatedLog event: ${err}`);\n }\n }\n\n /**\n * Validate and extract the certified public key from a KeyCertifiedLog event.\n * \n * @description\n * This method:\n * 1. Validates the log data contains required fields\n * 2. Extracts and parses the OpenPGP message from the log\n * 3. Verifies the primary key fingerprint matches the declared one\n * 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not \n * revoked at the time of certification (uses the block timestamp).\n * 5. Validates that at least one certification signature made by the issuer over the target key is present\n * \n * Cryptographic verifications of the key (step 4) can be skipped by setting the `skipCryptographicVerifications`\n * parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform\n * custom validations or inspections in case the verification fails, is expected to fail or is performed by an external\n * OpenPGP toolkit.\n * \n * @param log The KeyCertifiedLog event data from the blockchain\n * @param skipCryptographicVerifications If true, skips cryptographic verifications of key. Defaults to false.\n * @returns The validated OpenPGP public key extracted from the log\n * \n * @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields\n * @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted\n * @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data\n * @throws Web3PGPServiceValidationError if no valid certification signature made by the issuer is found\n * \n * @example\n * ```typescript\n * const logs = await web3pgp.searchKeyCertifiedLogs(issuerFingerprint, targetFingerprint);\n * for (const log of logs) {\n * try {\n * const certifiedKey = await service.extractFromKeyCertifiedLog(log);\n * console.log(`Valid certified key: ${certifiedKey.getFingerprint()}`);\n * } catch (err) {\n * console.warn(`Invalid log data: ${err.message}`);\n * }\n * }\n * ```\n */\n public async extractFromKeyCertifiedLog(log: KeyCertifiedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey> {\n try {\n // Read the OpenPGP message using the hex-encoded binary openPGP message from the log data\n let pk = await openpgp.readKey({ binaryKey: toBytes(log.keyCertificate) });\n const pkFp = toBytes32(to0x(pk.getFingerprint()));\n \n // Verify the fingerprint matches the declared one\n if (pkFp !== toBytes32(to0x(log.fingerprint))) {\n throw new Web3PGPServiceValidationError(`The fingerprint of the retrieved primary key ${pkFp} does not match the declared fingerprint in the KeyCertifiedLog event ${log.fingerprint}`);\n }\n // Remove extra subkeys\n pk = await OpenPGPUtils.sanitizePrimaryKey(pk);\n // Remove certifications revocations\n pk.users.forEach(user => {\n user.revocationSignatures = [];\n })\n // Verify the key if needed\n //\n // Note: Certifications are not verified here as they will be verified by the caller when needed.\n // This avoids fetching the public key of the issuer multiple times if there are multiple certifications to verify.\n if (skipCryptographicVerifications !== true) {\n await OpenPGPUtils.verifyKey(pk, log.blockTimestamp);\n }\n console.debug(`[Web3PGP - Service] Successfully extracted updated key ${pk.getFingerprint()} from KeyUpdatedLog event`);\n return pk.toPublic();\n } catch (err) {\n if (err instanceof Web3PGPServiceValidationError) {\n // Rethrow validation errors\n throw err;\n }\n // Wrap other errors\n throw new Web3PGPServiceValidationError(`Failed to extract the public key form the OpenPGP message in the KeyUpdatedLog event: ${err}`);\n }\n }\n\n /**\n * Validate and extract the revoked certification from a KeyCertificationRevokedLog event.\n * \n * @description\n * This method:\n * 1. Validates the log data contains required fields\n * 2. Extracts and parses the OpenPGP message from the log\n * 3. Verifies the primary key fingerprint matches the declared one\n * 4. (if verifications are enabled) Verifies the primary key has a valid signature, is not expired and is not \n * revoked at the time of certification revocation (uses the block timestamp).\n * 5. Validates that at least one certification revocation signature made by the issuer over the target key is present\n * \n * Cryptographic verifications of the key (step 4) can be skipped by setting the `skipCryptographicVerifications`\n * parameter to true. This is useful when users want to extract and parse the OpenPGP key material in order to perform\n * custom validations or inspections in case the verification fails, is expected to fail or is performed by an external\n * OpenPGP toolkit.\n * \n * @param log The KeyCertificationRevokedLog event data from the blockchain\n * @param skipCryptographicVerifications If true, skips cryptographic verifications of key. Defaults to false.\n * @returns The validated OpenPGP public key extracted from the log\n * \n * @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields\n * @throws Web3PGPServiceValidationError if the extracted OpenPGP message is invalid or corrupted\n * @throws Web3PGPServiceValidationError if the primary key fingerprint does not match the log data\n * @throws Web3PGPServiceValidationError if no valid certification revocation signature made by the issuer is found\n * \n * @example\n * ```typescript\n * const logs = await web3pgp.searchKeyCertificationRevokedLogs(issuerFingerprint, targetFingerprint);\n * for (const log of logs) {\n * try {\n * const revokedCertificationKey = await service.extractFromKeyCertificationRevokedLog(log);\n * console.log(`Valid revoked certification key: ${revokedCertificationKey.getFingerprint()}`);\n * } catch (err) {\n * console.warn(`Invalid log data: ${err.message}`);\n * }\n * }\n * ```\n */\n public async extractFromKeyCertificationRevokedLog(log: KeyCertificationRevokedLog, skipCryptographicVerifications?: boolean): Promise<openpgp.PublicKey> {\n try {\n // Read the OpenPGP message using the hex-encoded binary openPGP message from the log data\n let pk = await openpgp.readKey({ binaryKey: toBytes(log.revocationSignature) });\n const pkFp = toBytes32(to0x(pk.getFingerprint()));\n const issuerFp = toBytes32(to0x(log.issuerFingerprint));\n\n // Verify the fingerprint matches the declared one\n if (pkFp !== toBytes32(to0x(log.fingerprint))) {\n throw new Web3PGPServiceValidationError(`The fingerprint of the retrieved primary key ${pkFp} does not match the declared fingerprint in the KeyCertificationRevokedLog event ${log.fingerprint}`);\n }\n // Remove extra subkeys\n pk = await OpenPGPUtils.sanitizePrimaryKey(pk);\n // Verify the key if needed\n //\n // Note: Certifications and their revocations are not verified here as they will be verified by the caller when needed.\n // This avoids fetching the public key of the issuer multiple times if there are multiple certifications to verify.\n if (skipCryptographicVerifications !== true) {\n await OpenPGPUtils.verifyKey(pk, log.blockTimestamp);\n }\n console.debug(`[Web3PGP - Service] Successfully extracted updated key ${pk.getFingerprint()} from KeyUpdatedLog event`);\n return pk.toPublic();\n } catch (err) {\n if (err instanceof Web3PGPServiceValidationError) {\n // Rethrow validation errors\n throw err;\n }\n // Wrap other errors\n throw new Web3PGPServiceValidationError(`Failed to extract the public key form the OpenPGP message in the KeyUpdatedLog event: ${err}`);\n }\n }\n\n /**\n * Extract the signature from an OwnershipChallengedLog event. The signature is not verified at this stage.\n * \n * @description\n * This method:\n * 1. Validates the log data contains required fields\n * 2. Extracts and parses the OpenPGP signature from the log\n * \n * @param log The OwnershipProvedLog event data from the blockchain\n * @returns The OpenPGP signature extracted from the log\n * \n * @throws Web3PGPServiceValidationError if the log data is invalid or missing required fields\n * @throws Web3PGPServiceValidationError if the extracted OpenPGP signature is invalid or corrupted\n */\n public async extractFromOwnershipProvedLog(log: OwnershipProvedLog): Promise<openpgp.Signature> {\n try {\n // Read the OpenPGP signature using the hex-encoded binary signature from the log data\n return openpgp.readSignature({ binarySignature: toBytes(log.signature) });\n } catch (err) {\n throw new Web3PGPServiceValidationError(`Failed to read the OpenPGP signature from the OwnershipProvedLog event: ${err}`);\n }\n }\n\n /*****************************************************************************************************************/\n /* KEY RETRIEVAL */\n /*****************************************************************************************************************/\n\n /**\n * Retrieve and reconstruct an OpenPGP public key from the blockchain by its fingerprint.\n * \n * @param fingerprint The fingerprint of the key to retrieve (primary key or subkey)\n * @returns The reconstructed and validated OpenPGP public key, with revocations applied if any\n * \n * @throws Error if the key is not registered on-chain\n * @throws Error if the key data cannot be retrieved from blockchain events\n * @throws Error if the retrieved OpenPGP message is invalid or corrupted\n */\n public async getPublicKey(fingerprint: `0x${string}`): Promise<openpgp.PublicKey> {\n\n // 1. Get the publication block number of the target key and its parent if any\n const normalizedFingerprint = toBytes32(to0x(fingerprint));\n console.debug(`[Web3PGP - Service] Retrieving public key for fingerprint: ${normalizedFingerprint}`);\n const [publicationBlock, parent] = await Promise.allSettled([\n this.web3pgp.getKeyPublicationBlock(normalizedFingerprint),\n this.web3pgp.parentOf(normalizedFingerprint)\n ])\n\n if (publicationBlock.status === 'rejected') {\n throw new Web3PGPServiceCriticalError(`Failed to retrieve key publication block: ${publicationBlock.reason}`, publicationBlock.reason);\n }\n\n if (parent.status === 'rejected') {\n throw new Web3PGPServiceCriticalError(`Failed to retrieve parent fingerprint: ${parent.reason}`, parent.reason);\n }\n\n const publicationBlockNumber = publicationBlock.value;\n const parentFingerprint = parent.value;\n\n if (publicationBlockNumber === BigInt(0)) {\n console.debug(`[Web3PGP - Service] Key ${normalizedFingerprint} is not registered on-chain`);\n throw new Web3PGPServiceError(`The key with fingerprint ${fingerprint} is not registered on-chain.`);\n }\n\n console.debug(`[Web3PGP - Service] Key ${normalizedFingerprint} published at block ${publicationBlockNumber}, parent: ${parentFingerprint}`);\n\n // 2. Determine if the target key is a primary key or a subkey\n if (parentFingerprint !== BYTES32_ZERO) {\n // This is a subkey, retrieve the parent key and return the reconstructed full key\n console.debug(`[Web3PGP - Service] Key ${normalizedFingerprint} is a subkey, retrieving parent key to reconstruct full key`);\n return await this.getPublicKey(parentFingerprint);\n }\n\n // 3. List all subkeys and their revocations (certifications and revocations are not handled because subkeys cannot be certified)\n const subkeys = await this.fetchAllPaginated((start, limit) => this.web3pgp.listSubkeys(normalizedFingerprint, start, limit));\n\n // 4. Use the target fingerprint to retrieve blocks with logs related to the primary key and its subkeys\n let blockNumbers = await Promise.all([\n this.web3pgp.getKeyPublicationBlockBatch(subkeys),\n this.fetchAllPaginated((start, limit) => this.web3pgp.listKeyUpdates(normalizedFingerprint, start, limit)),\n this.fetchAllPaginated((start, limit) => this.web3pgp.listRevocations(normalizedFingerprint, start, limit)),\n this.fetchAllPaginated((start, limit) => this.web3pgp.listCertifications(normalizedFingerprint, start, limit)),\n this.fetchAllPaginated((start, limit) => this.web3pgp.listCertificationRevocations(normalizedFingerprint, start, limit)),\n ...subkeys.map(subkeyFingerprint => \n this.concurrencyLimit(() => \n this.fetchAllPaginated((start, limit) => \n this.web3pgp.listRevocations(subkeyFingerprint, start, limit)\n )\n )\n )\n ]);\n\n // 5. Merge and deduplicate all block numbers with key events\n const rawBlocks = [publicationBlockNumber, ...blockNumbers.flat()];\n const uniqueBlocks = [...new Set(rawBlocks)].filter(b => b > 0n);\n\n // 6. Build a map of the expectations for each block to ensure data consistency\n const expectationsMap: Map<bigint, (logs: Web3PGPEventLog[]) => boolean> = new Map();\n \n for (const blockNumber of uniqueBlocks) {\n const isPublicationBlock = blockNumber === publicationBlockNumber;\n\n // 1. Calculate how many explicit 'SubkeyAdded' events are expected in this block.\n // We exclude subkeys from the publication block count here because they are implicitly \n // included within the 'KeyRegistered' event, not emitted as separate 'SubkeyAdded' events.\n const subkeyAddedEventsExpected = blockNumbers[0].filter(b => b === blockNumber && b !== publicationBlockNumber).length;\n \n // 2. Calculate the total expected registration events (KeyRegistered + SubkeyAdded).\n // If this is the publication block, we MUST expect exactly 1 'KeyRegistered' event.\n // This prevents a race condition where an empty RPC response (0 events) would validate \n // as correct against an expectation of 0 events.\n const totalRegistrationEventsExpected = subkeyAddedEventsExpected + (isPublicationBlock ? 1 : 0);\n\n // 3. Calculate expectations for other event types\n const KeyUpdatedExpected = blockNumbers[1].filter(b => b === blockNumber).length;\n \n // Initial count for primary key revocations\n let KeyRevokedExpected = blockNumbers[2].filter(b => b === blockNumber).length;\n \n const KeyCertifiedExpected = blockNumbers[3].filter(b => b === blockNumber).length;\n const KeyCertificationRevokedExpected = blockNumbers[4].filter(b => b === blockNumber).length;\n \n // Add expectations for subkey revocations (iterating through the rest of the batch)\n for (let i = 5; i < blockNumbers.length; i++) {\n KeyRevokedExpected += blockNumbers[i].filter((b: bigint) => b === blockNumber).length;\n }\n\n // Build the predicate function that validates if the retrieved logs match the expectations\n expectationsMap.set(blockNumber, (logs: Web3PGPEventLog[]) => {\n const counts = {\n [Web3PGPEvents.KeyRegistered]: 0,\n [Web3PGPEvents.SubkeyAdded]: 0,\n [Web3PGPEvents.KeyUpdated]: 0,\n [Web3PGPEvents.KeyRevoked]: 0,\n [Web3PGPEvents.KeyCertified]: 0,\n [Web3PGPEvents.KeyCertificationRevoked]: 0\n };\n \n // Count actual events received from RPC\n for (const log of logs) {\n if (counts.hasOwnProperty(log.type)) {\n counts[log.type as keyof typeof counts]++;\n }\n }\n\n // Combine KeyRegistered and SubkeyAdded for comparison\n const keyRegisteredOrSubkeyAddedCount = counts[Web3PGPEvents.KeyRegistered] + counts[Web3PGPEvents.SubkeyAdded];\n\n // Strict equality check:\n // We use === to ensure we have exactly the number of events recorded in the smart contract state.\n // If the RPC is lagging and returns fewer events (or empty), this returns false and triggers a retry.\n return (\n keyRegisteredOrSubkeyAddedCount === totalRegistrationEventsExpected &&\n counts[Web3PGPEvents.KeyUpdated] === KeyUpdatedExpected &&\n counts[Web3PGPEvents.KeyRevoked] === KeyRevokedExpected &&\n counts[Web3PGPEvents.KeyCertified] === KeyCertifiedExpected &&\n counts[Web3PGPEvents.KeyCertificationRevoked] === KeyCertificationRevokedExpected\n );\n });\n }\n\n // 7. Use the searchKeyEvents method to find all relevant logs until we satisfy the expectations for each block\n //\n // Note: We perform up to 3 attempts per block with exponential backoff in case the RPC returns incomplete data.\n // This can happen when writing data to the blockchain and then immediatly querying for events, especially on public RPCs.\n // Although the low level client waits for the transaction to be mined, the event indexer used by the RPC may still be lagging behind.\n // Furthermore, load balancing and network latency can cause inconsistent results across multiple requests. This is why we\n // use the data from the smart contract state (step 5) as the source of truth for the expected events.\n const logs = await Promise.all(\n uniqueBlocks.map(blockNumber => \n this.concurrencyLimit(async () => {\n for (let attempt = 1; attempt <= 3; attempt++) {\n console.debug(`[Web3PGP - Service] Searching for key events for block ${blockNumber}, attempt ${attempt}...`);\n let logs = await this.web3pgp.searchKeyEvents([normalizedFingerprint, ...subkeys], blockNumber, blockNumber);\n const validate = expectationsMap.get(blockNumber);\n if (!validate) {\n // This should never happen\n throw new Web3PGPServiceCriticalError(`Missing expectations validator for block ${blockNumber}`);\n }\n if (validate(logs)) {\n console.debug(`[Web3PGP - Service] Retrieved all (${logs.length}) expected logs for block ${blockNumber} after ${attempt} attempt(s)`);\n return logs;\n } else {\n // Log and wait with an exponential backoff before retrying (start at 200ms)\n const delay = 200 * Math.pow(2, attempt - 1);\n console.debug(`[Web3PGP - Service] Retrieved logs for block ${blockNumber} do not match expectations on attempt ${attempt}. Retrying in ${delay}ms...`);\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n // If we reach here, all attempts failed\n throw new Web3PGPServiceError(`Failed to retrieve expected logs for block ${blockNumber} after 3 attempts.`);\n })\n ) as Promise<Web3PGPEventLog[]>[]\n );\n\n // 8. Flatten and sort the logs array\n const flattenedLogs = logs\n .flat()\n .sort((a, b) => {\n // Sort by block (Safe BigInt comparison)\n if (a.blockNumber < b.blockNumber) return -1;\n if (a.blockNumber > b.blockNumber) return 1;\n \n // Sort by log index within the block (Safe BigInt comparison)\n if (a.logIndex < b.logIndex) return -1;\n if (a.logIndex > b.logIndex) return 1;\n \n return 0;\n });\n\n // 9. KeyRegisteredLog contains the primary key and should be the first log given we sorted them\n // and no other log can be emitted by the smart contract before that log\n if (flattenedLogs[0].type !== Web3PGPEvents.KeyRegistered) {\n throw new Web3PGPServiceError(\n `Invalid event sequence: Key history must start with KeyRegistered. Found ${flattenedLogs[0].type} at block ${flattenedLogs[0].blockNumber} - tx ${flattenedLogs[0].transactionHash}.`\n );\n }\n console.debug(`[Web3PGP - Service] Found KeyRegistered log for primary key ${normalizedFingerprint} at block ${flattenedLogs[0].blockNumber} - tx ${flattenedLogs[0].transactionHash}`);\n let primaryKey = await this.extractFromKeyRegisteredLog(flattenedLogs[0]);\n\n // 10. Iterate over the logs and reconstruct the key\n console.debug(`[Web3PGP - Service] Reconstructing primary key ${normalizedFingerprint} from ${flattenedLogs.length} logs`);\n const historyLogs = flattenedLogs.slice(1); // Exclude the first log (KeyRegistered)\n for (const log of historyLogs) {\n try {\n switch (log.type) {\n case Web3PGPEvents.SubkeyAdded:\n console.debug(`[Web3PGP - Service] Processing SubkeyAdded log for subkey ${log.subkeyFingerprint} at block ${log.blockNumber} - tx ${log.transactionHash}`);\n const subkey = await this.extractFromSubkeyAddedLog(log);\n primaryKey = await primaryKey.update(subkey, log.blockTimestamp);\n break;\n case Web3PGPEvents.KeyRevoked:\n console.debug(`[Web3PGP - Service] Processing KeyRevoked log for fingerprint ${log.fingerprint} at block ${log.blockNumber} - tx ${log.transactionHash}`);\n const [revokedKey, revocationCert] = await this.extractFromKeyRevokedLog(log);\n if (revokedKey) {\n primaryKey = await primaryKey.update(revokedKey, log.blockTimestamp);\n } else if (revocationCert) {\n try {\n const result = await openpgp.revokeKey({ \n key: primaryKey, \n revocationCertificate: revocationCert,\n date: log.blockTimestamp,\n format: 'object'\n });\n \n primaryKey = await primaryKey.update(result.publicKey, log.blockTimestamp);\n } catch (err) {\n // Wrap and throw error when the application of the revocation certificate fails because it does not match the key\n throw new Web3PGPServiceValidationError(`Failed to apply standalone revocation certificate for key ${log.fingerprint} from KeyRevokedLog event: ${err}`);\n }\n }\n break;\n case Web3PGPEvents.KeyUpdated:\n console.debug(`[Web3PGP - Service] Processing KeyUpdated log at block ${log.blockNumber} - tx ${log.transactionHash}`);\n const updatedKey = await this.extractFromKeyUpdatedLog(log);\n primaryKey = await primaryKey.update(updatedKey, log.blockTimestamp);\n break;\n case Web3PGPEvents.KeyCertified:\n console.debug(`[Web3PGP - Service] Processing KeyCertified log at block ${log.blockNumber} - tx ${log.transactionHash}`);\n const certifiedKey = await this.extractFromKeyCertifiedLog(log);\n primaryKey = await primaryKey.update(certifiedKey, log.blockTimestamp);\n break;\n case Web3PGPEvents.KeyCertificationRevoked:\n console.debug(`[Web3PGP - Service] Processing KeyCertificationRevoked log at block ${log.blockNumber} - tx ${log.transactionHash}`);\n const certRevokedKey = await this.extractFromKeyCertificationRevokedLog(log);\n primaryKey = await primaryKey.update(certRevokedKey, log.blockTimestamp);\n break;\n default:\n // OwnershipChallenged and OwnershipProved logs are not relevant for key reconstruction\n console.warn(`[Web3PGP - Service] Unused log type ${log.type} at block ${log.blockNumber} - tx ${log.transactionHash}`);\n break;\n }\n } catch (err) {\n if (err instanceof Web3PGPServiceValidationError) {\n console.warn(`[Web3PGP - Service] Failed to process log of type ${log.type} at block ${log.blockNumber} for key ${primaryKey.getFingerprint()}: ${err}`);\n } else {\n // Rethrow other errors\n throw err;\n }\n } \n }\n\n // 11. Return the reconstructed public key\n console.debug(`[Web3PGP - Service] Successfully retrieved and reconstructed the public key`);\n return primaryKey;\n }\n\n /**\n * Searches for all key-related events within a specified block range. Optionally filters by fingerprints.\n * \n * Note: The fingerprints are the subjects of the events (i.e., the keys being registered, updated, revoked, certified, etc.).\n * Results will also include subkeys added, challenges, and proofs of ownership related to the listed fingerprints.\n * \n * @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.\n * @param fromBlock Starting block number (inclusive). Defaults to 'earliest' if not provided. 'pending' is not allowed.\n * @param toBlock Ending block number (inclusive). Defaults to 'latest' if not provided. 'pending' is not allowed.\n * @return An array of Web3PGPEventLog.\n */\n public async searchKeyEvents(fingerprints?: `0x${string}` | `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<Web3PGPEventLog[]> {\n return this.web3pgp.searchKeyEvents(fingerprints, fromBlock, toBlock);\n }\n \n /**\n * Get the current block number of the connected blockchain.\n * @return The current block number as a bigint.\n */\n public async getBlockNumber(): Promise<bigint> {\n return this.web3pgp.getBlockNumber();\n }\n\n /*****************************************************************************************************************/\n /* UTILITY FUNCTIONS */\n /*****************************************************************************************************************/\n\n /**\n * Helper method to fetch all items from a paginated contract method.\n * @param fetchFn The paginated fetch function to call\n * @param limit The number of items to fetch per page\n * @param maxItems The maximum number of items to fetch in total (safety limit)\n * @returns An array containing all fetched items\n */\n private async fetchAllPaginated<T>(\n fetchFn: (start: bigint, limit: bigint) => Promise<T[]>,\n limit: bigint = 1000n,\n maxItems: bigint = 100000n // Safety limit\n ): Promise<T[]> {\n const results: T[] = [];\n let start = 0n;\n\n do {\n const batch = await fetchFn(start, limit);\n results.push(...batch);\n\n if (batch.length < Number(limit) || results.length >= Number(maxItems)) {\n break;\n }\n start += limit;\n } while (true);\n\n return results;\n }\n}\n\n\n","import { BaseLog } from \"../../common/types/types\";\n\n/**\n * This struct is used to describe the recipient of a document and indicate if the recipient is requested to\n * sign the document.\n * \n * @property fingerprint The fingerprint of the recipient's key.\n * @property signatureRequested Indicates whether a signature from this recipient has been requested.\n */\nexport type Recipient = {\n fingerprint: `0x${string}`;\n signatureRequested: boolean;\n}\n\n/**\n * Enum used by Notification events to help users understand what kind of event is related to the notification.\n */\nexport enum EventType {\n DOCUMENT = 0, // The notification is caused by a user sending a document to peers (Document).\n COPY = 1 // The notification is caused by a user sending a certified copy of a document (Copy).\n}\n\n/**\n * Constants representing the different event types emitted by the Web3Doc smart contract.\n */\nexport const Web3DocEvents = {\n Document: 'Document',\n Copy: 'Copy',\n Notification: 'Notification',\n Signature: 'Signature',\n Timestamp: 'Timestamp',\n SignatureRevocation: 'SignatureRevocation'\n} as const;\n\n/**\n * Type representing a Document event emitted when a user sends a document to peers.\n *\n * @property id Unique ID generated by the smart contract.\n * @property emitter The fingerprint of the key used to produce the signature.\n * @property dochash The keccak256 hash of the document.\n * @property signature An OpenPGP message which contains the detached signature made over the document.\n * @property document An optional OpenPGP message which contains the (encrypted) document.\n * @property uri An optional URI which can be used to download the document from an off-chain storage like IPFS, S3, SFTP, ...\n * @property mimeType Optional, The MIME type of the document and additional attributes (RFC6838)\n */\nexport type DocumentLog = BaseLog & {\n type: typeof Web3DocEvents.Document;\n id: bigint;\n emitter: `0x${string}`;\n dochash: `0x${string}`;\n signature: `0x${string}`;\n document: `0x${string}`;\n uri: string;\n mimeType: string;\n}; \n\n/**\n * Type representing a Copy event emitted when a user sends a certified copy of a document.\n * \n * @property copy The unique ID assigned to the copy by the smart contract.\n * @property original The ID of the original document assigned by the smart contract.\n * @property emitter The fingerprint of the key used by the emitter.\n * @property document The binary OpenPGP message containing the document itself.\n * @property uri The URI which can be used to download the binary OpenPGP message containing the document from an off-chain storage.\n */\nexport type CopyLog = BaseLog & {\n type: typeof Web3DocEvents.Copy;\n copy: bigint;\n original: bigint;\n emitter: `0x${string}`;\n document: `0x${string}`;\n uri: string;\n};\n\n/**\n * Type representing a Notification event emitted to warn recipients that a new document has been sent to them.\n *\n * @property id The unique ID of the document that has been sent.\n * @property emitter The fingerprint of the key used by the emitter.\n * @property recipient The fingerprint of the key of the recipient.\n * @property source The type of event that has caused this notification (publication, response or copy).\n * @property signatureRequested If true, the recipient is prompted by the emitter to sign the document.\n */\nexport type NotificationLog = BaseLog & {\n type: typeof Web3DocEvents.Notification;\n id: bigint;\n emitter: `0x${string}`;\n recipient: `0x${string}`;\n source: EventType;\n signatureRequested: boolean;\n};\n\n/**\n * Type representing a Signature event emitted when a user signs a document.\n *\n * @property id The unique ID of the document being signed.\n * @property emitter The fingerprint of the key used to create the signature.\n * @property signatureHash The keccak256 hash of the signature created over the document (hashed by the smart contract).\n * @property signature The binary OpenPGP message which contains the detached signature over the document.\n */\nexport type SignatureLog = BaseLog & {\n type: typeof Web3DocEvents.Signature;\n id: bigint;\n emitter: `0x${string}`;\n signatureHash: `0x${string}`;\n signature: `0x${string}`;\n};\n\n/**\n * Type representing a SignatureRevocation event emitted when a user revokes a previously published signature.\n *\n * @property id The unique ID of the document whose signature is being revoked.\n * @property emitter The fingerprint of the key that created the signature being revoked.\n * @property signatureHash The keccak256 hash of the signature being revoked.\n * @property signature A detached binary OpenPGP signature created over the signature hash.\n */\nexport type SignatureRevocationLog = BaseLog & {\n type: typeof Web3DocEvents.SignatureRevocation;\n id: bigint;\n emitter: `0x${string}`;\n signatureHash: `0x${string}`;\n signature: `0x${string}`;\n};\n\n/**\n * Type representing a Timestamp event emitted when a user timestamps a document.\n *\n * @property id A unique ID generated by the smart contract for this timestamp event.\n * @property emitter The fingerprint of the public key used to create the signature.\n * @property dochash The keccak256 hash of the document used to look up the timestamp and to verify the document's integrity.\n * @property signature A detached binary OpenPGP signature created over the keccak256 hash of the document.\n */\nexport type TimestampLog = BaseLog & {\n type: typeof Web3DocEvents.Timestamp;\n id: bigint;\n emitter: `0x${string}`;\n dochash: `0x${string}` ;\n signature: `0x${string}`;\n};\n\n","/**\n * ABI for Web3Doc\n * Auto-generated from Foundry build artifacts\n */\nexport const Web3Doc = [{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"receive\",\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"UPGRADE_INTERFACE_VERSION\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"authority\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"copyOffChain\",\"inputs\":[{\"name\":\"original\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"emitter\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"recipients\",\"type\":\"tuple[]\",\"internalType\":\"struct IWeb3Doc.Recipient[]\",\"components\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"signatureRequested\",\"type\":\"bool\",\"internalType\":\"bool\"}]},{\"name\":\"uri\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"copyOnChain\",\"inputs\":[{\"name\":\"original\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"emitter\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"recipients\",\"type\":\"tuple[]\",\"internalType\":\"struct IWeb3Doc.Recipient[]\",\"components\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"signatureRequested\",\"type\":\"bool\",\"internalType\":\"bool\"}]},{\"name\":\"document\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"getDocumentBlockNumberByID\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getDocumentBlockNumberByIDBatch\",\"inputs\":[{\"name\":\"ids\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getSignatureBlockNumberByHash\",\"inputs\":[{\"name\":\"signatureHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getSignatureBlockNumberByHashBatch\",\"inputs\":[{\"name\":\"signatureHashes\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getWeb3PGPAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initialize\",\"inputs\":[{\"name\":\"fee\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"manager\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"web3pgp\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"initializeUpgrade\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"isConsumingScheduledOp\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\",\"internalType\":\"bytes4\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isCopyOf\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"listDocumentIdsByHash\",\"inputs\":[{\"name\":\"dochash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"start\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"limit\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"listSignatureRevocationsBlockNumbers\",\"inputs\":[{\"name\":\"signatureHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"start\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"limit\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"listSignatures\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"start\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"limit\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proxiableUUID\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"requestedFee\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"revokeSignature\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"emitter\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"signatureHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"sendOffChain\",\"inputs\":[{\"name\":\"emitter\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"recipients\",\"type\":\"tuple[]\",\"internalType\":\"struct IWeb3Doc.Recipient[]\",\"components\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"signatureRequested\",\"type\":\"bool\",\"internalType\":\"bool\"}]},{\"name\":\"dochash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"uri\",\"type\":\"string\",\"internalType\":\"string\"},{\"name\":\"mimeType\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"sendOnChain\",\"inputs\":[{\"name\":\"emitter\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"recipients\",\"type\":\"tuple[]\",\"internalType\":\"struct IWeb3Doc.Recipient[]\",\"components\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"signatureRequested\",\"type\":\"bool\",\"internalType\":\"bool\"}]},{\"name\":\"dochash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"document\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"mimeType\",\"type\":\"string\",\"internalType\":\"string\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"setAuthority\",\"inputs\":[{\"name\":\"newAuthority\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"sign\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"emitter\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"timestamp\",\"inputs\":[{\"name\":\"emitter\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"dochash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"signature\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"updateRequestedFee\",\"inputs\":[{\"name\":\"newFee\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upgradeToAndCall\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"withdrawFees\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AuthorityUpdated\",\"inputs\":[{\"name\":\"authority\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Copy\",\"inputs\":[{\"name\":\"copy\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"original\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"emitter\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"document\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"uri\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Document\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"emitter\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"dochash\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"signature\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"document\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"uri\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"},{\"name\":\"mimeType\",\"type\":\"string\",\"indexed\":false,\"internalType\":\"string\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"FeesWithdrawn\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Notification\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"emitter\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"recipient\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"source\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"enum IWeb3Doc.EventType\"},{\"name\":\"signatureRequested\",\"type\":\"bool\",\"indexed\":true,\"internalType\":\"bool\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"RequestedFeeUpdated\",\"inputs\":[{\"name\":\"oldFee\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"newFee\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Signature\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"emitter\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"signatureHash\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"signature\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SignatureRevocation\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"emitter\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"signatureHash\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"signature\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Timestamp\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"emitter\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"dochash\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"},{\"name\":\"signature\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Upgraded\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"AccessManagedInvalidAuthority\",\"inputs\":[{\"name\":\"authority\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"AccessManagedRequiredDelay\",\"inputs\":[{\"name\":\"caller\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"delay\",\"type\":\"uint32\",\"internalType\":\"uint32\"}]},{\"type\":\"error\",\"name\":\"AccessManagedUnauthorized\",\"inputs\":[{\"name\":\"caller\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"AddressEmptyCode\",\"inputs\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"DocumentIsACopy\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"DocumentNotFound\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"ERC1967InvalidImplementation\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC1967NonPayable\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"EmitterNotFound\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"FailedCall\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FeeRequired\",\"inputs\":[{\"name\":\"provided\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"required\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"FeesWithdrawalFailed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidInitialization\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NoDirectPaymentsAllowed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NoFeesToWithdraw\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotInitializing\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RecipientNotFound\",\"inputs\":[{\"name\":\"fingerprint\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"ReentrancyGuardReentrantCall\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SignatureNotFound\",\"inputs\":[{\"name\":\"signatureHash\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"UUPSUnauthorizedCallContext\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UUPSUnsupportedProxiableUUID\",\"inputs\":[{\"name\":\"slot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]}] as const;\n\nexport default Web3Doc;\n","/**\n * Base error class for all Web3Doc-related errors.\n * Extends the native Error class to provide consistent error handling across the Web3Doc system.\n */\nexport class Web3DocError extends Error {\n /**\n * Optional underlying error that caused this error.\n */\n cause?: Error | undefined;\n\n /**\n * Creates a new Web3DocError instance.\n * @param message - Human-readable error description\n * @param cause - Optional underlying error that caused this error\n */\n constructor(message: string, cause?: Error) {\n super(message);\n this.name = 'Web3DocError';\n this.cause = cause;\n \n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\n/**\n * Critical error class for unrecoverable Web3Doc errors.\n * Used when the system encounters a fatal condition that requires immediate attention.\n */\nexport class Web3DocCriticalError extends Web3DocError {\n /**\n * Creates a new Web3DocCriticalError instance.\n * @param message - Human-readable error description\n * @param cause - Optional underlying error that caused this error\n */\n constructor(message: string, cause?: Error) {\n super(message, cause);\n this.name = 'Web3DocCriticalError';\n }\n}\n\n/**\n * Base error class for Web3Doc service-related errors.\n * Used for errors that occur during service operations.\n */\nexport class Web3DocServiceError extends Error {\n /**\n * Optional underlying error that caused this error.\n */\n cause?: Error | undefined;\n\n /**\n * Creates a new Web3DocServiceError instance.\n * @param message - Human-readable error description\n * @param cause - Optional underlying error that caused this error\n */\n constructor(message: string, cause?: Error) {\n super(message);\n this.name = 'Web3DocServiceError';\n this.cause = cause;\n \n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\n/**\n * Validation error class for Web3Doc service validation failures.\n * Thrown when input validation fails or data does not meet required criteria.\n */\nexport class Web3DocServiceValidationError extends Web3DocServiceError {\n /**\n * Creates a new Web3DocServiceValidationError instance.\n * @param message - Human-readable error description\n * @param cause - Optional underlying error that caused this error\n */\n constructor(message: string, cause?: Error) {\n super(message, cause);\n this.name = 'Web3DocServiceValidationError';\n }\n}\n\n/**\n * Critical service error class for unrecoverable Web3Doc service errors.\n * Used when a service encounters a fatal condition that prevents continued operation.\n */\nexport class Web3DocServiceCriticalError extends Web3DocServiceError {\n /**\n * Creates a new Web3DocServiceCriticalError instance.\n * @param message - Human-readable error description\n * @param cause - Optional underlying error that caused this error\n */\n constructor(message: string, cause?: Error) {\n super(message, cause);\n this.name = 'Web3DocServiceCriticalError';\n }\n}","import { Address, TransactionReceipt, PublicClient, WalletClient, parseEventLogs, BlockTag } from 'viem';\nimport { IWeb3Doc } from './web3doc.interface';\nimport { IWeb3PGP } from '../web3pgp/web3pgp.interface';\nimport { Recipient, DocumentLog, CopyLog, SignatureLog, TimestampLog, NotificationLog, Web3DocEvents, SignatureRevocationLog } from './types/types';\nimport { Web3Doc as Web3DocABI } from '../abis/Web3Doc';\nimport { to0x, toBytes32 } from '../utils/0xstr';\nimport { FlatFee } from '../flatfee/flatefee';\nimport { getBlockTimestamp } from '../utils/viemutils';\nimport { Web3DocCriticalError, Web3DocError } from './types/errors';\n\n/**\n * Implementation of the Web3Doc contract interface.\n * \n * This class provides low-level bindings to interact with the Web3Doc contract deployed on the blockchain.\n * Extends FlatFee to inherit fee management and access control functionality.\n */\nexport class Web3Doc extends FlatFee implements IWeb3Doc {\n\n public static readonly abi = Web3DocABI;\n \n // Pre-computed event definitions for efficient log queries\n private static readonly DOCUMENT_EVENT = Web3DocABI.find(item => item.type === 'event' && item.name === 'Document')!;\n private static readonly COPY_EVENT = Web3DocABI.find(item => item.type === 'event' && item.name === 'Copy')!;\n private static readonly NOTIFICATION_EVENT = Web3DocABI.find(item => item.type === 'event' && item.name === 'Notification')!;\n private static readonly SIGNATURE_EVENT = Web3DocABI.find(item => item.type === 'event' && item.name === 'Signature')!;\n private static readonly SIGNATURE_REVOCATION_EVENT = Web3DocABI.find(item => item.type === 'event' && item.name === 'SignatureRevocation')!;\n private static readonly TIMESTAMP_EVENT = Web3DocABI.find(item => item.type === 'event' && item.name === 'Timestamp')!;\n\n /**\n * Creates a new Web3Doc instance.\n * \n * @param address The address of the Web3Doc smart contract.\n * @param web3pgp An instance implementing the IWeb3PGP interface for public key operations.\n * @param client A Viem public client for interacting with the blockchain.\n * @param walletClient Optional Viem wallet client for signing transactions.\n */\n public constructor(address: Address, web3pgp: IWeb3PGP, client: PublicClient, walletClient?: WalletClient) {\n super(address, client, walletClient);\n }\n\n /*****************************************************************************************************************/\n /* WRITE FUNCTIONS */\n /*****************************************************************************************************************/\n\n /**\n * Sends a document and its detached signature on-chain and notifies the specified recipients.\n *\n * @param emitter The fingerprint of the key used by the emitter to produce the signature.\n * @param recipients The list of recipients to notify and optionally prompt to sign the document.\n * @param dochash The declared keccak256 hash of the document.\n * @param signature A detached binary OpenPGP signature of the document.\n * @param document The binary OpenPGP message which contains the document.\n * @param mimeType Optional, The MIME type of the document and additional attributes (RFC6838)\n */\n public async sendOnChain(\n emitter: `0x${string}`,\n recipients: Recipient[],\n dochash: `0x${string}`,\n signature: `0x${string}`,\n document: `0x${string}`,\n mimeType: string\n ): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the requested fee\n const fee = await this.requestedFee();\n // Simulate client call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3DocABI,\n functionName: 'sendOnChain',\n args: [\n toBytes32(to0x(emitter)), \n recipients.map(recipient => ({\n fingerprint: toBytes32(to0x(recipient.fingerprint)),\n signatureRequested: recipient.signatureRequested,\n })),\n dochash, \n signature, \n document, \n mimeType\n ],\n value: fee, // Include fee in the transaction value\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Sends a document using an off-chain channel, publishes its detached signature on-chain and notifies the specified recipients.\n *\n * @param emitter The fingerprint of the key used to produce the signature.\n * @param recipients The list of recipients to notify and optionally prompt to sign the document.\n * @param dochash The declared keccak256 hash of the document.\n * @param signature A detached binary OpenPGP signature of the document.\n * @param uri A URI which can be used to download the OpenPGP message (compressed and encrypted) which contains the document.\n * @param mimeType Optional, The MIME type of the document and additional attributes (RFC6838)\n */\n public async sendOffChain(\n emitter: `0x${string}`,\n recipients: Recipient[],\n dochash: `0x${string}`,\n signature: `0x${string}`,\n uri: string,\n mimeType: string\n ): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the requested fee\n const fee = await this.requestedFee();\n // Simulate client call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3DocABI,\n functionName: 'sendOffChain',\n args: [\n toBytes32(to0x(emitter)), \n recipients.map(recipient => ({\n fingerprint: toBytes32(to0x(recipient.fingerprint)),\n signatureRequested: recipient.signatureRequested,\n })),\n dochash, \n signature, \n uri, \n mimeType\n ],\n value: fee, // Include fee in the transaction value\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Send a certified copy of a document on-chain.\n *\n * @param original The ID of the original document that is the subject of the copy.\n * @param emitter The fingerprint of the emitter's public key.\n * @param recipients The list of recipient key fingerprints to be notified and, optionally, be prompted for a signature.\n * @param document The binary OpenPGP message containing the copy of the original document.\n */\n public async copyOnChain(\n original: bigint,\n emitter: `0x${string}`,\n recipients: Recipient[],\n document: `0x${string}`\n ): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the requested fee\n const fee = await this.requestedFee();\n // Simulate client call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3DocABI,\n functionName: 'copyOnChain',\n args: [\n original,\n toBytes32(to0x(emitter)), \n recipients.map(recipient => ({\n fingerprint: toBytes32(to0x(recipient.fingerprint)),\n signatureRequested: recipient.signatureRequested,\n })),\n document\n ],\n value: fee, // Include fee in the transaction value\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Send a certified copy of a document using an off-chain storage.\n *\n * @param original The ID of the original document being copied. Must reference a valid, non-copy document.\n * @param emitter The fingerprint of the key used to produce the signature.\n * @param recipients The list of recipient key fingerprints to be notified and, optionally, be prompted for a signature.\n * @param uri A URI which can be used to download the OpenPGP message containing the (compressed, encrypted and signed) document itself.\n */\n public async copyOffChain(\n original: bigint,\n emitter: `0x${string}`,\n recipients: Recipient[],\n uri: string\n ): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the requested fee\n const fee = await this.requestedFee();\n // Simulate client call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3DocABI,\n functionName: 'copyOffChain',\n args: [\n original,\n toBytes32(to0x(emitter)), \n recipients.map(recipient => ({\n fingerprint: toBytes32(to0x(recipient.fingerprint)),\n signatureRequested: recipient.signatureRequested,\n })),\n uri\n ],\n value: fee, // Include fee in the transaction value\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Publishes a binary detached OpenPGP signature of a document made with the emitter's key.\n *\n * @param id The unique ID of the document that has been signed.\n * @param emitter The fingerprint of the key used to produce the signature.\n * @param signature The detached binary OpenPGP signature made over the document.\n */\n public async sign(id: bigint, emitter: `0x${string}`, signature: `0x${string}`): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the requested fee\n const fee = await this.requestedFee();\n // Simulate client call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3DocABI,\n functionName: 'sign',\n args: [\n id,\n toBytes32(to0x(emitter)),\n signature\n ],\n value: fee, // Include fee in the transaction value\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Timestamps a document by publishing a detached signature of the hash of the document on-chain.\n *\n * @param emitter The fingerprint of the key used to produce the signature.\n * @param dochash The keccak256 hash of the document used to find the timestamp from the document and verify their integrity.\n * @param signature A detached binary OpenPGP signature made over the raw bytes of the keccak256 hash of the document.\n */\n public async timestamp(emitter: `0x${string}`, dochash: `0x${string}`, signature: `0x${string}`): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the requested fee\n const fee = await this.requestedFee();\n // Simulate client call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3DocABI,\n functionName: 'timestamp',\n args: [\n toBytes32(to0x(emitter)),\n dochash,\n signature\n ],\n value: fee, // Include fee in the transaction value\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /**\n * Revokes a signature previously published on-chain.\n *\n * @param id The ID of the document associated with the signature.\n * @param emitter The fingerprint of the key that made the signature.\n * @param signatureHash The hash of the signature to revoke.\n * @param signature A detached binary OpenPGP signature made over the raw bytes of the signature hash.\n */\n public async revokeSignature(\n id: bigint,\n emitter: `0x${string}`,\n signatureHash: `0x${string}`,\n signature: `0x${string}`\n ): Promise<TransactionReceipt> {\n this.ensureWalletClient();\n // Get the requested fee\n const fee = await this.requestedFee();\n // Simulate client call\n const { request } = await this.client.simulateContract({\n address: this.address,\n account: this.walletClient!.account,\n abi: Web3DocABI,\n functionName: 'revokeSignature',\n args: [\n id,\n toBytes32(to0x(emitter)),\n signatureHash,\n signature\n ],\n value: fee, // Include fee in the transaction value\n });\n // Use the wallet client to send the actual transaction\n const txhash = await this.walletClient!.writeContract(request);\n // Wait for transaction to be mined and return the receipt\n return this.client.waitForTransactionReceipt({ hash: txhash });\n }\n\n /*****************************************************************************************************************/\n /* READ FUNCTIONS */\n /*****************************************************************************************************************/\n\n /**\n * Get the address of the Web3PGP contract used as a global public key registry.\n *\n * @return The address of the Web3PGP contract used by this contract.\n */\n public async getWeb3PGPAddress(): Promise<Address> {\n return this.client.readContract({\n address: this.address,\n abi: Web3DocABI,\n functionName: 'getWeb3PGPAddress',\n });\n }\n\n /**\n * Returns the ID of the original document that the given document is a copy of.\n *\n * @param id The ID of a document that may be a copy of another previously published document.\n * @return The ID of the original document if the given document is a copy, or 0 if it is not a copy.\n */\n public async isCopyOf(id: bigint): Promise<bigint> {\n return this.client.readContract({\n address: this.address,\n abi: Web3DocABI,\n functionName: 'isCopyOf',\n args: [id],\n });\n }\n\n /**\n * Returns the block number in which the document or timestamps with the given ID was published.\n *\n * @param id The ID of the document whose block number is to be retrieved.\n * @return The block number in which the document was published. 0 if the document does not exist.\n */\n public async getDocumentBlockNumberByID(id: bigint): Promise<bigint> {\n return this.client.readContract({\n address: this.address,\n abi: Web3DocABI,\n functionName: 'getDocumentBlockNumberByID',\n args: [id],\n });\n }\n\n /**\n * Returns the block numbers in which the documents or timestamps with the given IDs were published.\n *\n * @param ids The IDs of the documents whose block numbers are to be retrieved.\n * @return The block numbers in which the documents were published.\n */\n public async getDocumentBlockNumberByIDBatch(ids: bigint[]): Promise<bigint[]> {\n return this.client.readContract({\n address: this.address,\n abi: Web3DocABI,\n functionName: 'getDocumentBlockNumberByIDBatch',\n args: [ids],\n }) as Promise<bigint[]>;\n }\n\n /**\n * Lists the block numbers when were published the signatures associated with the given document.\n *\n * @param id The ID of the document whose signatures are to be listed.\n * @param start The starting index from which to list signatures (0-based).\n * @param limit The maximum number of signatures to list.\n * @return An array of signature IDs associated with the document.\n */\n public async listSignatures(id: bigint, start: bigint, limit: bigint): Promise<bigint[]> {\n return this.client.readContract({\n address: this.address,\n abi: Web3DocABI,\n functionName: 'listSignatures',\n args: [id, start, limit],\n }) as Promise<bigint[]>;\n }\n\n /**\n * Returns the block number in which the signature with the given hash was created or 0 if the signature does not exist.\n *\n * @param signatureHash The hash of the signature.\n * @return The block number in which the signature was created, or 0 if the signature does not exist.\n */\n public async getSignatureBlockNumberByHash(signatureHash: `0x${string}`): Promise<bigint> {\n return this.client.readContract({\n address: this.address,\n abi: Web3DocABI,\n functionName: 'getSignatureBlockNumberByHash',\n args: [signatureHash],\n });\n }\n\n /**\n * Returns the block numbers in which the signatures with the given hashes were created.\n *\n * @param signatureHashes The hashes of the signatures.\n * @return The block numbers in which the signatures were created.\n */\n public async getSignatureBlockNumberByHashBatch(signatureHashes: `0x${string}`[]): Promise<bigint[]> {\n return this.client.readContract({\n address: this.address,\n abi: Web3DocABI,\n functionName: 'getSignatureBlockNumberByHashBatch',\n args: [signatureHashes],\n }) as Promise<bigint[]>;\n }\n\n /**\n * Lists the document IDs by the given document hash.\n *\n * @param dochash The hash of the document.\n * @param start The starting index from which to list documents (0-based).\n * @param limit The maximum number of documents to list.\n * @return An array of document IDs with the given hash.\n */\n public async listDocumentIdsByHash(dochash: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]> {\n return this.client.readContract({\n address: this.address,\n abi: Web3DocABI,\n functionName: 'listDocumentIdsByHash',\n args: [dochash, start, limit],\n }) as Promise<bigint[]>;\n }\n\n /**\n * Lists the block numbers of signature revocations for the given signature hash.\n *\n * @param signatureHash The hash of the signature.\n * @param start The starting index from which to list revocations (0-based).\n * @param limit The maximum number of revocations to list.\n * @return An array of block numbers where the signature was revoked.\n */\n public async listSignatureRevocationsBlockNumbers(signatureHash: `0x${string}`, start: bigint, limit: bigint): Promise<bigint[]> {\n return this.client.readContract({\n address: this.address,\n abi: Web3DocABI,\n functionName: 'listSignatureRevocationsBlockNumbers',\n args: [signatureHash, start, limit],\n }) as Promise<bigint[]>;\n }\n\n /*****************************************************************************************************************/\n /* LOGS SEARCH FUNCTIONS */\n /*****************************************************************************************************************/\n\n /**\n * Searches for Document events emitted by the smart contract, filtered by the provided criteria.\n * Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.\n * \n * @param ids Filter by document IDs. IDs uniqueness is guaranteed by the smart contract.\n * @param emitters Filter by emitter fingerprints.\n * @param dochashes Filter by document hashes.\n * @param fromBlock Filter events from this block number. Genesis block if not specified.\n * @param toBlock Filter events up to this block number. Latest block if not specified.\n * @returns The list of DocumentLog matching the provided filters.\n */\n public async searchDocumentLogs(\n ids?: bigint[], \n emitters?: `0x${string}`[], \n dochashes?: `0x${string}`[], \n fromBlock?: BlockTag | bigint, \n toBlock?: BlockTag | bigint\n ): Promise<DocumentLog[]> {\n // Reject pending block tags for fromBlock/toBlock\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n // Use default values: fromBlock = earliest block, toBlock = latest block\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n // Build args only if a filter is provided\n let args: any = undefined;\n if (ids !== undefined || emitters !== undefined || dochashes !== undefined) {\n args = {};\n if (ids !== undefined) {\n args.id = ids;\n }\n if (emitters !== undefined) {\n args.emitter = emitters.map(toBytes32);\n }\n if (dochashes !== undefined) {\n args.dochash = dochashes;\n }\n }\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3Doc.DOCUMENT_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n \n // Batch fetch timestamps for unique block numbers\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n\n return logs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Document,\n id: log.args.id,\n emitter: log.args.emitter,\n dochash: log.args.dochash,\n signature: log.args.signature,\n document: log.args.document,\n uri: log.args.uri,\n mimeType: log.args.mimeType,\n }));\n }\n\n /**\n * Retrieves a Document event by its unique ID.\n * \n * @param id The unique ID of the document.\n * @param blockNumber The block number where to search for the document.\n * @returns The DocumentLog if found, otherwise undefined.\n * @example\n * ```typescript\n * const targetID = 1n;\n * const blockNumber = await web3Doc.getDocumentBlockNumberByID(targetID);\n * const documentLog = await web3Doc.getDocumentLogByID(targetID, blockNumber);\n * ```\n */\n public async getDocumentLogByID(id: bigint, blockNumber: bigint): Promise<DocumentLog | undefined> {\n const logs = await this.searchDocumentLogs([id], undefined, undefined, blockNumber, blockNumber);\n if (logs.length === 1) return logs[0];\n if (logs.length === 0) return undefined;\n // This should never happen as document IDs are unique but we guard against it anyway\n throw new Web3DocCriticalError(`Multiple Document logs found for document ID ${id} at block ${blockNumber}`);\n }\n\n /**\n * Searches for Copy events emitted by the smart contract, filtered by the provided criteria.\n * Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.\n * \n * @param copies Filter by copy IDs. Copy IDs uniqueness is guaranteed by the smart contract. \n * @param originals Filter by original document IDs.\n * @param emitters Filter by emitter fingerprints.\n * @param fromBlock Filter events from this block number. Genesis block if not specified.\n * @param toBlock Filter events up to this block number. Latest block if not specified.\n * @returns The list of CopyLog matching the provided filters.\n */\n public async searchCopyLogs(\n copies?: bigint[], \n originals?: bigint[], \n emitters?: `0x${string}`[], \n fromBlock?: BlockTag | bigint, \n toBlock?: BlockTag | bigint\n ): Promise<CopyLog[]> {\n // Reject pending block tags for fromBlock/toBlock\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n // Use default values: fromBlock = earliest block, toBlock = latest block\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n \n // Build args only if a filter is provided\n let args: any = undefined;\n if (copies !== undefined || originals !== undefined || emitters !== undefined) {\n args = {};\n if (copies !== undefined) {\n args.copy = copies;\n }\n if (originals !== undefined) {\n args.original = originals;\n }\n if (emitters !== undefined) {\n args.emitter = emitters.map(toBytes32);\n }\n }\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3Doc.COPY_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n \n // Batch fetch timestamps for unique block numbers\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n\n return logs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Copy,\n copy: log.args.copy,\n original: log.args.original,\n emitter: log.args.emitter,\n document: log.args.document,\n uri: log.args.uri,\n }));\n }\n\n /**\n * Retrieves a Copy event by its unique ID.\n * \n * @param copy The unique ID of the copy.\n * @param blockNumber The block number where to search for the copy.\n * @returns The CopyLog if found, otherwise undefined.\n * @example\n * ```typescript\n * const targetCopyID = 1n;\n * const blockNumber = await web3Doc.getDocumentBlockNumberByID(targetCopyID);\n * const copyLog = await web3Doc.getCopyLogByID(targetCopyID, blockNumber);\n * ```\n */\n public async getCopyLogByID(copy: bigint, blockNumber: bigint): Promise<CopyLog | undefined> {\n const logs = await this.searchCopyLogs([copy], undefined, undefined, blockNumber, blockNumber);\n if (logs.length === 1) return logs[0];\n if (logs.length === 0) return undefined;\n // This should never happen as copy IDs are unique but we guard against it anyway\n throw new Web3DocCriticalError(`Multiple Copy logs found for copy ID ${copy} at block ${blockNumber}`);\n }\n\n /**\n * Searches for Notification events emitted by the smart contract, filtered by the provided criteria.\n * Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.\n * \n * @param ids Filter by document IDs. Document IDs uniqueness is guaranteed by the smart contract.\n * @param recipients Filter by recipient fingerprints.\n * @param signatureRequested Filter by whether a signature was requested or not.\n * @param fromBlock Filter events from this block number. Genesis block if not specified.\n * @param toBlock Filter events up to this block number. Latest block if not specified.\n * @returns The list of NotificationLog matching the provided filters.\n */\n public async searchNotificationLogs(\n ids?: bigint[],\n recipients?: `0x${string}`[],\n signatureRequested?: boolean,\n fromBlock?: BlockTag | bigint, \n toBlock?: BlockTag | bigint\n ): Promise<NotificationLog[]> {\n // Reject pending block tags for fromBlock/toBlock\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n // Use default values: fromBlock = earliest block, toBlock = latest block\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n \n // Build args only if a filter is provided\n let args: any = undefined;\n if (ids !== undefined || recipients !== undefined || signatureRequested !== undefined) {\n args = {};\n if (ids !== undefined) {\n args.id = ids;\n }\n if (recipients !== undefined) {\n args.recipient = recipients.map(toBytes32);\n }\n if (signatureRequested !== undefined) {\n args.signatureRequested = signatureRequested;\n }\n }\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3Doc.NOTIFICATION_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n \n // Batch fetch timestamps for unique block numbers\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n\n return logs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Notification,\n id: log.args.id,\n recipient: log.args.recipient,\n emitter: log.args.emitter,\n source: log.args.source,\n signatureRequested: log.args.signatureRequested,\n }));\n }\n\n /**\n * Retrieves a Notification event by its unique ID and recipient.\n * \n * @param id The unique ID of the document that is the subject of the notification. \n * @param recipient The fingerprint of the recipient who received the notification.\n * @param blockNumber The block number where to search for the notification.\n * @returns The NotificationLog if found, otherwise undefined.\n * @example\n * ```typescript\n * const targetID = 1n;\n * const recipientFingerprint = '0x...';\n * const blockNumber = await web3Doc.getDocumentBlockNumberByID(targetID);\n * const notificationLog = await web3Doc.getNotificationLog(targetID, recipientFingerprint, blockNumber);\n * ```\n */\n public async getNotificationLog(id: bigint, recipient: `0x${string}`, blockNumber: bigint): Promise<NotificationLog | undefined> {\n const logs = await this.searchNotificationLogs([id], [recipient], undefined, blockNumber, blockNumber);\n if (logs.length === 1) return logs[0];\n if (logs.length === 0) return undefined;\n // This should never happen as document ID + recipient uniqueness is guaranteed by the smart contract but we guard against it anyway\n throw new Web3DocCriticalError(`Multiple Notification logs found for document ID ${id} and recipient ${recipient} at block ${blockNumber}`);\n }\n\n /**\n * Searches for Signature events emitted by the smart contract, filtered by the provided criteria.\n * Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.\n * \n * @param ids Filter by signature IDs. Signature IDs uniqueness is guaranteed by the smart contract.\n * @param emitters Filter by emitter fingerprints.\n * @param signatureHashes Filter by signature hashes.\n * @param fromBlock Filter events from this block number. Genesis block if not specified.\n * @param toBlock Filter events up to this block number. Latest block if not specified.\n * @returns The list of SignatureLog matching the provided filters.\n */\n public async searchSignatureLogs(\n ids?: bigint[], \n emitters?: `0x${string}`[], \n signatureHashes?: `0x${string}`[],\n fromBlock?: BlockTag | bigint, \n toBlock?: BlockTag | bigint\n ): Promise<SignatureLog[]> {\n // Reject pending block tags for fromBlock/toBlock\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n // Use default values: fromBlock = earliest block, toBlock = latest block\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n // Build args only if a filter is provided\n let args: any = undefined;\n if (ids !== undefined || emitters !== undefined || signatureHashes !== undefined) {\n args = {};\n if (ids !== undefined) {\n args.id = ids;\n }\n if (emitters !== undefined) {\n args.emitter = emitters.map(toBytes32);\n }\n if (signatureHashes !== undefined) {\n args.signatureHash = signatureHashes;\n }\n }\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3Doc.SIGNATURE_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n \n // Batch fetch timestamps for unique block numbers\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n\n return logs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Signature,\n id: log.args.id,\n emitter: log.args.emitter,\n signatureHash: log.args.signatureHash,\n signature: log.args.signature,\n }));\n }\n\n /**\n * Retrieves Timestamp events emitted by the smart contract, filtered by the provided criteria.\n * Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.\n * \n * @param ids Filter by timestamp IDs. Timestamp IDs uniqueness is guaranteed by the smart contract. \n * @param emitters Filter by emitter fingerprints.\n * @param dochashes Filter by document hashes.\n * @param fromBlock Filter events from this block number. Genesis block if not specified.\n * @param toBlock Filter events up to this block number. Latest block if not specified.\n * @returns The list of TimestampLog matching the provided filters.\n */\n public async searchTimestampLogs(\n ids?: bigint[],\n emitters?: `0x${string}`[], \n dochashes?: `0x${string}`[], \n fromBlock?: BlockTag | bigint, \n toBlock?: BlockTag | bigint\n ): Promise<TimestampLog[]> {\n // Reject pending block tags for fromBlock/toBlock\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n // Use default values: fromBlock = earliest block, toBlock = latest block\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n // Build args only if a filter is provided\n let args: any = undefined;\n if (ids !== undefined || emitters !== undefined || dochashes !== undefined) {\n args = {};\n if (ids !== undefined) {\n args.id = ids;\n }\n if (emitters !== undefined) {\n args.emitter = emitters.map(toBytes32);\n }\n if (dochashes !== undefined) {\n args.dochash = dochashes;\n }\n }\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3Doc.TIMESTAMP_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n \n // Batch fetch timestamps for unique block numbers\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n\n return logs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Timestamp,\n id: log.args.id,\n emitter: log.args.emitter,\n dochash: log.args.dochash,\n signature: log.args.signature,\n }));\n }\n\n /**\n * Retrieves a Timestamp event by its unique ID.\n * @param id The unique ID of the timestamp.\n * @param blockNumber The block number where to search for the timestamp.\n * @returns The TimestampLog if found, otherwise undefined.\n */\n public async getTimestampLogByID(id: bigint, blockNumber: bigint): Promise<TimestampLog | undefined> {\n const logs = await this.searchTimestampLogs([id], undefined, undefined, blockNumber, blockNumber);\n if (logs.length === 1) return logs[0];\n if (logs.length === 0) return undefined;\n // This should never happen as timestamp IDs are unique but we guard against it anyway\n throw new Web3DocCriticalError(`Multiple Timestamp logs found for timestamp ID ${id} at block ${blockNumber}`);\n }\n\n /**\n * Extracts Document logs from a transaction receipt.\n * @param receipt The transaction receipt to extract logs from.\n * @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.\n * @returns A promise that resolves to an array of DocumentLog objects.\n */\n public async extractDocumentLog(receipt: TransactionReceipt, timestamp?: Date): Promise<DocumentLog[]> {\n const parsedLogs = parseEventLogs({\n abi: Web3DocABI,\n eventName: 'Document',\n logs: receipt.logs\n });\n\n if (timestamp) {\n // Use the provided timestamp for all logs\n return parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: timestamp,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Document,\n id: log.args.id,\n emitter: log.args.emitter,\n dochash: log.args.dochash,\n signature: log.args.signature,\n document: log.args.document,\n uri: log.args.uri,\n mimeType: log.args.mimeType,\n }));\n }\n\n // Get block timestamps from the chain\n const uniqueBlocks = [...new Set(parsedLogs.map(l => l.blockNumber))];\n const blockTimestamps = new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n \n return parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n id: log.args.id,\n emitter: log.args.emitter,\n dochash: log.args.dochash,\n signature: log.args.signature,\n document: log.args.document,\n uri: log.args.uri,\n mimeType: log.args.mimeType,\n logIndex: log.logIndex,\n type: Web3DocEvents.Document,\n }));\n }\n\n /**\n * Extracts Copy logs from a transaction receipt.\n * @param receipt The transaction receipt to extract logs from.\n * @returns A promise that resolves to an array of CopyLog objects.\n * @returns A promise that resolves to an array of CopyLog objects.\n */\n public async extractCopyLog(receipt: TransactionReceipt, timestamp?: Date): Promise<CopyLog[]> {\n const parsedLogs = parseEventLogs({\n abi: Web3DocABI,\n eventName: 'Copy',\n logs: receipt.logs\n });\n\n if (timestamp) {\n // Use the provided timestamp for all logs\n return parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: timestamp,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Copy,\n copy: log.args.copy,\n original: log.args.original,\n emitter: log.args.emitter,\n document: log.args.document,\n uri: log.args.uri,\n }));\n }\n\n // Get block timestamps from the chain\n const uniqueBlocks = [...new Set(parsedLogs.map(l => l.blockNumber))];\n const blockTimestamps = new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n \n return parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Copy,\n copy: log.args.copy,\n original: log.args.original,\n emitter: log.args.emitter,\n document: log.args.document,\n uri: log.args.uri,\n }));\n }\n\n /**\n * Extracts Signature logs from a transaction receipt.\n * @param receipt The transaction receipt to extract logs from.\n * @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.\n * @returns A promise that resolves to an array of SignatureLog objects.\n */\n public async extractSignatureLog(receipt: TransactionReceipt, timestamp?: Date): Promise<SignatureLog[]> {\n const parsedLogs = parseEventLogs({\n abi: Web3DocABI,\n eventName: 'Signature',\n logs: receipt.logs\n });\n\n if (timestamp) {\n // Use the provided timestamp for all logs\n return parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: timestamp,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Signature,\n id: log.args.id,\n emitter: log.args.emitter,\n signatureHash: log.args.signatureHash,\n signature: log.args.signature,\n }));\n }\n\n // Get block timestamps from the chain\n const uniqueBlocks = [...new Set(parsedLogs.map(l => l.blockNumber))];\n const blockTimestamps = new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n \n return parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Signature,\n id: log.args.id,\n emitter: log.args.emitter,\n signatureHash: log.args.signatureHash,\n signature: log.args.signature,\n }));\n }\n\n /**\n * Extracts Timestamp logs from a transaction receipt.\n * @param receipt The transaction receipt to extract logs from.\n * @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.\n * @returns A promise that resolves to an array of TimestampLog objects.\n */\n public async extractTimestampLog(receipt: TransactionReceipt, timestamp?: Date): Promise<TimestampLog[]> {\n const parsedLogs = parseEventLogs({\n abi: Web3DocABI,\n eventName: 'Timestamp',\n logs: receipt.logs\n });\n\n if (timestamp) {\n // Use the provided timestamp for all logs\n return parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: timestamp,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Timestamp,\n id: log.args.id,\n emitter: log.args.emitter,\n dochash: log.args.dochash,\n signature: log.args.signature,\n }));\n }\n\n // Get block timestamps from the chain\n const uniqueBlocks = [...new Set(parsedLogs.map(l => l.blockNumber))];\n const blockTimestamps = new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n\n return parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Timestamp,\n id: log.args.id,\n emitter: log.args.emitter,\n dochash: log.args.dochash,\n signature: log.args.signature,\n }));\n }\n\n /**\n * Extracts Notification logs from a transaction receipt.\n * @param receipt The transaction receipt to extract logs from.\n * @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.\n * @returns A promise that resolves to an array of NotificationLog objects.\n */\n public async extractNotificationLog(receipt: TransactionReceipt, timestamp?: Date): Promise<NotificationLog[]> {\n const parsedLogs = parseEventLogs({\n strict: true,\n abi: Web3DocABI,\n eventName: 'Notification',\n logs: receipt.logs\n });\n\n if (timestamp) {\n // Use the provided timestamp for all logs\n return parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: timestamp,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Notification,\n id: log.args.id,\n recipient: log.args.recipient,\n emitter: log.args.emitter,\n source: log.args.source,\n signatureRequested: log.args.signatureRequested,\n }));\n }\n\n // Get block timestamps from the chain\n const uniqueBlocks = [...new Set(parsedLogs.map(l => l.blockNumber))];\n const blockTimestamps = new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n\n return parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.Notification,\n id: log.args.id,\n recipient: log.args.recipient,\n emitter: log.args.emitter,\n source: log.args.source,\n signatureRequested: log.args.signatureRequested,\n }));\n }\n\n /**\n * Retireve signature revocation events emitted by the smart contract, filtered by the provided criteria.\n * Each value in a filter is combined using a logical OR, while all defined filters are combined using a logical AND.\n * \n * @param ids Filter by signature IDs. Signature IDs uniqueness is guaranteed by the smart contract.\n * @param emitters Filter by emitter fingerprints.\n * @param signatureHashes Filter by signature hashes.\n * @param fromBlock Filter events from this block number. Genesis block if not specified.\n * @param toBlock Filter events up to this block number. Latest block if not specified.\n * @returns The list of SignatureRevocationLog matching the provided filters.\n */\n public async searchSignatureRevocationLogs(ids?: bigint[], emitters?: `0x${string}`[], signatureHashes?: `0x${string}`[], fromBlock?: BlockTag | bigint, toBlock?: BlockTag | bigint): Promise<SignatureRevocationLog[]> {\n // Reject pending block tags for fromBlock/toBlock\n if (fromBlock === 'pending' || toBlock === 'pending') {\n throw new Error('fromBlock and toBlock cannot be \"pending\" for log searches');\n }\n\n // Use default values: fromBlock = earliest block, toBlock = latest block\n const from = fromBlock ?? 'earliest';\n const to = toBlock ?? 'latest';\n\n // Build args only if a filter is provided\n let args: any = undefined;\n if (ids !== undefined || emitters !== undefined || signatureHashes !== undefined) {\n args = {};\n if (ids !== undefined) {\n args.id = ids;\n }\n if (emitters !== undefined) {\n args.emitter = emitters.map(toBytes32);\n }\n if (signatureHashes !== undefined) {\n args.signatureHash = signatureHashes;\n }\n }\n\n const logs = await this.client.getLogs({\n strict: true,\n address: this.address,\n event: Web3Doc.SIGNATURE_REVOCATION_EVENT,\n fromBlock: from,\n toBlock: to,\n ...(args !== undefined && { args })\n });\n \n // Batch fetch timestamps for unique block numbers\n const uniqueBlocks = [...new Set(logs.map(l => l.blockNumber))];\n const blockTimestamps = new Map(\n await Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n ))\n );\n\n return logs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.SignatureRevocation,\n id: log.args.id,\n emitter: log.args.emitter,\n signatureHash: log.args.signatureHash,\n signature: log.args.signature,\n }));\n }\n\n /**\n * Retrieves Timestamp events by document hash.\n * @param dochash The keccak256 hash of the document.\n * @returns An array of TimestampLog entries associated with the document hash.\n */\n public async getTimestampLogsByHash(dochash: `0x${string}`): Promise<TimestampLog[]> {\n\n // TODO: Add concurrency control if needed\n\n // List all document IDs for the given document hash\n let ids = await this.fetchAllPaginated((start, limit) => \n this.listDocumentIdsByHash(dochash, start, limit)\n );\n if (ids.length === 0) {\n return [];\n }\n\n // List block numbers for each document ID\n let blockNumbers = await this.getDocumentBlockNumberByIDBatch(ids);\n if (blockNumbers.length !== ids.length) {\n throw new Web3DocCriticalError('Mismatch between document IDs and block numbers length');\n }\n\n // Search timestamp logs by IDs\n const timestampLogs = await Promise.all(\n blockNumbers.map(async (blockNumber) => {\n return this.searchTimestampLogs(ids, undefined, [dochash], blockNumber, blockNumber);\n })\n );\n\n // Flatten the array of arrays\n return timestampLogs.flat();\n }\n \n extractSignatureRevocationLog(receipt: TransactionReceipt, timestamp?: Date): Promise<SignatureRevocationLog[]> {\n const parsedLogs = parseEventLogs({\n strict: true,\n abi: Web3DocABI,\n eventName: 'SignatureRevocation',\n logs: receipt.logs\n });\n\n if (timestamp) {\n // Use the provided timestamp for all logs\n return Promise.resolve(parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: timestamp,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.SignatureRevocation,\n id: log.args.id,\n emitter: log.args.emitter,\n signatureHash: log.args.signatureHash,\n signature: log.args.signature,\n })));\n }\n\n // Get block timestamps from the chain\n const uniqueBlocks = [...new Set(parsedLogs.map(l => l.blockNumber))];\n return Promise.all(uniqueBlocks.map(async bn => \n [bn, await getBlockTimestamp(this.client, bn)] as [bigint, Date]\n )).then(blockTimestampArray => {\n const blockTimestamps = new Map(blockTimestampArray);\n\n return parsedLogs.map(log => ({\n blockNumber: log.blockNumber,\n blockHash: log.blockHash,\n blockTimestamp: blockTimestamps.get(log.blockNumber)!,\n transactionHash: log.transactionHash,\n logIndex: log.logIndex,\n type: Web3DocEvents.SignatureRevocation,\n id: log.args.id,\n emitter: log.args.emitter,\n signatureHash: log.args.signatureHash,\n signature: log.args.signature,\n }));\n });\n }\n\n /*****************************************************************************************************************/\n /* UTILITY METHODS */\n /*****************************************************************************************************************/\n\n /**\n * Helper method to fetch all items from a paginated contract method.\n * @param fetchFn The paginated fetch function to call\n * @param limit The number of items to fetch per page\n * @param maxItems The maximum number of items to fetch in total (safety limit)\n * @returns An array containing all fetched items\n */\n private async fetchAllPaginated<T>(\n fetchFn: (start: bigint, limit: bigint) => Promise<T[]>,\n limit: bigint = 1000n,\n maxItems: bigint = 100000n // Safety limit\n ): Promise<T[]> {\n const results: T[] = [];\n let start = 0n;\n\n do {\n const batch = await fetchFn(start, limit);\n results.push(...batch);\n\n if (batch.length < Number(limit) || results.length >= Number(maxItems)) {\n break;\n }\n start += limit;\n } while (true);\n\n return results;\n }\n}\n","import { hexToBytes, toHex, TransactionReceipt } from 'viem';\nimport * as openpgp from 'openpgp';\nimport { IWeb3DocService } from './web3doc.service.interface';\nimport { IWeb3Doc } from './web3doc.interface';\nimport { IWeb3PGPService } from '../web3pgp/web3pgp.service.interface';\nimport { Web3PGPServiceValidationError } from '../web3pgp/web3pgp.service';\nimport { to0x, toBytes32 } from '../utils/0xstr';\n\n/*****************************************************************************************************************/\n/* CUSTOM ERRORS */\n/*****************************************************************************************************************/\n\n/**\n * Base error class for Web3DocService errors.\n */\nexport class Web3DocServiceError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'Web3DocServiceError';\n }\n}\n\n/**\n * Error thrown when a critical failure occurs during service operations.\n *\n * This error indicates a serious problem that prevents the operation from continuing such as network failures and others has occurred.\n */\nexport class Web3DocServiceCriticalError extends Web3DocServiceError {\n constructor(message: string, public readonly cause?: Error) {\n super(message);\n this.name = 'Web3DocServiceCriticalError';\n }\n}\n\n/**\n * Error thrown when document or blockchain data validation fails.\n * \n * This can happen because the smart contract does not validate the data it stores, they\n * have to be verified by the client application. Furthermore, as anyone can submit documents,\n * malformed or invalid data may be submitted by malicious actors. \n */\nexport class Web3DocServiceValidationError extends Web3DocServiceError {\n constructor(message: string, public readonly cause?: Error) {\n super(message);\n this.name = 'Web3DocServiceValidationError';\n }\n}\n\n/*****************************************************************************************************************/\n/* SERVICE IMPLEMENTATION */\n/*****************************************************************************************************************/\n\n/**\n * Configuration options for Web3DocService.\n */\nexport interface Web3DocServiceOptions {\n /**\n * Maximum number of concurrent operations performed when processing documents and verifying signatures.\n * \n * This limit helps prevent resource exhaustion and rate-limiting issues when interacting with RPC endpoints or\n * when processing large numbers of documents.\n * \n * @default 10\n */\n concurrencyLimit?: number;\n}\n\n/**\n * Implementation of the Web3Doc service interface.\n * \n * This service provides high-level functions for managing documents on the blockchain with integrated\n * OpenPGP operations to ease developer experience.\n */\nexport class Web3DocService implements IWeb3DocService {\n\n private _web3pgpService: IWeb3PGPService;\n private _web3doc: IWeb3Doc;\n private _options: Required<Web3DocServiceOptions>;\n\n /**\n * Creates a new Web3DocService instance.\n * \n * @param web3doc An instance implementing the IWeb3Doc interface.\n * @param options Optional configuration options for the service.\n */\n constructor(web3doc: IWeb3Doc, web3pgpService: IWeb3PGPService, options?: Web3DocServiceOptions) {\n this._web3doc = web3doc;\n this._web3pgpService = web3pgpService;\n this._options = {\n concurrencyLimit: options?.concurrencyLimit ?? 10,\n };\n }\n\n /**\n * Gets the Web3Doc instance.\n */\n get web3doc(): IWeb3Doc {\n return this._web3doc;\n }\n\n /**\n * Sets the Web3Doc instance.\n */\n set web3doc(value: IWeb3Doc) {\n this._web3doc = value;\n }\n\n /**\n * Gets the Web3PGP service instance.\n */\n get web3pgpService(): IWeb3PGPService {\n return this._web3pgpService;\n }\n\n /**\n * Sets the Web3PGP service instance.\n */\n set web3pgpService(value: IWeb3PGPService) {\n this._web3pgpService = value;\n }\n\n /**\n * Gets the service configuration options.\n */\n get options(): Required<Web3DocServiceOptions> {\n return this._options;\n }\n\n /**\n * Sets the service configuration options.\n */\n set options(value: Required<Web3DocServiceOptions>) {\n this._options = value;\n }\n\n /*****************************************************************************************************************/\n /* TIMESTAMPING */\n /*****************************************************************************************************************/\n \n /**\n * This function allows submitting the data needed to timestamp a document to the Web3Doc smart contract.\n * \n * The function will download and verify the emitter's public key using the Web3PGP contract and then it will verify\n * the provided detached signature over the keccak256 hash of the document. If the signature is valid, it will submit\n * the hash and the signature to the smart contract for timestamping.\n * \n * The service is expected to be configured with a Web3PGP service instance to enable automatic public key retrieval based\n * on their fingerprint.\n * \n * @param hash The keccak256 hash of the document to be timestamped, provided as a Uint8Array.\n * @param signature The detached OpenPGP signature over the document hash.\n * @param emitter The fingerprint of the public key used to create the signature. Will be used to download the public key from Web3PGP.\n * @return A promise that resolves to the ID assigned to the new timestamp and the transaction receipt.\n */\n public async timestamp(hash: Uint8Array, signature: openpgp.Signature, emitter: `0x${string}`): Promise<[bigint, TransactionReceipt]> {\n try {\n // Download and verify the emitter's public key using the Web3PGP service\n console.debug(`[Web3Doc Service] Retrieving public key for emitter fingerprint: ${emitter}`);\n const pk = await this.web3pgpService.getPublicKey(emitter)\n \n // Verify the signature over the document hash\n console.debug(`[Web3Doc Service] Verifying signature for timestamp with emitter fingerprint: ${emitter}`);\n try {\n await openpgp.verify({\n message: await openpgp.createMessage({ binary: hash }),\n signature: signature,\n verificationKeys: pk,\n date: new Date(), // Use current date for verification\n })\n } catch (error) {\n throw new Web3DocServiceValidationError(`Signature verification failed for emitter fingerprint: ${emitter}`, error instanceof Error ? error : undefined);\n }\n\n // Submit the timestamp to the Web3Doc smart contract - Use the primary key fingerprint as emitter s the provided \n // arg might point to a subkey - It is preferable to always use the primary key fingerprint for emitter identification\n console.debug(`[Web3Doc Service] Submitting timestamp to Web3Doc smart contract for emitter fingerprint: ${emitter}`);\n const receipt = await this.web3doc.timestamp(toBytes32(to0x(pk.getFingerprint())), toHex(hash), toHex(signature.write()));\n console.debug(`[Web3Doc Service] Timestamp transaction submitted successfully`);\n // Extract the timestamp log from the transaction receipt - Use current date as timestamp as the receipt is \n // from a just submitted transaction and experience showed that the block timestamp may not be available yet\n const logs = await this.web3doc.extractTimestampLog(receipt, new Date());\n if (logs.length !== 1) {\n throw new Web3DocServiceCriticalError(`Unexpected number of timestamp logs in transaction receipt: ${logs.length}`);\n }\n console.debug(`[Web3Doc Service] Timestamp submitted successfully with ID: ${logs[0].id.toString()}`);\n return [logs[0].id, receipt];\n } catch (error) {\n if (error instanceof Web3PGPServiceValidationError) {\n // Wrap and rethrow validation errors from Web3PGP service\n throw new Web3DocServiceValidationError(`Emitter public key not valid for fingerprint: ${emitter}`, error);\n }\n console.error(error);\n throw new Web3DocServiceCriticalError('Failed to retrieve or verify emitter public key', error instanceof Error ? error : undefined);\n }\n }\n\n /**\n * Verifies a timestamp entry on the blockchain by its ID. The function retrieves the timestamp data from the\n * Web3Doc smart contract and verifies the detached signature over the document hash using the emitter's public key.\n * \n * The function returns the document hash, the signature, and the public key used for verification.\n * \n * The user can then compare the hash received from this function with the keccak256 hash they compute from their \n * document to ensure integrity.\n * \n * @param id The ID of the timestamp entry to verify.\n * @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. \n */\n public async verifyTimestamp(id: bigint): Promise<{ documentHash: Uint8Array; signature: openpgp.Signature; publicKey: openpgp.PublicKey; tx: `0x${string}`; date: Date; }> {\n try {\n // Get the block number where to search for the timestamp\n const blockNumber = await this.web3doc.getDocumentBlockNumberByID(id);\n\n // Retrieve the timestamp log from the blockchain\n const timestamp = await this.web3doc.getTimestampLogByID(id, blockNumber);\n if (!timestamp) {\n throw new Web3DocServiceValidationError(`Timestamp with ID ${id.toString()} not found on the blockchain`);\n }\n\n // Retrieve and verify the emitter's public key using the Web3PGP service\n console.debug(`[Web3Doc Service] Retrieving public key for emitter fingerprint: ${timestamp.emitter}`);\n const pk = await this.web3pgpService.getPublicKey(timestamp.emitter);\n\n // Verify the signature over the document hash\n console.debug(`[Web3Doc Service] Verifying signature for timestamp ID: ${id.toString()}`);\n const signature = await openpgp.readSignature({ binarySignature: hexToBytes(timestamp.signature) });\n try {\n await openpgp.verify({\n message: await openpgp.createMessage({ binary: hexToBytes(timestamp.dochash) }),\n signature: signature,\n verificationKeys: pk,\n date: timestamp.blockTimestamp, // Use the block timestamp for verification\n });\n } catch (error) {\n throw new Web3DocServiceValidationError(`Signature verification failed for timestamp ID: ${id.toString()}`, error instanceof Error ? error : undefined);\n }\n\n console.debug(`[Web3Doc Service] Timestamp ID: ${id.toString()} verified successfully`);\n return {\n documentHash: hexToBytes(timestamp.dochash),\n signature: signature,\n publicKey: pk,\n tx: timestamp.transactionHash,\n date: timestamp.blockTimestamp,\n };\n } catch (error) {\n if (error instanceof Web3PGPServiceValidationError) {\n // Wrap and rethrow validation errors from Web3PGP service\n throw new Web3DocServiceValidationError(`Emitter public key not valid`, error);\n }\n throw new Web3DocServiceCriticalError('Failed to retrieve or verify the timestamp', error instanceof Error ? error : undefined);\n }\n }\n\n /**\n * Finds all timestamp IDs associated with a given document hash. Timestamp IDs can be used to retrieve and verify\n * timestamp entries on the blockchain.\n * \n * @param hash The keccak256 hash of the document to search for.\n * @returns A promise that resolves to an array of timestamp IDs associated with the provided document hash.\n */\n public async findTimestampsByHash(hash: Uint8Array): Promise<bigint[]> {\n const timestamps = await this.web3doc.getTimestampLogsByHash(toHex(hash));\n return timestamps.map(t => t.id);\n }\n\n /*****************************************************************************************************************/\n /* DOCUMENT EXCHANGE */\n /*****************************************************************************************************************/\n\n // TODO: Implement document exchange methods (sendDocument, sendCopy, signDocument, etc.)\n}\n"]}
|