Skip to content

Commit 3f098f3

Browse files
committed
fix(rbac-registration): change box to arc
Signed-off-by: bkioshn <[email protected]>
1 parent d5a3e79 commit 3f098f3

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

rust/rbac-registration/src/cardano/cip509/types/cert_or_pk.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! C509 certificate, X509 certificate, or public key.
22
3+
use std::sync::Arc;
4+
35
use c509_certificate::c509::C509;
46
use ed25519_dalek::VerifyingKey;
57
use x509_cert::Certificate as X509;
@@ -10,9 +12,9 @@ use crate::cardano::cip509::extract_key;
1012
#[derive(Debug, Clone)]
1113
pub enum CertOrPk {
1214
/// X509 certificate, None if deleted.
13-
X509(Option<Box<X509>>),
15+
X509(Option<Arc<X509>>),
1416
/// C509 certificate, None if deleted.
15-
C509(Option<Box<C509>>),
17+
C509(Option<Arc<C509>>),
1618
/// Public key, None if deleted.
1719
PublicKey(Option<VerifyingKey>),
1820
}

rust/rbac-registration/src/registration/cardano/update_rbac.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ pub(crate) fn update_signing_key(
192192
record.add_signing_key(CertOrPk::X509(None), point_tx_idx);
193193
},
194194
X509DerCert::X509Cert(c) => {
195-
record.add_signing_key(CertOrPk::X509(Some(c.clone())), point_tx_idx);
195+
record
196+
.add_signing_key(CertOrPk::X509(Some(c.clone().into())), point_tx_idx);
196197
},
197198
X509DerCert::Undefined => {},
198199
}
@@ -205,7 +206,8 @@ pub(crate) fn update_signing_key(
205206
record.add_signing_key(CertOrPk::C509(None), point_tx_idx);
206207
},
207208
C509Cert::C509Certificate(c) => {
208-
record.add_signing_key(CertOrPk::C509(Some(c.clone())), point_tx_idx);
209+
record
210+
.add_signing_key(CertOrPk::C509(Some(c.clone().into())), point_tx_idx);
209211
},
210212
C509Cert::Undefined | C509Cert::C509CertInMetadatumReference(_) => {},
211213
}
@@ -242,7 +244,10 @@ pub(crate) fn update_encryption_key(
242244
record.add_encryption_key(CertOrPk::X509(None), point_tx_idx);
243245
},
244246
X509DerCert::X509Cert(c) => {
245-
record.add_encryption_key(CertOrPk::X509(Some(c.clone())), point_tx_idx);
247+
record.add_encryption_key(
248+
CertOrPk::X509(Some(c.clone().into())),
249+
point_tx_idx,
250+
);
246251
},
247252
X509DerCert::Undefined => {},
248253
}
@@ -255,7 +260,10 @@ pub(crate) fn update_encryption_key(
255260
record.add_encryption_key(CertOrPk::C509(None), point_tx_idx);
256261
},
257262
C509Cert::C509Certificate(c) => {
258-
record.add_encryption_key(CertOrPk::C509(Some(c.clone())), point_tx_idx);
263+
record.add_encryption_key(
264+
CertOrPk::C509(Some(c.clone().into())),
265+
point_tx_idx,
266+
);
259267
},
260268
C509Cert::Undefined | C509Cert::C509CertInMetadatumReference(_) => {},
261269
}

0 commit comments

Comments
 (0)