Class KeyPairServiceImpl

java.lang.Object
com.kryptokrauts.aeternity.sdk.service.keypair.impl.KeyPairServiceImpl
All Implemented Interfaces:
KeyPairService

public final class KeyPairServiceImpl
extends java.lang.Object
implements KeyPairService
  • Constructor Summary

    Constructors
    Constructor Description
    KeyPairServiceImpl()  
  • Method Summary

    Modifier and Type Method Description
    java.lang.String byteToHex​(byte[] key)  
    HdWallet generateHdWallet​(java.lang.String mnemonicSeedPassword)
    creates a keyPair as well as a list of mnemonic seed words wrapped into HdWallet object, which can be used to restore the key (derived from BIP32/39 HD-Wallet generation) the number of seed words depends on the parameter defined in KeyPairServiceConfiguration
    KeyPair generateKeyPair()  
    HdKeyPair getNextKeyPair​(HdWallet mnemonicKeyPair)
    derives the next hardened key.
    void printChildKeyPair​(byte[] il, byte[] ir)  
    HdWallet recoverHdWallet​(java.util.List<java.lang.String> mnemonicSeedWords, java.lang.String mnemonicSeedPassword)
    recover keypair from given mnemonic seed word list with given seed password
    KeyPair recoverKeyPair​(java.lang.String privateKey)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KeyPairServiceImpl

      public KeyPairServiceImpl()
  • Method Details

    • generateHdWallet

      public HdWallet generateHdWallet​(java.lang.String mnemonicSeedPassword) throws AException
      Description copied from interface: KeyPairService
      creates a keyPair as well as a list of mnemonic seed words wrapped into HdWallet object, which can be used to restore the key (derived from BIP32/39 HD-Wallet generation) the number of seed words depends on the parameter defined in KeyPairServiceConfiguration
      Specified by:
      generateHdWallet in interface KeyPairService
      Parameters:
      mnemonicSeedPassword - password or null which is used to seed the list of mnemonics
      Returns:
      keypair with private and public key as well as the generated list of mnemonic seed words wrapped into HdWallet
      Throws:
      AException - in case of an error
    • recoverHdWallet

      public HdWallet recoverHdWallet​(java.util.List<java.lang.String> mnemonicSeedWords, java.lang.String mnemonicSeedPassword) throws AException
      Description copied from interface: KeyPairService
      recover keypair from given mnemonic seed word list with given seed password
      Specified by:
      recoverHdWallet in interface KeyPairService
      Parameters:
      mnemonicSeedWords - the words to recover the Hdwallet
      mnemonicSeedPassword - the password that protects the keypair(s) generated with the seed phrase (can be null)
      Returns:
      instance of HdWallet
      Throws:
      AException - in case of an error
    • byteToHex

      public java.lang.String byteToHex​(byte[] key)
    • printChildKeyPair

      public void printChildKeyPair​(byte[] il, byte[] ir)
    • getNextKeyPair

      public HdKeyPair getNextKeyPair​(HdWallet mnemonicKeyPair) throws AException
      Description copied from interface: KeyPairService
      derives the next hardened key. The derived keys are generated according to the deterministic tree saved within the given menomincKeyPair stated in BIP32
      Specified by:
      getNextKeyPair in interface KeyPairService
      Parameters:
      mnemonicKeyPair - mnemonicKeyPair containing the deterministic tree of keys necessary for derivation
      Returns:
      a new derived child raw keypair
      Throws:
      AException - in case of an error
    • generateKeyPair

      public KeyPair generateKeyPair()
      Specified by:
      generateKeyPair in interface KeyPairService
      Returns:
      a byte arrayed keypair
    • recoverKeyPair

      public KeyPair recoverKeyPair​(java.lang.String privateKey)
      Specified by:
      recoverKeyPair in interface KeyPairService
      Parameters:
      privateKey - private key (hex)
      Returns:
      the recovered keypair