Skip to content

Commit

Permalink
Finished refactor Bexter so rawify and derawify can be called externa…
Browse files Browse the repository at this point in the history
…lly as static and class methods
  • Loading branch information
SmithSamuelM committed Aug 10, 2024
1 parent 8c038c9 commit c1798db
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/keri/core/coring.py
Original file line number Diff line number Diff line change
Expand Up @@ -2646,7 +2646,8 @@ def __init__(self, raw=None, qb64b=None, qb64=None, qb2=None,
raise ValidationError("Invalid code = {} for Bexter."
"".format(self.code))

def _rawify(self, bext):
@staticmethod
def _rawify(bext):
"""Returns raw value equivalent of Base64 text.
Suitable for variable sized matter
Expand All @@ -2661,7 +2662,7 @@ def _rawify(self, bext):
return raw # raw binary equivalent of text

@classmethod
def _decode(cls, raw, code):
def _derawify(cls, raw, code):
"""Returns decoded raw as B64 str aka bext value
Returns:
Expand All @@ -2684,16 +2685,7 @@ def bext(self):
Property bext: Base64 text value portion of qualified b64 str
Returns the value portion of .qb64 with text code and leader removed
"""
return self._decode(raw=self.raw, code=self.code)
#_, _, _, _, ls = self.Sizes[self.code]
#bext = encodeB64(bytes([0] * ls) + self.raw)
#ws = 0
#if ls == 0 and bext:
#if bext[0] == ord(b'A'): # strip leading 'A' zero pad
#ws = 1
#else:
#ws = (ls + 1) % 4
#return bext.decode('utf-8')[ws:]
return self._derawify(raw=self.raw, code=self.code)


class Pather(Bexter):
Expand Down

0 comments on commit c1798db

Please sign in to comment.