The _get_tag() function in code.py is missing 6 codec category tags that exist in the Go reference implementation: multikey, multisig, nonce, shelter, softhash, and vlad. Codecs belonging to these categories currently return "<unknown>" instead of the correct tag.
Problem
The _get_tag() function in multicodec/code.py uses hardcoded pattern matching to classify codecs into category tags. Six tags that exist in the upstream multicodec table.csv and in go-multicodec are not handled:
from multicodec import Code
# These should return specific tags but return "<unknown>" instead:
Code(0xA000).tag() # chacha20-poly1305 → "<unknown>" (should be "multikey")
Code(0x123B).tag() # nonce → "<unknown>" (should be "nonce")
Code(0xCC01).tag() # iscc → "<unknown>" (should be "softhash")
Code(0x1207).tag() # vlad → "<unknown>" (should be "vlad")
# All multisig codecs (es256k-msig, eddsa-msig, etc.) → "<unknown>" (should be "multisig")
# All shelter codecs (shelter-contract-*, shelter-file-*) → "<unknown>" (should be "shelter")
Proposed Solution
Add the 6 missing tag categories to _get_tag() in multicodec/code.py:
multikey — match "chacha20-poly1305"
multisig — match names containing "-msig" or "lamport-" with "-sig" suffix patterns
nonce — match "nonce"
shelter — match names starting with "shelter-"
softhash — match "iscc"
vlad — match "vlad"
Add corresponding tests in tests/test_code.py for each new tag.
Related
The
_get_tag()function incode.pyis missing 6 codec category tags that exist in the Go reference implementation:multikey,multisig,nonce,shelter,softhash, andvlad. Codecs belonging to these categories currently return"<unknown>"instead of the correct tag.Problem
The
_get_tag()function inmulticodec/code.pyuses hardcoded pattern matching to classify codecs into category tags. Six tags that exist in the upstream multicodec table.csv and in go-multicodec are not handled:Proposed Solution
Add the 6 missing tag categories to
_get_tag()inmulticodec/code.py:multikey— match"chacha20-poly1305"multisig— match names containing"-msig"or"lamport-"with"-sig"suffix patternsnonce— match"nonce"shelter— match names starting with"shelter-"softhash— match"iscc"vlad— match"vlad"Add corresponding tests in
tests/test_code.pyfor each new tag.Related
code_table.goTag() method