Class: TweetNaCl::CryptoSign
- Inherits:
-
Object
- Object
- TweetNaCl::CryptoSign
- Defined in:
- lib/tweetnacl/crypto_sign.rb
Instance Attribute Summary collapse
-
#keypair ⇒ Object
readonly
Returns the value of attribute keypair.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#signed_message ⇒ Object
readonly
Returns the value of attribute signed_message.
Instance Method Summary collapse
-
#initialize(keypair = KeyPair.new(TweetNaCl.crypto_sign_keypair)) ⇒ CryptoSign
constructor
A new instance of CryptoSign.
- #sign(message) ⇒ Object
- #verify(message) ⇒ Object
Constructor Details
#initialize(keypair = KeyPair.new(TweetNaCl.crypto_sign_keypair)) ⇒ CryptoSign
Returns a new instance of CryptoSign.
5 6 7 |
# File 'lib/tweetnacl/crypto_sign.rb', line 5 def initialize(keypair = KeyPair.new(TweetNaCl.crypto_sign_keypair)) @keypair = keypair end |
Instance Attribute Details
#keypair ⇒ Object (readonly)
Returns the value of attribute keypair.
3 4 5 |
# File 'lib/tweetnacl/crypto_sign.rb', line 3 def keypair @keypair end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/tweetnacl/crypto_sign.rb', line 3 def end |
#signed_message ⇒ Object (readonly)
Returns the value of attribute signed_message.
3 4 5 |
# File 'lib/tweetnacl/crypto_sign.rb', line 3 def end |
Instance Method Details
#sign(message) ⇒ Object
9 10 11 |
# File 'lib/tweetnacl/crypto_sign.rb', line 9 def sign() = TweetNaCl.crypto_sign(, @keypair.secret_key) end |
#verify(message) ⇒ Object
13 14 15 |
# File 'lib/tweetnacl/crypto_sign.rb', line 13 def verify() = TweetNaCl.crypto_sign_open(., @keypair.public_key) end |