diff --git a/packages/lexicon/schemas/item.json b/packages/lexicon/schemas/item.json index 45b8129..ea057f9 100644 --- a/packages/lexicon/schemas/item.json +++ b/packages/lexicon/schemas/item.json @@ -1,26 +1,11 @@ { "version": 1, "id": "app.cistern.lexicon.item", - "description": "An encrypted value meant to be accessed and deleted later.", + "description": "An encrypted memo intended to be accessed and deleted later.", "defs": { - "encryptedField": { - "type": "object", - "description": "An inline-encrypted property", - "required": ["value", "nonce"], - "properties": { - "value": { - "type": "string", - "description": "Encrypted field value" - }, - "nonce": { - "type": "string", - "description": "Nonce used to encrypt field value" - } - } - }, "main": { "type": "record", - "description": "A manifest representing an encrypted note or binary file", + "description": "An encrypted memo", "record": { "type": "object", "required": [ @@ -29,8 +14,9 @@ "nonce", "algorithm", "pubkey", - "chunks", - "metadata" + "payload", + "contentLength", + "contentHash" ], "properties": { "tid": { @@ -40,12 +26,13 @@ } "ciphertext": { "type": "string", - "description": "Encapsulated shared ciphertext" + "description": "Encapsulated shared ciphertext", + "maxLength": 2000 }, "nonce": { "type": "string", - "description": "Nonce used for content encryption", - "maxLength": 64, + "description": "Base64-encoded nonce used for content encryption", + "maxLength": 32, }, "algorithm": { "type": "string", @@ -57,42 +44,17 @@ "description": "URI to the public key used to encrypt this item", "format": "at-uri" }, - "chunks": { - "type": "array", - "description": "Encrypted blobs that compose the encrypted contents of the item" - "items": { - "type": "blob", - "accept": "application/octet-stream", - "maxSize": 50000000 - }, - "minLength": 1 + "payload": { + "type": "string", + "description": "Base64-encoded encrypted item contents" }, - "metadata": { - "type": "object", - "description": "Information about the encrypted content.", - "required": ["format", "length", "hash"], - "properties": { - "format": { - "type": "string", - "description": "Original contents format", - "knownValues": ["text", "file"] - }, - "length": { - "type": "ref", - "description": "Original content length in bytes", - "ref": "app.cistern.lexicon.item#encryptedField" - }, - "hash": { - "type": "string", - "description": "SHA-256 hash of the original file", - "maxLength": 64, - }, - "mimetype": { - "type": "ref", - "description": "Mimetype of original contents, if a file", - "ref": "app.cistern.lexicon.item#encryptedField" - } - } + "contentLength": { + "type": "integer", + "description": "Original content length in bytes", + }, + "contentHash": { + "type": "string", + "description": "Base64-encoded hash of the decrypted contents. Verify this before accepting the decrypted message. The algorithm is identified under `algorithm`" } } }