From 9d6a763f3ca639370212ce0e46531deb46954da7 Mon Sep 17 00:00:00 2001 From: Daniel Bluhm Date: Mon, 30 Oct 2023 11:25:07 -0400 Subject: [PATCH] style: formatting fixes Signed-off-by: Daniel Bluhm --- didcomm_messaging/multiformats/multibase.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/didcomm_messaging/multiformats/multibase.py b/didcomm_messaging/multiformats/multibase.py index 10b88bf..f66163c 100644 --- a/didcomm_messaging/multiformats/multibase.py +++ b/didcomm_messaging/multiformats/multibase.py @@ -41,17 +41,20 @@ def decode(self, value: str) -> bytes: class Base64UrlEncoder(MultibaseEncoder): """Base64URL encoding.""" + name = "base64url" character = "u" def encode(self, value: bytes) -> str: """Encode a byte string using the base64url encoding.""" import base64 + return base64.urlsafe_b64encode(value).decode().rstrip("=") def decode(self, value: str) -> bytes: """Decode a base64url encoded string.""" import base64 + return base64.urlsafe_b64decode(value + "=" * (-len(value) % 4))