Skip to content

Cot updates#1

Open
seqre wants to merge 11 commits intomainfrom
cot-updates
Open

Cot updates#1
seqre wants to merge 11 commits intomainfrom
cot-updates

Conversation

@seqre
Copy link
Member

@seqre seqre commented Mar 9, 2026

Local fork of secure-string to get it working for cot-rs/cot#328

@seqre seqre self-assigned this Mar 9, 2026
@seqre seqre marked this pull request as draft March 9, 2026 19:53
@seqre seqre marked this pull request as ready for review March 9, 2026 19:53
@seqre seqre requested a review from m4tx March 15, 2026 13:07
Copy link
Member

@m4tx m4tx left a comment

Choose a reason for hiding this comment

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

Please have a look at the comments, and fix the clippy problems.

#[derive(Eq, PartialEq, PartialOrd, Ord, Hash)]
pub struct SecureArray<T, const LENGTH: usize>
#[derive(Eq, PartialOrd, Ord, Hash)]
pub struct SecureArray<const LENGTH: usize>
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason for removing the T generic here? If we want to keep it this way, the name is misleading. This is not SecureArray anymore, but something more like SecureFixedByteBuffer now.

/// Be careful with `SecureVec::from`: if you have a borrowed string, it will be copied.
/// Use `SecureVec::new` if you have a `Vec<u8>`.
#[derive(Eq, PartialOrd, Ord, Hash)]
pub struct SecureVec {
Copy link
Member

Choose a reason for hiding this comment

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

Same question here, this is not SecureVec now. Please either change the name, or restore the generic parameter (feels like there's no real reason for removing the generic paramter, though)

unsafe {
std::str::from_utf8_unchecked_mut(self.0.unsecure_mut())
}
// TODO: fix
Copy link
Member

Choose a reason for hiding this comment

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

What's this TODO about?

impl<const LENGTH: usize> From<[u8; LENGTH]> for SecureArray<LENGTH>
where
T: Copy + Zeroize,
u8: Copy + Zeroize,
Copy link
Member

Choose a reason for hiding this comment

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

Where's this generic bound coming from? This is always true for u8 (to be honest, I would except to compiler to throw an error at this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants