sodium.cr/src/sodium/key.cr

16 lines
242 B
Crystal
Raw Normal View History

module Sodium
2017-07-12 05:13:52 +02:00
abstract class Key
abstract def bytes
delegate to_slice, to: @bytes
2017-07-12 05:13:52 +02:00
def to_base64
Base64.encode(bytes)
end
def self.from_base64(encoded_key)
new(Base64.decode(encoded_key))
end
end
end