Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
fd216b7
feat(sdk): refuse a private document type too small for its payload
QuantumExplorer Nov 7, 2026
63e3159
fix(sdk): check only the private types a contract update adds or chan…
QuantumExplorer Nov 7, 2026
839bfbe
feat(sdk): seal and open private document entries in the standard env…
QuantumExplorer Nov 7, 2026
e3e7707
fix(sdk): check private entry sizes on native wallet contract updates…
QuantumExplorer Nov 7, 2026
3d4d67d
Merge branch 'feat/private-document-minimum-entry-size' into feat/pri…
QuantumExplorer Nov 7, 2026
d130880
test(dpp): count a private type's integers at the width the contract …
QuantumExplorer Nov 7, 2026
450ffbd
Merge branch 'feat/private-document-minimum-entry-size' into feat/pri…
QuantumExplorer Nov 7, 2026
49473c9
fix(dpp): encode a private document payload whatever the version of t…
QuantumExplorer Nov 7, 2026
b0c97cf
fix(sdk): constant-time ECDH, readable old and empty-object payloads,…
QuantumExplorer Nov 7, 2026
fad9c53
fix(dpp): refuse a private payload whose objects hold bytes their mem…
QuantumExplorer Nov 7, 2026
e13eb1b
test(dpp): isolate a private payload's unread object bytes from the t…
QuantumExplorer Nov 7, 2026
94a400c
Merge remote-tracking branch 'origin/v5.1-dev' into feat/private-docu…
QuantumExplorer Nov 7, 2026
bcc9b6a
fix(sdk): build the envelope without getrandom, and check decoded val…
QuantumExplorer Nov 7, 2026
488066d
feat(sdk): verify a signed entry without a recipient key, and prepare…
QuantumExplorer Nov 8, 2026
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/rs-dpp/src/data_contract/document_type/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub use index_level::IndexLevelTypeInfo;
pub use index_level::IndexType;
pub(crate) use private_document::PRIVATE_DOCUMENT_TYPE_KEYWORDS;
pub use private_document::{
decode_private_document_payload, encode_private_document_payload,
largest_private_document_payload_size, minimum_private_document_entry_size,
validate_private_document_entry_size, PrivateDocumentConfig,
PRIVATE_DOCUMENT_ENVELOPE_V1_BODY_HEADER_BYTES, PRIVATE_DOCUMENT_ENVELOPE_V1_OVERHEAD_BYTES,
Expand Down
590 changes: 589 additions & 1 deletion packages/rs-dpp/src/data_contract/document_type/private_document.rs

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions packages/rs-dpp/src/document/v0/serialize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ impl DocumentPlatformSerializationMethodsV0 for DocumentV0 {
}
}

impl DocumentV0 {
/// This document in serialization format 3, whatever the version of its contract or of the
/// contract's config. A private document payload holds a type's properties as format 3
/// writes them (`encode_private_document_payload`), including for a type whose contract keeps
/// a version 0 config, whose documents [`DocumentPlatformConversionMethodsV0::serialize`]
/// writes in format 0. Format 3 writes each property at its type's width, and a version 0
/// config parses every integer as an `I64`, so the properties come out as format 0 writes
/// them too.
pub(crate) fn serialize_in_format_3(
&self,
document_type: DocumentTypeRef,
) -> Result<Vec<u8>, ProtocolError> {
DocumentV0::serialize_v3(self, document_type)
}
}

impl DocumentPlatformDeserializationMethodsV0 for DocumentV0 {
/// Format 0 β€” implementation in [`v0`].
fn from_bytes_v0(
Expand Down
7 changes: 5 additions & 2 deletions packages/rs-platform-encryption/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ description = "Cryptographic utilities for Dash Platform (DIP-15 DashPay encrypt
# doesn't pull in/compile all of dashcore. `secp256k1` is pinned to the same
# 0.33 dashcore re-exports, so the public `SecretKey`/`PublicKey` types unify
# with dashcore-typed callers (platform-wallet, rs-sdk-ffi).
secp256k1 = { version = "0.33.1", features = ["std"] }
secp256k1 = { version = "0.33.1", features = ["std", "recovery"] }
aes = "0.8"
cbc = "0.1"
# The envelope supplies its own seed and nonces, so no `getrandom`: standalone wasm32 builds
# without a JavaScript randomness backend still compile.
chacha20poly1305 = { version = "0.10", default-features = false, features = ["alloc"] }
hmac = "0.12"
sha2 = "0.10"
thiserror = "1.0"

[dev-dependencies]
# Tests generate keypairs via secp256k1's RNG helpers (`generate_keypair`,
# `secp256k1::rand`), gated behind the `rand` feature.
secp256k1 = { version = "0.33.1", features = ["std", "rand"] }
secp256k1 = { version = "0.33.1", features = ["std", "rand", "recovery"] }
10 changes: 10 additions & 0 deletions packages/rs-platform-encryption/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//! - [`account_label`] β€” `encryptedAccountLabel`.
//! - [`contact_info`] β€” `contactInfo` (`encToUserId` + `privateData`).
//! - [`account_reference`] β€” the masked `accountReference`.
//! - [`private_document_envelope`] β€” the standard private document envelope (version 1).
//! - [`error`] β€” the shared [`CryptoError`].
//!
//! Every public item is re-exported at the crate root, so the API is flat
Expand All @@ -22,6 +23,7 @@ mod compact_xpub;
mod contact_info;
mod ecdh;
mod error;
mod private_document_envelope;

pub use account_label::{decrypt_account_label, encrypt_account_label};
pub use account_reference::{
Expand All @@ -38,3 +40,11 @@ pub use contact_info::{
};
pub use ecdh::derive_shared_key_ecdh;
pub use error::CryptoError;
pub use private_document_envelope::{
open_private_document_entry, private_document_outgoing_viewing_key,
recover_sent_private_document_entry, seal_private_document_entry, OpenedPrivateDocumentEntry,
PrivateDocumentAuthMode, PrivateDocumentEnvelopeError, PrivateDocumentRecipient,
PrivateDocumentRecipientKeys, PrivateDocumentSender, PrivateDocumentTarget,
PRIVATE_DOCUMENT_ENVELOPE_BODY_HEADER_LEN, PRIVATE_DOCUMENT_ENVELOPE_OVERHEAD_LEN,
PRIVATE_DOCUMENT_ENVELOPE_VERSION, PRIVATE_DOCUMENT_ENVELOPE_WRAPPER_LEN,
};
Loading
Loading