Skip to content

Add Storable Helper Object #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vss-client"
version = "0.1.0"
version = "0.1.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would generally prefer to have releases in separate PRs. Also, do we want to start a CHANGELOG to mention what was included in each release?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

releases in separate PRs.

This is just a patch release, there are no users, i don't think it makes any difference and is unnecessary.

I don't think CHANGELOG is required until we have an alpha or rc release.
Everything is part of vss-client core functionality. It is equivalent to overwriting 0.1.0, but sadly cargo doesn't allow that.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a patch release, there are no users, i don't think it makes any difference and is unnecessary.

I don't think CHANGELOG is required until we have an alpha or rc release. Everything is part of vss-client core functionality. It is equivalent to overwriting 0.1.0, but sadly cargo doesn't allow that.

Yeah, we can have a more formal process then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think CHANGELOG is required until we have an alpha or rc release. Everything is part of vss-client core functionality. It is equivalent to overwriting 0.1.0, but sadly cargo doesn't allow that.

SGTM

license = "MIT OR Apache-2.0"
edition = "2021"
homepage = "https://lightningdevkit.org/"
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn main() {
#[cfg(feature = "genproto")]
fn generate_protos() {
download_file(
"https://raw.githubusercontent.com/lightningdevkit/vss-server/62e888e1bd3305d23b15da857edffaf527163048/app/src/main/proto/vss.proto",
"https://raw.githubusercontent.com/lightningdevkit/vss-server/cb1159c3b1835c66a857b25b114f15d18d2a4297/app/src/main/proto/vss.proto",
"src/proto/vss.proto",
).unwrap();

Expand Down
49 changes: 47 additions & 2 deletions src/types.rs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated nit: double the in docs of GetObjectRequest (line 15).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is auto-generated code, on top of that this comment is unrelated to added change, will resolve this in next PR of server side.
lets not block this one for this.
Otherwise we keep going back-and-forth on same thing and this gets auto-generated code takes 3-4 days to merge.

Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,56 @@ pub struct KeyValue {
#[prost(int64, tag = "2")]
pub version: i64,
/// Object value in bytes which is stored (in put) and fetched (in get).
/// Clients must encrypt this blob client-side before sending it over the wire to server in order
/// to preserve privacy and security.
/// Clients must encrypt the secret contents of this blob client-side before sending it over the
/// wire to the server in order to preserve privacy and security.
/// Clients may use a `Storable` object, serialize it and set it here.
#[prost(bytes = "vec", tag = "3")]
pub value: ::prost::alloc::vec::Vec<u8>,
}
/// Represents a storable object that can be serialized and stored as `value` in `PutObjectRequest`.
/// Only provided as a helper object for ease of use by clients.
/// Clients MUST encrypt the `PlaintextBlob` before using it as `data` in `Storable`.
/// The server does not use or read anything from `Storable`, Clients may use its fields as
/// required.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Storable {
/// Represents an encrypted and serialized `PlaintextBlob`. MUST encrypt the whole `PlaintextBlob`
/// using client-side encryption before setting here.
#[prost(bytes = "vec", tag = "1")]
pub data: ::prost::alloc::vec::Vec<u8>,
/// Represents encryption related metadata
#[prost(message, optional, tag = "2")]
pub encryption_metadata: ::core::option::Option<EncryptionMetadata>,
}
/// Represents encryption related metadata
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EncryptionMetadata {
/// The encryption algorithm used for encrypting the `PlaintextBlob`.
#[prost(string, tag = "1")]
pub cipher_format: ::prost::alloc::string::String,
/// The nonce used for encryption. Nonce is a random or unique value used to ensure that the same
/// plaintext results in different ciphertexts every time it is encrypted.
#[prost(bytes = "vec", tag = "2")]
pub nonce: ::prost::alloc::vec::Vec<u8>,
/// The authentication tag used for encryption. It provides integrity and authenticity assurance
/// for the encrypted data.
#[prost(bytes = "vec", tag = "3")]
pub tag: ::prost::alloc::vec::Vec<u8>,
}
/// Represents a data blob, which is encrypted, serialized and later used in `Storable.data`.
/// Since the whole `Storable.data` is client-side encrypted, the server cannot understand this.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PlaintextBlob {
/// The unencrypted value.
#[prost(bytes = "vec", tag = "1")]
pub value: ::prost::alloc::vec::Vec<u8>,
/// The version of the value. Can be used by client to verify version integrity.
#[prost(int64, tag = "2")]
pub version: i64,
}
/// ErrorCodes to be used in `ErrorResponse`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: tick ErrorCode, also on lines 64, 89, 123.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is defining ErrorCode, as it is here, we should write either "Error codes" or "Codes" without ticks, IMO.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is auto-generated code, on top of that this comment is unrelated to added change, will resolve this in next PR of server side.
lets not block this one for this.
Otherwise we keep going back-and-forth on same thing and this gets auto-generated code takes 3-4 days to merge.

#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
Expand Down