Skip to content

Commit f96592f

Browse files
committed
fix: account for p256 curve in tests
1 parent bfc6ecc commit f96592f

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

crates/auths-verifier/src/core.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,15 +1582,15 @@ impl<'de> Deserialize<'de> for CommitOid {
15821582
/// Error type for `PublicKeyHex` construction.
15831583
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
15841584
pub enum PublicKeyHexError {
1585-
/// The hex string has the wrong length (not 64 chars / 32 bytes).
1586-
#[error("expected 64 hex chars (32 bytes), got {0} chars")]
1585+
/// The hex string has the wrong length (not 64 or 66 chars).
1586+
#[error("expected 64 (Ed25519) or 66 (P-256) hex chars, got {0} chars")]
15871587
InvalidLength(usize),
15881588
/// The string contains non-hex characters.
15891589
#[error("invalid hex: {0}")]
15901590
InvalidHex(String),
15911591
}
15921592

1593-
/// A validated hex-encoded Ed25519 public key (64 hex chars = 32 bytes).
1593+
/// A validated hex-encoded public key (64 hex chars for Ed25519, 66 for P-256 compressed).
15941594
///
15951595
/// Use `to_ed25519()` to convert to the byte-array `Ed25519PublicKey` type.
15961596
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize)]
@@ -1612,7 +1612,7 @@ impl PublicKeyHex {
16121612
pub fn parse(raw: &str) -> Result<Self, PublicKeyHexError> {
16131613
let s = raw.trim().to_lowercase();
16141614
let bytes = hex::decode(&s).map_err(|e| PublicKeyHexError::InvalidHex(e.to_string()))?;
1615-
if bytes.len() != 32 {
1615+
if bytes.len() != 32 && bytes.len() != 33 {
16161616
return Err(PublicKeyHexError::InvalidLength(s.len()));
16171617
}
16181618
Ok(Self(s))

packages/auths-node/__test__/integration.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ describe('identity lifecycle', () => {
4949
expect(identity.did).toMatch(/^did:keri:/)
5050
expect(identity.keyAlias).toBeDefined()
5151
expect(identity.publicKey).toBeDefined()
52-
expect(identity.publicKey.length).toBe(64)
52+
// 64 hex chars (Ed25519, 32 bytes) or 66 hex chars (P-256 compressed, 33 bytes)
53+
expect([64, 66]).toContain(identity.publicKey.length)
5354
})
5455

5556
it('getPublicKey returns hex string', () => {

tests/e2e/test_device_attestation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def test_device_revoke(self, auths_bin, init_identity):
6666
def test_device_verify(self, auths_bin, init_identity, tmp_path):
6767
att_file = tmp_path / "attestation.json"
6868
att_data = export_attestation(init_identity, att_file)
69-
issuer_pk = att_data["device_public_key"]
69+
dpk = att_data["device_public_key"]
70+
issuer_pk = dpk["key"] if isinstance(dpk, dict) else dpk
7071

7172
verify = run_auths(
7273
auths_bin,

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", "--",
3030
"artifact", "sign", artifact_path,
3131
"--ci",
3232
"--ci-platform", "local",

0 commit comments

Comments
 (0)