0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-19 19:42:19 +02:00

keytrans: Update proto definitions

Co-authored-by: Max Moiseev <moiseev@signal.org>
This commit is contained in:
Brendan McMillion 2024-08-30 13:37:46 -07:00 committed by GitHub
parent eb860ea051
commit f142c25b72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 11 deletions

View File

@ -172,7 +172,7 @@ fn verify_full_tree_head(
// greater than or equal to what they were before.
match storage.get_last_tree_head()? {
None => {
if !fth.consistency.is_empty() {
if !fth.last.is_empty() {
return Err(Error::VerificationFailed(
"consistency proof provided when not expected".to_string(),
));
@ -189,7 +189,7 @@ fn verify_full_tree_head(
"current timestamp is less than previous timestamp".to_string(),
));
}
if !fth.consistency.is_empty() {
if !fth.last.is_empty() {
return Err(Error::VerificationFailed(
"consistency proof provided when not expected".to_string(),
));
@ -206,7 +206,7 @@ fn verify_full_tree_head(
"current timestamp is less than previous timestamp".to_string(),
));
}
let proof = get_hash_proof(&fth.consistency)?;
let proof = get_hash_proof(&fth.last)?;
verify_consistency_proof(last.tree_size, tree_head.tree_size, &proof, last_root, root)?
}
};
@ -586,9 +586,8 @@ pub fn verify_monitor(
// don't update monitoring data based on parts of the tree that we
// don't intend to retain.
req.consistency
.as_ref()
.and_then(|consistency| consistency.last)
.ok_or(Error::VerificationFailed("monitoring request malformed: consistency field expected when monitoring distinguished key".to_string()))?
.last
} else {
tree_size
};

View File

@ -26,8 +26,8 @@ message AuditorTreeHead {
// needed for validation.
message FullTreeHead {
TreeHead tree_head = 1;
repeated bytes distinguished = 2;
repeated bytes consistency = 3;
repeated bytes last = 2;
repeated bytes distinguished = 3;
optional AuditorTreeHead auditor_tree_head = 4;
}
@ -54,7 +54,7 @@ message UpdateValue {
// Consistency specifies the parameters of the consistency proof(s) that should
// be returned.
message Consistency {
uint64 last = 1;
optional uint64 last = 1;
optional uint64 distinguished = 2;
}
@ -62,7 +62,7 @@ message Consistency {
message SearchRequest {
bytes search_key = 1;
optional uint32 version = 2;
optional Consistency consistency = 3;
Consistency consistency = 3;
}
// SearchResponse is the output of executing a search on the tree.
@ -79,7 +79,7 @@ message SearchResponse {
message UpdateRequest {
bytes search_key = 1;
bytes value = 2;
optional Consistency consistency = 3;
Consistency consistency = 3;
}
// UpdateResponse is the output of executing an update on the tree.
@ -102,7 +102,7 @@ message MonitorKey {
message MonitorRequest {
repeated MonitorKey owned_keys = 1;
repeated MonitorKey contact_keys = 2;
optional Consistency consistency = 3;
Consistency consistency = 3;
}
// MonitorProof proves that a single key has been correctly managed in the log.