Skip to content

Commit 8972816

Browse files
committed
Add Storable Helper Object
Motivation: Provides helper object for client to use, avoids some foot-guns in client-side encryption. Ensures easy backward compatibility, cross-language support and efficient serialization when dealing with long-lived storage objects.
1 parent 806371c commit 8972816

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

app/src/main/proto/vss.proto

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,48 @@ message KeyValue {
293293
int64 version = 2;
294294

295295
// Object value in bytes which is stored (in put) and fetched (in get).
296-
// Clients must encrypt this blob client-side before sending it over the wire to server in order
297-
// to preserve privacy and security.
296+
// Clients must encrypt the secret contents of this blob client-side before sending it over the
297+
// wire to the server in order to preserve privacy and security.
298+
// Clients may use a `Storable` object, serialize it and set it here.
298299
bytes value = 3;
299300
}
301+
302+
// Represents a storable object that can be serialized and stored as `value` in `PutObjectRequest`.
303+
// Only provided as a helper object for ease of use by clients.
304+
// Clients MUST encrypt the `PlaintextBlob` before using it as `data` in `Storable`.
305+
// The server does not use or read anything from `Storable`, Clients may use its fields as
306+
// required.
307+
message Storable {
308+
309+
// Represents an encrypted and serialized `PlaintextBlob`. MUST encrypt the whole `PlaintextBlob`
310+
// using client-side encryption before setting here.
311+
bytes data = 1;
312+
313+
// Represents encryption related metadata
314+
EncryptionMetadata encryption_metadata = 2;
315+
}
316+
317+
// Represents encryption related metadata
318+
message EncryptionMetadata {
319+
// The encryption algorithm used for encrypting the `PlaintextBlob`.
320+
string cipher_format = 1;
321+
322+
// The nonce used for encryption. Nonce is a random or unique value used to ensure that the same
323+
// plaintext results in different ciphertexts every time it is encrypted.
324+
bytes nonce = 2;
325+
326+
// The authentication tag used for encryption. It provides integrity and authenticity assurance
327+
// for the encrypted data.
328+
bytes tag = 3;
329+
}
330+
331+
// Represents a data blob, which is encrypted, serialized and later used in `Storable.data`.
332+
// Since the whole `Storable.data` is client-side encrypted, the server cannot understand this.
333+
message PlaintextBlob {
334+
335+
// The unencrypted value.
336+
bytes value = 1;
337+
338+
// The version of the value. Can be used by client to verify version integrity.
339+
int64 version = 2;
340+
}

0 commit comments

Comments
 (0)