class TweetNaCl::CryptoBox

Attributes

cipher[R]
keypair[R]
message[R]

Public Class Methods

new(keypair = KeyPair.new) click to toggle source
# File lib/tweetnacl/crypto_box.rb, line 5
def initialize(keypair = KeyPair.new)
  @keypair = keypair
end

Public Instance Methods

close(message, nonce) click to toggle source
# File lib/tweetnacl/crypto_box.rb, line 9
def close(message, nonce)
  @cipher = TweetNaCl.crypto_box(message, nonce, @keypair.public_key, @keypair.secret_key)
end
open(box, nonce) click to toggle source
# File lib/tweetnacl/crypto_box.rb, line 13
def open(box, nonce)
  @message = TweetNaCl.crypto_box_open(box.cipher, nonce, @keypair.public_key, @keypair.secret_key)
end