@@ -25,19 +25,15 @@ use crate::{
25
25
fabric:: FabricMgr ,
26
26
interaction_model:: InteractionModel ,
27
27
mdns:: Mdns ,
28
- secure_channel:: core:: SecureChannel ,
28
+ secure_channel:: { core:: SecureChannel , pake :: PaseMgr , spake2p :: VerifierData } ,
29
29
transport,
30
30
} ;
31
31
use std:: sync:: Arc ;
32
32
33
- #[ derive( Default ) ]
34
33
/// Device Commissioning Data
35
34
pub struct CommissioningData {
36
- /// The commissioning salt
37
- pub salt : [ u8 ; 16 ] ,
38
- /// The password for commissioning the device
39
- // TODO: We should replace this with verifier instead of password
40
- pub passwd : u32 ,
35
+ /// The data like password or verifier that is required to authenticate
36
+ pub verifier : VerifierData ,
41
37
/// The 12-bit discriminator used to differentiate between multiple devices
42
38
pub discriminator : u16 ,
43
39
}
@@ -57,17 +53,19 @@ impl Matter {
57
53
/// requires a set of device attestation certificates and keys. It is the responsibility of
58
54
/// this object to return the device attestation details when queried upon.
59
55
pub fn new (
60
- dev_det : & BasicInfoConfig ,
56
+ dev_det : BasicInfoConfig ,
61
57
dev_att : Box < dyn DevAttDataFetcher > ,
62
- dev_comm : & CommissioningData ,
58
+ dev_comm : CommissioningData ,
63
59
) -> Result < Box < Matter > , Error > {
64
60
let mdns = Mdns :: get ( ) ?;
65
- mdns. set_values ( dev_det. vid , dev_det. pid , dev_comm . discriminator ) ;
61
+ mdns. set_values ( dev_det. vid , dev_det. pid ) ;
66
62
67
63
let fabric_mgr = Arc :: new ( FabricMgr :: new ( ) ?) ;
68
64
let acl_mgr = Arc :: new ( AclMgr :: new ( ) ?) ;
65
+ let mut pase = PaseMgr :: new ( ) ;
69
66
let open_comm_window = fabric_mgr. is_empty ( ) ;
70
- let data_model = DataModel :: new ( dev_det, dev_att, fabric_mgr. clone ( ) , acl_mgr) ?;
67
+ let data_model =
68
+ DataModel :: new ( dev_det, dev_att, fabric_mgr. clone ( ) , acl_mgr, pase. clone ( ) ) ?;
71
69
let mut matter = Box :: new ( Matter {
72
70
transport_mgr : transport:: mgr:: Mgr :: new ( ) ?,
73
71
data_model,
@@ -76,11 +74,12 @@ impl Matter {
76
74
let interaction_model =
77
75
Box :: new ( InteractionModel :: new ( Box :: new ( matter. data_model . clone ( ) ) ) ) ;
78
76
matter. transport_mgr . register_protocol ( interaction_model) ?;
79
- let mut secure_channel = Box :: new ( SecureChannel :: new ( matter . fabric_mgr . clone ( ) ) ) ;
77
+
80
78
if open_comm_window {
81
- secure_channel . open_comm_window ( & dev_comm. salt , dev_comm. passwd ) ?;
79
+ pase . enable_pase_session ( dev_comm. verifier , dev_comm. discriminator ) ?;
82
80
}
83
81
82
+ let secure_channel = Box :: new ( SecureChannel :: new ( pase, matter. fabric_mgr . clone ( ) ) ) ;
84
83
matter. transport_mgr . register_protocol ( secure_channel) ?;
85
84
Ok ( matter)
86
85
}
0 commit comments