Method: Lockbox::AES_GCM#initialize

Defined in:
lib/lockbox/aes_gcm.rb

#initialize(key) ⇒ AES_GCM

Returns a new instance of AES_GCM.

Raises:

  • (ArgumentError)


3
4
5
6
7
8
# File 'lib/lockbox/aes_gcm.rb', line 3

def initialize(key)
  raise ArgumentError, "Key must be 32 bytes" unless key && key.bytesize == 32
  raise ArgumentError, "Key must be binary" unless key.encoding == Encoding::BINARY

  @key = key
end