Skip to content

Commit f1303dc

Browse files
committed
fix(rust): Remove role and rotation from new as we should use with_role and with_rotation to set them.
1 parent 74d6fb5 commit f1303dc

File tree

1 file changed

+9
-9
lines changed
  • rust/catalyst-types/src/id_uri

1 file changed

+9
-9
lines changed

rust/catalyst-types/src/id_uri/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,17 @@ impl IdUri {
112112

113113
/// Create a new `IdUri` for a Signing Key
114114
#[must_use]
115-
pub fn new(
116-
network: &str, subnet: Option<&str>, role0_pk: VerifyingKey, role: RoleIndex,
117-
rotation: KeyRotation,
118-
) -> Self {
115+
pub fn new(network: &str, subnet: Option<&str>, role0_pk: VerifyingKey) -> Self {
119116
Self {
120117
username: None, // Default to Not set, use `with_username` if required.
121118
nonce: None, // Default to Not set, use `with_nonce` if required.
122119
network: network.to_string(),
123120
subnet: subnet.map(str::to_string),
124121
role0_pk,
125-
role,
126-
rotation,
127-
encryption: false,
128-
id: false, // Default to `URI` formatted.
122+
role: RoleIndex::default(), // Defaulted, use `with_role()` to change it.
123+
rotation: KeyRotation::default(), // Defaulted, use `with_rotation()` to change it.
124+
encryption: false, // Defaulted, use `with_encryption()` to change it.
125+
id: false, // Default to `URI` formatted.
129126
}
130127
}
131128

@@ -395,7 +392,10 @@ impl FromStr for IdUri {
395392
};
396393

397394
let cat_id = {
398-
let mut cat_id = Self::new(network, subnet, role0_pk, role_index, rotation);
395+
let mut cat_id = Self::new(network, subnet, role0_pk)
396+
.with_role(role_index)
397+
.with_rotation(rotation);
398+
399399
if uri.has_fragment() {
400400
if uri.fragment() == Some(Self::ENCRYPTION_FRAGMENT) {
401401
cat_id = cat_id.with_encryption();

0 commit comments

Comments
 (0)