@@ -107,7 +107,7 @@ impl CatalystSignedDocument {
107107 & self . inner . signatures
108108 }
109109
110- /// Verify document signatures and `UUID`s .
110+ /// Verify document signatures.
111111 ///
112112 /// # Errors
113113 ///
@@ -117,100 +117,6 @@ 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-
150- let extra = self . doc_meta ( ) ;
151- if let Some ( doc_ref) = extra. doc_ref ( ) {
152- if !doc_ref. is_valid ( ) {
153- error_report. functional_validation (
154- & format ! ( "Document Reference {doc_ref:?} is invalid" ) ,
155- "During Document Reference UUID verification" ,
156- ) ;
157- }
158- }
159-
160- if let Some ( template) = extra. template ( ) {
161- if !template. is_valid ( ) {
162- error_report. functional_validation (
163- & format ! ( "Document Template {template:?} is invalid" ) ,
164- "During Document Template UUID verification" ,
165- ) ;
166- }
167- }
168-
169- if let Some ( reply) = extra. reply ( ) {
170- if !reply. is_valid ( ) {
171- error_report. functional_validation (
172- & format ! ( "Document Reply {reply:?} is invalid" ) ,
173- "During Document Reply UUID verification" ,
174- ) ;
175- }
176- }
177-
178- if let Some ( brand_id) = extra. brand_id ( ) {
179- if !brand_id. is_valid ( ) {
180- error_report. functional_validation (
181- & format ! ( "Document Brand ID {brand_id:?} is invalid" ) ,
182- "During Document Brand ID UUID verification" ,
183- ) ;
184- }
185- }
186-
187- if let Some ( campaign_id) = extra. campaign_id ( ) {
188- if !campaign_id. is_valid ( ) {
189- error_report. functional_validation (
190- & format ! ( "Document Campaign ID {campaign_id:?} is invalid" ) ,
191- "During Document Campaign ID UUID verification" ,
192- ) ;
193- }
194- }
195-
196- if let Some ( election_id) = extra. election_id ( ) {
197- if !election_id. is_valid ( ) {
198- error_report. functional_validation (
199- & format ! ( "Document Election ID {election_id:?} is invalid" ) ,
200- "During Document Election ID UUID verification" ,
201- ) ;
202- }
203- }
204-
205- if let Some ( category_id) = extra. category_id ( ) {
206- if !category_id. is_valid ( ) {
207- error_report. functional_validation (
208- & format ! ( "Document Category ID {category_id:?} is invalid" ) ,
209- "During Document Category ID UUID verification" ,
210- ) ;
211- }
212- }
213-
214120 match self . as_cose_sign ( ) {
215121 Ok ( cose_sign) => {
216122 let signatures = self . signatures ( ) . cose_signatures ( ) ;
@@ -262,12 +168,11 @@ impl CatalystSignedDocument {
262168 /// Returns a signed document `Builder` pre-loaded with the current signed document's
263169 /// data.
264170 #[ must_use]
265- pub fn as_signed_doc_builder ( & self ) -> Builder {
266- Builder {
267- metadata : Some ( self . inner . metadata . clone ( ) ) ,
268- content : Some ( self . inner . content . decoded_bytes ( ) . to_vec ( ) ) ,
269- signatures : self . inner . signatures . clone ( ) ,
270- }
171+ pub fn into_builder ( self ) -> Builder {
172+ Builder :: new ( )
173+ . with_metadata ( self . inner . metadata . clone ( ) )
174+ . with_decoded_content ( self . inner . content . decoded_bytes ( ) . to_vec ( ) )
175+ . with_signatures ( self . inner . signatures . clone ( ) )
271176 }
272177
273178 /// Convert Catalyst Signed Document into `coset::CoseSign`
0 commit comments