Skip to content

feat: add encoder_by_name factory function#54

Open
sumanjeet0012 wants to merge 1 commit into
multiformats:masterfrom
sumanjeet0012:fix-issue-39
Open

feat: add encoder_by_name factory function#54
sumanjeet0012 wants to merge 1 commit into
multiformats:masterfrom
sumanjeet0012:fix-issue-39

Conversation

@sumanjeet0012

Copy link
Copy Markdown
Contributor

Fixes #39

Description

This pull request adds an encoder_by_name() factory function, which enables creating an Encoder from a single-character prefix as well as the standard name, bringing the python implementation into alignment with the go-multibase reference implementation.

Changes

  • Created encoder_by_name() in multibase/multibase.py which inspects the given string and resolves it if it matches either a name or a prefix.
  • Exported encoder_by_name from __init__.py.
  • Added tests for encoder_by_name demonstrating successful construction from prefix, name, and base256emoji, as well as proper exception handling for unsupported/invalid strings.

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.

Encoder class only accepts encoding names, not prefix characters

1 participant