Skip to content

Commit 9c878f0

Browse files
authored
fix(rust/cardano-chain-follower): Update RBAC 509 API (#50)
* fix(rust/cardano-chain-follower): make KeyLocalRef fields public * feat(rust/cardano-chain-follower): make extract_cip19_hash public * fix(rust/cardano-chain-follower): code format
1 parent c0e5b96 commit 9c878f0

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

rust/cardano-chain-follower/src/metadata/cip509/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
// cspell: words pkix
66

77
pub mod rbac;
8+
pub mod utils;
89
pub mod x509_chunks;
910

1011
mod decode_helper;
11-
mod utils;
1212

1313
use std::sync::Arc;
1414

rust/cardano-chain-follower/src/metadata/cip509/rbac/role_data.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@ impl Decode<'_, ()> for KeyReference {
112112
#[derive(Debug, PartialEq, Clone)]
113113
pub struct KeyLocalRef {
114114
/// Local reference.
115-
local_ref: LocalRefInt,
115+
pub local_ref: LocalRefInt,
116116
/// Key offset.
117-
key_offset: u64,
117+
pub key_offset: u64,
118118
}
119119

120120
/// Enum of local reference with its associated unsigned integer value.
121121
#[derive(FromRepr, Debug, PartialEq, Clone)]
122122
#[repr(u8)]
123-
enum LocalRefInt {
123+
pub enum LocalRefInt {
124124
/// x509 certificates.
125125
X509Certs = Cip509RbacMetadataInt::X509Certs as u8, // 10
126126
/// c509 certificates.

rust/cardano-chain-follower/src/metadata/cip509/utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ use crate::witness::TxWitness;
77
/// Example input: `web+cardano://addr/<cip-19 address string>`
88
/// <https://github.com/cardano-foundation/CIPs/tree/6bae5165dde5d803778efa5e93bd408f3317ca03/CPS-0016>
99
/// URI = scheme ":" ["//" authority] path ["?" query] ["#" fragment]
10-
pub(crate) fn extract_cip19_hash(uri: &str, prefix: Option<&str>) -> Option<Vec<u8>> {
10+
#[must_use]
11+
pub fn extract_cip19_hash(uri: &str, prefix: Option<&str>) -> Option<Vec<u8>> {
1112
// Regex pattern to match the expected URI format
1213
let r = Regex::new("^.+://addr/(.+)$").ok()?;
1314

0 commit comments

Comments
 (0)