util

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const ED25519_CURVE = "ed25519 seed"
View Source
const HARDENED_OFFSET = 0x80000000

Variables

View Source
var DerivePathPrefix = regexp.MustCompile(`^[mM]'?\/?`)
View Source
var ExternalHTTPClient = &http.Client{
	Transport: gzhttp.Transport(externalTr),
	Timeout:   time.Second * 15,
}
View Source
var HTTPClient = &http.Client{
	Transport: gzhttp.Transport(internalTr),
	Timeout:   time.Second * 5,
}
View Source
var Validator *validator.Validate

Functions

func CopyHeader

func CopyHeader(dst http.Header, src http.Header, names ...string)

func DeriveEd25519 added in v1.2.2

func DeriveEd25519(
	seed []byte,
	derivationPath []uint32,
) (priv [32]byte)

SLIP-0010 https://github.com/satoshilabs/slips/blob/master/slip-0010.md

func DerivePath added in v1.2.2

func DerivePath(path string) ([]uint32, error)

func DigInvoke

func DigInvoke(function interface{}, opts ...dig.InvokeOption) error

DigInvoke ...

func DigProvide

func DigProvide(constructor interface{}, opts ...dig.ProvideOption) error

DigProvide ...

func IsNotFoundErr added in v0.6.4

func IsNotFoundErr(err error) bool

func NextDerivePath added in v1.2.2

func NextDerivePath(path string) (string, error)

func Ptr added in v0.4.0

func Ptr[T any](t T) *T

func RequestCBOR

func RequestCBOR(ctx context.Context, cli *http.Client, method, api string, input, output any) error

func RequestJSON

func RequestJSON(ctx context.Context, cli *http.Client, method, api string, input, output any) error

func SliceHas added in v0.4.0

func SliceHas[T comparable](sl []T, v T) bool

func ToDerivePath added in v1.2.2

func ToDerivePath(idxs []uint32) string

func Unmarshal added in v0.6.0

func Unmarshal[T any](b *Bytes) (*T, error)

Types

type Bytes added in v0.6.0

type Bytes []byte

func (Bytes) MarshalCBOR added in v0.6.0

func (r Bytes) MarshalCBOR() ([]byte, error)

func (Bytes) MarshalJSON added in v0.6.0

func (r Bytes) MarshalJSON() ([]byte, error)

func (Bytes) String added in v0.6.0

func (r Bytes) String() string

func (*Bytes) UnmarshalCBOR added in v0.6.0

func (r *Bytes) UnmarshalCBOR(data []byte) error

func (*Bytes) UnmarshalJSON added in v0.6.0

func (r *Bytes) UnmarshalJSON(data []byte) error

type ContextHTTPHeader

type ContextHTTPHeader http.Header

type ID

type ID xid.ID
var ANON ID = mustParseID("000000000000000anon0") // anonymous user
var JARVIS ID = mustParseID("0000000000000jarvis0") // system user
var ZeroID ID

func NewID added in v0.6.0

func NewID() ID

func ParseID added in v0.6.0

func ParseID(s string) (ID, error)

func TryParseID added in v0.6.0

func TryParseID(s string) *ID

func (ID) Bytes added in v1.2.2

func (id ID) Bytes() []byte

func (ID) MarshalCBOR

func (id ID) MarshalCBOR() ([]byte, error)

func (ID) MarshalJSON

func (id ID) MarshalJSON() ([]byte, error)

func (ID) MarshalText added in v0.6.0

func (id ID) MarshalText() ([]byte, error)

func (*ID) String

func (id *ID) String() string

func (*ID) UnmarshalCBOR

func (id *ID) UnmarshalCBOR(data []byte) error

func (*ID) UnmarshalJSON

func (id *ID) UnmarshalJSON(data []byte) error

func (*ID) UnmarshalText added in v0.6.0

func (id *ID) UnmarshalText(data []byte) error

type UUID

type UUID uuid.UUID

func NewUUID added in v0.6.0

func NewUUID() UUID

func (UUID) Base64 added in v0.2.0

func (id UUID) Base64() string

func (UUID) MarshalCBOR

func (id UUID) MarshalCBOR() ([]byte, error)

func (UUID) MarshalText

func (id UUID) MarshalText() ([]byte, error)

func (*UUID) String

func (id *UUID) String() string

func (*UUID) UnmarshalCBOR

func (id *UUID) UnmarshalCBOR(data []byte) error

func (*UUID) UnmarshalText

func (id *UUID) UnmarshalText(data []byte) error

Jump to

Keyboard shortcuts

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