Class Transactor


  • public class Transactor
    extends Object
    Transactor provides helper methods to hide the complexity of Tx creation, signature and API dialog.
    • Constructor Detail

      • Transactor

        public Transactor​(String apiUrl,
                          String chainId,
                          String companyChainId,
                          PrivateKey txSigner)
        Transactor constructor.
        Parameters:
        apiUrl - String
        chainId - String
        companyChainId - String
        txSigner - PrivateKey
      • Transactor

        public Transactor​(String apiUrl)
        Transactor constructor.
        Parameters:
        apiUrl - String
    • Method Detail

      • sendCertificateRawV1

        public TxStatus sendCertificateRawV1​(String uuid,
                                             byte[] value)
                                      throws Exception
        creates a CertificateRaw (V1), wraps in a tx and sends it to the API.
        Parameters:
        uuid - String
        value - byte[]
        Returns:
        TxStatus tx status
        Throws:
        Exception - the exception
      • sendCertificateEd25519V1

        public TxStatus sendCertificateEd25519V1​(String uuid,
                                                 PublicKey signer,
                                                 byte[] signature)
                                          throws Exception
        creates a CertificateEd25519 (V1), wraps in a tx and sends it to the API.
        Parameters:
        uuid - String
        signer - PublicKey
        signature - byte[]
        Returns:
        TxStatus tx status
        Throws:
        Exception - the exception
      • retrieveCertificate

        public TxWrapper retrieveCertificate​(String companyChainId,
                                             String uuid)
                                      throws IOException
        fetches the API to find the corresponding tx and return a tx wrapper.
        Parameters:
        companyChainId - String
        uuid - String
        Returns:
        TxWrapper tx wrapper
        Throws:
        IOException - the io exception
      • retrieveCertificatesHistory

        public TxWrappers retrieveCertificatesHistory​(String companyChainId,
                                                      String uuid)
                                               throws IOException
        fetches the API to find the corresponding txs and returns tx wrappers or an error.
        Parameters:
        companyChainId - String
        uuid - String
        Returns:
        TxWrappers tx wrappers
        Throws:
        IOException - the io exception
      • sendSecretNaclBoxV1

        public TxStatus sendSecretNaclBoxV1​(String uuid,
                                            PublicKey sender,
                                            byte[] nonce,
                                            byte[] content)
                                     throws Exception
        creates a SecretNaclBox (V1), wraps in a tx and sends it to the API.
        Parameters:
        uuid - String
        sender - io.katena.crypto.Nacl.PublicKey
        nonce - byte[]
        content - byte[]
        Returns:
        TxStatus tx status
        Throws:
        Exception - the exception
      • retrieveSecrets

        public TxWrappers retrieveSecrets​(String companyChainId,
                                          String uuid)
                                   throws IOException
        fetches the API to find the corresponding txs and returns tx wrappers.
        Parameters:
        companyChainId - String
        uuid - String
        Returns:
        TxWrappers tx wrappers
        Throws:
        IOException - the io exception
      • getTx

        public Tx getTx​(TxData txData)
                 throws Exception
        signs a tx data and returns a new tx ready to be sent.
        Parameters:
        txData - TxData
        Returns:
        Tx tx
        Throws:
        Exception - the exception
      • getTxDataState

        public byte[] getTxDataState​(String chainId,
                                     Date nonceTime,
                                     TxData txData)
        returns the sorted and marshaled json representation of a TxData ready to be signed.
        Parameters:
        chainId - String
        nonceTime - Date
        txData - TxData
        Returns:
        byte[] byte [ ]
      • formatBcid

        protected String formatBcid​(String companyChainId,
                                    String uuid)
        concatenates a company chain id and a uuid into a bcid.
        Parameters:
        companyChainId - String
        uuid - String
        Returns:
        String string