[verified] fix(qr): bind invite sig fields; cap decode
Some checks failed
ci / test (pull_request) Failing after 54s
Some checks failed
ci / test (pull_request) Failing after 54s
Reject non-32-byte spk, non-v3 onion, and invites over 4KiB before hex alloc. Sign onionwire-invite-v1 with 0x00 separators; verify that first. Well-formed v1 concat still verifies after field checks.
This commit is contained in:
parent
bdea9578e4
commit
68da7fec3b
3 changed files with 190 additions and 18 deletions
|
|
@ -71,7 +71,7 @@ fn chrome_renders_at_80x24_and_120x40() {
|
|||
use ratatui::Terminal;
|
||||
|
||||
let fp = "abcdef0123456789";
|
||||
let onion = "abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopq.onion";
|
||||
let onion = "abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion";
|
||||
for (w, h) in [(80u16, 24u16), (120, 40)] {
|
||||
let backend = TestBackend::new(w, h);
|
||||
let mut terminal = Terminal::new(backend).expect("terminal");
|
||||
|
|
@ -113,7 +113,7 @@ fn chrome_renders_at_80x24_and_120x40() {
|
|||
#[test]
|
||||
fn main_footer_keeps_help_at_80_and_120() {
|
||||
let fp = "abcdef0123456789deadbeef";
|
||||
let onion = "abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopq.onion";
|
||||
let onion = "abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion";
|
||||
let hints = main_footer_hints();
|
||||
assert!(hints.contains("? help"));
|
||||
for w in [80u16, 120] {
|
||||
|
|
@ -170,7 +170,7 @@ fn share_screen_shows_invite_not_qr_at_80x24() {
|
|||
use ratatui::Terminal;
|
||||
|
||||
let sk = [7u8; 32];
|
||||
let onion = "abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopq.onion";
|
||||
let onion = "abcdefghijklmnopqrstuvwxyz234567abcdefghijklmnopqrstuvwx.onion";
|
||||
let payload = qr::encode(&sk, onion, &[1u8; 32]).expect("encode");
|
||||
assert!(payload.starts_with("onionwire:v1:"));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue