Skip to content

Commit

Permalink
Merge pull request #433 from Foundation-Devices/SFT-2878-maximum-dens…
Browse files Browse the repository at this point in the history
…ity-qr-code-shrinks-on-fe

SFT-2878: maximum density qr code shrinks on fe
  • Loading branch information
mjg-foundation authored Dec 8, 2023
2 parents d5cc6a6 + f57ce25 commit 0731735
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
9 changes: 2 additions & 7 deletions extmod/foundation-rust/src/ur/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use minicbor::{Encode, Encoder};

use crate::ur::{
decoder::UR_DECODER_MAX_MESSAGE_LEN, registry::UR_Value, UR_MAX_TYPE,
UR_MIN_TYPE,
};

/// Maximum size of an encoded Uniform Resource.
Expand All @@ -32,7 +31,7 @@ pub const UR_ENCODER_MIN_STRING: usize = 224;
/// parts that the message is divided into.
/// cbindgen:ignore
pub const UR_ENCODER_MAX_FRAGMENT_LEN: usize =
max_fragment_len(UR_MIN_TYPE, 1, UR_ENCODER_MAX_STRING);
max_fragment_len(UR_MAX_TYPE, usize::MAX, UR_ENCODER_MAX_STRING);

/// Minimum fragment length.
pub const UR_ENCODER_MIN_FRAGMENT_LEN: usize =
Expand Down Expand Up @@ -116,11 +115,7 @@ pub unsafe extern "C" fn ur_encoder_start(
encoder.inner.start(
value.ur_type(),
message,
max_fragment_len(
value.ur_type(),
UR_ENCODER_MAX_SEQUENCE_COUNT,
max_chars,
),
max_fragment_len(UR_MAX_TYPE, usize::MAX, max_chars),
);
}

Expand Down
4 changes: 0 additions & 4 deletions extmod/foundation-rust/src/ur/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ static mut UR_ERROR: heapless::String<256> = heapless::String::new();
/// cbindgen:ignore
const UR_MAX_TYPE: &str = "crypto-coin-info";

/// The minimum length of a UR type
/// cbindgen:ignore
const UR_MIN_TYPE: &str = "bytes";

const fn max_message_len(max_characters: usize) -> usize {
const MAX_UR_PREFIX: usize = "ur:".len() + UR_MAX_TYPE.len();

Expand Down

0 comments on commit 0731735

Please sign in to comment.