Skip to content

Commit

Permalink
Merge pull request #680 from lukso-network/DEV-8625
Browse files Browse the repository at this point in the history
Add details about `AllowedERC725YDataKeys`
  • Loading branch information
CJ42 authored Oct 18, 2023
2 parents 7e7a833 + 88f87aa commit 6a5aa75
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/contracts/overview/KeyManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,36 @@ To illustrate, in the case of Universal Profile and the browser extension, you c

Afterwards, you can grant partial access to dApp and protocol (more specifically the smart contract addresses behind them), so that they can use your Universal Profile to interact on your behalf. This catalyze interactions on the blockchain, where your Universal Profile can do more and operate automatically in controlled manner, without requiring the main profile owner to have to do everything.

### Allowed ERC725Y Data Keys

:::note

If controller has `SETDATA` permission but has no `AllowedERC725YDataKeys`, controller will not be able to use the `SETDATA` permission at all.

:::

Key Manager allows for restricting controller addresses to change only specific or dynamic data keys. In order to achieve such functionallity one could encode a set of data keys to [`bytes[CompactBytesArray]`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md#bytescompactbytesarray), and store them under the [Allowed ERC725Y Data Keys](../../standards/universal-profile/lsp6-key-manager.md#allowed-erc725y-data-keys) data key.

#### Specific Data Keys

A _Specific Data Key_ must have the length of 32 bytes. Setting a _Specific Data Key_ in the [Allowed ERC725Y Data Keys](../../standards/universal-profile/lsp6-key-manager.md#allowed-erc725y-data-keys) will allow the controller to only modify the data value of that _Specific Data Key_.

#### Dynamic Data Keys

A _Dynamic Data Key_ can have any length between 0 and 32 (except 0 and 32). Setting a _Dynamic Data Key_ in the [Allowed ERC725Y Data Keys](../../standards/universal-profile/lsp6-key-manager.md#allowed-erc725y-data-keys) will allow the controller to modify the data value of any data key that starts exactly with that _Dynamic Data Key_.

Example:

Dynamic Data Key - `0xcafe0000cafe0000beef0000beef`

| Data key | Can modify data value? |
| :------------------------------------------------------------------ | :--------------------- |
| `0xcafe0000cafe0000beef0000beef000000000000000000000000000000000000`||
| `0xcafe0000cafe0000beef0000beef000000000000000000000000000000000123`||
| `0xcafe0000cafe0000beef0000beefcafecafecafecafecafecafecafecafecafe`||
| `0x0000000000000000000000000000cafecafecafecafecafecafecafecafecafe`||
| `0x000000000000000000000000000000000000cafe0000cafe0000beef0000beef`||

## Further Reading

- [The Bytecode episode #4 (Youtube) - overview of the Solidity code of the `LSP6KeyManagerCore.sol` by Jean Cavallera](https://www.youtube.com/watch?v=2Sm9LsCPjdE)

0 comments on commit 6a5aa75

Please sign in to comment.