utils

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: MIT Imports: 22 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 BuildNamespace added in v0.1.2

func BuildNamespace(options config.ServerOptions) string

func BytesToId added in v0.1.1

func BytesToId(bytes []byte) ([32]byte, 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(originatorID uint32, 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 MinutesSinceEpoch added in v0.3.0

func MinutesSinceEpoch(timestamp time.Time) int32

func MinutesSinceEpochNow added in v0.3.0

func MinutesSinceEpochNow() int32

func NsToDate added in v0.3.0

func NsToDate(ns int64) time.Time

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(ctx context.Context, maxDuration time.Duration)

func SignClientEnvelope added in v0.1.1

func SignClientEnvelope(
	originatorID uint32,
	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