Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion docs/use-wallets/zerodev-plugins/build-your-own-plugin.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 2
sidebar_position: 3
---

# Build your own plugin
Expand Down
39 changes: 39 additions & 0 deletions docs/use-wallets/zerodev-plugins/use-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
sidebar_position: 1
---

# Use Plugin

Using plugin will require user to have a `EIP4337PluginFallbck` as fallback module. This module can handle classic EIP4337's validateUserOp, and plugin based validateUserOp.

If plugin fallback is set, userOp with signature longer than 97 will automatically considered as plugin based userOp.

Signature of userOp is constructed as following

```
signature[0:20] = pluginAddress
signature[20:26] = validUntil
signature[26:32] = validAfter
signature[32:97] = user signed signature
signature[97:] = abi.encode(bytes pluginData, bytes pluginProof)
```

user will be required to sign the data using EIP712 with struct [`ValidateUserOpPlugin`](#ValidateUserOpPlugin)

By signing the signature, user should be noticed that they are delegating validation process to plugin, thus plugin can do anything with their wallet.

Also, it should be aware that `validUntil`, `validAfter` value should be tight enough to make user feel safe.

# Reference

## ValidateUserOpPlugin

```solidity
struct ValidateUserOpPlugin {
address sender;
uint48 validUntil;
uint48 validAfter;
address plugin;
bytes data;
}
```
23 changes: 21 additions & 2 deletions docs/use-wallets/zerodev-plugins/use-session-keys.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
---
sidebar_position: 1
sidebar_position: 2
---

# Use session keys

UPCOMING
If user approved a session key plugin, user will be allowing the "sessionKey" to sign userOp on their behalf.

userOp's signature will have `pluginData` and `pluginProof` appended to it.

`pluginData` will represent sessionKey that is used to sign the userOp.

`pluginProof` will represent the signature of the userOp signed by sessionKey.

sessionKey is required to sign the userOpHash and sessionNonce using EIP712 with struct [`Session`](#Session)

# Reference

## Session

```solidity
struct Session {
bytes32 userOpHash;
uint256 nonce;
}
```
Loading