Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeonLewis committed Feb 27, 2024
1 parent d980a1c commit 80b4dc1
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ Users can create their zkAuth wallet based on their OAuth2 idToken.
- `chainId`: Chain ID
- Output
- `cfAddress`: Calculated AA wallet address
- `salt`: Salt to generate subHash. The saltSeed is `sub`
- `salt`: Salt to generate subHash. Note that the saltSeed is `sub` itself
- Save
- `ownerKey`: Save to user side (can't be saved to DB since it's non-custodial wallet)
- `cfAddress`: Save to DB or user side
- `saltSeed`: Save to DB or user side
- `sub`: Optionally save to DB or user side to reuse it in the future without re-login (e.g. to remove guardian)
- `sub (== saltSeed)`: Optionally save to DB or user side to reuse it in the future without re-login (e.g. to remove guardian)

```js
const signer = new ethers.Wallet(ownerKey, JsonRpcProvider);
Expand Down Expand Up @@ -84,23 +84,13 @@ Users can send transaction called `UserOp` with their zkAuth wallet. It requires
1. Prepare a RecoveryAccountAPI with appropriate signer and parameters
```js
// If the account hasn't been deployed yet, you need to manually set all the parameters
if (isPhantomWallet) {
param = {
subHash: subHash,
initialGuardianAddress: initGuardian,
initialOwnerAddress: initOwner,
chainIdOrZero: 0,
provider: getProvider(network.chainId),
entryPointAddress: Addresses.entryPointAddr,
};
} else {
param = {
scaAddr: cfAddress,
provider: getProvider(network.chainId),
entryPointAddress: Addresses.entryPointAddr,
};
}
// Assume that the wallet is already created and deployed
// If it hasn't been deployed yet, you need to fill `InitCodeParams` and `BaseApiParams` with the appropriate values
param = {
scaAddr: cfAddress,
provider: getProvider(network.chainId),
entryPointAddress: Addresses.entryPointAddr,
};
const scw = new RecoveryAccountAPI(signer, param, Addresses.oidcRecoveryFactoryV02Addr);
```

Expand Down Expand Up @@ -276,6 +266,10 @@ If user wallet is `ghost` wallet, user can't recover it, so delete it and create
guardian: guardians[idx],
proof: generateProof(jwks[idx].kid, proof.pi_a, proof.pi_b, proof.pi_c, proofAndPubSigs[idx].pubSignals),
};
// Note that subSigner is an optional signer which is owned by the service provider
// The subSigner sends transaction on behalf of the user to improve user experience
// Without subSigner, user needs to fund KLAY to the new owner address
await scw.requestRecover(newOwnerAddress, auth, subSigner);
}
...
Expand Down

0 comments on commit 80b4dc1

Please sign in to comment.