Secret remove pub properties #782

Merged
asmogo merged 8 commits from secret_remove_pub into main 2025-06-05 11:25:57 +00:00
asmogo commented 2025-06-02 21:46:12 +00:00 (Migrated from github.com)

Description

ref #606


Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

### Description ref #606 ----- ### Notes to the reviewers <!-- In this section you can include notes directed to the reviewers, like explaining why some parts of the PR were done in a specific way --> ----- ### Suggested [CHANGELOG](https://github.com/cashubtc/cdk/blob/main/CHANGELOG.md) Updates <!-- Please do not edit the actual changelog but note what you changed here. --> #### CHANGED #### ADDED #### REMOVED #### FIXED ---- ### Checklist * [ ] I followed the [code style guidelines](https://github.com/cashubtc/cdk/blob/main/CODE_STYLE.md) * [ ] I ran `just final-check` before committing
thesimplekid (Migrated from github.com) reviewed 2025-06-04 12:26:02 +00:00
@ -34,21 +34,53 @@ pub enum Kind {
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
thesimplekid (Migrated from github.com) commented 2025-06-04 12:24:36 +00:00
impl SecretData {
    /// Create new [`SecretData`]
    pub fn new<S, V>(data: S, tags: Option<V>) -> Self
    where
        S: Into<String>,
        V: Into<Vec<Vec<String>>>,
{
    let nonce = crate::secret::Secret::generate().to_string();
    
    Self {
            nonce,
            data: data.into(),
            tags: tags.map(|v| v.into()),
    }
}

I think it makes sense to add a new fn on SecretData and then we can call that from Secret::new instead of generating the nonce there.

```suggestion impl SecretData { /// Create new [`SecretData`] pub fn new<S, V>(data: S, tags: Option<V>) -> Self where S: Into<String>, V: Into<Vec<Vec<String>>>, { let nonce = crate::secret::Secret::generate().to_string(); Self { nonce, data: data.into(), tags: tags.map(|v| v.into()), } } ``` I think it makes sense to add a new fn on `SecretData` and then we can call that from `Secret::new` instead of generating the nonce there.
thesimplekid (Migrated from github.com) approved these changes 2025-06-05 11:25:29 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/cdk!782
No description provided.