From eee8a74a6048bd074485269b98f8d659867fc2f1 Mon Sep 17 00:00:00 2001 From: Sotatek-TuLe2 Date: Wed, 28 Feb 2024 15:00:57 +0700 Subject: [PATCH 1/7] Make change to test workflows --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index b504761..f05872e 100644 --- a/package.json +++ b/package.json @@ -68,3 +68,4 @@ "test": "test" } } + From 2bfd660875e4b933109dd5695fbd0d2e83c466a0 Mon Sep 17 00:00:00 2001 From: Sotatek-TuLe2 Date: Wed, 28 Feb 2024 15:54:51 +0700 Subject: [PATCH 2/7] Feat : add publish workflow --- .github/workflows/publish.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6a02083 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +name: "Publish SDK" + +on: + workflow_run: + workflows: ["testing"] + branches: [main] + types: + - completed + +jobs: + build: + permissions: write-all + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + + - name: generate zkauth-sdk + shell: bash + run: | + npm install && npm run build + + - name: publish zkauth-sdk + shell: bash + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + npx pnpm --filter "@klaytn/*" -r publish --publish-branch main --no-git-check --access=public + \ No newline at end of file From 1168d1481a2703291f94209b5eed9ac3be2ef959 Mon Sep 17 00:00:00 2001 From: hyeonLewis Date: Thu, 29 Feb 2024 12:25:12 +0900 Subject: [PATCH 3/7] Update contracts --- README.md | 20 +- src/account-utils.ts | 24 +- src/account.ts | 26 +- src/constants/Address.ts | 63 +- .../abi/contracts/Guardian/Guardian.json | 297 +++++ .../JwksProvider/JwksProviderBase.json | 460 +++---- .../JwksProvider/ManualJwksProvider.json | 690 +++++------ .../JwksProvider/OraklJwksProvider.json | 986 +++++++-------- .../OIDCGuardianV02/OIDCGuardianV02.json | 297 ----- .../OIDCRecoveryAccountFactoryV02.json | 104 -- .../OIDCRecoveryAccountV02.json | 1063 ----------------- .../OIDCZKVerifierV02/OIDCZKVerifierV02.json | 297 ----- .../RecoveryAccount/RecoveryAccount.json | 1063 +++++++++++++++++ .../RecoveryAccountFactory.json | 130 ++ src/constants/abi/index.ts | 7 +- src/userOp.ts | 9 +- src/utils.ts | 10 +- 17 files changed, 2636 insertions(+), 2910 deletions(-) create mode 100644 src/constants/abi/contracts/Guardian/Guardian.json delete mode 100644 src/constants/abi/contracts/OIDCGuardianV02/OIDCGuardianV02.json delete mode 100644 src/constants/abi/contracts/OIDCRecoveryAccountFactoryV02/OIDCRecoveryAccountFactoryV02.json delete mode 100644 src/constants/abi/contracts/OIDCRecoveryAccountV02/OIDCRecoveryAccountV02.json delete mode 100644 src/constants/abi/contracts/OIDCZKVerifierV02/OIDCZKVerifierV02.json create mode 100644 src/constants/abi/contracts/RecoveryAccount/RecoveryAccount.json create mode 100644 src/constants/abi/contracts/RecoveryAccountFactory/RecoveryAccountFactory.json diff --git a/README.md b/README.md index ad51951..cdcb70a 100644 --- a/README.md +++ b/README.md @@ -47,10 +47,10 @@ Users can create their zkAuth wallet based on their OAuth2 idToken. chainIdOrZero: 0, subHash: subHash, provider: JsonRpcProvider, - entryPointAddress: Addresses[chainId].entryPointAddr, + entryPointAddress: Addresses[chainId].EntryPointAddr, }; - const scw = new RecoveryAccountAPI(signer, params, Addresses[chainId].oidcRecoveryFactoryV02Addr); + const scw = new RecoveryAccountAPI(signer, params, Addresses[chainId].RecoveryFactoryAddr); const cfAddress = await scw.getAccountAddress(); // Save wallet as your own ``` @@ -63,7 +63,7 @@ Users can create their zkAuth wallet based on their OAuth2 idToken. ```js const signer = new ethers.Wallet(ownerKey, JsonRpcProvider); - const scw = new RecoveryAccountAPI(signer, params, Addresses.oidcRecoveryFactoryV02Addr); + const scw = new RecoveryAccountAPI(signer, params, Addresses.RecoveryFactoryAddr); const target = cfAddress; // You can use any UserOp, so use entryPoint() as an example @@ -93,7 +93,7 @@ Users can send transaction called `UserOp` with their zkAuth wallet. It requires provider: getProvider(network.chainId), entryPointAddress: Addresses.entryPointAddr, }; - const scw = new RecoveryAccountAPI(signer, param, Addresses.oidcRecoveryFactoryV02Addr); + const scw = new RecoveryAccountAPI(signer, param, Addresses.RecoveryFactoryAddr); ``` 2. Prepare transaction data @@ -136,9 +136,9 @@ Users can add a new guardian to their zkAuth wallet. It allows same provider but const param: RecoveryAccountApiParams = { scaAddr: cfAddress, provider: JsonRpcProvider, - entryPointAddress: Addresses[chainId].entryPointAddr, + entryPointAddress: Addresses[chainId].EntryPointAddr, }; - const scw = new RecoveryAccountAPI(signer, param, Addresses[chainId].oidcRecoveryFactoryV02Addr); + const scw = new RecoveryAccountAPI(signer, param, Addresses[chainId].RecoveryFactoryAddr); const data = scw.encodeAddGuardian(newGuardian, newSubHash, newThreshold); const tx: TransactionDetailsForUserOp = { target: cfAddress, @@ -173,9 +173,9 @@ Users can remove a guardian from their zkAuth wallet. const param: RecoveryAccountApiParams = { scaAddr: cfAddress, provider: JsonRpcProvider, - entryPointAddress: Addresses[chainId].entryPointAddr, + entryPointAddress: Addresses[chainId].EntryPointAddr, }; - const scw = new RecoveryAccountAPI(signer, param, Addresses[chainId].oidcRecoveryFactoryV02Addr); + const scw = new RecoveryAccountAPI(signer, param, Addresses[chainId].RecoveryFactoryAddr); const data = scw.encodeRemoveGuardian(targetGuardian, newSubHash, newThreshold); const tx: TransactionDetailsForUserOp = { target: cfAddress, @@ -257,9 +257,9 @@ If user wallet is `ghost` wallet, user can't recover it, so delete it and create const params: RecoveryAccountApiParams = { scaAddr: cfAddress, provider: JsonRpcProvider, - entryPointAddress: Addresses[chainId].entryPointAddr, + entryPointAddress: Addresses[chainId].EntryPointAddr, }; - const scw = new RecoveryAccountAPI(signer, params, Addresses[chainId].oidcRecoveryFactoryV02Addr); + const scw = new RecoveryAccountAPI(signer, params, Addresses[chainId].RecoveryFactoryAddr); for (const [idx] of recoverTokens.entries()) { const proof = proofAndPubSigs[idx].proof; diff --git a/src/account-utils.ts b/src/account-utils.ts index 8ea40cc..9c54471 100644 --- a/src/account-utils.ts +++ b/src/account-utils.ts @@ -1,6 +1,6 @@ import { ethers } from "ethers"; -import { OIDCRecoveryAccountV02, OIDCGuardianV02 } from "."; +import { RecoveryAccount, Guardian } from "."; export const isPhantom = async (cfAddress: string, rpcUrl: string) => { const provider = new ethers.providers.JsonRpcProvider(rpcUrl); @@ -16,8 +16,8 @@ export const getThreshold = async (cfAddress: string, rpcUrl: string) => { return 0; } const provider = new ethers.providers.JsonRpcProvider(rpcUrl); - const oidcRecoveryAccount = new ethers.Contract(cfAddress, OIDCRecoveryAccountV02, provider); - return Number(await oidcRecoveryAccount.threshold()); + const recoveryAccount = new ethers.Contract(cfAddress, RecoveryAccount, provider); + return Number(await recoveryAccount.threshold()); }; export const getIss = async (cfAddress: string, rpcUrl: string) => { @@ -32,7 +32,7 @@ export const getIss = async (cfAddress: string, rpcUrl: string) => { } for (const address of guardianAddress) { - const guardian = new ethers.Contract(address, OIDCGuardianV02, provider); + const guardian = new ethers.Contract(address, Guardian, provider); const iss = await guardian.iss(); oidcIss.push(iss); } @@ -44,8 +44,8 @@ export const getGuardians = async (cfAddress: string, rpcUrl: string) => { return []; } const provider = new ethers.providers.JsonRpcProvider(rpcUrl); - const oidcRecoveryAccount = new ethers.Contract(cfAddress, OIDCRecoveryAccountV02, provider); - const guardians = await oidcRecoveryAccount.getGuardiansInfo(); + const recoveryAccount = new ethers.Contract(cfAddress, RecoveryAccount, provider); + const guardians = await recoveryAccount.getGuardiansInfo(); const guardianAddress = guardians.map((guardian: any) => guardian[1]); return guardianAddress; }; @@ -55,9 +55,9 @@ export const getInitialOwnerAddress = async (cfAddress: string, rpcUrl: string) return undefined; } const provider = new ethers.providers.JsonRpcProvider(rpcUrl); - const oidcRecoveryAccount = new ethers.Contract(cfAddress, OIDCRecoveryAccountV02, provider); + const recoveryAccount = new ethers.Contract(cfAddress, RecoveryAccount, provider); - return await oidcRecoveryAccount.initialOwner(); + return await recoveryAccount.initialOwner(); }; export const getInitialGuardianAddress = async (cfAddress: string, rpcUrl: string) => { @@ -65,9 +65,9 @@ export const getInitialGuardianAddress = async (cfAddress: string, rpcUrl: strin return undefined; } const provider = new ethers.providers.JsonRpcProvider(rpcUrl); - const oidcRecoveryAccount = new ethers.Contract(cfAddress, OIDCRecoveryAccountV02, provider); + const recoveryAccount = new ethers.Contract(cfAddress, RecoveryAccount, provider); - return await oidcRecoveryAccount.initialGuardian(); + return await recoveryAccount.initialGuardian(); }; export const getOwnerAddress = async (cfAddress: string, rpcUrl: string) => { @@ -75,7 +75,7 @@ export const getOwnerAddress = async (cfAddress: string, rpcUrl: string) => { return undefined; } const provider = new ethers.providers.JsonRpcProvider(rpcUrl); - const oidcRecoveryAccount = new ethers.Contract(cfAddress, OIDCRecoveryAccountV02, provider); + const recoveryAccount = new ethers.Contract(cfAddress, RecoveryAccount, provider); - return await oidcRecoveryAccount.owner(); + return await recoveryAccount.owner(); }; diff --git a/src/account.ts b/src/account.ts index 4d82a0a..aa7ef43 100644 --- a/src/account.ts +++ b/src/account.ts @@ -3,7 +3,7 @@ import { ethers } from "ethers"; import { arrayify, hexConcat, Interface } from "ethers/lib/utils"; import { AuthData } from "./authBuilder"; -import { OIDCRecoveryAccountFactoryV02, OIDCRecoveryAccountV02 } from "./constants/abi"; +import { RecoveryAccountFactory, RecoveryAccount } from "./constants/abi"; /** * Needed if user's account is not yet deployed @@ -47,27 +47,23 @@ export class RecoveryAccountAPI extends BaseAccountAPI { this.signer = signer; } - async _getOIDCRecoveryAccountV02(): Promise { - const accountContract = new ethers.Contract( - await this.getAccountAddress(), - OIDCRecoveryAccountV02, - this.signer - ); + async _getRecoveryAccount(): Promise { + const accountContract = new ethers.Contract(await this.getAccountAddress(), RecoveryAccount, this.signer); return accountContract; } - async _getOIDCRecoveryAccountFactoryV02(): Promise { + async _getRecoveryAccountFactory(): Promise { if (this.factoryAddress == null) { throw new Error("no factory address"); } - const accountContract = new ethers.Contract(this.factoryAddress, OIDCRecoveryAccountFactoryV02, this.signer); + const accountContract = new ethers.Contract(this.factoryAddress, RecoveryAccountFactory, this.signer); return accountContract; } async _getAccountContract(): Promise { if (this.accountContract == null) { - this.accountContract = await this._getOIDCRecoveryAccountV02(); + this.accountContract = await this._getRecoveryAccount(); } return this.accountContract; } @@ -82,7 +78,7 @@ export class RecoveryAccountAPI extends BaseAccountAPI { async _getFactoryContract(): Promise { if (this.factory == null) { if (this.factoryAddress?.length !== 0) { - this.factory = await this._getOIDCRecoveryAccountFactoryV02(); + this.factory = await this._getRecoveryAccountFactory(); } else { throw new Error("no factory to get initCode"); } @@ -150,7 +146,7 @@ export class RecoveryAccountAPI extends BaseAccountAPI { async requestRecover(newOwner: string, auth: AuthData, subSigner?: ethers.Wallet) { // TODO: Make separate API for subSigner. const sca = subSigner - ? new ethers.Contract(await this.getAccountAddress(), OIDCRecoveryAccountV02, subSigner) + ? new ethers.Contract(await this.getAccountAddress(), RecoveryAccount, subSigner) : await this._getAccountContract(); const tx = await sca.requestRecover(newOwner, auth); await tx.wait(); @@ -169,19 +165,19 @@ export class RecoveryAccountAPI extends BaseAccountAPI { } encodeAddGuardian(guardian: string, subHash: string, newThreshold: number) { - const iface = new Interface(OIDCRecoveryAccountV02); + const iface = new Interface(RecoveryAccount); const data = iface.encodeFunctionData("addGuardian", [guardian, subHash, newThreshold]); return data; } encodeRemoveGuardian(guardian: string, subHash: string, newThreshold: number) { - const iface = new Interface(OIDCRecoveryAccountV02); + const iface = new Interface(RecoveryAccount); const data = iface.encodeFunctionData("removeGuardian", [guardian, subHash, newThreshold]); return data; } encodeUpdateThreshold(newThreshold: number) { - const iface = new Interface(OIDCRecoveryAccountV02); + const iface = new Interface(RecoveryAccount); const data = iface.encodeFunctionData("updateThreshold", [newThreshold]); return data; } diff --git a/src/constants/Address.ts b/src/constants/Address.ts index 9da5a93..ba8f99e 100644 --- a/src/constants/Address.ts +++ b/src/constants/Address.ts @@ -4,45 +4,42 @@ export enum Networks { } interface Addresses { - entryPointAddr: string; - oidcRecoveryFactoryV02Addr?: string; - zkVerifierV02Addr?: string; - manualJwksProviderAddr?: string; - oraklJwksProviderAddr?: string; - googleGuardianV02Addr?: string; - kakaoGuardianV02Addr?: string; - twitchGuardianV02Addr?: string; - appleGuardianV02Addr?: string; - lineGuardianV02Addr?: string; - counterAddr?: string; + CounterAddr?: string; + EntryPointAddr: string; + RecoveryFactoryAddr?: string; + ManualJwksProviderAddr?: string; + OraklJwksProviderAddr?: string; + GoogleGuardianAddr?: string; + KakaoGuardianAddr?: string; + TwitchGuardianAddr?: string; + AppleGuardianAddr?: string; + LineGuardianAddr?: string; } const CYPRESS: Addresses = { - entryPointAddr: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", - oidcRecoveryFactoryV02Addr: undefined, - zkVerifierV02Addr: undefined, - manualJwksProviderAddr: undefined, - oraklJwksProviderAddr: undefined, - googleGuardianV02Addr: undefined, - kakaoGuardianV02Addr: undefined, - twitchGuardianV02Addr: undefined, - appleGuardianV02Addr: undefined, - lineGuardianV02Addr: undefined, - counterAddr: undefined, + CounterAddr: undefined, + EntryPointAddr: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + RecoveryFactoryAddr: undefined, + ManualJwksProviderAddr: undefined, + OraklJwksProviderAddr: undefined, + GoogleGuardianAddr: undefined, + KakaoGuardianAddr: undefined, + TwitchGuardianAddr: undefined, + AppleGuardianAddr: undefined, + LineGuardianAddr: undefined, }; const BAOBAB: Addresses = { - entryPointAddr: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", - oidcRecoveryFactoryV02Addr: "0x5A454a213BeD09052c6b84a4344a8eD3A69D559c", - zkVerifierV02Addr: "0xC7B94E3827FD4D2c638EEae2e9219Da063b5BB55", - manualJwksProviderAddr: "0xF871E80Ac5F679f9137Db4091841F0657dFD2B04", - oraklJwksProviderAddr: "0x993BcF72A45c834A12a04d095B7961472325B6A2", - googleGuardianV02Addr: "0x18B64ff66D993f8875AdA004dD3e11Da61576B35", - kakaoGuardianV02Addr: "0x7D3f210ae1E50E40902515D7CDFb7d7Af9dF8323", - twitchGuardianV02Addr: "0xaE99480B3FaaB2A79083513b4d8EaD3c04cC6353", - appleGuardianV02Addr: undefined, - lineGuardianV02Addr: undefined, - counterAddr: "0x3F2201Db69c7bD8427FD816ca4d38CC17B448d90", + CounterAddr: "0x3F2201Db69c7bD8427FD816ca4d38CC17B448d90", + EntryPointAddr: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789", + RecoveryFactoryAddr: "0x280fd135dD72D5bcC060e3b280fa13CF543073FA", + ManualJwksProviderAddr: "0x20e8d77CBFAD3d08FD5fa1e118D844a012f4c2bC", + OraklJwksProviderAddr: "0xcb10b0FF081797A96258b3aEB45a43E382dA0481", + GoogleGuardianAddr: "0xa1930Df14A842b8DfA47BECf5347Bf8A1d8B4E75", + KakaoGuardianAddr: "0x364669A6040585A1117979399E454A9a3FabeD03", + TwitchGuardianAddr: "0x7897e273EE938cb88A9E6C3DdB36f7e5050D2891", + AppleGuardianAddr: undefined, + LineGuardianAddr: undefined, }; export const Addresses: { [key: number]: Addresses } = { diff --git a/src/constants/abi/contracts/Guardian/Guardian.json b/src/constants/abi/contracts/Guardian/Guardian.json new file mode 100644 index 0000000..9713d1e --- /dev/null +++ b/src/constants/abi/contracts/Guardian/Guardian.json @@ -0,0 +1,297 @@ +[ + { + "inputs": [ + { + "internalType": "contract IZkVerifierV02", + "name": "_verifier", + "type": "address" + }, + { + "internalType": "contract IJwksProvider", + "name": "_jwksProvider", + "type": "address" + }, + { + "internalType": "string", + "name": "_aud", + "type": "string" + }, + { + "internalType": "string", + "name": "_iss", + "type": "string" + }, + { + "internalType": "string", + "name": "_confUrl", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "inputs": [], + "name": "VERIFY_RECOVER_TYPEHASH", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "input", + "type": "string" + } + ], + "name": "base64UrlDecode", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sca", + "type": "address" + }, + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "calcNonceA", + "outputs": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "address", + "name": "guardianAddress", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "domainSeparator", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "structHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "nonceA", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "confUrl", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "iss", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "jwksProvider", + "outputs": [ + { + "internalType": "contract IJwksProvider", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "verifier", + "outputs": [ + { + "internalType": "contract IZkVerifierV02", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "name": "verifyRecover", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "nonceA", + "type": "string" + }, + { + "internalType": "string", + "name": "iss", + "type": "string" + }, + { + "internalType": "string", + "name": "aud", + "type": "string" + }, + { + "internalType": "uint256", + "name": "iat", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "exp", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "modulus", + "type": "bytes" + } + ], + "internalType": "struct PublicSignalData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/constants/abi/contracts/JwksProvider/JwksProviderBase.json b/src/constants/abi/contracts/JwksProvider/JwksProviderBase.json index 8a9bb0f..74a5e6a 100644 --- a/src/constants/abi/contracts/JwksProvider/JwksProviderBase.json +++ b/src/constants/abi/contracts/JwksProvider/JwksProviderBase.json @@ -1,232 +1,232 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "JwksUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "jwksUrl", - "type": "string" - } - ], - "name": "UrlUpdated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "string", - "name": "kid", - "type": "string" - } - ], - "name": "getJwk", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "kid", - "type": "string" - }, - { - "internalType": "string", - "name": "kty", - "type": "string" - }, - { - "internalType": "string[]", - "name": "pubkeys", - "type": "string[]" - }, - { - "internalType": "bool", - "name": "fulfilled", - "type": "bool" - } - ], - "internalType": "struct Jwk", - "name": "jwk", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "kty", - "type": "string" - } - ], - "name": "getKeyNames", - "outputs": [ - { - "internalType": "string[]", - "name": "names", - "type": "string[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "getKids", - "outputs": [ - { - "internalType": "string[]", - "name": "kids", - "type": "string[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "string", - "name": "kid", - "type": "string" - } - ], - "name": "getLatestJwk", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "kid", - "type": "string" - }, - { - "internalType": "string", - "name": "kty", - "type": "string" - }, - { - "internalType": "string[]", - "name": "pubkeys", - "type": "string[]" - }, - { - "internalType": "bool", - "name": "fulfilled", - "type": "bool" - } - ], - "internalType": "struct Jwk", - "name": "jwk", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - } - ], - "name": "getLatestKids", - "outputs": [ - { - "internalType": "string[]", - "name": "kids", - "type": "string[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - } - ], - "name": "getUpdateTimestamps", - "outputs": [ - { - "internalType": "uint256[]", - "name": "updateTimestamps", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - } - ], - "name": "getUrl", - "outputs": [ - { - "internalType": "string", - "name": "jwksUrl", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "JwksUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "jwksUrl", + "type": "string" + } + ], + "name": "UrlUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "string", + "name": "kid", + "type": "string" + } + ], + "name": "getJwk", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "kid", + "type": "string" + }, + { + "internalType": "string", + "name": "kty", + "type": "string" + }, + { + "internalType": "string[]", + "name": "pubkeys", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "fulfilled", + "type": "bool" + } + ], + "internalType": "struct Jwk", + "name": "jwk", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "kty", + "type": "string" + } + ], + "name": "getKeyNames", + "outputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getKids", + "outputs": [ + { + "internalType": "string[]", + "name": "kids", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "string", + "name": "kid", + "type": "string" + } + ], + "name": "getLatestJwk", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "kid", + "type": "string" + }, + { + "internalType": "string", + "name": "kty", + "type": "string" + }, + { + "internalType": "string[]", + "name": "pubkeys", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "fulfilled", + "type": "bool" + } + ], + "internalType": "struct Jwk", + "name": "jwk", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + } + ], + "name": "getLatestKids", + "outputs": [ + { + "internalType": "string[]", + "name": "kids", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + } + ], + "name": "getUpdateTimestamps", + "outputs": [ + { + "internalType": "uint256[]", + "name": "updateTimestamps", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + } + ], + "name": "getUrl", + "outputs": [ + { + "internalType": "string", + "name": "jwksUrl", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } ] diff --git a/src/constants/abi/contracts/JwksProvider/ManualJwksProvider.json b/src/constants/abi/contracts/JwksProvider/ManualJwksProvider.json index bfeda5d..7ee69b3 100644 --- a/src/constants/abi/contracts/JwksProvider/ManualJwksProvider.json +++ b/src/constants/abi/contracts/JwksProvider/ManualJwksProvider.json @@ -1,349 +1,349 @@ [ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "JwksUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "jwksUrl", - "type": "string" - } - ], - "name": "UrlUpdated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "string", - "name": "kid", - "type": "string" - } - ], - "name": "getJwk", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "kid", - "type": "string" - }, - { - "internalType": "string", - "name": "kty", - "type": "string" - }, - { - "internalType": "string[]", - "name": "pubkeys", - "type": "string[]" - }, - { - "internalType": "bool", - "name": "fulfilled", - "type": "bool" - } + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } ], - "internalType": "struct Jwk", - "name": "jwk", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "kty", - "type": "string" - } - ], - "name": "getKeyNames", - "outputs": [ - { - "internalType": "string[]", - "name": "names", - "type": "string[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "getKids", - "outputs": [ - { - "internalType": "string[]", - "name": "kids", - "type": "string[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "string", - "name": "kid", - "type": "string" - } - ], - "name": "getLatestJwk", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "kid", - "type": "string" - }, - { - "internalType": "string", - "name": "kty", - "type": "string" - }, - { - "internalType": "string[]", - "name": "pubkeys", - "type": "string[]" - }, - { - "internalType": "bool", - "name": "fulfilled", - "type": "bool" - } + "name": "JwksUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } ], - "internalType": "struct Jwk", - "name": "jwk", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - } - ], - "name": "getLatestKids", - "outputs": [ - { - "internalType": "string[]", - "name": "kids", - "type": "string[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "string", - "name": "kid", - "type": "string" - } - ], - "name": "getRsaModulus", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - } - ], - "name": "getUpdateTimestamps", - "outputs": [ - { - "internalType": "uint256[]", - "name": "updateTimestamps", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - } - ], - "name": "getUrl", - "outputs": [ - { - "internalType": "string", - "name": "jwksUrl", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "string", - "name": "jwksUrl", - "type": "string" - } - ], - "name": "setJwksUrl", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "string[]", - "name": "kids", - "type": "string[]" - }, - { - "internalType": "string[]", - "name": "moduluses", - "type": "string[]" - } - ], - "name": "setRsaModulus", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "jwksUrl", + "type": "string" + } + ], + "name": "UrlUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "string", + "name": "kid", + "type": "string" + } + ], + "name": "getJwk", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "kid", + "type": "string" + }, + { + "internalType": "string", + "name": "kty", + "type": "string" + }, + { + "internalType": "string[]", + "name": "pubkeys", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "fulfilled", + "type": "bool" + } + ], + "internalType": "struct Jwk", + "name": "jwk", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "kty", + "type": "string" + } + ], + "name": "getKeyNames", + "outputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getKids", + "outputs": [ + { + "internalType": "string[]", + "name": "kids", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "string", + "name": "kid", + "type": "string" + } + ], + "name": "getLatestJwk", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "kid", + "type": "string" + }, + { + "internalType": "string", + "name": "kty", + "type": "string" + }, + { + "internalType": "string[]", + "name": "pubkeys", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "fulfilled", + "type": "bool" + } + ], + "internalType": "struct Jwk", + "name": "jwk", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + } + ], + "name": "getLatestKids", + "outputs": [ + { + "internalType": "string[]", + "name": "kids", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "string", + "name": "kid", + "type": "string" + } + ], + "name": "getRsaModulus", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + } + ], + "name": "getUpdateTimestamps", + "outputs": [ + { + "internalType": "uint256[]", + "name": "updateTimestamps", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + } + ], + "name": "getUrl", + "outputs": [ + { + "internalType": "string", + "name": "jwksUrl", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "string", + "name": "jwksUrl", + "type": "string" + } + ], + "name": "setJwksUrl", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "string[]", + "name": "kids", + "type": "string[]" + }, + { + "internalType": "string[]", + "name": "moduluses", + "type": "string[]" + } + ], + "name": "setRsaModulus", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } ] diff --git a/src/constants/abi/contracts/JwksProvider/OraklJwksProvider.json b/src/constants/abi/contracts/JwksProvider/OraklJwksProvider.json index c5e07f6..bfccb7d 100644 --- a/src/constants/abi/contracts/JwksProvider/OraklJwksProvider.json +++ b/src/constants/abi/contracts/JwksProvider/OraklJwksProvider.json @@ -1,498 +1,498 @@ [ - { - "inputs": [ - { - "internalType": "uint64", - "name": "_accId", - "type": "uint64" - }, - { - "internalType": "address", - "name": "coordinator", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "have", - "type": "address" - }, - { - "internalType": "address", - "name": "want", - "type": "address" - } - ], - "name": "OnlyCoordinatorCanFulfill", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "JwksUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "reqId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "string", - "name": "url", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "path", - "type": "string" - } - ], - "name": "OraklRequested", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "refreshId", - "type": "uint256" - } - ], - "name": "Refreshed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "jwksUrl", - "type": "string" - } - ], - "name": "UrlUpdated", - "type": "event" - }, - { - "inputs": [], - "name": "COORDINATOR", - "outputs": [ - { - "internalType": "contract IRequestResponseCoordinator", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "accId", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "string", - "name": "kid", - "type": "string" - } - ], - "name": "getJwk", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "kid", - "type": "string" - }, - { - "internalType": "string", - "name": "kty", - "type": "string" - }, - { - "internalType": "string[]", - "name": "pubkeys", - "type": "string[]" - }, - { - "internalType": "bool", - "name": "fulfilled", - "type": "bool" - } + { + "inputs": [ + { + "internalType": "uint64", + "name": "_accId", + "type": "uint64" + }, + { + "internalType": "address", + "name": "coordinator", + "type": "address" + } ], - "internalType": "struct Jwk", - "name": "jwk", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "kty", - "type": "string" - } - ], - "name": "getKeyNames", - "outputs": [ - { - "internalType": "string[]", - "name": "names", - "type": "string[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "name": "getKids", - "outputs": [ - { - "internalType": "string[]", - "name": "kids", - "type": "string[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "string", - "name": "kid", - "type": "string" - } - ], - "name": "getLatestJwk", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "kid", - "type": "string" - }, - { - "internalType": "string", - "name": "kty", - "type": "string" - }, - { - "internalType": "string[]", - "name": "pubkeys", - "type": "string[]" - }, - { - "internalType": "bool", - "name": "fulfilled", - "type": "bool" - } + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "have", + "type": "address" + }, + { + "internalType": "address", + "name": "want", + "type": "address" + } ], - "internalType": "struct Jwk", - "name": "jwk", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - } - ], - "name": "getLatestKids", - "outputs": [ - { - "internalType": "string[]", - "name": "kids", - "type": "string[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reqId", - "type": "uint256" - } - ], - "name": "getOraklReqInfo", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "refreshId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "uint256", - "name": "jwkIndex", - "type": "uint256" - }, - { - "internalType": "string", - "name": "field", - "type": "string" - } + "name": "OnlyCoordinatorCanFulfill", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } ], - "internalType": "struct OraklReqInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - } - ], - "name": "getUpdateTimestamps", - "outputs": [ - { - "internalType": "uint256[]", - "name": "updateTimestamps", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "confUrl", - "type": "string" - } - ], - "name": "getUrl", - "outputs": [ - { - "internalType": "string", - "name": "jwksUrl", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "lastRefreshId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "response", - "type": "string" - } - ], - "name": "rawFulfillDataRequest", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "callbackGasLimit", - "type": "uint32" - }, - { - "internalType": "string", - "name": "confUrl", - "type": "string" - }, - { - "internalType": "uint32", - "name": "jwksLen", - "type": "uint32" - }, - { - "internalType": "string[]", - "name": "ktys", - "type": "string[]" - } - ], - "name": "requestJwksRefresh", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "callbackGasLimit", - "type": "uint32" - }, - { - "internalType": "string", - "name": "confUrl", - "type": "string" - } - ], - "name": "requestJwksUrlRefresh", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } + "name": "JwksUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reqId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", + "name": "url", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "path", + "type": "string" + } + ], + "name": "OraklRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "refreshId", + "type": "uint256" + } + ], + "name": "Refreshed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "indexed": false, + "internalType": "string", + "name": "jwksUrl", + "type": "string" + } + ], + "name": "UrlUpdated", + "type": "event" + }, + { + "inputs": [], + "name": "COORDINATOR", + "outputs": [ + { + "internalType": "contract IRequestResponseCoordinator", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "accId", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "string", + "name": "kid", + "type": "string" + } + ], + "name": "getJwk", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "kid", + "type": "string" + }, + { + "internalType": "string", + "name": "kty", + "type": "string" + }, + { + "internalType": "string[]", + "name": "pubkeys", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "fulfilled", + "type": "bool" + } + ], + "internalType": "struct Jwk", + "name": "jwk", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "kty", + "type": "string" + } + ], + "name": "getKeyNames", + "outputs": [ + { + "internalType": "string[]", + "name": "names", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "uint256", + "name": "timestamp", + "type": "uint256" + } + ], + "name": "getKids", + "outputs": [ + { + "internalType": "string[]", + "name": "kids", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "string", + "name": "kid", + "type": "string" + } + ], + "name": "getLatestJwk", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "kid", + "type": "string" + }, + { + "internalType": "string", + "name": "kty", + "type": "string" + }, + { + "internalType": "string[]", + "name": "pubkeys", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "fulfilled", + "type": "bool" + } + ], + "internalType": "struct Jwk", + "name": "jwk", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + } + ], + "name": "getLatestKids", + "outputs": [ + { + "internalType": "string[]", + "name": "kids", + "type": "string[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reqId", + "type": "uint256" + } + ], + "name": "getOraklReqInfo", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "refreshId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "uint256", + "name": "jwkIndex", + "type": "uint256" + }, + { + "internalType": "string", + "name": "field", + "type": "string" + } + ], + "internalType": "struct OraklReqInfo", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + } + ], + "name": "getUpdateTimestamps", + "outputs": [ + { + "internalType": "uint256[]", + "name": "updateTimestamps", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "confUrl", + "type": "string" + } + ], + "name": "getUrl", + "outputs": [ + { + "internalType": "string", + "name": "jwksUrl", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastRefreshId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "response", + "type": "string" + } + ], + "name": "rawFulfillDataRequest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "callbackGasLimit", + "type": "uint32" + }, + { + "internalType": "string", + "name": "confUrl", + "type": "string" + }, + { + "internalType": "uint32", + "name": "jwksLen", + "type": "uint32" + }, + { + "internalType": "string[]", + "name": "ktys", + "type": "string[]" + } + ], + "name": "requestJwksRefresh", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "callbackGasLimit", + "type": "uint32" + }, + { + "internalType": "string", + "name": "confUrl", + "type": "string" + } + ], + "name": "requestJwksUrlRefresh", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } ] diff --git a/src/constants/abi/contracts/OIDCGuardianV02/OIDCGuardianV02.json b/src/constants/abi/contracts/OIDCGuardianV02/OIDCGuardianV02.json deleted file mode 100644 index cb93a93..0000000 --- a/src/constants/abi/contracts/OIDCGuardianV02/OIDCGuardianV02.json +++ /dev/null @@ -1,297 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "contract IZkVerifierV02", - "name": "_verifier", - "type": "address" - }, - { - "internalType": "contract IJWKSProvider", - "name": "_jwksProvider", - "type": "address" - }, - { - "internalType": "string", - "name": "_aud", - "type": "string" - }, - { - "internalType": "string", - "name": "_iss", - "type": "string" - }, - { - "internalType": "string", - "name": "_confUrl", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidShortString", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "str", - "type": "string" - } - ], - "name": "StringTooLong", - "type": "error" - }, - { - "anonymous": false, - "inputs": [], - "name": "EIP712DomainChanged", - "type": "event" - }, - { - "inputs": [], - "name": "VERIFY_RECOVER_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "input", - "type": "string" - } - ], - "name": "base64UrlDecode", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sca", - "type": "address" - }, - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "calcNonceA", - "outputs": [ - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "version", - "type": "string" - }, - { - "internalType": "address", - "name": "guardianAddress", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "domainSeparator", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "structHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "nonceA", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "confUrl", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eip712Domain", - "outputs": [ - { - "internalType": "bytes1", - "name": "fields", - "type": "bytes1" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "version", - "type": "string" - }, - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "verifyingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "uint256[]", - "name": "extensions", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "iss", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "jwksProvider", - "outputs": [ - { - "internalType": "contract IJWKSProvider", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "verifier", - "outputs": [ - { - "internalType": "contract IZkVerifierV02", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - }, - { - "internalType": "bytes", - "name": "proof", - "type": "bytes" - } - ], - "name": "verifyRecover", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "string", - "name": "nonceA", - "type": "string" - }, - { - "internalType": "string", - "name": "iss", - "type": "string" - }, - { - "internalType": "string", - "name": "aud", - "type": "string" - }, - { - "internalType": "uint256", - "name": "iat", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "exp", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "modulus", - "type": "bytes" - } - ], - "internalType": "struct PublicSignalData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/src/constants/abi/contracts/OIDCRecoveryAccountFactoryV02/OIDCRecoveryAccountFactoryV02.json b/src/constants/abi/contracts/OIDCRecoveryAccountFactoryV02/OIDCRecoveryAccountFactoryV02.json deleted file mode 100644 index ab2d517..0000000 --- a/src/constants/abi/contracts/OIDCRecoveryAccountFactoryV02/OIDCRecoveryAccountFactoryV02.json +++ /dev/null @@ -1,104 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "contract IEntryPoint", - "name": "_entryPoint", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "accountImplementation", - "outputs": [ - { - "internalType": "contract OIDCRecoveryAccountV02", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "guardian", - "type": "address" - }, - { - "internalType": "address", - "name": "initialOwner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "idx", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "chainIdOrZero", - "type": "uint16" - } - ], - "name": "createAccount", - "outputs": [ - { - "internalType": "contract IOIDCRecoverable", - "name": "ret", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "guardian", - "type": "address" - }, - { - "internalType": "address", - "name": "initialOwner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "idx", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "chainIdOrZero", - "type": "uint16" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] diff --git a/src/constants/abi/contracts/OIDCRecoveryAccountV02/OIDCRecoveryAccountV02.json b/src/constants/abi/contracts/OIDCRecoveryAccountV02/OIDCRecoveryAccountV02.json deleted file mode 100644 index 80badd3..0000000 --- a/src/constants/abi/contracts/OIDCRecoveryAccountV02/OIDCRecoveryAccountV02.json +++ /dev/null @@ -1,1063 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "contract IEntryPoint", - "name": "anEntryPoint", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "guardian", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "threshold", - "type": "uint256" - } - ], - "name": "GuardianAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "guardian", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "threshold", - "type": "uint256" - } - ], - "name": "GuardianRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "guardian", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "iat", - "type": "uint256" - } - ], - "name": "RecoverRequested", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "Recovered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "contract IEntryPoint", - "name": "entryPoint", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "SimpleAccountInitialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "threshold", - "type": "uint256" - } - ], - "name": "ThresholdUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [], - "name": "MAJOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "MINOR", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "addDeposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "guardian", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "newThreshold", - "type": "uint256" - } - ], - "name": "addGuardian", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "chainIdOrZero", - "outputs": [ - { - "internalType": "uint16", - "name": "", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "entryPoint", - "outputs": [ - { - "internalType": "contract IEntryPoint", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "dest", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "func", - "type": "bytes" - } - ], - "name": "execute", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "dest", - "type": "address[]" - }, - { - "internalType": "bytes[]", - "name": "func", - "type": "bytes[]" - } - ], - "name": "executeBatch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getConfirmers", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getConfirmersInfo", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "contract IGuardian", - "name": "guardian", - "type": "address" - }, - { - "internalType": "uint256", - "name": "iat", - "type": "uint256" - } - ], - "internalType": "struct GuardianInfo[]", - "name": "ret", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getDeposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "guardian", - "type": "address" - } - ], - "name": "getGuardianId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "guardianId", - "type": "bytes32" - } - ], - "name": "getGuardianInfo", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "contract IGuardian", - "name": "guardian", - "type": "address" - }, - { - "internalType": "uint256", - "name": "iat", - "type": "uint256" - } - ], - "internalType": "struct GuardianInfo", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getGuardians", - "outputs": [ - { - "internalType": "bytes32[]", - "name": "", - "type": "bytes32[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getGuardiansInfo", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "contract IGuardian", - "name": "guardian", - "type": "address" - }, - { - "internalType": "uint256", - "name": "iat", - "type": "uint256" - } - ], - "internalType": "struct GuardianInfo[]", - "name": "ret", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "guardianInfo", - "outputs": [ - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "contract IGuardian", - "name": "guardian", - "type": "address" - }, - { - "internalType": "uint256", - "name": "iat", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "guardians", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "idx", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialGuardian", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialSubHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_subHash", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "_guardian", - "type": "address" - }, - { - "internalType": "address", - "name": "_owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_idx", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "_chainIdOrZero", - "type": "uint16" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "anOwner", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC1155BatchReceived", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC1155Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC721Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pendingNewOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "guardian", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "newThreshold", - "type": "uint256" - } - ], - "name": "removeGuardian", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "guardian", - "type": "address" - }, - { - "internalType": "bytes", - "name": "proof", - "type": "bytes" - } - ], - "internalType": "struct AuthData", - "name": "auth", - "type": "tuple" - } - ], - "name": "requestRecover", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "threshold", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "tokensReceived", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newThreshold", - "type": "uint256" - } - ], - "name": "updateThreshold", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "initCode", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "callData", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "callGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "verificationGasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "preVerificationGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPriorityFeePerGas", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "paymasterAndData", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct UserOperation", - "name": "userOp", - "type": "tuple" - }, - { - "internalType": "bytes32", - "name": "userOpHash", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "missingAccountFunds", - "type": "uint256" - } - ], - "name": "validateUserOp", - "outputs": [ - { - "internalType": "uint256", - "name": "validationData", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address payable", - "name": "withdrawAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdrawDepositTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "stateMutability": "payable", - "type": "receive" - } -] diff --git a/src/constants/abi/contracts/OIDCZKVerifierV02/OIDCZKVerifierV02.json b/src/constants/abi/contracts/OIDCZKVerifierV02/OIDCZKVerifierV02.json deleted file mode 100644 index 0d99b99..0000000 --- a/src/constants/abi/contracts/OIDCZKVerifierV02/OIDCZKVerifierV02.json +++ /dev/null @@ -1,297 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "contract IZkVerifierV02", - "name": "_verifier", - "type": "address" - }, - { - "internalType": "contract IJWKSProvider", - "name": "_jwksProvider", - "type": "address" - }, - { - "internalType": "string", - "name": "_aud", - "type": "string" - }, - { - "internalType": "string", - "name": "_iss", - "type": "string" - }, - { - "internalType": "string", - "name": "_confUrl", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidShortString", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "str", - "type": "string" - } - ], - "name": "StringTooLong", - "type": "error" - }, - { - "anonymous": false, - "inputs": [], - "name": "EIP712DomainChanged", - "type": "event" - }, - { - "inputs": [], - "name": "VERIFY_RECOVER_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "input", - "type": "string" - } - ], - "name": "base64UrlDecode", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sca", - "type": "address" - }, - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "calcNonceA", - "outputs": [ - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "version", - "type": "string" - }, - { - "internalType": "address", - "name": "guardianAddress", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "domainSeparator", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "structHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "nonceA", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "confUrl", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eip712Domain", - "outputs": [ - { - "internalType": "bytes1", - "name": "fields", - "type": "bytes1" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "version", - "type": "string" - }, - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "verifyingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "uint256[]", - "name": "extensions", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "iss", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "jwksProvider", - "outputs": [ - { - "internalType": "contract IJWKSProvider", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "verifier", - "outputs": [ - { - "internalType": "contract IZkVerifierV02", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - }, - { - "internalType": "bytes", - "name": "proof", - "type": "bytes" - } - ], - "name": "verifyRecover", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "subHash", - "type": "bytes32" - }, - { - "internalType": "string", - "name": "nonceA", - "type": "string" - }, - { - "internalType": "string", - "name": "iss", - "type": "string" - }, - { - "internalType": "string", - "name": "aud", - "type": "string" - }, - { - "internalType": "uint256", - "name": "iat", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "exp", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "modulus", - "type": "bytes" - } - ], - "internalType": "struct PublicSignalData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } -] diff --git a/src/constants/abi/contracts/RecoveryAccount/RecoveryAccount.json b/src/constants/abi/contracts/RecoveryAccount/RecoveryAccount.json new file mode 100644 index 0000000..8088a34 --- /dev/null +++ b/src/constants/abi/contracts/RecoveryAccount/RecoveryAccount.json @@ -0,0 +1,1063 @@ +[ + { + "inputs": [ + { + "internalType": "contract IEntryPoint", + "name": "anEntryPoint", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "guardian", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "threshold", + "type": "uint256" + } + ], + "name": "GuardianAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "guardian", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "threshold", + "type": "uint256" + } + ], + "name": "GuardianRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "guardian", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "iat", + "type": "uint256" + } + ], + "name": "RecoverRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "contract IEntryPoint", + "name": "entryPoint", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "SimpleAccountInitialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "threshold", + "type": "uint256" + } + ], + "name": "ThresholdUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "inputs": [], + "name": "MAJOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "MINOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "addDeposit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "guardian", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "newThreshold", + "type": "uint256" + } + ], + "name": "addGuardian", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "chainIdOrZero", + "outputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "entryPoint", + "outputs": [ + { + "internalType": "contract IEntryPoint", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "dest", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "func", + "type": "bytes" + } + ], + "name": "execute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "dest", + "type": "address[]" + }, + { + "internalType": "bytes[]", + "name": "func", + "type": "bytes[]" + } + ], + "name": "executeBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getConfirmers", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getConfirmersInfo", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "internalType": "contract IGuardian", + "name": "guardian", + "type": "address" + }, + { + "internalType": "uint256", + "name": "iat", + "type": "uint256" + } + ], + "internalType": "struct GuardianInfo[]", + "name": "ret", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDeposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "guardian", + "type": "address" + } + ], + "name": "getGuardianId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "guardianId", + "type": "bytes32" + } + ], + "name": "getGuardianInfo", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "internalType": "contract IGuardian", + "name": "guardian", + "type": "address" + }, + { + "internalType": "uint256", + "name": "iat", + "type": "uint256" + } + ], + "internalType": "struct GuardianInfo", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGuardians", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getGuardiansInfo", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "internalType": "contract IGuardian", + "name": "guardian", + "type": "address" + }, + { + "internalType": "uint256", + "name": "iat", + "type": "uint256" + } + ], + "internalType": "struct GuardianInfo[]", + "name": "ret", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "guardianInfo", + "outputs": [ + { + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "internalType": "contract IGuardian", + "name": "guardian", + "type": "address" + }, + { + "internalType": "uint256", + "name": "iat", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "guardians", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "idx", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialGuardian", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialSubHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_subHash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "_guardian", + "type": "address" + }, + { + "internalType": "address", + "name": "_owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_idx", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "_chainIdOrZero", + "type": "uint16" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "anOwner", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC1155BatchReceived", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC1155Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pendingNewOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "guardian", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "newThreshold", + "type": "uint256" + } + ], + "name": "removeGuardian", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "guardian", + "type": "address" + }, + { + "internalType": "bytes", + "name": "proof", + "type": "bytes" + } + ], + "internalType": "struct AuthData", + "name": "auth", + "type": "tuple" + } + ], + "name": "requestRecover", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "threshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "tokensReceived", + "outputs": [], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newThreshold", + "type": "uint256" + } + ], + "name": "updateThreshold", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "initCode", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "callData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "callGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "verificationGasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "preVerificationGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxPriorityFeePerGas", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "paymasterAndData", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } + ], + "internalType": "struct UserOperation", + "name": "userOp", + "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "userOpHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "missingAccountFunds", + "type": "uint256" + } + ], + "name": "validateUserOp", + "outputs": [ + { + "internalType": "uint256", + "name": "validationData", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address payable", + "name": "withdrawAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdrawDepositTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } +] diff --git a/src/constants/abi/contracts/RecoveryAccountFactory/RecoveryAccountFactory.json b/src/constants/abi/contracts/RecoveryAccountFactory/RecoveryAccountFactory.json new file mode 100644 index 0000000..40d992f --- /dev/null +++ b/src/constants/abi/contracts/RecoveryAccountFactory/RecoveryAccountFactory.json @@ -0,0 +1,130 @@ +[ + { + "inputs": [ + { + "internalType": "contract IEntryPoint", + "name": "_entryPoint", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "MAJOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "MINOR", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "accountImplementation", + "outputs": [ + { + "internalType": "contract RecoveryAccount", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "guardian", + "type": "address" + }, + { + "internalType": "address", + "name": "initialOwner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "idx", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "chainIdOrZero", + "type": "uint16" + } + ], + "name": "createAccount", + "outputs": [ + { + "internalType": "contract IRecoveryAccount", + "name": "ret", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "subHash", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "guardian", + "type": "address" + }, + { + "internalType": "address", + "name": "initialOwner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "idx", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "chainIdOrZero", + "type": "uint16" + } + ], + "name": "getAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/constants/abi/index.ts b/src/constants/abi/index.ts index f0dbcb5..3a9cd9e 100644 --- a/src/constants/abi/index.ts +++ b/src/constants/abi/index.ts @@ -1,9 +1,8 @@ export { default as EntryPoint } from "./contracts/EntryPoint/EntryPoint.json"; export { default as Counter } from "./contracts/Counter/Counter.json"; -export { default as OIDCRecoveryAccountFactoryV02 } from "./contracts/OIDCRecoveryAccountFactoryV02/OIDCRecoveryAccountFactoryV02.json"; -export { default as OIDCRecoveryAccountV02 } from "./contracts/OIDCRecoveryAccountV02/OIDCRecoveryAccountV02.json"; -export { default as OIDCGuardianV02 } from "./contracts/OIDCGuardianV02/OIDCGuardianV02.json"; -export { default as OIDCZKVerifierV02 } from "./contracts/OIDCZKVerifierV02/OIDCZKVerifierV02.json"; +export { default as RecoveryAccountFactory } from "./contracts/RecoveryAccountFactory/RecoveryAccountFactory.json"; +export { default as RecoveryAccount } from "./contracts/RecoveryAccount/RecoveryAccount.json"; +export { default as Guardian } from "./contracts/Guardian/Guardian.json"; export { default as Groth16VerifierV02 } from "./contracts/Groth16VerifierV02/Groth16VerifierV02.json"; export { default as ERC1967Proxy } from "./contracts/ERC1967Proxy/ERC1967Proxy.json"; export { default as OraklJwksProvider } from "./contracts/JwksProvider/OraklJwksProvider.json"; diff --git a/src/userOp.ts b/src/userOp.ts index c4542e8..9716334 100644 --- a/src/userOp.ts +++ b/src/userOp.ts @@ -43,9 +43,14 @@ async function createAdjustedSignedUserOp(smartWallet: RecoveryAccountAPI, tx: T return signedUo; } -export async function createAndSendUserOp(smartWallet: RecoveryAccountAPI, bundlerUrl: string, chainId: Networks, tx: TransactionDetailsForUserOp) { +export async function createAndSendUserOp( + smartWallet: RecoveryAccountAPI, + bundlerUrl: string, + chainId: Networks, + tx: TransactionDetailsForUserOp +) { const signedUo = await createAdjustedSignedUserOp(smartWallet, tx); - const rpc = new HttpRpcClient(bundlerUrl, Addresses[chainId].entryPointAddr, chainId); + const rpc = new HttpRpcClient(bundlerUrl, Addresses[chainId].EntryPointAddr, chainId); const uoHash = await rpc.sendUserOpToBundler(signedUo); await new Promise((resolve) => { setTimeout(resolve, 1000); diff --git a/src/utils.ts b/src/utils.ts index 94bed33..d7f9970 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -15,15 +15,15 @@ for (const [key, value] of Object.entries(providerNameToIss)) { export const getGuardianFromIssOrName = (issOrName: string, chainId: Networks) => { if (issOrName === "https://accounts.google.com" || issOrName === "google") { - return Addresses[chainId].googleGuardianV02Addr; + return Addresses[chainId].GoogleGuardianAddr; } else if (issOrName === "https://kauth.kakao.com" || issOrName === "kakao") { - return Addresses[chainId].kakaoGuardianV02Addr; + return Addresses[chainId].KakaoGuardianAddr; } else if (issOrName === "https://appleid.apple.com" || issOrName === "apple") { - return Addresses[chainId].appleGuardianV02Addr; + return Addresses[chainId].AppleGuardianAddr; } else if (issOrName === "https://access.line.me" || issOrName === "line") { - return Addresses[chainId].lineGuardianV02Addr; + return Addresses[chainId].LineGuardianAddr; } else if (issOrName === "https://id.twitch.tv/oauth2" || issOrName === "twitch") { - return Addresses[chainId].twitchGuardianV02Addr; + return Addresses[chainId].TwitchGuardianAddr; } else { return ""; } From e27e200cfab12cc4a8075e980051a62013e71269 Mon Sep 17 00:00:00 2001 From: hyeonLewis Date: Fri, 1 Mar 2024 12:57:24 +0900 Subject: [PATCH 4/7] Re-deploy guardians --- src/constants/Address.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/constants/Address.ts b/src/constants/Address.ts index ba8f99e..9f04e5f 100644 --- a/src/constants/Address.ts +++ b/src/constants/Address.ts @@ -35,9 +35,9 @@ const BAOBAB: Addresses = { RecoveryFactoryAddr: "0x280fd135dD72D5bcC060e3b280fa13CF543073FA", ManualJwksProviderAddr: "0x20e8d77CBFAD3d08FD5fa1e118D844a012f4c2bC", OraklJwksProviderAddr: "0xcb10b0FF081797A96258b3aEB45a43E382dA0481", - GoogleGuardianAddr: "0xa1930Df14A842b8DfA47BECf5347Bf8A1d8B4E75", - KakaoGuardianAddr: "0x364669A6040585A1117979399E454A9a3FabeD03", - TwitchGuardianAddr: "0x7897e273EE938cb88A9E6C3DdB36f7e5050D2891", + GoogleGuardianAddr: "0x605BD3E7546172Ad730585b2c0caAb2524B4F4e8", + KakaoGuardianAddr: "0xd909993fADC292F2Aa5728133b8aFf2db8aeB208", + TwitchGuardianAddr: "0x8829CACE02d18f89d2c137F9328309652DeF9Ada", AppleGuardianAddr: undefined, LineGuardianAddr: undefined, }; From a4410da48ce5695a0dfc502de5d381212fedad68 Mon Sep 17 00:00:00 2001 From: hyeonLewis Date: Thu, 7 Mar 2024 12:43:14 +0900 Subject: [PATCH 5/7] Update readme --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index cdcb70a..1fba7e9 100644 --- a/README.md +++ b/README.md @@ -225,8 +225,6 @@ If user wallet is `ghost` wallet, user can't recover it, so delete it and create const iss: string[] = []; const sub: string[] = []; const salts: string[] = []; - const confUrls: string[] = []; - const jwkUrls: string[] = []; const jwks: RsaJsonWebKey[] = []; const proofAndPubSigs: any[] = []; @@ -239,8 +237,6 @@ If user wallet is `ghost` wallet, user can't recover it, so delete it and create sub.push(subTemp); salts.push(await calcSalt(subTemp)); const provider = getProviderNameFromIss(issTemp); - confUrls.push(OIDCProviders.find(p => p.name === provider.toLowerCase())?.confUrl as string); - jwkUrls.push(OIDCProviders.find(p => p.name === provider.toLowerCase())?.jwkUrl as string); jwks.push((await getJWKs(provider, header.kid)) as RsaJsonWebKey); // Prepare zk proof From 7beabea54ae816f612f06ba83fe58aa486c58fe8 Mon Sep 17 00:00:00 2001 From: hyeonLewis Date: Thu, 7 Mar 2024 12:43:24 +0900 Subject: [PATCH 6/7] Fix pubsigs process --- src/circuit-helpers.ts | 113 +++++++++++++++++++++++++++-------------- src/zkauth-circuit.ts | 37 +++++++------- 2 files changed, 92 insertions(+), 58 deletions(-) diff --git a/src/circuit-helpers.ts b/src/circuit-helpers.ts index 2dbe11c..c6a1ff2 100644 --- a/src/circuit-helpers.ts +++ b/src/circuit-helpers.ts @@ -1,7 +1,46 @@ import { Buffer } from "buffer"; +import base64url from "base64url"; import _ from "lodash"; +const numBits = 248; +const numBytes = numBits / 8; + +// fromXXX: convert from XXX type to buffer +// toXXX: convert from buffer to XXX type + +export function fromASCII(str: string): Buffer { + return Buffer.from(str, "ascii"); +} + +export function fromBase64(str: string): Buffer { + return base64url.toBuffer(str); +} + +export function fromHex(str: string): Buffer { + return Buffer.from(str, "hex"); +} + +export function fromUints(arr: string[]): Buffer { + return Buffer.concat(arr.map((x) => Buffer.from(BigInt(x).toString(16), "hex"))); +} + +export function fromQwords(arr: string[]): Buffer { + return Buffer.from(_.reverse(_.map(arr, (x: any) => BigInt(x).toString(16).padStart(16, "0"))).join(""), "hex"); +} + +export function toASCII(buffer: Buffer): string { + return buffer.toString("ascii"); +} + +export function toBase64(buffer: Buffer): string { + return base64url(buffer); +} + +export function toHex(buffer: Buffer): string { + return buffer.toString("hex"); +} + function bufferToUints(buffer: Buffer, chunkLen: number): string[] { const result: string[] = []; _.map(_.chunk(buffer, chunkLen), (slice: Buffer) => { @@ -10,6 +49,23 @@ function bufferToUints(buffer: Buffer, chunkLen: number): string[] { return result; } +export function toUints(buffer: Buffer, maxLen: number): string[] { + const stretched = stretch(buffer, maxLen); + const result: string[] = []; + _.map(_.chunk(stretched, numBytes), (slice: Buffer) => { + result.push(BigInt("0x" + Buffer.from(slice).toString("hex")).toString()); + }); + return result; +} + +export function toQwords(buf: string | Buffer): string[] { + const bi = BigInt("0x" + Buffer.from(buf).toString("hex")); + return _.times(32, (i: any) => ((bi >> BigInt(i * 64)) & (2n ** 64n - 1n)).toString(10)); +} + +// Misc helpers + +// stretch: pad the buffer to the given length function stretch(buf: Buffer, len: number): Buffer { if (buf.length < len) { return Buffer.concat([buf, Buffer.alloc(len - buf.length, 0)]); @@ -17,56 +73,37 @@ function stretch(buf: Buffer, len: number): Buffer { return buf; } -export function string2Uints(str: string | Buffer, maxLen: number): string[] { - const numBits = 248; - const numBytes = numBits / 8; - - let paddedStr = Buffer.from(str); - - // Pad the string to the max length - paddedStr = stretch(paddedStr, maxLen); +// sha256Pad: add SHA256 padding +// [ string ][ 80 ][ 00..00 ][ len ] +export function sha256Pad(str: string | Buffer): Buffer { + let padded = Buffer.from(str); + const blockSize = 64; // Block size in bytes - return bufferToUints(paddedStr, numBytes); -} + padded = Buffer.concat([padded, Buffer.from([0x80])]); // Append a single '1' bit -export function uints2String(arr: string[]): string { - return arr.map((x) => Buffer.from(BigInt(x).toString(16), "hex").toString("ascii")).join(""); -} + const zeroBits = Buffer.alloc( + (padded.length + 8) % blockSize == 0 ? 0 : blockSize - ((padded.length + 8) % blockSize) + ); + padded = Buffer.concat([padded, zeroBits]); // Append the '0' bits -export function uints2Buffer(arr: string[]): Buffer { - return Buffer.concat(arr.map((x) => Buffer.from(BigInt(x).toString(16), "hex"))); -} + const lengthBits = Buffer.alloc(8); + lengthBits.writeBigInt64BE(BigInt(str.length * 8), 0); + padded = Buffer.concat([padded, lengthBits]); // Append the length -export function string2Qwords(str: string): string[] { - const bi = str.startsWith("0x") ? BigInt(str) : BigInt("0x" + str); - return _.times(32, (i: any) => ((bi >> BigInt(i * 64)) & (2n ** 64n - 1n)).toString(10)); + return padded; } -export function qwords2String(arr: string[]): string { - return Buffer.from( - _.reverse(_.map(arr, (x: any) => BigInt(x).toString(16).padStart(16, "0"))).join(""), - "hex" - ).toString("base64"); +// sha256BlockLen: calculate the number of SHA256b blocks for given buffer +export function sha256BlockLen(buf: string | Buffer): number { + // 1 is for 0x80, 8 is for length bits (64 bits) + return Math.ceil((buf.length + 1 + 8) / 64); } -export function string2UintsSha256Padded(str: string | Buffer, maxLen: number): string[] { +export function string2Uints(str: string | Buffer, maxLen: number): string[] { const numBits = 248; const numBytes = numBits / 8; - // Add the SHA256 padding let paddedStr = Buffer.from(str); - const blockSize = 64; // Block size in bytes - - paddedStr = Buffer.concat([paddedStr, Buffer.from([0x80])]); // Append a single '1' bit - - const zeroBits = Buffer.alloc( - (paddedStr.length + 8) % blockSize == 0 ? 0 : blockSize - ((paddedStr.length + 8) % blockSize) - ); - paddedStr = Buffer.concat([paddedStr, zeroBits]); // Append the '0' bits - - const lengthBits = Buffer.alloc(8); - lengthBits.writeBigInt64BE(BigInt(str.length * 8), 0); - paddedStr = Buffer.concat([paddedStr, lengthBits]); // Append the length // Pad the string to the max length paddedStr = stretch(paddedStr, maxLen); diff --git a/src/zkauth-circuit.ts b/src/zkauth-circuit.ts index ec38b5d..47e401e 100644 --- a/src/zkauth-circuit.ts +++ b/src/zkauth-circuit.ts @@ -2,7 +2,7 @@ import { Buffer } from "buffer"; import base64url from "base64url"; -import { string2Uints, string2UintsSha256Padded, uints2String, uints2Buffer } from "./circuit-helpers"; +import * as helper from "./circuit-helpers"; export const ZkauthJwtV02 = { maxSaltedSubLen: 341, // 31 * 11 @@ -25,14 +25,13 @@ export const ZkauthJwtV02 = { const payOff = header.length + 1; // position in base64-encoded JWT const payLen = payload.length; - const pay = base64url.decode(payload); + // toString('ascii') may result in some unicode characters to be misinterpreted + const pay = base64url.toBuffer(payload).toString("ascii"); const payObject = JSON.parse(base64url.decode(payload)); console.assert(signedJwt.substring(payOff, payOff + payLen) == payload, "payOff"); - // [ string ][ 80 ][ 00..00 ][ len ] - const jwtUints = string2UintsSha256Padded(jwt, maxLen); - // 1 is for 0x80, 8 is for length bits (64 bits) - const jwtBlocks = Math.ceil((jwt.length + 1 + 8) / 64); + const jwtUints = helper.toUints(helper.sha256Pad(jwt), maxLen); + const jwtBlocks = helper.sha256BlockLen(jwt); // Claims function claimPos(jwt: string, name: string): number[] { @@ -67,13 +66,12 @@ export const ZkauthJwtV02 = { const sub = '"' + payObject["sub"] + '"'; // salt is hex string and sub is ASCII string const saltedSub = Buffer.concat([Buffer.from(salt, "hex"), Buffer.from(sub, "ascii")]); - const saltedSubUints = string2UintsSha256Padded(saltedSub, maxSaltedSubLen); - // 1 is for 0x80, 8 is for length bits (64 bits) - const saltedSubBlocks = Math.ceil((saltedSub.length + 1 + 8) / 64); + const saltedSubUints = helper.toUints(helper.sha256Pad(saltedSub), maxSaltedSubLen); + const saltedSubBlocks = helper.sha256BlockLen(saltedSub); // Signature - const sigUints = string2Uints(base64url.toBuffer(signature), maxSigLen); - const pubUints = string2Uints(base64url.toBuffer(pub), maxPubLen); + const sigUints = helper.toUints(helper.fromBase64(signature), maxSigLen); + const pubUints = helper.toUints(helper.fromBase64(pub), maxPubLen); return { jwtUints, @@ -94,26 +92,25 @@ export const ZkauthJwtV02 = { }; }, process_output: function (pubsig: string[]) { - const iss = uints2String(pubsig.slice(0, 9)); + const iss = helper.toASCII(helper.fromUints(pubsig.slice(0, 9))); const issLen = pubsig[9]; - const aud = uints2String(pubsig.slice(10, 19)); + const aud = helper.toASCII(helper.fromUints(pubsig.slice(10, 19))); const audLen = pubsig[19]; - const iat = uints2String(pubsig.slice(20, 29)); + const iat = helper.toASCII(helper.fromUints(pubsig.slice(20, 29))); const iatLen = pubsig[29]; - const exp = uints2String(pubsig.slice(30, 39)); + const exp = helper.toASCII(helper.fromUints(pubsig.slice(30, 39))); const expLen = pubsig[39]; - const nonce = uints2String(pubsig.slice(40, 49)); + const nonce = helper.toASCII(helper.fromUints(pubsig.slice(40, 49))); const nonceLen = pubsig[49]; - const hSub = - BigInt(pubsig[50]).toString(16).padStart(32, "0") + BigInt(pubsig[51]).toString(16).padStart(32, "0"); - const pub = base64url(uints2Buffer(pubsig.slice(52, 61)).subarray(0, 256)); + const hSub = "0x" + helper.toHex(helper.fromUints(pubsig.slice(50, 52)).subarray(0, 32)); + const pub = helper.toBase64(helper.fromUints(pubsig.slice(52, 61)).subarray(0, 256)); console.log("iss =", iss, ", issLen =", issLen); console.log("aud =", aud, ", audLen =", audLen); console.log("iat =", iat, ", iatLen =", iatLen); console.log("exp =", exp, ", expLen =", expLen); console.log("nonce =", nonce, ", nonceLen =", nonceLen); - console.log("hSub =", "0x" + hSub); + console.log("hSub =", hSub); console.log("pub =", pub); }, }; From 3f4ad1ea78ecd7c8ef3fab61674c92aea5d7ee43 Mon Sep 17 00:00:00 2001 From: hyeonLewis Date: Fri, 8 Mar 2024 10:46:09 +0900 Subject: [PATCH 7/7] Use toUints for generateModPubSig --- src/authBuilder.ts | 4 ++-- src/circuit-helpers.ts | 20 -------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/src/authBuilder.ts b/src/authBuilder.ts index a06abf1..e7b3c21 100644 --- a/src/authBuilder.ts +++ b/src/authBuilder.ts @@ -9,7 +9,7 @@ import { IJwtProvider } from "./jwtProvider"; import { typeDataRecovery } from "./samples"; import { sampleProofA, sampleProofB, sampleProofC } from "./samples/constants"; -import { ZkauthJwtV02, string2Uints } from "."; +import { ZkauthJwtV02, toUints } from "."; export interface typeDataArgs { verifyingContract: string; @@ -280,7 +280,7 @@ export function calcGuardianId(subHash: string, guardian: string) { } export const generateModPubSig = (modBytes: string | Buffer) => { - return string2Uints(modBytes, ZkauthJwtV02.maxPubLen); + return toUints(Buffer.from(modBytes), ZkauthJwtV02.maxPubLen); }; export const generateJwtPubSig = (jwt: string) => { diff --git a/src/circuit-helpers.ts b/src/circuit-helpers.ts index c6a1ff2..c481a89 100644 --- a/src/circuit-helpers.ts +++ b/src/circuit-helpers.ts @@ -41,14 +41,6 @@ export function toHex(buffer: Buffer): string { return buffer.toString("hex"); } -function bufferToUints(buffer: Buffer, chunkLen: number): string[] { - const result: string[] = []; - _.map(_.chunk(buffer, chunkLen), (slice: Buffer) => { - result.push(BigInt("0x" + Buffer.from(slice).toString("hex")).toString()); - }); - return result; -} - export function toUints(buffer: Buffer, maxLen: number): string[] { const stretched = stretch(buffer, maxLen); const result: string[] = []; @@ -98,15 +90,3 @@ export function sha256BlockLen(buf: string | Buffer): number { // 1 is for 0x80, 8 is for length bits (64 bits) return Math.ceil((buf.length + 1 + 8) / 64); } - -export function string2Uints(str: string | Buffer, maxLen: number): string[] { - const numBits = 248; - const numBytes = numBits / 8; - - let paddedStr = Buffer.from(str); - - // Pad the string to the max length - paddedStr = stretch(paddedStr, maxLen); - - return bufferToUints(paddedStr, numBytes); -}