module Stellar::KeyPair::FactoryMethods
Public Instance Methods
from_address(address)
click to toggle source
# File lib/stellar/key_pair.rb, line 9 def from_address(address) pk_bytes = Util::StrKey.check_decode(:account_id, address) from_public_key(pk_bytes) end
from_network_passphrase(passphrase)
click to toggle source
# File lib/stellar/key_pair.rb, line 31 def from_network_passphrase(passphrase) network_id = Digest::SHA256.digest(passphrase) from_raw_seed network_id end
from_public_key(pk_bytes)
click to toggle source
# File lib/stellar/key_pair.rb, line 20 def from_public_key(pk_bytes) public_key = RbNaCl::VerifyKey.new(pk_bytes) new(public_key) end
from_raw_seed(seed_bytes)
click to toggle source
# File lib/stellar/key_pair.rb, line 14 def from_raw_seed(seed_bytes) secret_key = RbNaCl::SigningKey.new(seed_bytes) public_key = secret_key.verify_key new(public_key, secret_key) end
from_seed(seed)
click to toggle source
# File lib/stellar/key_pair.rb, line 4 def from_seed(seed) seed_bytes = Util::StrKey.check_decode(:seed, seed) from_raw_seed seed_bytes end
master()
click to toggle source
# File lib/stellar/key_pair.rb, line 36 def master from_raw_seed(Stellar.current_network_id) end
random()
click to toggle source
# File lib/stellar/key_pair.rb, line 25 def random secret_key = RbNaCl::SigningKey.generate public_key = secret_key.verify_key new(public_key, secret_key) end