@@ -22,7 +22,6 @@ use catalyst_types::{
2222 uuid:: UuidV4 ,
2323} ;
2424use cbork_utils:: decode_helper:: { decode_bytes, decode_helper, decode_map_len} ;
25- use ed25519_dalek:: VerifyingKey ;
2625use minicbor:: {
2726 decode:: { self } ,
2827 Decode , Decoder ,
@@ -33,7 +32,6 @@ use uuid::Uuid;
3332
3433use crate :: cardano:: cip509:: {
3534 decode_context:: DecodeContext ,
36- extract_key,
3735 rbac:: Cip509RbacMetadata ,
3836 types:: { PaymentHistory , TxInputHash , ValidationSignature } ,
3937 utils:: Cip0134UriSet ,
@@ -42,7 +40,7 @@ use crate::cardano::cip509::{
4240 validate_txn_inputs_hash,
4341 } ,
4442 x509_chunks:: X509Chunks ,
45- C509Cert , LocalRefInt , Payment , PointTxnIdx , RoleData , SimplePublicKeyType , X509DerCert ,
43+ Payment , PointTxnIdx , RoleData ,
4644} ;
4745
4846/// A x509 metadata envelope.
@@ -229,46 +227,6 @@ impl Cip509 {
229227 self . metadata . as_ref ( ) . and_then ( |m| m. role_data . get ( & role) )
230228 }
231229
232- /// Returns signing public key for a role.
233- #[ must_use]
234- pub fn signing_pk_for_role (
235- & self ,
236- role : RoleId ,
237- ) -> Option < VerifyingKey > {
238- self . metadata . as_ref ( ) . and_then ( |m| {
239- let key_ref = m. role_data . get ( & role) . and_then ( |d| d. signing_key ( ) ) ?;
240- match key_ref. local_ref {
241- LocalRefInt :: X509Certs => {
242- m. x509_certs . get ( key_ref. key_offset ) . and_then ( |c| {
243- if let X509DerCert :: X509Cert ( c) = c {
244- extract_key:: x509_key ( & c) . ok ( )
245- } else {
246- None
247- }
248- } )
249- } ,
250- LocalRefInt :: C509Certs => {
251- m. c509_certs . get ( key_ref. key_offset ) . and_then ( |c| {
252- if let C509Cert :: C509Certificate ( c) = c {
253- extract_key:: c509_key ( & c) . ok ( )
254- } else {
255- None
256- }
257- } )
258- } ,
259- LocalRefInt :: PubKeys => {
260- m. pub_keys . get ( key_ref. key_offset ) . and_then ( |c| {
261- if let SimplePublicKeyType :: Ed25519 ( c) = c {
262- Some ( c. clone ( ) )
263- } else {
264- None
265- }
266- } )
267- } ,
268- }
269- } )
270- }
271-
272230 /// Returns a purpose of this registration.
273231 #[ must_use]
274232 pub fn purpose ( & self ) -> Option < UuidV4 > {
@@ -355,26 +313,10 @@ impl Cip509 {
355313 . unwrap_or_default ( )
356314 }
357315
358- /// Returns `Cip509` fields consuming the structure if it was successfully decoded and
359- /// validated otherwise return the problem report that contains all the encountered
360- /// issues.
361- ///
362- /// # Errors
363- ///
364- /// - `Err(ProblemReport)`
365- pub fn consume ( self ) -> Result < ( UuidV4 , Cip509RbacMetadata , PaymentHistory ) , ProblemReport > {
366- match (
367- self . purpose ,
368- self . txn_inputs_hash ,
369- self . metadata ,
370- self . validation_signature ,
371- ) {
372- ( Some ( purpose) , Some ( _) , Some ( metadata) , Some ( _) ) if !self . report . is_problematic ( ) => {
373- Ok ( ( purpose, metadata, self . payment_history ) )
374- } ,
375-
376- _ => Err ( self . report ) ,
377- }
316+ /// Returns a payment history map.
317+ #[ must_use]
318+ pub fn payment_history ( & self ) -> & PaymentHistory {
319+ & self . payment_history
378320 }
379321}
380322
0 commit comments