Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ just stop # stop emulator
#### Run CLI with desktop USB PCSC NFC card reader

```
just run --help
just run -- --help
just run certs
just run read
```
Expand Down
2 changes: 1 addition & 1 deletion cktap-ffi/src/sats_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl SatsCard {
addr: card.addr.clone(),
pubkey,
card_ident: card.card_ident(),
auth_delay: card.auth_delay().map(|d| d as u8),
auth_delay: card.auth_delay(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion cktap-ffi/src/sats_chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl SatsChip {
.map(|p| p.iter().map(|&p| p as u64).collect()),
pubkey: card.pubkey().to_string(),
card_ident: card.card_ident(),
auth_delay: card.auth_delay().map(|d| d as u8),
auth_delay: card.auth_delay(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion cktap-ffi/src/tap_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl TapSigner {
num_backups: card.num_backups.unwrap_or_default() as u64,
pubkey: card.pubkey().to_string(),
card_ident: card.card_ident(),
auth_delay: card.auth_delay().map(|d| d as u8),
auth_delay: card.auth_delay(),
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/apdu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub struct StatusResponse {
/// normal operation begins. If the CVC value is incorrect, the 15-second delay between
/// attempts continues.
#[serde(default)]
pub auth_delay: Option<usize>,
pub auth_delay: Option<u8>,
}

impl ResponseApdu for StatusResponse {}
Expand Down Expand Up @@ -628,7 +628,7 @@ pub struct WaitResponse {
success: bool,
/// how much more delay is now required
#[serde(default)]
pub(crate) auth_delay: usize,
pub(crate) auth_delay: u8,
}

impl ResponseApdu for WaitResponse {}
Expand Down
8 changes: 4 additions & 4 deletions lib/src/sats_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub struct SatsCard {
pub addr: Option<String>,
pub pubkey: PublicKey,
pub card_nonce: [u8; 16],
pub auth_delay: Option<usize>,
pub auth_delay: Option<u8>,
}

impl Authentication for SatsCard {
Expand All @@ -56,11 +56,11 @@ impl Authentication for SatsCard {
self.card_nonce = new_nonce;
}

fn auth_delay(&self) -> &Option<usize> {
&self.auth_delay
fn auth_delay(&self) -> Option<u8> {
self.auth_delay
}

fn set_auth_delay(&mut self, auth_delay: Option<usize>) {
fn set_auth_delay(&mut self, auth_delay: Option<u8>) {
self.auth_delay = auth_delay;
}

Expand Down
8 changes: 4 additions & 4 deletions lib/src/sats_chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct SatsChip {
pub num_backups: Option<usize>,
pub pubkey: PublicKey,
pub card_nonce: [u8; 16],
pub auth_delay: Option<usize>,
pub auth_delay: Option<u8>,
}

impl Authentication for SatsChip {
Expand All @@ -52,11 +52,11 @@ impl Authentication for SatsChip {
self.card_nonce = new_nonce;
}

fn auth_delay(&self) -> &Option<usize> {
&self.auth_delay
fn auth_delay(&self) -> Option<u8> {
self.auth_delay
}

fn set_auth_delay(&mut self, auth_delay: Option<usize>) {
fn set_auth_delay(&mut self, auth_delay: Option<u8>) {
self.auth_delay = auth_delay;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ pub trait Authentication {
fn pubkey(&self) -> &PublicKey;
fn card_nonce(&self) -> &[u8; 16];
fn set_card_nonce(&mut self, new_nonce: [u8; 16]);
fn auth_delay(&self) -> &Option<usize>;
fn set_auth_delay(&mut self, auth_delay: Option<usize>);
fn auth_delay(&self) -> Option<u8>;
fn set_auth_delay(&mut self, auth_delay: Option<u8>);
fn transport(&self) -> Arc<dyn CkTransport>;
fn card_ident(&self) -> String {
card_pubkey_to_ident(self.pubkey())
Expand Down Expand Up @@ -244,7 +244,7 @@ pub trait Read: Authentication {

#[async_trait]
pub trait Wait: Authentication {
async fn wait(&mut self, cvc: Option<String>) -> Result<Option<usize>, CkTapError> {
async fn wait(&mut self, cvc: Option<String>) -> Result<Option<u8>, CkTapError> {
let epubkey_xcvc = cvc.map(|cvc| {
let (_, epubkey, xcvc) = self.calc_ekeys_xcvc(&cvc, WaitCommand::name());
(epubkey, xcvc)
Expand Down
8 changes: 4 additions & 4 deletions lib/src/tap_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct TapSigner {
pub num_backups: Option<usize>,
pub pubkey: PublicKey,
pub card_nonce: [u8; 16],
pub auth_delay: Option<usize>,
pub auth_delay: Option<u8>,
}

impl Authentication for TapSigner {
Expand All @@ -62,11 +62,11 @@ impl Authentication for TapSigner {
self.card_nonce = new_nonce;
}

fn auth_delay(&self) -> &Option<usize> {
&self.auth_delay
fn auth_delay(&self) -> Option<u8> {
self.auth_delay
}

fn set_auth_delay(&mut self, auth_delay: Option<usize>) {
fn set_auth_delay(&mut self, auth_delay: Option<u8>) {
self.auth_delay = auth_delay;
}

Expand Down
Loading