module HealthCards::Encoding

Encoding utilities for producing JWS

@see datatracker.ietf.org/doc/html/rfc7515#appendix-A.3.1

Public Instance Methods

decode(data) click to toggle source

Decodes the provided data using url safe base 64 @param data [String] the data to be decoded @return [String] the decoded data

# File lib/health_cards/encoding.rb, line 20
def decode(data)
  Base64.urlsafe_decode64(data)
end
encode(data) click to toggle source

Encodes the provided data using url safe base64 without padding @param data [String] the data to be encoded @return [String] the encoded data

# File lib/health_cards/encoding.rb, line 13
def encode(data)
  Base64.urlsafe_encode64(data, padding: false).gsub("\n", '')
end