Method: Prevoty::Client#generate_ecdsa_keypair

Defined in:
lib/prevoty/client.rb

#generate_ecdsa_keypair(curve) ⇒ ECDSAPrivateKey

Generate a keypair using ECDSA

Parameters:

Returns:



370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/prevoty/client.rb', line 370

def generate_ecdsa_keypair(curve)
  params = {api_key: @api_key, algorithm: Prevoty::Crypto::KeyAlgorithms::ECDSA, meta: curve}

  response = HTTParty.post("#{@base}/1/crypto/genkeypair", query: params)
  case response.code
  when 200 then return ECDSAPrivateKey.new(JSON.parse(response.body))
  when 400 then raise BadInputParameter
  when 403 then raise BadAPIKey
  when 500 then raise InternalError
  when 507 then raise AccountQuotaExceeded
  else raise Exception
  end
end