mirror of
https://github.com/ratspeak/rsReticulum
synced 2026-11-22 23:10:33 +00:00
transport: expose announce aspect hashes
This commit is contained in:
1 parent
fe665b2216
commit
4ddbf01a2a
4 files changed
+20
No files matched your search
@@ -455,6 +455,7 @@ mod tests {
|
||||
timestamp: 0.0,
|
||||
public_key: Some([0x11; 64]),
|
||||
ratchet: None,
|
||||
name_hash: [0; 10],
|
||||
retained: false,
|
||||
},
|
||||
AnnounceRpcEntry {
|
||||
@@ -464,6 +465,7 @@ mod tests {
|
||||
timestamp: 0.0,
|
||||
public_key: Some([0x22; 64]),
|
||||
ratchet: None,
|
||||
name_hash: [0; 10],
|
||||
retained: false,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -5855,6 +5855,21 @@ mod tests {
|
||||
rns_identity::name_hash::name_hash("lxmf.delivery"),
|
||||
"RecentAnnounce.name_hash must match SHA-256(app_name)[:10]"
|
||||
);
|
||||
|
||||
match actor.handle_query(crate::messages::TransportQuery::GetRecentAnnounces) {
|
||||
crate::messages::TransportQueryResponse::Announces(entries) => {
|
||||
let rpc_entry = entries
|
||||
.iter()
|
||||
.find(|entry| entry.dest_hash == dh)
|
||||
.expect("announce must be exposed over RPC");
|
||||
assert_eq!(
|
||||
rpc_entry.name_hash,
|
||||
rns_identity::name_hash::name_hash("lxmf.delivery"),
|
||||
"AnnounceRpcEntry.name_hash must preserve the cached aspect hash"
|
||||
);
|
||||
}
|
||||
other => panic!("expected Announces response, got {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper: insert a synthetic recent_announce for `(dest_hash, identity)`.
|
||||
|
||||
@@ -108,6 +108,7 @@ impl TransportActor {
|
||||
timestamp: a.timestamp,
|
||||
public_key: a.public_key,
|
||||
ratchet: a.ratchet,
|
||||
name_hash: a.name_hash,
|
||||
retained: a.retained,
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -572,6 +572,8 @@ pub struct AnnounceRpcEntry {
|
||||
pub timestamp: f64,
|
||||
pub public_key: Option<[u8; 64]>,
|
||||
pub ratchet: Option<[u8; 32]>,
|
||||
/// `SHA-256(app_name)[:10]` for the announced aspect.
|
||||
pub name_hash: [u8; 10],
|
||||
/// Pinned via `RetainDestination`; the maintenance sweep skips the
|
||||
/// entry regardless of age while this is `true`.
|
||||
pub retained: bool,
|
||||
|
||||
Reference in new issue
Block a user