Repository navigation
feat(contracts,backend): self-sovereign identity (DID) integration (#397) - #446
Closed
Degentle12 wants to merge 1 commit into
Closed
Degentle12 wants to merge 1 commit into
Degentle12 wants to merge 1 commit into
Conversation
…etherEdu#397) Add a Soroban DID registry contract plus a backend service, model, and REST endpoints so learners can create and manage a DID bound to their Stellar wallet. - contracts: new did_registry module with DID documents containing verification keys, key rotation (retired keys stay verifiable so existing credentials are not broken), explicit key revocation, DID deactivation, and credential references anchored to the holder's DID. Entry points are exposed on AetherMintContract; on-chain lifecycle events are published for off-chain indexing. - backend: Identity model, DID service (create/resolve/rotate/revoke/ deactivate, key checks, Ed25519 signature verification, credential recording), and /api/did routes documented in the OpenAPI spec. - fixes pre-existing contract CI blockers on main: missing Symbol import in credentials.rs, dead test modules for disabled contracts, and cargo fmt across the crate. Closes AetherEdu#397
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements self-sovereign identity (DID) integration for AetherMint. Learners can now create and manage a decentralized identifier bound to their Stellar wallet, with resolvable DID documents, verifiable Ed25519 signatures, and key rotation that does not invalidate previously issued credentials.
Acceptance criteria
did_registrycontract module (create_did,add_verification_method,deactivate_did, …) exposed onAetherMintContract, plusPOST /api/didand the management endpoints.resolve_didon-chain andGET /api/did/{did}return the document with its verification methods (key id, type, public key, added/retired timestamps, revocation flag).attach_credential/get_credentialson-chain andPOST|GET /api/did/{did}/credentialsanchor issued credential references to the holder's DID.verify_did_keyon-chain, and off-chainverifyKey+ real Ed25519 signature verification (verifySignature) in the DID service viaPOST /api/did/{did}/verifyandGET /api/did/{did}/verify-key/{keyId}.Changes
contracts/src/did_registry.rs(new) — DID registry with DID documents, verification methods, key rotation/revocation, deactivation, credential references, and on-chain lifecycle events (did_optopic) for off-chain indexers.contracts/src/lib.rs— registers the module and exposes the DID entry points onAetherMintContract.contracts/src/did_registry_test.rs(new) — 12 unit tests covering create/resolve, wallet binding, rotation (old keys stay valid), revocation, deactivation, and credential references.backend/src/models/Identity.ts(new) — Mongoose model for DIDs with verification methods and credential references.backend/src/services/did/(new) —DidServicewith create/resolve/rotate/revoke/deactivate, key checks, Ed25519 signature verification (hex or base64 raw public keys, Nodecrypto), and an optional on-chain sync hook.backend/src/routes/did.ts(new) —/api/didendpoints (also mounted under/api/v1/did) with OpenAPI annotations; mutations require a bearer token, resolution/verification are public (DIDs are meant to be publicly resolvable).backend/src/__tests__/didService.test.ts(new) — 11 unit tests with real Ed25519 keypairs.backend/src/index.ts— mounts the DID routes.CI notes
While working on this I found
main's contract CI was already red, which this PR fixes where cheap and safe:cargo fmt --checkfailed on four spec/schema files (they merged that way in the spec-testing work) — the crate is now fmt-clean.contracts/src/credentials.rsdid not compile (missingSymbolimport left over from the Soroban SDK 20→26 migration) — fixed.Remaining known issue (pre-existing, not touched here to keep this PR focused): the rest of the contract test suite still does not compile against soroban-sdk 26 (
dna_storage_test,dynamic_nft_test,credentials_test,tokenomics_events_test,user_profile_test, and the spec/schema tests use pre-migration APIs). It is a follow-up item — the new DID tests are SDK-26 compatible and pass.Verification
cargo fmt --check✅,cargo clippy -- -D warnings✅,cargo build --release✅, DID contract tests 12/12 ✅tscbuild ✅, eslint clean on new files ✅, DID service tests 11/11 ✅, OpenAPI spec generation + swagger-parser validation ✅ (360 documented paths)Closes #397