Skip to content

fix: validate Ed25519 key type and specify explicit algorithm (Fixes #52)#6

Open
zeroknowledge0x wants to merge 1 commit into
permission-protocol:mainfrom
zeroknowledge0x:fix/issue-52-ed25519-algorithm-validation
Open

fix: validate Ed25519 key type and specify explicit algorithm (Fixes #52)#6
zeroknowledge0x wants to merge 1 commit into
permission-protocol:mainfrom
zeroknowledge0x:fix/issue-52-ed25519-algorithm-validation

Conversation

@zeroknowledge0x
Copy link
Copy Markdown

Summary

Fixes #52 — the reference verifier accepted non-Ed25519 signatures (RSA, ECDSA, Ed448) while reporting them as verified Ed25519 receipts.

Root Cause

verifySignature(null, ...) with null as the algorithm parameter causes Node.js to infer the algorithm from the key type. This means any key type that passes crypto.verify() would be accepted, regardless of what signatureAlg claims.

Changes

  1. Key type validation — Check keyResult.key.asymmetricKeyType and reject if not ed25519
  2. Explicit algorithm — Pass 'ed25519' to crypto.verify() instead of null

Testing

  • Verified that Ed25519 signatures still pass
  • Non-Ed25519 keys now fail with clear error message
  • No breaking changes to existing valid receipts

- Add asymmetricKeyType check to reject non-Ed25519 keys (RSA, ECDSA, Ed448)
- Pass 'ed25519' explicitly to crypto.verify() instead of null
- Prevents algorithm confusion where non-Ed25519 signatures pass verification
- Fixes #52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant