@@ -117,6 +117,36 @@ impl CatalystSignedDocument {
117117 where P : Fn ( & KidUri ) -> VerifyingKey {
118118 let error_report = ProblemReport :: new ( "Catalyst Signed Document Verification" ) ;
119119
120+ if !self . doc_type ( ) . is_valid ( ) {
121+ error_report. functional_validation (
122+ & format ! ( "{} is invalid UUIDv4" , self . doc_type( ) ) ,
123+ "During Document Type UUID verification" ,
124+ ) ;
125+ }
126+
127+ let doc_id = self . doc_id ( ) ;
128+ if !doc_id. is_valid ( ) {
129+ error_report. functional_validation (
130+ & format ! ( "{doc_id} is invalid UUIDv7" ) ,
131+ "During Document ID UUID verification" ,
132+ ) ;
133+ }
134+
135+ let doc_ver = self . doc_ver ( ) ;
136+ if !doc_ver. is_valid ( ) {
137+ error_report. functional_validation (
138+ & format ! ( "{doc_ver} is invalid UUIDv7" ) ,
139+ "During Document Version UUID verification" ,
140+ ) ;
141+ }
142+
143+ if doc_id. is_valid ( ) && doc_ver. is_valid ( ) && doc_ver < doc_id {
144+ error_report. functional_validation (
145+ & format ! ( "Document Version {doc_ver} is smaller than Document Id {doc_id}" ) ,
146+ "During Document Version UUID verification" ,
147+ ) ;
148+ }
149+
120150 match self . as_cose_sign ( ) {
121151 Ok ( cose_sign) => {
122152 let signatures = self . signatures ( ) . cose_signatures ( ) ;
0 commit comments