Skip to content

Commit 4d9e91e

Browse files
committed
fix: update schema, account for p256 in tests
1 parent f96592f commit 4d9e91e

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

crates/auths-verifier/src/verify.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::error::AttestationError;
77
use crate::types::{ChainLink, VerificationReport, VerificationStatus};
88
#[cfg(feature = "native")]
99
use crate::witness::WitnessVerifyConfig;
10-
use auths_crypto::{CryptoProvider, ED25519_PUBLIC_KEY_LEN};
10+
use auths_crypto::CryptoProvider;
1111
use auths_keri::{Event, compute_said, find_seal_in_kel};
1212
use chrono::{DateTime, Duration, Utc};
1313
use log::debug;
@@ -351,11 +351,19 @@ pub(crate) async fn verify_with_keys_at(
351351
}
352352

353353
// --- 4. Check provided issuer public key length ---
354-
if !att.identity_signature.is_empty() && issuer_pk_bytes.len() != ED25519_PUBLIC_KEY_LEN {
355-
return Err(AttestationError::InvalidInput(format!(
356-
"Provided issuer public key has invalid length: {}",
357-
issuer_pk_bytes.len()
358-
)));
354+
if !att.identity_signature.is_empty() {
355+
let curve = match issuer_pk_bytes.len() {
356+
32 => auths_crypto::CurveType::Ed25519,
357+
33 | 65 => auths_crypto::CurveType::P256,
358+
n => {
359+
return Err(AttestationError::InvalidInput(format!(
360+
"Provided issuer public key has invalid length: {n}"
361+
)));
362+
}
363+
};
364+
crate::core::DevicePublicKey::try_new(curve, issuer_pk_bytes).map_err(|e| {
365+
AttestationError::InvalidInput(format!("Invalid issuer public key: {e}"))
366+
})?;
359367
}
360368

361369
// --- 5. Reconstruct and canonicalize data ---

schemas/identity-bundle-v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@
285285
}
286286
},
287287
"PublicKeyHex": {
288-
"description": "A validated hex-encoded Ed25519 public key (64 hex chars = 32 bytes).\n\nUse `to_ed25519()` to convert to the byte-array `Ed25519PublicKey` type.",
288+
"description": "A validated hex-encoded public key (64 hex chars for Ed25519, 66 for P-256 compressed).\n\nUse `to_ed25519()` to convert to the byte-array `Ed25519PublicKey` type.",
289289
"type": "string"
290290
},
291291
"Role": {

tests/e2e/test_ephemeral_signing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_ephemeral_sign_and_verify():
2626

2727
# Sign with ephemeral CI key
2828
sign_result = run([
29-
"cargo", "run", "-p", "auths-cli", "--",
29+
"cargo", "run", "-p", "auths-cli", "--bin", "auths", "--",
3030
"artifact", "sign", artifact_path,
3131
"--ci",
3232
"--ci-platform", "local",

0 commit comments

Comments
 (0)