Skip to content

Commit

Permalink
Remove outdated recovery doc
Browse files Browse the repository at this point in the history
  • Loading branch information
derekchiang authored Oct 21, 2023
1 parent 900016f commit 1b4bd72
Showing 1 changed file with 1 addition and 136 deletions.
137 changes: 1 addition & 136 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(<NewOwnerAddress>);
```

#### Share recoveryId with the guardians to sign recoveryHash

```ts
// 1. Intialize the Recovery Provider for guardian
const guardian =
LocalAccountSigner.privateKeyToAccountSigner(<PrivateKey>);
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(<PrivateKey>);
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

Expand Down

0 comments on commit 1b4bd72

Please sign in to comment.