sodium.cr/src/cox/public_key.cr

16 lines
324 B
Crystal
Raw Normal View History

2017-07-12 05:13:52 +02:00
require "./lib_sodium"
module Cox
class PublicKey < Key
property bytes : Bytes
KEY_SIZE = LibSodium::PUBLIC_KEY_SIZE
2017-07-12 05:13:52 +02:00
def initialize(@bytes : Bytes)
if bytes.bytesize != KEY_SIZE
raise ArgumentError.new("Public key must be #{KEY_SIZE} bytes, got #{bytes.bytesize}")
2017-07-12 05:13:52 +02:00
end
end
end
end