From c1798db6653be6265f12a69c57817fcdbf9e69d7 Mon Sep 17 00:00:00 2001 From: Samuel M Smith Date: Sat, 10 Aug 2024 16:32:30 -0600 Subject: [PATCH] Finished refactor Bexter so rawify and derawify can be called externally as static and class methods --- src/keri/core/coring.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/keri/core/coring.py b/src/keri/core/coring.py index 973f5e50..dd36a691 100644 --- a/src/keri/core/coring.py +++ b/src/keri/core/coring.py @@ -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 @@ -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: @@ -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):