Skip to content

Commit

Permalink
refactor(crypto): CRP-2596 rename VetKdArgs::encryption_key to encryp…
Browse files Browse the repository at this point in the history
…tion_public_key (#2789)

Renames `VetKdArgs::encryption_key` to
`VetKdArgs::encryption_public_key` to avoid confusions as to whether
this is the private or the public part of an asymmetric encryption key
pair and thus to make clear that this is not sensitive information.
  • Loading branch information
fspreiss authored Nov 25, 2024
1 parent 0067c23 commit 7d5f657
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions rs/types/types/src/crypto/vetkd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct VetKdArgs {
#[serde(with = "serde_bytes")]
pub derivation_id: Vec<u8>,
#[serde(with = "serde_bytes")]
pub encryption_key: Vec<u8>,
pub encryption_public_key: Vec<u8>,
}

impl fmt::Debug for VetKdArgs {
Expand All @@ -26,7 +26,10 @@ impl fmt::Debug for VetKdArgs {
.field("ni_dkg_id", &self.ni_dkg_id)
.field("derivation_path", &self.derivation_path)
.field("derivation_id", &HexEncoding::from(&self.derivation_id))
.field("encryption_key", &HexEncoding::from(&self.encryption_key))
.field(
"encryption_public_key",
&HexEncoding::from(&self.encryption_public_key),
)
.finish()
}
}
Expand Down
4 changes: 2 additions & 2 deletions rs/types/types/src/crypto/vetkd/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ mod display_and_debug {
derivation_path: vec![b"dp".to_vec()],
},
derivation_id: b"did".to_vec(),
encryption_key: b"ek".to_vec(),
encryption_public_key: b"ek".to_vec(),
};
let output = "VetKdArgs { \
ni_dkg_id: NiDkgId { start_block_height: 7, dealer_subnet: ot5wk-sbkaa-aaaaa-aaaap-yai, dkg_tag: HighThreshold, target_subnet: Remote(0x2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a) }, \
derivation_path: ExtendedDerivationPath { caller: 7xzs3-rqraa-aaaaa-aaaap-2ai, \
derivation_path: { 6470 } }, \
derivation_id: 0x646964, \
encryption_key: 0x656b \
encryption_public_key: 0x656b \
}"
.to_string();

Expand Down

0 comments on commit 7d5f657

Please sign in to comment.