From 7ab68425cefe48bb24a7a88e4f24cb89a70fb110 Mon Sep 17 00:00:00 2001 From: b00ste Date: Mon, 16 Oct 2023 17:37:53 +0300 Subject: [PATCH] Add details about `AllowedERC725YDataKeys` --- docs/contracts/overview/KeyManager.md | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/contracts/overview/KeyManager.md b/docs/contracts/overview/KeyManager.md index 9a46025e76..92f98ce10f 100644 --- a/docs/contracts/overview/KeyManager.md +++ b/docs/contracts/overview/KeyManager.md @@ -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) \ No newline at end of file