Log App Attest transcript hashes

Signed-off-by: Tom Brow <tomb@block.xyz>
Co-authored-by: Codex <noreply@openai.com>
Ai-assisted: true
This commit is contained in:
Tom Brow
2026-08-21 15:20:39 -07:00
parent 6d8c5f97aa
commit 5a1468227e
2 changed files with 20 additions and 1 deletions

View File

@@ -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<AppState>, 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");

View File

@@ -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