def set_encode_key_value(self, value, store_type):
        """Save the key value base on it's storage type."""
        self._store_type = store_type
        if store_type == PUBLIC_KEY_STORE_TYPE_HEX:
            self._value = value.hex()
        elif store_type == PUBLIC_KEY_STORE_TYPE_BASE64:
            self._value = b64encode(value).decode()
        elif store_type == PUBLIC_KEY_STORE_TYPE_BASE85:
            self._value = b85encode(value).decode()
        elif store_type == PUBLIC_KEY_STORE_TYPE_JWK:
            # TODO: need to decide on which jwk library to import?
            raise NotImplementedError
        else:
            self._value = value
        return value
def set_encode_key_value ( self , value , store_type ) : self . _store_type = store_type if store_type == PUBLIC_KEY_STORE_TYPE_HEX : self . _value = value . hex ( ) elif store_type == PUBLIC_KEY_STORE_TYPE_BASE64 : self . _value = b64encode ( value ) . decode ( ) elif store_type == PUBLIC_KEY_STORE_TYPE_BASE85 : self . _value = b85encode ( value ) . decode ( ) elif store_type == PUBLIC_KEY_STORE_TYPE_JWK : raise NotImplementedError else : self . _value = value return value
Save the key value base on it's storage type.