Skip to content

Commit

Permalink
fixup! refactor!: Pull Crypto trait to the high-level implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
chrysn committed Nov 15, 2023
1 parent 7d9be6e commit 180b8d1
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions examples/edhoc-rs-no_std/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ fn main() -> ! {

fn test_new_initiator() {
let state = Default::default();
let _initiator = EdhocInitiator::new(state, I, CRED_I, Some(CRED_R));
let _initiator = EdhocInitiator::new(
state,
edhoc_crypto::default_crypto(),
I,
CRED_I,
Some(CRED_R),
);
}

test_new_initiator();
Expand All @@ -94,7 +100,13 @@ fn main() -> ! {

fn test_prepare_message_1() {
let state = Default::default();
let mut initiator = EdhocInitiator::new(state, I, CRED_I, Some(CRED_R));
let mut initiator = EdhocInitiator::new(
state,
edhoc_crypto::default_crypto(),
I,
CRED_I,
Some(CRED_R),
);

let c_i: u8 = generate_connection_identifier_cbor().into();
let message_1 = initiator.prepare_message_1(c_i);
Expand All @@ -106,9 +118,21 @@ fn main() -> ! {

fn test_handshake() {
let state_initiator = Default::default();
let mut initiator = EdhocInitiator::new(state_initiator, I, CRED_I, Some(CRED_R));
let mut initiator = EdhocInitiator::new(
state_initiator,
edhoc_crypto::default_crypto(),
I,
CRED_I,
Some(CRED_R),
);
let state_responder = Default::default();
let responder = EdhocResponder::new(state_responder, R, CRED_R, Some(CRED_I));
let responder = EdhocResponder::new(
state_responder,
edhoc_crypto::default_crypto(),
R,
CRED_R,
Some(CRED_I),
);

let c_i: u8 = generate_connection_identifier_cbor().into();
let (initiator, message_1) = initiator.prepare_message_1(c_i).unwrap(); // to update the state
Expand Down

0 comments on commit 180b8d1

Please sign in to comment.