Skip to content

feat(crypto)!: migrate cryptographic primitives to NetCrypto (#75)#77

Merged
moisesja merged 3 commits into
mainfrom
feat/issue-75-netcrypto-migration
Jun 13, 2026
Merged

feat(crypto)!: migrate cryptographic primitives to NetCrypto (#75)#77
moisesja merged 3 commits into
mainfrom
feat/issue-75-netcrypto-migration

Conversation

@moisesja

Copy link
Copy Markdown
Owner

Closes #75 — the cryptographic half of the NetCrypto/DataProofs refactor.

NetDid.Core now carries zero crypto primitives; they are consumed from the NetCrypto 1.0.0 package. The Data Integrity / eddsa-jcs-2022 engine, JCS canonicalization, and the did:key proof-signer parser remain in-repo for now and migrate to DataProofsDotnet in the data-proof half (#76).

Breaking changes (→ v2.0.0)

  • Crypto primitive / key-type / signer / keystore / JWK / KDF types move namespace from NetDid.Core / NetDid.Core.Crypto / .KeyStore / .Jwk to NetCrypto. Consumers replace using NetDid.Core.Crypto; (and .KeyStore / .Jwk / .Crypto.Kdf) with using NetCrypto;. Signatures and enum ordinals are otherwise unchanged.
  • KeyTypeExtensions.ToKeyType(ulong)FromMulticodec(ulong).
  • AddNetDid(...) registers crypto via NetCrypto.AddNetCrypto(); BBS-absent now surfaces as NetCrypto.BbsUnavailableException.

What changed

  • Removed: the Crypto/ primitive cluster, I* crypto interfaces, KeyStore/InMemoryKeyStore, Jwk/JwkConverter, Kdf/ConcatKdf, the BBS provider + ZkryptiumNative, the self-hosted native/zkryptium-ffi/ Rust crate, the bundled runtimes/** dylib, the runtimes pack directive, and <AllowUnsafeBlocks>.
  • Packages: add NetCrypto 1.0.0; bump NetCid 1.5.0 → 1.6.0; drop the now-transitive NSec.Cryptography / NBitcoin.Secp256k1 / Nethermind.Crypto.Bls. BBS native payload (all 5 RIDs) now flows transitively from NetCrypto.
  • Version: NetDidVersion 1.3.1 → 2.0.0; CHANGELOG [2.0.0] added.
  • Rewired ~40 consumers (src + samples + all test projects). The two internal-decompress tests were re-expressed against the public JwkConverter.ToPublicJwk path rather than deleted; only the BBS-keygen test and the one direct internal-primitive test were removed (covered by NetCrypto.Tests).

Scope notes

Verification

  • ✅ Full solution builds clean, no warnings, zero references to deleted namespaces.
  • 800 tests pass: Core 400, W3C Conformance 175 (byte-identical — proves the swap is type-identity, not behavior), WebVh 130, Key 44, Peer 40, DI 11.
  • ✅ All 4 samples run end-to-end (DidKey, DidPeer incl. ConcatKdf, DidWebVh incl. proof creation, DependencyInjection).

🤖 Generated with Claude Code

Delete all in-repo cryptographic primitives from NetDid.Core and consume
them from the NetCrypto package. NetDid.Core now carries only DID-method
logic. This is the cryptographic half of the NetCrypto/DataProofs refactor;
the Data Integrity / eddsa-jcs-2022 engine, JCS canonicalization, and the
did:key proof-signer parser remain in-repo and migrate to DataProofsDotnet
in the data-proof half (#76).

BREAKING CHANGE: crypto primitive, key-type, signer, keystore, JWK, and KDF
types move namespace from NetDid.Core / NetDid.Core.Crypto / .KeyStore / .Jwk
to NetCrypto (ICryptoProvider, IBbsCryptoProvider, ISigner, IKeyGenerator,
IKeyStore, DefaultCryptoProvider, DefaultBbsCryptoProvider, DefaultKeyGenerator,
KeyType, KeyTypeExtensions, EcPointValidator, EcdsaSignatureFormat, KeyPair,
KeyPairSigner, KeyStoreSigner, StoredKeyInfo, PublicKeyReference,
InMemoryKeyStore, JwkConverter, ConcatKdf). KeyTypeExtensions.ToKeyType(ulong)
renamed to FromMulticodec(ulong). AddNetDid(...) now registers crypto via
NetCrypto.AddNetCrypto(); BBS-absent surfaces as BbsUnavailableException.

- Remove the Crypto/ primitive cluster, I* crypto interfaces,
  KeyStore/InMemoryKeyStore, Jwk/JwkConverter, Kdf/ConcatKdf, the BBS provider
  + ZkryptiumNative, the native/zkryptium-ffi Rust crate, runtimes/** dylib,
  the runtimes pack directive, and <AllowUnsafeBlocks>.
- Add NetCrypto 1.0.0; bump NetCid 1.5.0 -> 1.6.0; drop the now-transitive
  NSec.Cryptography / NBitcoin.Secp256k1 / Nethermind.Crypto.Bls refs.
- Bump NetDidVersion 1.3.1 -> 2.0.0; update CHANGELOG.
- Rewire ~40 consumers (src + samples + all test projects). Re-express the
  internal-decompress tests against the public JwkConverter path.

Verified: full build clean, 800 tests pass (incl. 175 W3C conformance,
byte-identical), all 4 samples run end-to-end.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@moisesja moisesja self-assigned this Jun 13, 2026
@moisesja moisesja added this to the 2.0.0 milestone Jun 13, 2026
moisesja and others added 2 commits June 13, 2026 14:20
NSec.Cryptography, NBitcoin.Secp256k1, and Nethermind.Crypto.Bls have no
direct PackageReference anywhere on this branch after the NetCrypto
migration — NetCrypto pulls them transitively. Removing the now-unused
PackageVersion pins. did:ethr (#70) resolves NBitcoin.Secp256k1
transitively via NetDid.Core -> NetCrypto and is unaffected; if it later
takes a direct reference it should re-add the pin.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@moisesja moisesja merged commit 9ff6255 into main Jun 13, 2026
1 of 2 checks passed
@moisesja moisesja deleted the feat/issue-75-netcrypto-migration branch June 13, 2026 18:21
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.

Refactor: migrate cryptographic primitives to NetCrypto + NetCid (remove in-repo crypto/BBS/JCS)

1 participant