Skip to content

Commit

Permalink
more prelim work to support CESR native message
Browse files Browse the repository at this point in the history
  • Loading branch information
SmithSamuelM committed Mar 26, 2024
1 parent fd8b3fb commit bcb6f17
Show file tree
Hide file tree
Showing 7 changed files with 629 additions and 251 deletions.
23 changes: 0 additions & 23 deletions src/keri/core/coring.py
Original file line number Diff line number Diff line change
Expand Up @@ -4696,27 +4696,6 @@ def __iter__(self):
CtrDex = CounterCodex()


@dataclass(frozen=True)
class GenusCodex:
"""GenusCodex is codex of protocol genera for code table.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via 'in' operator works.
"""
KERI_ACDC_SPAC: str = '--AAA' # KERI, ACDC, and SPAC Protocol Stacks share the same tables
KERI: str = '--AAA' # KERI and ACDC Protocol Stacks share the same tables
ACDC: str = '--AAA' # KERI and ACDC Protocol Stacks share the same tables
SPAC: str = '--AAA' # KERI and ACDC Protocol Stacks share the same tables


def __iter__(self):
return iter(astuple(self)) # enables inclusion test with "in"
# duplicate values above just result in multiple entries in tuple so
# in inclusion still works

GenDex = GenusCodex() # Make instance


class Counter:
"""
Counter is fully qualified cryptographic material primitive base class for
Expand Down Expand Up @@ -5186,8 +5165,6 @@ def _inhale(self, raw):
if version != Version:
raise VersionError("Unsupported version = {}.{}, expected {}."
"".format(version.major, version.minor, Version))
#if len(raw) < size:
#raise ShortageError("Need more bytes.")

ked = loads(raw=raw, size=size, kind=kind)

Expand Down
56 changes: 37 additions & 19 deletions src/keri/core/counting.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,29 @@
from ..core.coring import Sizage



@dataclass(frozen=True)
class GenusCodex:
"""GenusCodex is codex of protocol genera for code table.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via 'in' operator works.
"""
KERI_ACDC_SPAC: str = '--AAA' # KERI, ACDC, and SPAC Protocol Stacks share the same tables
KERI: str = '--AAA' # KERI and ACDC Protocol Stacks share the same tables
ACDC: str = '--AAA' # KERI and ACDC Protocol Stacks share the same tables
SPAC: str = '--AAA' # KERI and ACDC Protocol Stacks share the same tables


def __iter__(self):
return iter(astuple(self)) # enables inclusion test with "in"
# duplicate values above just result in multiple entries in tuple so
# in inclusion still works

GenDex = GenusCodex() # Make instance



@dataclass
class MapDom:
"""Base class for dataclasses that support map syntax
Expand Down Expand Up @@ -173,25 +196,6 @@ def __iter__(self):

CtrDex_2_0 = CounterCodex_2_0()


@dataclass(frozen=True)
class GenusCodex(MapCodex):
"""GenusCodex is codex of protocol genera for code table.
Only provide defined codes.
Undefined are left out so that inclusion(exclusion) via 'in' operator works.
"""
KERI: str = '--AAA' # KERI and ACDC Protocol Stacks share the same tables
ACDC: str = '--AAA' # KERI and ACDC Protocol Stacks share the same tables


def __iter__(self):
return iter(astuple(self)) # enables value not key inclusion test with "in"
# duplicate values above just result in multiple entries in tuple so
# in inclusion still works

GenDex = GenusCodex() # Make instance

# keys and values as strings of keys
Codict1 = asdict(CtrDex_1_0)
Tagage_1_0 = namedtuple("Tagage_1_0", list(Codict1), defaults=list(Codict1))
Expand Down Expand Up @@ -581,10 +585,24 @@ def count(self):
"""
Returns ._count
Makes ._count read only
number of quadlets of b64 chars or triplets of b2 bytes of material
framed by counter
"""
return self._count


@property
def fullSize(self):
"""
Returns full size of counter in bytes
"""
_, _, fs, _ = self.sizes[self.code] # get from sizes table

return fs


@property
def qb64b(self):
"""
Expand Down
Loading

0 comments on commit bcb6f17

Please sign in to comment.