KeyPairFactory

Overview

Transforms given value into Stellar::Keypair object.

KeyPairFactory Object

AttributeTypeDescription
subjectStringGiven value to identify keypair

📘

subject

subject can be any of the following:

  • String
  • Stellar::Account
  • Stellar::PublicKey
  • Stellar::SignerKey
  • Stellar::Keypair

Methods

#produce(subject) ⇒ Stellar::Keypair

Generates Stellar::Keypair from subject, use Stellar::Client.to_keypair as shortcut.

# From a public key
guser = "GDPNZJR42G4PVA3235JHCGGTU2J54X4XGJIMQGDJXYGHQDY6MQW5SZ5Y"
keypair = Mobius::Client::Blockchain::KeyPairFactory.produce(guser)
# =>
<Stellar::KeyPair:0x00007f01c0004da8 @public_key=# 
<RbNaCl::Signatures::Ed25519::VerifyKey:dedca63c>, @secret_seed=nil>
  
# From a private seed
suser = "SCRBVUQF4N7JNXSEVQKZ4OEOEORC54BURPI3RCKN4FP3CO6AA7EZTJOA"
keypair = Mobius::Client::Blockchain::KeyPairFactory.produce(suser)
# =>
<Stellar::KeyPair:0x00007f01b8565638 @public_key=#
<RbNaCl::Signatures::Ed25519::VerifyKey:dedca63c>, @secret_seed=#
<RbNaCl::Signatures::Ed25519::SigningKey:a21ad205>>