Class: Prototok::Ciphers::V1::Mac
- Defined in:
- lib/prototok/ciphers/V1/mac.rb
Instance Method Summary collapse
- #decode(decoded_auth, decoded_blob) ⇒ Object
- #encode(blob) ⇒ Object
-
#initialize(private_key) ⇒ Mac
constructor
A new instance of Mac.
Methods inherited from Base
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 |