-
Notifications
You must be signed in to change notification settings - Fork 9
Implement all missing multibase encodings and API features #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add 10 missing encodings: base16upper, base32upper, base32pad, base32padupper, base32hexupper, base32hexpad, base32hexpadupper, base64pad, base64urlpad, base256emoji - Implement RFC 4648 padding support for base32 and base64 variants - Add structured exception classes (UnsupportedEncodingError, InvalidMultibaseStringError, DecodingError) - Add Encoder and Decoder classes for reusable encoding/decoding - Add decode(return_encoding=True) to return encoding type - Add encoding metadata functions (get_encoding_info, list_encodings, is_encoding_supported) - Add decoder composition support via Decoder.or_() method - Update tests for all new encodings and API features - Update documentation and create news fragment Closes #20 Achieves 100% encoding coverage (24/24 encodings)
2cb4656 to
02ac83c
Compare
…nt, add make targets docs
…prove docs, add test - Simplify redundant padding logic in BaseByteStringConverter - Add return type hints to Base256EmojiConverter methods - Add clarifying comments to exception handling in decode() - Add test for ComposedDecoder error messages when all decoders fail - Improve Base256EmojiConverter documentation with better docstrings
…mentations - Replace dynamic emoji generation with hardcoded alphabet matching js-multiformats and go-multibase - Update decode method to iterate character-by-character (matching reference implementations) - Ensures full compatibility with js-multiformats and go-multibase - All test cases from js-multiformats spec tests now pass exactly This fixes the compatibility issue where our implementation was generating a different emoji set than the reference implementations.
Implement all missing multibase encodings and API featuresThis PR implements all missing features identified in the gap analysis to bring py-multibase to 100% compatibility with reference implementations (go-multibase, rust-multibase, js-multiformats). New Encodings (10 total)High Priority (9 encodings)
Low Priority (1 encoding)
API EnhancementsReusable Encoder/Decoder Classes
Return Encoding Type on Decode
Structured Exception Classes
Encoding Metadata Functions
Implementation DetailsPadding Support
Base256Emoji Implementation
Code Quality
Testing
Documentation
Results
Breaking ChangesNone. All changes are backward compatible. RelatedCloses #20 |
|
Amazing work, @acul71! 🎉 This is a huge milestone for py-multibase — taking it from 58% → 100% encoding coverage and bringing full parity with go / rust / js implementations is a massive achievement. The implementation quality, attention to detail, API improvements, and exhaustive test coverage really stand out. Thank you for the thorough gap analysis, clean design of the new Encoder/Decoder abstractions, well-structured exceptions, and for ensuring complete compatibility (including the tricky base256emoji). The documentation, type hints, padding fixes, and newsfragment are all perfectly done. All tests, linting, and docs build cleanly — fantastic contribution. 🚀 Really appreciate the level of polish and care you bring to the project! |
|
@acul71 : Wonderful, Luca :) Appreciate the contribution. |
Summary
This PR implements all missing features identified in the gap analysis to bring py-multibase to 100% compatibility with reference implementations (go-multibase, rust-multibase, js-multiformats).
Changes
New Encodings (10 total)
API Enhancements
EncoderandDecoderclassesdecode(return_encoding=True)parameter to return encoding typeUnsupportedEncodingError,InvalidMultibaseStringError,DecodingErrorget_encoding_info(),list_encodings(),is_encoding_supported()Decoder.or_()methodTesting
Documentation
Results
Closes #20