From 5a1468227e8b9b3ffe57f106a7ede8676f4d0560 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Fri, 21 Aug 2026 15:20:39 -0700 Subject: [PATCH] Log App Attest transcript hashes Signed-off-by: Tom Brow Co-authored-by: Codex Ai-assisted: true --- crates/buzz-push-gateway/src/http.rs | 6 +++++- .../BuzzPushKit/BuzzDevPushEnrollmentDriver.swift | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/crates/buzz-push-gateway/src/http.rs b/crates/buzz-push-gateway/src/http.rs index 7786f41f1c..4bd65a5550 100644 --- a/crates/buzz-push-gateway/src/http.rs +++ b/crates/buzz-push-gateway/src/http.rs @@ -22,6 +22,7 @@ use nostr::{ nips::nip98::{verify_auth_header, HttpMethod}, Event, JsonUtil, Timestamp, }; +use sha2::{Digest, Sha256}; use std::{ collections::HashMap, sync::{ @@ -212,6 +213,10 @@ async fn enroll(State(s): State, body: Bytes) -> Response { Some(v) => v, None => return error(StatusCode::BAD_REQUEST, "invalid_request"), }; + tracing::info!( + transcript_sha256 = %hex::encode(Sha256::digest(signed.as_bytes())), + "App Attest enrollment transcript prepared" + ); let verified = match profile.app_attest.as_ref().and_then(|policy| { policy .verify_attestation(&r.attestation, &r.key_id, signed.as_bytes()) @@ -835,7 +840,6 @@ pub fn router_with_metrics( #[cfg(test)] mod transcript_vector_tests { use super::*; - use sha2::{Digest, Sha256}; const VECTORS_JSON: &str = include_str!("../tests/vectors/app_attest_transcripts.json"); diff --git a/mobile/ios/BuzzPushKit/Sources/BuzzPushKit/BuzzDevPushEnrollmentDriver.swift b/mobile/ios/BuzzPushKit/Sources/BuzzPushKit/BuzzDevPushEnrollmentDriver.swift index 99ce31a759..2b5a4d9128 100644 --- a/mobile/ios/BuzzPushKit/Sources/BuzzPushKit/BuzzDevPushEnrollmentDriver.swift +++ b/mobile/ios/BuzzPushKit/Sources/BuzzPushKit/BuzzDevPushEnrollmentDriver.swift @@ -2,6 +2,10 @@ import CryptoKit import DeviceCheck import Foundation +#if canImport(OSLog) + import OSLog +#endif + #if canImport(Security) import Security #endif @@ -506,6 +510,17 @@ public final class BuzzDevPushEnrollmentDriver { expiresAt: expiresAt, gatewayOrigin: gatewayBaseURL.absoluteString ) +#if canImport(OSLog) + let enrollmentTranscriptHash = Self.lowercaseHex( + Data(SHA256.hash(data: enrollmentClientData)) + ) + Logger( + subsystem: "com.tombrow.buzz.mobile", + category: "push-enrollment" + ).notice( + "App Attest enrollment transcript SHA-256: \(enrollmentTranscriptHash, privacy: .public)" + ) +#endif let attestation = try await appAttest.attestation( preparedAttestation, clientData: enrollmentClientData