class Prototok::Ciphers::V1::EncryptedMac
Public Class Methods
new(private_key)
click to toggle source
# File lib/prototok/ciphers/V1/encrypted_mac.rb, line 9 def initialize(private_key) @cipher = cipher_class.new(private_key) end
Public Instance Methods
decode(decoded_nonce, decoded_blob)
click to toggle source
# File lib/prototok/ciphers/V1/encrypted_mac.rb, line 18 def decode(decoded_nonce, decoded_blob) @cipher.open(decoded_nonce, decoded_blob) end
encode(blob)
click to toggle source
# File lib/prototok/ciphers/V1/encrypted_mac.rb, line 13 def encode(blob) nonce = RbNaCl::Random.random_bytes @cipher.nonce_bytes [nonce, @cipher.box(nonce, blob)] end