@@ -9,6 +9,7 @@ import { XMLDocument } from "../../parser";
99import { generateQR } from "../qr" ;
1010import defaultUBLExtensions from "../templates/ubl_sign_extension_template" ;
1111import defaultUBLExtensionsSignedProperties , { defaultUBLExtensionsSignedPropertiesForSigning } from "../templates/ubl_extension_signed_properties_template" ;
12+ import { log } from "../../logger" ;
1213
1314/**
1415 * Removes (UBLExtensions (Signing), Signature Envelope, and QR data) Elements. Then canonicalizes the XML to c14n.
@@ -149,15 +150,15 @@ export const generateSignedXMLString = ({invoice_xml, certificate_string, privat
149150
150151 // 1: Invoice Hash
151152 const invoice_hash = getInvoiceHash ( invoice_xml ) ;
152- console . log ( "Invoice hash: " , invoice_hash ) ;
153+ log ( "Info" , "Signer" , ` Invoice hash: ${ invoice_hash } ` ) ;
153154
154155 // 2: Certificate hash and certificate info
155156 const cert_info = getCertificateInfo ( certificate_string ) ;
156- console . log ( "Certificate info: " , cert_info ) ;
157+ log ( "Info" , "Signer" , ` Certificate info: ${ JSON . stringify ( cert_info ) } ` ) ;
157158
158159 // 3: Digital Certificate
159160 const digital_signature = createInvoiceDigitalSignature ( invoice_hash , private_key_string ) ;
160- console . log ( "Digital signature: " , digital_signature ) ;
161+ log ( "Info" , "Signer" , ` Digital signature: ${ digital_signature } ` ) ;
161162
162163 // 4: QR
163164 const qr = generateQR ( {
@@ -166,7 +167,7 @@ export const generateSignedXMLString = ({invoice_xml, certificate_string, privat
166167 public_key : cert_info . public_key ,
167168 certificate_signature : cert_info . signature
168169 } ) ;
169- console . log ( "QR: " , qr ) ;
170+ log ( "Info" , "Signer" , `QR: ${ qr } ` ) ;
170171
171172
172173 // Set Signed properties
@@ -183,7 +184,7 @@ export const generateSignedXMLString = ({invoice_xml, certificate_string, privat
183184 const signed_properties_bytes = Buffer . from ( ubl_signature_signed_properties_xml_string_for_signing ) ;
184185 let signed_properties_hash = createHash ( "sha256" ) . update ( signed_properties_bytes ) . digest ( 'hex' ) ;
185186 signed_properties_hash = Buffer . from ( signed_properties_hash ) . toString ( "base64" ) ;
186- console . log ( "Signed properites hash: " , signed_properties_hash ) ;
187+ log ( "Info" , "Signer" , ` Signed properites hash: ${ signed_properties_hash } ` ) ;
187188
188189 // UBL Extensions
189190 let ubl_signature_xml_string = defaultUBLExtensions (
0 commit comments