Skip to content

Commit

Permalink
Remove unused public_key
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Dec 19, 2024
1 parent e2a9921 commit dca1f28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
4 changes: 0 additions & 4 deletions components/remote_settings/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@ pub struct CollectionMetadata {
#[derive(Clone, Debug, Default, Deserialize, Serialize, Eq, PartialEq)]
pub struct CollectionSignature {
pub signature: String,
pub public_key: String,
pub x5u: String,
}

Expand Down Expand Up @@ -1759,7 +1758,6 @@ mod test_new_client {
bucket: "main".into(),
signature: CollectionSignature {
signature: "b64sig".into(),
public_key: "public_key".into(),
x5u: "http://x5u.com".into(),
},
},
Expand Down Expand Up @@ -2046,7 +2044,6 @@ mod cached_data_tests {
bucket: "main".into(),
signature: CollectionSignature {
signature: "b64sig".into(),
public_key: "public_key".into(),
x5u: "http://x5u.com".into(),
},
},
Expand Down Expand Up @@ -2226,7 +2223,6 @@ mod cached_data_tests {
bucket: "main".into(),
signature: CollectionSignature {
signature: "b64sig".into(),
public_key: "public_key".into(),
x5u: "http://x5u.com".into(),
},
},
Expand Down
15 changes: 5 additions & 10 deletions components/remote_settings/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ impl Storage {
bucket TEXT,
last_modified INTEGER,
signature TEXT,
public_key TEXT,
x5u TEXT,
fetched BOOLEAN
);
Expand Down Expand Up @@ -121,7 +120,7 @@ impl Storage {
collection_url: &str,
) -> Result<Option<CollectionMetadata>> {
let mut stmt_metadata = self.conn.prepare(
"SELECT bucket, signature, public_key, x5u FROM collection_metadata WHERE collection_url = ?",
"SELECT bucket, signature, x5u FROM collection_metadata WHERE collection_url = ?",
)?;

if let Some(metadata) = stmt_metadata
Expand All @@ -130,8 +129,7 @@ impl Storage {
bucket: row.get(0).unwrap_or_default(),
signature: CollectionSignature {
signature: row.get(1).unwrap_or_default(),
public_key: row.get(2).unwrap_or_default(),
x5u: row.get(3).unwrap_or_default(),
x5u: row.get(2).unwrap_or_default(),
},
})
})
Expand Down Expand Up @@ -194,14 +192,13 @@ impl Storage {

tx.execute(
"INSERT OR REPLACE INTO collection_metadata \
(collection_url, last_modified, bucket, signature, public_key, x5u, fetched) \
(collection_url, last_modified, bucket, signature, x5u, fetched) \
VALUES (?, ?, ?, ?, ?, true)",
(
collection_url,
timestamp,
metadata.bucket,
metadata.signature.signature,
metadata.signature.public_key,
metadata.signature.x5u,
),
)?;
Expand Down Expand Up @@ -724,17 +721,15 @@ mod tests {
bucket: "main".into(),
signature: CollectionSignature {
signature: "b64encodedsig".into(),
public_key: "some public key".into(),
x5u: "http://x5u/".into(),
x5u: "http://15u/".into(),
},
},
)?;

let metadata = storage.get_collection_metadata(collection_url)?.unwrap();

assert_eq!(metadata.signature.signature, "b64encodedsig");
assert_eq!(metadata.signature.public_key, "some public key");
assert_eq!(metadata.signature.x5u, "http://x5u/");
assert_eq!(metadata.signature.x5u, "http://15u/");

Ok(())
}
Expand Down

0 comments on commit dca1f28

Please sign in to comment.