Skip to content

Commit b333bad

Browse files
authored
refactor: change encryption structure and enhance security notes
Removed tokenGate field and updated encryption section with decryptionParams. Added security considerations for decryption parameters.
1 parent 892df0f commit b333bad

File tree

1 file changed

+40
-21
lines changed

1 file changed

+40
-21
lines changed

LSPs/LSP-29-EncryptedAssets.md

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,13 @@ The [VerifiableURI] stored in the array MUST point to a JSON file on IPFS confor
115115
"name": "<string>",
116116
"description": "<string>"
117117
},
118-
"tokenGate": {
119-
"tokenAddress": "<address>",
120-
"requiredBalance": "<string>"
121-
},
122118
"encryption": {
123119
"method": "<string>",
124120
"ciphertext": "<string>",
125121
"dataToEncryptHash": "<string>",
126122
"accessControlConditions": "<array>",
127-
"decryptionCode": "<string>"
123+
"decryptionCode": "<string>",
124+
"decryptionParams": "<object>"
128125
},
129126
"chunks": {
130127
"cids": "<array>",
@@ -144,7 +141,6 @@ The [VerifiableURI] stored in the array MUST point to a JSON file on IPFS confor
144141
| `revision` | number | Yes | Version number starting at 1, incremented for each update |
145142
| `createdAt` | string | Yes | ISO 8601 timestamp when this revision was created |
146143
| `file` | object | Yes | Metadata about the encrypted file |
147-
| `tokenGate` | object | Yes | Token requirements for decryption access |
148144
| `encryption` | object | Yes | Encryption metadata for decryption |
149145
| `chunks` | object | Yes | Chunked storage information |
150146

@@ -156,22 +152,29 @@ The [VerifiableURI] stored in the array MUST point to a JSON file on IPFS confor
156152
| `name` | string | Yes | Original filename |
157153
| `description` | string | No | Human-readable description of the content |
158154

159-
#### tokenGate
155+
#### encryption
160156

161-
| Key | Type | Required | Description |
162-
| ----------------- | ------- | -------- | ------------------------------------------------------------------- |
163-
| `tokenAddress` | address | Yes | Address of the token contract (LSP7 or LSP8) required for access |
164-
| `requiredBalance` | string | Yes | Minimum token balance required (as string for BigInt compatibility) |
157+
| Key | Type | Required | Description |
158+
| ------------------------- | ------ | -------- | ---------------------------------------------------------- |
159+
| `method` | string | Yes | Encryption method identifier (see supported methods below) |
160+
| `ciphertext` | string | Yes | Encrypted symmetric key |
161+
| `dataToEncryptHash` | string | Yes | Hash of the encrypted data for verification |
162+
| `accessControlConditions` | array | Yes | Conditions for decryption access |
163+
| `decryptionCode` | string | Yes | Code or reference for decryption logic |
164+
| `decryptionParams` | object | Yes | Dynamic parameters embedded in `decryptionCode` |
165165

166-
#### encryption
166+
The `decryptionParams` object contains the dynamic values that are hardcoded into the `decryptionCode`. This enables UI display and content filtering without parsing the decryption code. See [Decryption Parameters Security](#decryption-parameters-security) for important security considerations.
167167

168-
| Key | Type | Required | Description |
169-
| ------------------------- | ------ | -------- | -------------------------------------------------------- |
170-
| `method` | string | Yes | Encryption method identifier (e.g., `"lit-protocol-v1"`) |
171-
| `ciphertext` | string | Yes | Encrypted symmetric key |
172-
| `dataToEncryptHash` | string | Yes | Hash of the encrypted data for verification |
173-
| `accessControlConditions` | array | Yes | Conditions for decryption access |
174-
| `decryptionCode` | string | Yes | Code or reference for decryption logic |
168+
**Supported Encryption Methods:**
169+
170+
| Method | Description | Example `decryptionParams` |
171+
| ------------------------- | -------------------------------------- | -------------------------------------------------------------------------------------- |
172+
| `lit-lsp7-balance-v1` | LSP7 token balance via Lit Protocol | `{ "tokenAddress": "0x...", "requiredBalance": "1000000" }` |
173+
| `lit-lsp8-ownership-v1` | LSP8 NFT ownership via Lit Protocol | `{ "tokenAddress": "0x...", "requiredTokenId": "42" }` |
174+
| `lit-lsp8-balance-v1` | LSP8 balance via Lit Protocol | `{ "tokenAddress": "0x...", "requiredBalance": "1" }` |
175+
| `lit-lsp26-follower-v1` | LSP26 on-chain follower check | `{ "followedAddresses": ["0x...", "0x..."] }` |
176+
| `lit-social-followers-v1` | Off-chain social verification | `{ "platform": "twitter", "creatorHandle": "@creator", "requiredFollowers": "10000" }` |
177+
| `lit-time-locked-v1` | Time-lock via Lit Protocol | `{ "unlockTimestamp": "1735689600" }` |
175178

176179
#### chunks
177180

@@ -278,9 +281,25 @@ While the array is append-only at the application level, ERC725Y storage can tec
278281
- Consider timestamps when multiple versions exist
279282
- Be aware that "latest" mapping can be updated
280283

281-
### Token Gate Validation
284+
### Decryption Parameters Security
285+
286+
The `decryptionParams` field exists for UI/querying purposes and MUST match the hardcoded values in `decryptionCode`. Applications SHOULD:
287+
288+
- Verify `decryptionParams` values match those embedded in `decryptionCode` when possible
289+
- Display warnings to users if discrepancies are detected
290+
- Never rely solely on `decryptionParams` for access control enforcement
291+
- Treat `decryptionCode` as the authoritative source of truth
292+
293+
Actual access control MUST be enforced by the decryption mechanism (e.g., Lit Protocol access control conditions embedded in `decryptionCode`). Applications MUST NOT rely solely on the JSON `decryptionParams` field for security.
294+
295+
### Method Versioning
296+
297+
The `method` field includes a version suffix (e.g., `lit-lsp7-balance-v1`). When creating new encryption methods:
282298

283-
The `tokenGate` field in the JSON is for UI/querying purposes only. Actual access control MUST be enforced by the decryption mechanism (e.g., Lit Protocol access control conditions). Applications MUST NOT rely solely on the JSON `tokenGate` field for security.
299+
- Use unique, descriptive method identifiers
300+
- Include version suffix for future compatibility (e.g., `-v1`, `-v2`)
301+
- Document required `decryptionParams` schema for each method
302+
- Maintain backward compatibility when incrementing versions
284303

285304
### Content ID Collisions
286305

0 commit comments

Comments
 (0)