Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b27e51c
Add Recover with Google button
matias-gonz Feb 13, 2025
084849b
Add GoogleFlow
matias-gonz Feb 13, 2025
c5b6c1c
Add useAddOidcAccount
matias-gonz Feb 13, 2025
1423b21
feat: add OidcValidator to account
matias-gonz Feb 15, 2025
3fdd925
Add OidcRecoveryModuleAbi
matias-gonz Feb 17, 2025
5f41a14
Add addOidcAccount to client
matias-gonz Feb 17, 2025
8e11bd9
Add addOidcAccount calldata
matias-gonz Feb 17, 2025
b5af9bd
Fix ABI
matias-gonz Feb 17, 2025
e79b884
fix: encodedOidcData
matias-gonz Feb 18, 2025
2b9842f
feat: add oidcData parameter
matias-gonz Feb 18, 2025
7551cdf
lint: sdk
matias-gonz Feb 18, 2025
6d2dac2
chore: lint oidc key registry server
matias-gonz Feb 18, 2025
5b0e1ca
chore: lint auth-server
matias-gonz Feb 18, 2025
06c6192
chore: lint md
matias-gonz Feb 18, 2025
6a771d7
chore: run prettier
matias-gonz Feb 18, 2025
6a98acb
chore: add keywords to cspell
matias-gonz Feb 18, 2025
206117c
chore: add keywords to cspell
matias-gonz Feb 18, 2025
9d437cb
chore: update lock file
matias-gonz Feb 18, 2025
4433331
chore: run prettier
matias-gonz Feb 18, 2025
2fbd1cb
chore: lint auth-server
matias-gonz Feb 18, 2025
c512462
chore: lint oidc key registry server
matias-gonz Feb 18, 2025
6bf49c6
fix: zeek nft
matias-gonz Feb 18, 2025
91870b0
fix: zeek nft
matias-gonz Feb 18, 2025
8810a43
Merge branch 'oidc/add-google-recovery-flow' of github.com:matter-lab…
matias-gonz Feb 18, 2025
3884e2a
Merge branch 'feat/oidc-account-recovery' of github.com:matter-labs/z…
matias-gonz Feb 19, 2025
1625942
Merge branch 'oidc/add-google-recovery-flow' of github.com:matter-lab…
matias-gonz Feb 19, 2025
749e76a
Merge branch 'feat/oidc-account-recovery' into oidc/sdk-google-recove…
matias-gonz Feb 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@
</template>

<script setup lang="ts">
import { useAddOidcAccount } from "~/composables/useAddOidcAccount";
import type { OidcData } from "zksync-sso/client";

const { addOidcAccount, isLoading } = useAddOidcAccount();
addOidcAccount();
import { useRecoveryOidc } from "~/composables/useRecoveryOidc";

const { addOidcAccount, isLoading } = useRecoveryOidc();
const oidcData = {
oidcDigest: "0xdeadbeef",
iss: "0xdeadbeef",
aud: "0xdeadbeef",
} as OidcData;
addOidcAccount(oidcData);

defineExpose({ isLoading });
</script>
23 changes: 23 additions & 0 deletions packages/auth-server/composables/useRecoveryOidc.ts
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,

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.

},
oidcData,
});
});

return {
addOidcAccount,
isLoading,
error,
};
};
11 changes: 6 additions & 5 deletions packages/auth-server/stores/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add it to the backlog

},
};

Expand Down
328 changes: 328 additions & 0 deletions packages/sdk/src/abi/OidcRecoveryModule.ts
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;
1 change: 1 addition & 0 deletions packages/sdk/src/abi/index.ts
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";
Loading
Loading