Skip to content

Commit 9a363ca

Browse files
committed
mtc_worker: Change format of log and cosigner ID in metadata
Instead of base64 encoding the BER, just return the string encoding.
1 parent d255fc6 commit 9a363ca

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

crates/mtc_api/src/cosigner.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ impl MtcCosigner {
6060
Ok(self.k.try_sign(&serialized)?.to_vec())
6161
}
6262

63-
/// Return the log ID as bytes.
64-
pub fn log_id(&self) -> &[u8] {
65-
self.v.log_id.as_bytes()
63+
/// Return the log ID.
64+
pub fn log_id(&self) -> &TrustAnchorID {
65+
&self.v.log_id
6666
}
6767

68-
/// Return the cosigner ID as bytes.
69-
pub fn cosigner_id(&self) -> &[u8] {
70-
self.v.cosigner_id.as_bytes()
68+
/// Return the cosigner ID.
69+
pub fn cosigner_id(&self) -> &TrustAnchorID {
70+
&self.v.cosigner_id
7171
}
7272

7373
/// Return the verifying key as bytes.

crates/mtc_worker/src/frontend_worker.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ const UNKNOWN_LOG_MSG: &str = "unknown log";
4545
struct MetadataResponse<'a> {
4646
#[serde(skip_serializing_if = "Option::is_none")]
4747
description: &'a Option<String>,
48-
#[serde_as(as = "Base64")]
49-
log_id: &'a [u8],
50-
#[serde_as(as = "Base64")]
51-
cosigner_id: &'a [u8],
48+
log_id: String,
49+
cosigner_id: String,
5250
#[serde_as(as = "Base64")]
5351
cosigner_public_key: &'a [u8],
5452
submission_url: &'a str,
@@ -226,8 +224,8 @@ async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
226224
let cosigner = load_checkpoint_cosigner(&ctx.env, name);
227225
Response::from_json(&MetadataResponse {
228226
description: &params.description,
229-
log_id: cosigner.log_id(),
230-
cosigner_id: cosigner.cosigner_id(),
227+
log_id: cosigner.log_id().to_string(),
228+
cosigner_id: cosigner.cosigner_id().to_string(),
231229
cosigner_public_key: cosigner.verifying_key(),
232230
submission_url: &params.submission_url,
233231
monitoring_url: if params.monitoring_url.is_empty() {

0 commit comments

Comments
 (0)