@@ -26,7 +26,7 @@ use bcr_ebill_core::{
2626 } ,
2727} ;
2828
29- use crate :: util:: validate_node_id_network;
29+ use crate :: { get_config , util:: validate_node_id_network} ;
3030
3131use super :: { BillAction , Result , error:: Error , service:: BillService } ;
3232
@@ -56,6 +56,14 @@ impl BillService {
5656 BillParticipant :: Ident ( _) => false ,
5757 } ;
5858
59+ let identity_proof = self
60+ . get_signer_identity_proof (
61+ signer_public_data,
62+ identity,
63+ & get_config ( ) . mint_config . default_mint_node_id ,
64+ )
65+ . await ?;
66+
5967 let block = match bill_action {
6068 // has to be ident to accept
6169 BillAction :: Accept => {
@@ -65,6 +73,11 @@ impl BillService {
6573 signatory : signing_keys. signatory_identity ,
6674 signing_timestamp : timestamp,
6775 signing_address : signer. postal_address . clone ( ) ,
76+ signer_identity_proof : identity_proof
77+ . ok_or ( Error :: Protocol (
78+ ProtocolValidationError :: NoSignerIdentityProof . into ( ) ,
79+ ) ) ?
80+ . into ( ) ,
6881 } ;
6982 // nothing to validate - all checked via type system
7083 BillBlock :: create_block_for_accept (
@@ -95,6 +108,11 @@ impl BillService {
95108 signatory : signing_keys. signatory_identity ,
96109 signing_timestamp : timestamp,
97110 signing_address : signer_public_data. postal_address ( ) ,
111+ signer_identity_proof : if holder_is_anon {
112+ None
113+ } else {
114+ identity_proof. map ( |sp| sp. into ( ) )
115+ } ,
98116 acceptance_deadline_timestamp : * acceptance_deadline_timestamp,
99117 } ;
100118 block_data. validate ( ) ?;
@@ -122,6 +140,11 @@ impl BillService {
122140 signatory : signing_keys. signatory_identity ,
123141 signing_timestamp : timestamp,
124142 signing_address : signer_public_data. postal_address ( ) ,
143+ signer_identity_proof : if holder_is_anon {
144+ None
145+ } else {
146+ identity_proof. map ( |sp| sp. into ( ) )
147+ } ,
125148 payment_deadline_timestamp : * payment_deadline_timestamp,
126149 } ;
127150 block_data. validate ( ) ?;
@@ -164,6 +187,11 @@ impl BillService {
164187 signatory : signing_keys. signatory_identity ,
165188 signing_timestamp : timestamp,
166189 signing_address : signer_public_data. postal_address ( ) ,
190+ signer_identity_proof : if holder_is_anon {
191+ None
192+ } else {
193+ identity_proof. map ( |sp| sp. into ( ) )
194+ } ,
167195 recourse_deadline_timestamp : * recourse_deadline_timestamp,
168196 } ;
169197 block_data. validate ( ) ?;
@@ -198,6 +226,11 @@ impl BillService {
198226 signatory : signing_keys. signatory_identity ,
199227 signing_timestamp : timestamp,
200228 signing_address : signer_public_data. postal_address ( ) ,
229+ signer_identity_proof : if holder_is_anon {
230+ None
231+ } else {
232+ identity_proof. map ( |sp| sp. into ( ) )
233+ } ,
201234 } ;
202235 block_data. validate ( ) ?;
203236 BillBlock :: create_block_for_recourse (
@@ -226,6 +259,11 @@ impl BillService {
226259 signatory : signing_keys. signatory_identity ,
227260 signing_timestamp : timestamp,
228261 signing_address : signer_public_data. postal_address ( ) ,
262+ signer_identity_proof : if holder_is_anon {
263+ None
264+ } else {
265+ identity_proof. map ( |sp| sp. into ( ) )
266+ } ,
229267 } ;
230268 block_data. validate ( ) ?;
231269 BillBlock :: create_block_for_mint (
@@ -259,6 +297,11 @@ impl BillService {
259297 signatory : signing_keys. signatory_identity ,
260298 signing_timestamp : timestamp,
261299 signing_address : signer_public_data. postal_address ( ) ,
300+ signer_identity_proof : if holder_is_anon {
301+ None
302+ } else {
303+ identity_proof. map ( |sp| sp. into ( ) )
304+ } ,
262305 buying_deadline_timestamp : * buying_deadline_timestamp,
263306 } ;
264307 block_data. validate ( ) ?;
@@ -289,6 +332,11 @@ impl BillService {
289332 signatory : signing_keys. signatory_identity ,
290333 signing_timestamp : timestamp,
291334 signing_address : signer_public_data. postal_address ( ) ,
335+ signer_identity_proof : if holder_is_anon {
336+ None
337+ } else {
338+ identity_proof. map ( |sp| sp. into ( ) )
339+ } ,
292340 } ;
293341 block_data. validate ( ) ?;
294342 BillBlock :: create_block_for_sell (
@@ -316,6 +364,11 @@ impl BillService {
316364 signatory : signing_keys. signatory_identity ,
317365 signing_timestamp : timestamp,
318366 signing_address : signer_public_data. postal_address ( ) ,
367+ signer_identity_proof : if holder_is_anon {
368+ None
369+ } else {
370+ identity_proof. map ( |sp| sp. into ( ) )
371+ } ,
319372 } ;
320373 block_data. validate ( ) ?;
321374 BillBlock :: create_block_for_endorse (
@@ -337,6 +390,11 @@ impl BillService {
337390 signatory : signing_keys. signatory_identity ,
338391 signing_timestamp : timestamp,
339392 signing_address : signer. postal_address . clone ( ) ,
393+ signer_identity_proof : identity_proof
394+ . ok_or ( Error :: Protocol (
395+ ProtocolValidationError :: NoSignerIdentityProof . into ( ) ,
396+ ) ) ?
397+ . into ( ) ,
340398 } ;
341399 // nothing to validate - all checked via type system
342400 BillBlock :: create_block_for_reject_to_accept (
@@ -367,6 +425,11 @@ impl BillService {
367425 signatory : signing_keys. signatory_identity ,
368426 signing_timestamp : timestamp,
369427 signing_address : signer_public_data. postal_address ( ) ,
428+ signer_identity_proof : if holder_is_anon {
429+ None
430+ } else {
431+ identity_proof. map ( |sp| sp. into ( ) )
432+ } ,
370433 } ;
371434 // nothing to validate - all checked via type system
372435 BillBlock :: create_block_for_reject_to_buy (
@@ -388,6 +451,11 @@ impl BillService {
388451 signatory : signing_keys. signatory_identity ,
389452 signing_timestamp : timestamp,
390453 signing_address : signer. postal_address . clone ( ) ,
454+ signer_identity_proof : identity_proof
455+ . ok_or ( Error :: Protocol (
456+ ProtocolValidationError :: NoSignerIdentityProof . into ( ) ,
457+ ) ) ?
458+ . into ( ) ,
391459 } ;
392460 // nothing to validate - all checked via type system
393461 BillBlock :: create_block_for_reject_to_pay (
@@ -414,6 +482,11 @@ impl BillService {
414482 signatory : signing_keys. signatory_identity ,
415483 signing_timestamp : timestamp,
416484 signing_address : signer. postal_address . clone ( ) ,
485+ signer_identity_proof : identity_proof
486+ . ok_or ( Error :: Protocol (
487+ ProtocolValidationError :: NoSignerIdentityProof . into ( ) ,
488+ ) ) ?
489+ . into ( ) ,
417490 } ;
418491 // nothing to validate - all checked via type system
419492 BillBlock :: create_block_for_reject_to_pay_recourse (
0 commit comments