Documentation ¶
Index ¶
- Variables
- func DecodeResponse[T any](encoded []byte) (*T, error)
- func ToInternalError(err error) error
- type Balance
- type BalanceType
- type Call
- type CallType
- type EnclaveResponse
- func AsEmptyResponse() *EnclaveResponse
- func AsEncryptedEmptyResponse(encryptHandler Encryptor) *EnclaveResponse
- func AsEncryptedError(err error, encrypt Encryptor) *EnclaveResponse
- func AsEncryptedResponse[T any](data *T, encryptHandler Encryptor) *EnclaveResponse
- func AsPlaintextError(err error) *EnclaveResponse
- func AsPlaintextResponse(encResp EncryptedUserResponse) *EnclaveResponse
- func AsSystemErr() *EnclaveResponse
- func ToEnclaveResponse(encoded []byte) *EnclaveResponse
- type EncryptedUserResponse
- type Encryptor
- type Gas
- type GasPriceType
- type GasType
- type Logs
- type LogsType
- type NonceType
- type PrivateQueryResponse
- type RawTx
- type RawTxType
- type ReceiptType
- type Receipts
- type TxByHash
- type TxCount
- type TxReceipt
- type TxType
- type UserResponse
- type ViewingKeyEncryptor
Constants ¶
This section is empty.
Variables ¶
var InternalErrMsg = "internal system error"
InternalErrMsg is the common response returned to the user when an InternalError occurs
Functions ¶
func DecodeResponse ¶
DecodeResponse - Extracts the user response from a decrypted bytes field and returns the result or nil and optional error.
func ToInternalError ¶
ToInternalError - Converts an error to an InternalError
Types ¶
type Balance ¶
type Balance = EnclaveResponse // The response for an RPC getBalance request, as a JSON object encrypted with the viewing key of the user.
type BalanceType ¶
type Call ¶
type Call = EnclaveResponse // As above, but for an RPC call request.
type EnclaveResponse ¶
type EnclaveResponse struct { EncUserResponse EncryptedUserResponse Err *string }
EnclaveResponse - The response that the enclave returns for sensitive API calls The user response is encrypted while the error is in plaintext
func AsEmptyResponse ¶
func AsEmptyResponse() *EnclaveResponse
AsEmptyResponse - Creates an empty enclave response. Useful for when no error encountered but also no result found.
func AsEncryptedEmptyResponse ¶ added in v0.22.0
func AsEncryptedEmptyResponse(encryptHandler Encryptor) *EnclaveResponse
AsEncryptedEmptyResponse - encrypts an empty message
func AsEncryptedError ¶
func AsEncryptedError(err error, encrypt Encryptor) *EnclaveResponse
AsEncryptedError - Encodes and encrypts an error to be returned for a concrete user.
func AsEncryptedResponse ¶
func AsEncryptedResponse[T any](data *T, encryptHandler Encryptor) *EnclaveResponse
AsEncryptedResponse - wraps the data passed into the proper format, serializes it and encrypts it. It is then encoded in a plaintext response.
func AsPlaintextError ¶
func AsPlaintextError(err error) *EnclaveResponse
AsPlaintextError - generates a plaintext response containing a visible to the host error.
func AsPlaintextResponse ¶
func AsPlaintextResponse(encResp EncryptedUserResponse) *EnclaveResponse
AsPlaintextResponse - creates the plaintext part of the enclave response It would be visible that there is an enclave response, but the bytes in it will still be encrypted todo - rename
func AsSystemErr ¶
func AsSystemErr() *EnclaveResponse
AsSystemErr - generates a plaintext response containing a visible error.
func ToEnclaveResponse ¶
func ToEnclaveResponse(encoded []byte) *EnclaveResponse
ToEnclaveResponse - Converts an encoded plaintext into an enclave response
func (*EnclaveResponse) Encode ¶
func (er *EnclaveResponse) Encode() []byte
Encode - serializes the enclave response into a json
func (*EnclaveResponse) Error ¶
func (er *EnclaveResponse) Error() error
type EncryptedUserResponse ¶
type EncryptedUserResponse []byte
EncryptedUserResponse - This is the encoded & encrypted form of a UserResponse[Type]
type Gas ¶
type Gas = EnclaveResponse // As above, but for an RPC estimateGas response.
type GasPriceType ¶ added in v0.21.0
type Logs ¶
type Logs = EnclaveResponse
type PrivateQueryResponse ¶
type PrivateQueryResponse = EnclaveResponse
type RawTx ¶
type RawTx = EnclaveResponse // As above, but for an RPC sendRawTransaction request.
type ReceiptType ¶
type Receipts ¶
type Receipts = EnclaveResponse
type TxByHash ¶
type TxByHash = EnclaveResponse // As above, but for an RPC getTransactionByHash request.
type TxCount ¶
type TxCount = EnclaveResponse // As above, but for an RPC getTransactionCount request.
type TxReceipt ¶
type TxReceipt = EnclaveResponse // As above, but for an RPC getTransactionReceipt request.
type TxType ¶
type TxType = types.Transaction
type UserResponse ¶
UserResponse - The response struct that contains either data or result which will be decoded only on the client side.
func (*UserResponse[T]) Error ¶
func (ur *UserResponse[T]) Error() error
Error - converts the encoded string in the response into a normal error and returns it.