Skip to content

Commit

Permalink
Added KY and MM to valid prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
titusz committed Apr 13, 2022
1 parent 977285e commit 097cc1e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## [0.2.6] - Unreleased
- Added `KY` and `MM` to valid prefixes

## [0.2.5] - 2022-04-10
- Fixed missing `jcs` dependency
- Added SubType `NONE` to MT.ISCC to distinquish from SUM
Expand Down
5 changes: 4 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog

## [0.2.5] - Unreleased
## [0.2.6] - Unreleased
- Added `KY` and `MM` to valid prefixes

## [0.2.5] - 2022-04-10
- Fixed missing `jcs` dependency
- Added SubType `NONE` to MT.ISCC to distinquish from SUM
- Added support for deterministic generation of random ISCC-CODEs
Expand Down
2 changes: 2 additions & 0 deletions iscc_core/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,11 @@ def iscc_validate(iscc, strict=True):
"KM",
"KQ",
"KU",
"KY",
"MA",
"ME",
"MI",
"MM",
"OA",
}
cleaned = iscc_clean(iscc)
Expand Down
4 changes: 3 additions & 1 deletion tests/build_valid_prefixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ def build_valid_prefixes():
for stype in stype_for_mtype[mtype]:
digest = ic.encode_header(mtype, stype, 0, 0)
base = ic.encode_base32(digest)
prefixes.add(base[:2])
prefix = base[:2]
prefixes.add(prefix)
print(f"{prefix} -> {ic.MT(mtype).name}-{stype.name}")

return sorted(list(prefixes))

Expand Down
4 changes: 4 additions & 0 deletions tests/test_codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ def test_codec_validate_header_prefix():
ic.iscc_validate(invalid)


def test_codec_validate_iscc_id():
assert ic.iscc_validate("ISCC:MMAMRVPW22XVU4FR", strict=False) is True


def test_decode_iscc():
assert ic.iscc_decode("AAAQCAAAAABAAAAA") == (0, 0, 0, 1, b"\x01\x00\x00\x00\x02\x00\x00\x00")

Expand Down

0 comments on commit 097cc1e

Please sign in to comment.