class Secp256k1::BaseKey

Public Class Methods

new(ctx, flags) click to toggle source
# File lib/secp256k1/key.rb, line 7
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