Class: Prototok::Ciphers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/prototok/ciphers.rb

Direct Known Subclasses

V1::EncryptedMac, V1::EncryptedSign, V1::Mac, V1::Sign

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.cipher_classObject



9
10
11
12
# File 'lib/prototok/ciphers.rb', line 9

def cipher_class
  @cipher_class ||
    raise(Errors::CipherError, 'No cipher_class declared')
end

Class Method Details

.keyObject



14
15
16
# File 'lib/prototok/ciphers.rb', line 14

def key
  RbNaCl::Random.random_bytes(cipher_class.key_bytes)
end

Instance Method Details

#cipher_classObject



19
20
21
# File 'lib/prototok/ciphers.rb', line 19

def cipher_class
  self.class.cipher_class
end