Skip to content

_get_tag() missing 6 tags present in go-multicodec #37

Description

@sumanjeet0012

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:

  1. multikey — match "chacha20-poly1305"
  2. multisig — match names containing "-msig" or "lamport-" with "-sig" suffix patterns
  3. nonce — match "nonce"
  4. shelter — match names starting with "shelter-"
  5. softhash — match "iscc"
  6. vlad — match "vlad"

Add corresponding tests in tests/test_code.py for each new tag.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions