-
Notifications
You must be signed in to change notification settings - Fork 18
OIDC/sdk google recovery flow #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b27e51c
084849b
c5b6c1c
1423b21
3fdd925
5f41a14
8e11bd9
b5af9bd
e79b884
2b9842f
7551cdf
6d2dac2
5b0e1ca
06c6192
6a771d7
6a98acb
206117c
9d437cb
4433331
2fbd1cb
c512462
6bf49c6
91870b0
8810a43
3884e2a
1625942
749e76a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import type { OidcData } from "zksync-sso/client"; | ||
|
|
||
| export const useRecoveryOidc = () => { | ||
| const { getClient, defaultChain } = useClientStore(); | ||
| const paymasterAddress = contractsByChain[defaultChain!.id].accountPaymaster; | ||
|
|
||
| const { inProgress: isLoading, error, execute: addOidcAccount } = useAsync(async (oidcData: OidcData) => { | ||
| const client = getClient({ chainId: defaultChain.id }); | ||
|
|
||
| return await client.addOidcAccount({ | ||
| paymaster: { | ||
| address: paymasterAddress, | ||
| }, | ||
| oidcData, | ||
| }); | ||
| }); | ||
|
|
||
| return { | ||
| addOidcAccount, | ||
| isLoading, | ||
| error, | ||
| }; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,11 +29,12 @@ export const contractsByChain: Record<SupportedChainId, ChainContracts> = { | |
| accountPaymaster: "0xA46D949858335308859076FA605E773eB679e534", | ||
| }, | ||
| [zksyncInMemoryNode.id]: { | ||
| session: "0x045b82c1e4F36442Bbc16FAde8aDf898B3D67Fd3", | ||
| passkey: "0x5F8Ef9E98ad0C51648B16d977F07F75bE3DE082a", | ||
| recovery: "0x971AFC8451cEfB03d679c47455F973Dd42554AAa", | ||
| accountFactory: "0x90953AEAe78a8995E917B7Ff29d277271737D9ab", | ||
| accountPaymaster: "0x13e7b3b311a2b020572f421d27779639ce9ab40F", | ||
| session: "0x644040Bc7f2b243BB5ba28ccFa67Ec3dD7f9a77F", | ||
| passkey: "0x1Ec1126fab9eE89d0babC8669076e1dd1e36cd09", | ||
| recovery: "0x4E619cA9DDb3A207E4764F3Ee5D36DD478212335", | ||
| recoveryOidc: "0x3ad654fC38bb5Abe789c912cfE900A867d52A164", | ||
| accountFactory: "0x01F99512191c036FcA9Fcd416dE73b19e93B7D60", | ||
| accountPaymaster: "0x2A2869fa5a1E94474798C02ED930278C154EE213", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we research if nuxt offers a better way to save this kind of data? It's kind of awful having to update this on every deploy. Maybe we can do something were the deploy script exports the addresses in some format that we can use as an input for this. Not for this PR, though.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will add it to the backlog |
||
| }, | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,328 @@ | ||
| export const OidcRecoveryModuleAbi = [ | ||
| { | ||
| inputs: [ | ||
| { | ||
| internalType: "address", | ||
| name: "_keyRegistry", | ||
| type: "address", | ||
| }, | ||
| { | ||
| internalType: "address", | ||
| name: "_verifier", | ||
| type: "address", | ||
| }, | ||
| ], | ||
| stateMutability: "nonpayable", | ||
| type: "constructor", | ||
| }, | ||
| { | ||
| anonymous: false, | ||
| inputs: [ | ||
| { | ||
| indexed: false, | ||
| internalType: "uint8", | ||
| name: "version", | ||
| type: "uint8", | ||
| }, | ||
| ], | ||
| name: "Initialized", | ||
| type: "event", | ||
| }, | ||
| { | ||
| anonymous: false, | ||
| inputs: [ | ||
| { | ||
| indexed: true, | ||
| internalType: "address", | ||
| name: "account", | ||
| type: "address", | ||
| }, | ||
| { | ||
| indexed: false, | ||
| internalType: "bytes", | ||
| name: "iss", | ||
| type: "bytes", | ||
| }, | ||
| { | ||
| indexed: false, | ||
| internalType: "bool", | ||
| name: "isNew", | ||
| type: "bool", | ||
| }, | ||
| ], | ||
| name: "OidcKeyUpdated", | ||
| type: "event", | ||
| }, | ||
| { | ||
| inputs: [ | ||
| { | ||
| internalType: "address", | ||
| name: "", | ||
| type: "address", | ||
| }, | ||
| ], | ||
| name: "accountData", | ||
| outputs: [ | ||
| { | ||
| internalType: "bytes", | ||
| name: "oidcDigest", | ||
| type: "bytes", | ||
| }, | ||
| { | ||
| internalType: "bytes", | ||
| name: "iss", | ||
| type: "bytes", | ||
| }, | ||
| { | ||
| internalType: "bytes", | ||
| name: "aud", | ||
| type: "bytes", | ||
| }, | ||
| ], | ||
| stateMutability: "view", | ||
| type: "function", | ||
| }, | ||
| { | ||
| inputs: [ | ||
| { | ||
| internalType: "bytes", | ||
| name: "key", | ||
| type: "bytes", | ||
| }, | ||
| ], | ||
| name: "addValidationKey", | ||
| outputs: [ | ||
| { | ||
| internalType: "bool", | ||
| name: "", | ||
| type: "bool", | ||
| }, | ||
| ], | ||
| stateMutability: "nonpayable", | ||
| type: "function", | ||
| }, | ||
| { | ||
| inputs: [ | ||
| { | ||
| internalType: "address", | ||
| name: "_keyRegistry", | ||
| type: "address", | ||
| }, | ||
| { | ||
| internalType: "address", | ||
| name: "_verifier", | ||
| type: "address", | ||
| }, | ||
| ], | ||
| name: "initialize", | ||
| outputs: [], | ||
| stateMutability: "nonpayable", | ||
| type: "function", | ||
| }, | ||
| { | ||
| inputs: [], | ||
| name: "keyRegistry", | ||
| outputs: [ | ||
| { | ||
| internalType: "address", | ||
| name: "", | ||
| type: "address", | ||
| }, | ||
| ], | ||
| stateMutability: "view", | ||
| type: "function", | ||
| }, | ||
| { | ||
| inputs: [ | ||
| { | ||
| internalType: "bytes", | ||
| name: "data", | ||
| type: "bytes", | ||
| }, | ||
| ], | ||
| name: "onInstall", | ||
| outputs: [], | ||
| stateMutability: "nonpayable", | ||
| type: "function", | ||
| }, | ||
| { | ||
| inputs: [ | ||
| { | ||
| internalType: "bytes", | ||
| name: "data", | ||
| type: "bytes", | ||
| }, | ||
| ], | ||
| name: "onUninstall", | ||
| outputs: [], | ||
| stateMutability: "nonpayable", | ||
| type: "function", | ||
| }, | ||
| { | ||
| inputs: [ | ||
| { | ||
| internalType: "bytes4", | ||
| name: "interfaceId", | ||
| type: "bytes4", | ||
| }, | ||
| ], | ||
| name: "supportsInterface", | ||
| outputs: [ | ||
| { | ||
| internalType: "bool", | ||
| name: "", | ||
| type: "bool", | ||
| }, | ||
| ], | ||
| stateMutability: "pure", | ||
| type: "function", | ||
| }, | ||
| { | ||
| inputs: [ | ||
| { | ||
| internalType: "bytes32", | ||
| name: "signedHash", | ||
| type: "bytes32", | ||
| }, | ||
| { | ||
| internalType: "bytes", | ||
| name: "signature", | ||
| type: "bytes", | ||
| }, | ||
| ], | ||
| name: "validateSignature", | ||
| outputs: [ | ||
| { | ||
| internalType: "bool", | ||
| name: "", | ||
| type: "bool", | ||
| }, | ||
| ], | ||
| stateMutability: "view", | ||
| type: "function", | ||
| }, | ||
| { | ||
| inputs: [ | ||
| { | ||
| internalType: "bytes32", | ||
| name: "signedHash", | ||
| type: "bytes32", | ||
| }, | ||
| { | ||
| internalType: "bytes", | ||
| name: "signature", | ||
| type: "bytes", | ||
| }, | ||
| { | ||
| components: [ | ||
| { | ||
| internalType: "uint256", | ||
| name: "txType", | ||
| type: "uint256", | ||
| }, | ||
| { | ||
| internalType: "uint256", | ||
| name: "from", | ||
| type: "uint256", | ||
| }, | ||
| { | ||
| internalType: "uint256", | ||
| name: "to", | ||
| type: "uint256", | ||
| }, | ||
| { | ||
| internalType: "uint256", | ||
| name: "gasLimit", | ||
| type: "uint256", | ||
| }, | ||
| { | ||
| internalType: "uint256", | ||
| name: "gasPerPubdataByteLimit", | ||
| type: "uint256", | ||
| }, | ||
| { | ||
| internalType: "uint256", | ||
| name: "maxFeePerGas", | ||
| type: "uint256", | ||
| }, | ||
| { | ||
| internalType: "uint256", | ||
| name: "maxPriorityFeePerGas", | ||
| type: "uint256", | ||
| }, | ||
| { | ||
| internalType: "uint256", | ||
| name: "paymaster", | ||
| type: "uint256", | ||
| }, | ||
| { | ||
| internalType: "uint256", | ||
| name: "nonce", | ||
| type: "uint256", | ||
| }, | ||
| { | ||
| internalType: "uint256", | ||
| name: "value", | ||
| type: "uint256", | ||
| }, | ||
| { | ||
| internalType: "uint256[4]", | ||
| name: "reserved", | ||
| type: "uint256[4]", | ||
| }, | ||
| { | ||
| internalType: "bytes", | ||
| name: "data", | ||
| type: "bytes", | ||
| }, | ||
| { | ||
| internalType: "bytes", | ||
| name: "signature", | ||
| type: "bytes", | ||
| }, | ||
| { | ||
| internalType: "bytes32[]", | ||
| name: "factoryDeps", | ||
| type: "bytes32[]", | ||
| }, | ||
| { | ||
| internalType: "bytes", | ||
| name: "paymasterInput", | ||
| type: "bytes", | ||
| }, | ||
| { | ||
| internalType: "bytes", | ||
| name: "reservedDynamic", | ||
| type: "bytes", | ||
| }, | ||
| ], | ||
| internalType: "struct Transaction", | ||
| name: "transaction", | ||
| type: "tuple", | ||
| }, | ||
| ], | ||
| name: "validateTransaction", | ||
| outputs: [ | ||
| { | ||
| internalType: "bool", | ||
| name: "", | ||
| type: "bool", | ||
| }, | ||
| ], | ||
| stateMutability: "view", | ||
| type: "function", | ||
| }, | ||
| { | ||
| inputs: [], | ||
| name: "verifier", | ||
| outputs: [ | ||
| { | ||
| internalType: "address", | ||
| name: "", | ||
| type: "address", | ||
| }, | ||
| ], | ||
| stateMutability: "view", | ||
| type: "function", | ||
| }, | ||
| ] as const; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| export { FactoryAbi } from "./Factory.js"; | ||
| export { GuardianRecoveryModuleAbi } from "./GuardianRecoveryModule.js"; | ||
| export { OidcRecoveryModuleAbi } from "./OidcRecoveryModule.js"; | ||
| export { SessionKeyModuleAbi } from "./SessionKeyModule.js"; | ||
| export { WebAuthModuleAbi } from "./WebAuthModule.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to ask about using the paymaster for these txs.