Skip to content

Enforce Ed25519-only DID operations - #44

Merged
PhearZero merged 2 commits into
feat/pq-accountsfrom
feat/gate-did-operations-to-ed25519
Oct 1, 2026
Merged

PhearZero merged 2 commits into
feat/pq-accountsfrom
feat/gate-did-operations-to-ed25519

Conversation

@bwmx

@bwmx bwmx commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

DID operations now require an Ed25519 did:key and reject PQ transaction signatures before manager signing or broadcast. DID listings skip unsupported keys; document and manager signing paths reject non-32-byte keys.

Validation: 43 focused tests, build, and lint passed.

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Coverage report

St.❔
Category Percentage Covered / Total
🟡 Statements
67.74% (+3.88% 🔼)
1600/2362
🔴 Branches
46.78% (+2.5% 🔼)
298/637
🟡 Functions
60.19% (+3.76% 🔼)
195/324
🟡 Lines
68.19% (+3.99% 🔼)
1490/2185

Test suite run success

259 tests passing in 25 suites.

Report generated by 🧪jest coverage report action from 2ba7d1f

@bwmx
bwmx requested a balanced review from Copilot September 28, 2026 10:27
@bwmx
bwmx marked this pull request as ready for review September 28, 2026 10:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The validation is consistently applied and adequately covered by focused tests.

Review effort: Balanced
Findings: None

What changed in this PR

Enforces Ed25519-only DID operations and rejects unsupported transaction signatures before manager signing or broadcast.

Changes:

  • Validates DID, manager, and document keys as Ed25519.
  • Rejects PQ and malformed wallet signatures before sponsorship.
  • Updates tests, API documentation, and README guidance.
File Description
src/​did/​vault-signer.ts Validates manager keys.
src/​did/​vault-signer.spec.ts Tests PQ manager rejection.
src/​did/​did.service.ts Enforces key and signature validation.
src/​did/​did.service.spec.ts Covers unsupported keys and signatures.
src/​did/​did.controller.ts Documents Ed25519 API requirements.
src/​did/​did-key.ts Adds shared Ed25519 validation.
src/​did/​did-document.ts Validates document keys.
src/​did/​did-document.spec.ts Tests invalid document keys.
README.md Documents DID restrictions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@bwmx
bwmx force-pushed the feat/gate-did-operations-to-ed25519 branch from abd3a95 to 00876c7 Compare September 28, 2026 10:40
@bwmx
bwmx marked this pull request as draft September 28, 2026 12:29
@PhearZero
PhearZero added this pull request to stack #45 September 29, 2026 14:42
@bwmx
bwmx marked this pull request as ready for review September 29, 2026 15:02
@PhearZero
PhearZero self-requested a review September 29, 2026 15:07

@PhearZero PhearZero left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright everything looks fairly in place. A small nit would be on the error handling, let's create a new concrete type similar to this:

export class UnsupportedDidKeyError extends Error {
  /** The offending `did:key`, when the failure came from parsing one. */
  readonly didKey?: string;

  constructor(message: string, didKey?: string) {
    super(message);
    this.name = 'UnsupportedDidKeyError';
    this.didKey = didKey;
  }
}

And handle the error from the service (ie the error that decodeDidKeyEd25519 throws), then treat it in the controller as a BadRequestException. This should prevent 500 errors on the routes from improper inputs/encoding

decodeDidKeyEd25519 and assertEd25519PublicKey now throw a typed
UnsupportedDidKeyError (carrying the offending did:key when one was
parsed) instead of a plain Error. The service lets it propagate, and
the DID controller maps caller did:key failures to BadRequestException
on GET /did/identities/:didKey and the create/update
transactions/submit routes. Raw-key failures (a non-Ed25519 manager
key) remain server errors.

listUserDids now skips only UnsupportedDidKeyError and rethrows
anything else.
@bwmx
bwmx force-pushed the feat/gate-did-operations-to-ed25519 branch from 00876c7 to 2ba7d1f Compare September 30, 2026 10:02
@bwmx
bwmx requested review from PhearZero and a balanced review from Copilot September 30, 2026 10:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The validation is consistently applied and covered across service, signing, document, and controller paths.

Review effort: Balanced
Findings: None

@PhearZero PhearZero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PhearZero
PhearZero merged commit 7d97e66 into master Oct 1, 2026
4 checks passed
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.

3 participants