feat: implement DID registration with JWT signing

- Add full DID registration flow matching TypeScript version
- Implement ES256K JWT signing with PEM key format
- Add async/await support for JWT operations
- Improve error handling and debug output
- Add rich documentation and type hints

Technical Changes:
- Convert private key to PEM format for JWT signing
- Match TypeScript's JWT payload structure
- Add proper JWT header with ES256K algorithm
- Implement async functions for JWT creation
- Add detailed debug output for JWT parts

Documentation:
- Add module-level docstring with flow description
- Add function-level docstrings with examples
- Document security considerations
- Add technical details and error handling info

Dependencies:
- Add cryptography for key format conversion
- Add jwcrypto for JWT operations
- Update requirements.txt with versions and comments

This commit implements the complete DID registration flow,
matching the TypeScript implementation's behavior and
adding comprehensive documentation and error handling.
This commit is contained in:
Matthew Raymer
2025-03-05 13:44:42 +00:00
parent ddcf674b94
commit 2da44c4de6
6 changed files with 2081 additions and 65 deletions

View File

@@ -1,6 +1,11 @@
eth-account>=0.8.0
eth-keys>=0.4.0
PyJWT>=2.8.0
requests>=2.31.0
cryptography>=41.0.0
python-dotenv==1.0.0
# DID Generator Python Requirements
mnemonic>=0.20 # For seed phrase generation
eth-account>=0.5.9 # For Ethereum account operations
eth-keys>=0.4.0 # For key manipulation
requests>=2.28.2 # For API communication
typing-extensions>=4.7.1 # For type hints
web3>=6.0.0 # For Ethereum interaction
eth-utils>=2.1.0 # For Ethereum utilities
pyjwt>=2.8.0 # For JWT operations
cryptography>=42.0.0 # For key format conversion
jwcrypto