Class: Secp256k1::BaseKey
- Inherits:
-
Object
- Object
- Secp256k1::BaseKey
- Defined in:
- lib/secp256k1/key.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(ctx, flags) ⇒ BaseKey
constructor
A new instance of BaseKey.
Constructor Details
#initialize(ctx, flags) ⇒ BaseKey
Returns a new instance of BaseKey.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/secp256k1/key.rb', line 8 def initialize(ctx, flags) @destroy = false unless ctx raise ArgumentError, "invalid flags" unless [NO_FLAGS, FLAG_SIGN, FLAG_VERIFY, ALL_FLAGS].include?(flags) ctx = FFI::AutoPointer.new C.secp256k1_context_create(flags), C.method(:secp256k1_context_destroy) @destroy = true end @flags = flags @ctx = ctx end |