Class: SymmetricEncryption::Encoder::Base64UrlSafe
- Inherits:
-
Object
- Object
- SymmetricEncryption::Encoder::Base64UrlSafe
- Defined in:
- lib/symmetric_encryption/encoder.rb
Instance Method Summary collapse
Instance Method Details
#decode(encoded_string) ⇒ Object
78 79 80 81 82 83 |
# File 'lib/symmetric_encryption/encoder.rb', line 78 def decode(encoded_string) return encoded_string if encoded_string.nil? || (encoded_string == "") decoded_string = ::Base64.urlsafe_decode64(encoded_string) decoded_string.force_encoding(SymmetricEncryption::BINARY_ENCODING) end |
#encode(binary_string) ⇒ Object
71 72 73 74 75 76 |
# File 'lib/symmetric_encryption/encoder.rb', line 71 def encode(binary_string) return binary_string if binary_string.nil? || (binary_string == "") encoded_string = ::Base64.urlsafe_encode64(binary_string) encoded_string.force_encoding(SymmetricEncryption::UTF8_ENCODING) end |