Package com.github.katenachain
Class Transactor
- java.lang.Object
-
- com.github.katenachain.Transactor
-
public class Transactor extends Object
Transactor provides helper methods to hide the complexity of Tx creation, signature and API dialog.
-
-
Constructor Summary
Constructors Constructor Description Transactor(String apiUrl)Transactor constructor.Transactor(String apiUrl, String chainId, String companyChainId, PrivateKey txSigner)Transactor constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TxgetTx(TxData txData)signs a tx data and returns a new tx ready to be sent.byte[]getTxDataState(String chainId, Date nonceTime, TxData txData)returns the sorted and marshaled json representation of a TxData ready to be signed.TxWrapperretrieveCertificate(String companyChainId, String uuid)fetches the API to find the corresponding tx and return a tx wrapper.TxWrappersretrieveCertificatesHistory(String companyChainId, String uuid)fetches the API to find the corresponding txs and returns tx wrappers or an error.TxWrappersretrieveSecrets(String companyChainId, String uuid)fetches the API to find the corresponding txs and returns tx wrappers.TxStatussendCertificateEd25519V1(String uuid, PublicKey signer, byte[] signature)creates a CertificateEd25519 (V1), wraps in a tx and sends it to the API.TxStatussendCertificateRawV1(String uuid, byte[] value)creates a CertificateRaw (V1), wraps in a tx and sends it to the API.TxStatussendSecretNaclBoxV1(String uuid, PublicKey sender, byte[] nonce, byte[] content)creates a SecretNaclBox (V1), wraps in a tx and sends it to the API.
-
-
-
Constructor Detail
-
Transactor
public Transactor(String apiUrl, String chainId, String companyChainId, PrivateKey txSigner)
Transactor constructor.
-
Transactor
public Transactor(String apiUrl)
Transactor constructor.
-
-
Method Detail
-
sendCertificateRawV1
public TxStatus sendCertificateRawV1(String uuid, byte[] value) throws IOException, ApiException, SignatureException, NoSuchAlgorithmException, InvalidKeyException, ClientException
creates a CertificateRaw (V1), wraps in a tx and sends it to the API.
-
sendCertificateEd25519V1
public TxStatus sendCertificateEd25519V1(String uuid, PublicKey signer, byte[] signature) throws IOException, ApiException, SignatureException, NoSuchAlgorithmException, InvalidKeyException, ClientException
creates a CertificateEd25519 (V1), wraps in a tx and sends it to the API.
-
retrieveCertificate
public TxWrapper retrieveCertificate(String companyChainId, String uuid) throws IOException, ApiException
fetches the API to find the corresponding tx and return a tx wrapper.- Throws:
IOExceptionApiException
-
retrieveCertificatesHistory
public TxWrappers retrieveCertificatesHistory(String companyChainId, String uuid) throws IOException, ApiException
fetches the API to find the corresponding txs and returns tx wrappers or an error.- Throws:
IOExceptionApiException
-
sendSecretNaclBoxV1
public TxStatus sendSecretNaclBoxV1(String uuid, PublicKey sender, byte[] nonce, byte[] content) throws IOException, ApiException, SignatureException, NoSuchAlgorithmException, InvalidKeyException, ClientException
creates a SecretNaclBox (V1), wraps in a tx and sends it to the API.
-
retrieveSecrets
public TxWrappers retrieveSecrets(String companyChainId, String uuid) throws IOException, ApiException
fetches the API to find the corresponding txs and returns tx wrappers.- Throws:
IOExceptionApiException
-
getTx
public Tx getTx(TxData txData) throws ClientException, NoSuchAlgorithmException, InvalidKeyException, SignatureException
signs a tx data and returns a new tx ready to be sent.
-
-