class Izokatu::Rbnacl::Encrypter

Abstract class for Rbnacl encrypters

@abstract Subclasses are containing implementation of {#create_encrypter!}

Attributes

nonce[R]

@return [String] initialization vector for one-time use

Public Class Methods

new(clear_data:) click to toggle source

Initializing option for encryption

@param clear_data (clear_data)

@since 0.1.0

Calls superclass method Izokatu::Encrypter::new
# File lib/izokatu/rbnacl/encrypter.rb, line 19
def initialize(clear_data:)
  super
  create_encrypter!
  generate_nonce!
end

Public Instance Methods

create_encrypter!() click to toggle source

Creating encrypter instance

@raise RuntimeError

@since 0.1.0

# File lib/izokatu/rbnacl/encrypter.rb, line 30
def create_encrypter!
  raise 'Not implemented!'
end
generate_nonce!() click to toggle source

Generating nonce from encrypter instance

@return [String] initialization vector for one-time use

@since 0.1.0

# File lib/izokatu/rbnacl/encrypter.rb, line 40
def generate_nonce!
  @nonce = RbNaCl::Random.random_bytes(encrypter.nonce_bytes)
end