From 1b4bd72cf215a7c851f882fcbea032e610ba5880 Mon Sep 17 00:00:00 2001 From: Derek Chiang Date: Fri, 20 Oct 2023 22:07:01 -0700 Subject: [PATCH] Remove outdated recovery doc --- README.md | 137 +----------------------------------------------------- 1 file changed, 1 insertion(+), 136 deletions(-) diff --git a/README.md b/README.md index 188fee01..16986c29 100644 --- a/README.md +++ b/README.md @@ -560,142 +560,7 @@ const sessionKeyProvider = await SessionKeyProvider.fromSessionKeyParams({ ### Recovery Key Validator -#### Enable the recovery plugin - -```ts -// 1. Get the default ecdsa validator provider -const ecdsaProvider = await ECDSAProvider.init({ - projectId, // zeroDev projectId - owner, -}); - -// 2. Initialize the Recovery Provider -const recoveryData = { - guardians: { - // Guardian addresses with their weights - [guardianAddress]: 1, - [guardian2Address]: 1, - [guardian3Address]: 1, - }, - threshold: 3, - delaySeconds: 0, -}; - -const recoveryProvider = await RecoveryProvider.init({ - projectId, - defaultProvider: ecdsaProvider, - opts: { - validatorConfig: { - ...recoveryData, - }, - }, -}); - -// 3. Enable the recovery plugin -const result = await recoveryProvider.enableRecovery(); -await recoveryProvider.waitForUserOperationTransaction(result.hash as Hex); -``` - -#### Initiate the recovery and retrieve the recoveryId - -```ts -// 1. Initialize the Recovery Provider -const recoveryProvider = await RecoveryProvider.init({ - projectId, - opts: { - accountConfig: { - accountAddress - } - } -}); - -// 2. Initiate the recovery -const recoveryId = await recoveryProvider.initiateRecovery(); -``` - -#### Share recoveryId with the guardians to sign recoveryHash - -```ts -// 1. Intialize the Recovery Provider for guardian -const guardian = - LocalAccountSigner.privateKeyToAccountSigner(); -const recoveryProvider = await RecoveryProvider.init({ - projectId, - recoveryId, - opts: { - validatorConfig: { - accountSigner: guardian, - }, - }, -}); - -// 2. Sign the recovery hash -await recoveryProvider.signRecovery(); -``` - -#### Submit the recovery request - -| Anybody can submit the recovery request if they have the recoveryId - -```ts -// 1. Initialize the recovery provider -const account = privateKeyToAccount(); -const recoveryProvider = await RecoveryProvider.init({ - projectId, - recoveryId, -}); - -// 2. Submit the recovery request -const result = await recoveryProvider.submitRecovery(); -await recoveryProvider.waitForUserOperationTransaction( - result.hash as Hex -); -``` - -#### Cancel the recovery request - -| Owner of the account can cancel the recovery request - -```ts -// 1. Get the default ecdsa validator provider -const ecdsaProvider = await ECDSAProvider.init({ - projectId, // zeroDev projectId - owner, -}); - -// 2. Initialize the Recovery Provider -const recoveryProvider = await RecoveryProvider.init({ - projectId, - defaultProvider: ecdsaProvider, - recoveryId, -}); - -// 3. Cancel the recovery -const result = await recoveryProvider.cancelRecovery(); -await recoveryProvider.waitForUserOperationTransaction(result.hash as Hex); -``` - -#### Disable the recovery plugin - -| To re-enable Recovery plugin with new recovery data (e.g. guardians, weights, threshold, delaySeconds), the existing enabled recovery plugin needs to be disabled first. - -```ts -// 1. Get the default ecdsa validator provider -const ecdsaProvider = await ECDSAProvider.init({ - projectId, // zeroDev projectId - owner, -}); - -// 2. Initialize the Recovery Provider -const recoveryProvider = await RecoveryProvider.init({ - projectId, - defaultProvider: ecdsaProvider, -}); - -// 3. Delete the recovery data -const result = await recoveryProvider.deleteRecoveryData(); -await recoveryProvider.waitForUserOperationTransaction(result.hash as Hex); -``` +[Please check out the recovery docs here](https://docs.zerodev.app/use-wallets/recovery) ## Components