pay: domain-separate tip and gate legacy signature acceptance
`tip` was the one payment frame with no domain tag: sign_tip signed the LF-joined fields, so its signature could be confused with any other newline-joined preimage. Mirror inv/rcp: sign_tip now emits "onionwire-tip-v1" || 0x00-separated txid/amount/address/memo/ts, and verify_tip tries that form then the historical layout. Legacy acceptance is now one switch instead of nine call sites: `pay::LEGACY_SIGS` (default true) plus `pay::legacy_sigs()`. Every v1 / concat fallback reads it — the `onionwire:v1` invite string and its two historical signature forms, `loc`, `inv`, `rcp`, and `tip`. `prf` is not gated here because src/profile.rs is outside this card's file scope; the spec says so. Tests: legacy-on keeps every untagged form verifying (incl. a new tip case); legacy-off rejects each untagged form while the tagged form still verifies (loc, inv, rcp, tip, invite); sign_tip is pinned to the tagged layout. docs/PROTOCOL.md gains the emitted/accepted table per signed frame and the mixed-fleet consequence.
This commit is contained in:
parent
36969a7e95
commit
b8c52ca97d
6 changed files with 352 additions and 35 deletions
|
|
@ -54,9 +54,10 @@ pub fn verify(identity_pk: &[u8], loc: &Loc) -> bool {
|
|||
let signature = Signature::from_bytes(&sig);
|
||||
vk.verify(&sign_msg_v2(&loc.onion, loc.ts), &signature)
|
||||
.is_ok()
|
||||
|| vk
|
||||
.verify(&sign_msg_v1(&loc.onion, loc.ts), &signature)
|
||||
.is_ok()
|
||||
|| (crate::pay::legacy_sigs()
|
||||
&& vk
|
||||
.verify(&sign_msg_v1(&loc.onion, loc.ts), &signature)
|
||||
.is_ok())
|
||||
}
|
||||
|
||||
pub fn encode(loc: &Loc) -> Vec<u8> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue