refactor(did): ecdsa- und base58-Abhängigkeit durch pure-Python ersetzen#34
Merged
Conversation
…on-Code ersetzen sdata.did ist damit krypto-/encoding-seitig abhängigkeitsfrei (nur noch 'requests' für die HTTP-Auflösung von did:web/did:github). Neu: - eddsa.py: drop-in-Teilmenge der ecdsa-API (SigningKey/VerifyingKey/Ed25519/ BadSignatureError), gestützt auf die vorhandenen RFC-8032-Primitive in ed25519.py. Schlüsselerzeugung via os.urandom(32). - base58btc.py: konsolidierte base58btc-Kodierung (zuvor inline in did_peer4), jetzt zentral und mit klarer Fehlerbehandlung. Umstellungen: - jose.py, keys.py: Import von .eddsa statt ecdsa. - did_web.py, utils_didkey.py: Import von .base58btc statt base58; did_peer4.py re-exportiert b58encode/b58decode aus dem neuen Modul. - setup.py: [did]-Extra ohne ecdsa/base58 (no-op, bleibt installierbar); tests_require entschlackt. Docstrings aktualisiert. Tests: - tests/test_eddsa.py: offizielle RFC-8032-Testvektoren (§7.1) sichern die bitgenaue Korrektheit von sign/verify/publickey; Adapter- und base58-Tests. - test_did.py: obsolete importorskip(ecdsa/base58) entfernt. Verifiziert ohne ecdsa/base58 im Environment: 377 passed, 5 skipped, Coverage 100% (inkl. neuer Module).
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| UnusedCode | 1 medium 1 minor |
| Documentation | 19 minor |
| ErrorProne | 2 high |
| Security | 17 high |
🟢 Metrics 25 complexity · 0 duplication
Metric Results Complexity 25 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
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.
Macht
sdata.didkrypto-/encoding-seitig abhängigkeitsfrei. Beide bisherigen[did]-Extra-Dependencies (ecdsa,base58) entfallen — nur nochrequests(Core-Dependency) für die HTTP-Auflösung vondid:web/did:github.Motivation
Es wurde nur Ed25519 aus
python-ecdsagenutzt (kein echtes ECDSA/NIST). Eine geprüfte pure-Python-RFC-8032-Implementierung lag bereits im Repo (ed25519.py, vondiddoc.pyschon genutzt) — unddid_peer4.pybrachte bereits eine eigene base58btc-Kodierung mit. Die Abhängigkeiten waren also redundant.Änderungen
Neu
eddsa.py— drop-in-Teilmenge derecdsa-API (SigningKey/VerifyingKey/Ed25519/BadSignatureError) über die RFC-8032-Primitive; Schlüsselerzeugung viaos.urandom(32).base58btc.py— konsolidierte base58btc-Kodierung (vorher inline), zentral + saubere Fehlerbehandlung.Umstellungen
jose.py,keys.py:from .eddsa import …stattecdsa.did_web.py,utils_didkey.py:from .base58btc import …;did_peer4.pyre-exportiertb58encode/b58decode.setup.py:[did]-Extra ohneecdsa/base58(no-op, bleibt installierbar). Docstrings aktualisiert.Sicherheit
Kein Constant-time-Regress:
python-ecdsawar ebenfalls pure-Python/nicht seitenkanalresistent. Der ehrliche Sicherheitshinweis bleibt; für Hochsicherheit weiterhin PyNaCl/cryptographyempfohlen. Korrektheit ist gegen die offiziellen RFC-8032-Testvektoren (§7.1) abgesichert (tests/test_eddsa.py).Verifikation
Mit deinstalliertem
ecdsa/base58:377 passed, 5 skipped, Coverage 100 % (inkl. neuer Module).did:key+ JWS sign/verify-Roundtrip pure-Python bestätigt.