Skip to content

Commit

Permalink
style: formatting fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bluhm <[email protected]>
  • Loading branch information
dbluhm committed Oct 30, 2023
1 parent d8b29c7 commit 9d6a763
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions didcomm_messaging/multiformats/multibase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))


Expand Down

0 comments on commit 9d6a763

Please sign in to comment.