utils

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertHexDecode

func AssertHexDecode(s string) []byte

func BuildLogger

func BuildLogger(options config.LogOptions) (*zap.Logger, *zap.Config, error)

func EcdsaPrivateKeyToString

func EcdsaPrivateKeyToString(key *ecdsa.PrivateKey) string

func EcdsaPublicKeyToAddress

func EcdsaPublicKeyToAddress(key *ecdsa.PublicKey) string

func EcdsaPublicKeyToString

func EcdsaPublicKeyToString(key *ecdsa.PublicKey) string

func GenerateEcdsaPrivateKey

func GenerateEcdsaPrivateKey() (*ecdsa.PrivateKey, error)

func GetCredentialsForAddress

func GetCredentialsForAddress(
	isTLS bool,
) (credentials.TransportCredentials, error)

func GetEventSig

func GetEventSig(abi *abi.ABI, eventName string) (string, error)

Extract the an event signature from an ABI by event name

func GetEventTopic

func GetEventTopic(abi *abi.ABI, eventName string) (common.Hash, error)

Extract the an event topic (the hash of the signature) from an ABI by event name

func HashJWTSignatureInput

func HashJWTSignatureInput(textToSign []byte) []byte

func HashOriginatorSignatureInput

func HashOriginatorSignatureInput(unsignedOriginatorEnvelope []byte) []byte

func HashPayerSignatureInput

func HashPayerSignatureInput(unsignedClientEnvelope []byte) []byte

func HexDecode

func HexDecode(s string) ([]byte, error)

func HexEncode

func HexEncode(data []byte) string

func HttpAddressToGrpcTarget

func HttpAddressToGrpcTarget(httpAddress string) (string, bool, error)

/ Maps from a URL, as defined in https://pkg.go.dev/net/url#URL, to a gRPC target, / as defined in https://github.com/grpc/grpc/blob/master/doc/naming.md

func ParseEcdsaPrivateKey

func ParseEcdsaPrivateKey(key string) (*ecdsa.PrivateKey, error)

func ParseEcdsaPublicKey

func ParseEcdsaPublicKey(key string) (*ecdsa.PublicKey, error)

Take the stringified form of an ECDSA public key and return the *ecdsa.PublicKey

func ParseInboxId

func ParseInboxId(inboxIdString string) ([32]byte, error)

func RandomSleep

func RandomSleep(maxTimeMs int)

func SignPayerEnvelope

func SignPayerEnvelope(
	unsignedClientEnvelope []byte,
	payerPrivateKey *ecdsa.PrivateKey,
) ([]byte, error)

func Unimplemented

func Unimplemented(message string, unusedVariables ...interface{})

Unimplemented panics with a message indicating that the function is not implemented.

func UnmarshalClientEnvelope

func UnmarshalClientEnvelope(envelope []byte) (*envelopes.ClientEnvelope, error)

func UnmarshalOriginatorEnvelope

func UnmarshalOriginatorEnvelope(envelope []byte) (*envelopes.OriginatorEnvelope, error)

func UnmarshalUnsignedEnvelope

func UnmarshalUnsignedEnvelope(
	unsignedEnvelopeBytes []byte,
) (*envelopes.UnsignedOriginatorEnvelope, error)

func Unused

func Unused(unusedVariables ...interface{})

Unused is a no-op function that takes any number of arguments and does nothing with them. Useful for temporarily silencing "unused variable" warnings in development.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL