From 5236ac5ae86cc87846d2cd69acfebe96acba1d69 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Fri, 3 Feb 2023 13:57:53 -0500 Subject: [PATCH] Add Base64URLString to SHA256Hash --- ct/types.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ct/types.go b/ct/types.go index d1619aa..883e9db 100644 --- a/ct/types.go +++ b/ct/types.go @@ -259,6 +259,11 @@ func (s SHA256Hash) Base64String() string { return base64.StdEncoding.EncodeToString(s[:]) } +// Returns the raw base64url representation of this SHA256Hash. +func (s SHA256Hash) Base64URLString() string { + return base64.RawURLEncoding.EncodeToString(s[:]) +} + // MarshalJSON implements the json.Marshaller interface for SHA256Hash. func (s SHA256Hash) MarshalJSON() ([]byte, error) { return []byte(`"` + s.Base64String() + `"`), nil