Class: Prototok::Ciphers::V1::Mac

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

Instance Method Summary collapse

Methods inherited from Base

#cipher_class, key

Constructor Details

#initialize(private_key) ⇒ Mac

Returns a new instance of Mac.



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

def initialize(private_key)
  @cipher = cipher_class.new(private_key)
end

Instance Method Details

#decode(decoded_auth, decoded_blob) ⇒ Object



17
18
19
20
# File 'lib/prototok/ciphers/V1/mac.rb', line 17

def decode(decoded_auth, decoded_blob)
  @cipher.verify(decoded_auth, decoded_blob)
  decoded_blob
end

#encode(blob) ⇒ Object



13
14
15
# File 'lib/prototok/ciphers/V1/mac.rb', line 13

def encode(blob)
  [@cipher.auth(blob), blob]
end