beacon

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MoneysocketHrp = "moneysocket"
View Source
const SharedSeedLength = 16

Variables

This section is empty.

Functions

This section is empty.

Types

type Beacon

type Beacon struct {
	// contains filtered or unexported fields
}

func DecodeFromBech32Str

func DecodeFromBech32Str(tlvBytes string) (Beacon, error)

func DecodeTlvs

func DecodeTlvs(b []byte) (beacon Beacon, err error)

func NewBeacon

func NewBeacon() Beacon

func NewBeaconFromSeed

func NewBeaconFromSeed(seed SharedSeed) Beacon

func (*Beacon) AddLocation

func (b *Beacon) AddLocation(loc location.Location)

apppend a location to the beacon

func (Beacon) EncodeLocationListTlvs

func (b Beacon) EncodeLocationListTlvs() []byte

encode a list of locations as tlvs

func (Beacon) EncodeTlvs

func (b Beacon) EncodeTlvs() []byte

encode beacon tlvs

func (Beacon) GetSharedSeed

func (b Beacon) GetSharedSeed() SharedSeed

fetch the shared seed from the beacon

func (Beacon) Locations

func (b Beacon) Locations() []location.Location

func (Beacon) ToBech32Str

func (b Beacon) ToBech32Str() string

func (Beacon) ToObject

func (b Beacon) ToObject() map[string]interface{}

type SharedSeed

type SharedSeed struct {
	// contains filtered or unexported fields
}

func BytesToSharedSeed

func BytesToSharedSeed(rawBytes []byte) (seed SharedSeed, err error)

create a shared seed from a byte slice

func HexToSharedSeed

func HexToSharedSeed(rawHex string) (seed SharedSeed, err error)

create a shared seed from a hex

func NewSharedSeed

func NewSharedSeed() SharedSeed

generate a new random shared seed

func (SharedSeed) DeriveAes256Key

func (s SharedSeed) DeriveAes256Key() []byte

returns a derived aes256 key wrapper around DoubleSha256

func (SharedSeed) DeriveRendezvousId

func (s SharedSeed) DeriveRendezvousId() []byte

create a double sha256 of the derived aes 256 key (itself a double sha-256)

func (SharedSeed) DoubleSha256

func (s SharedSeed) DoubleSha256(inputBytes []byte) []byte

TODO: find out why these are part of this struct double sha 256

func (SharedSeed) EncodedTLV

func (s SharedSeed) EncodedTLV() []byte

encode the static record into a

func (SharedSeed) Equal

func (s SharedSeed) Equal(seed SharedSeed) bool

check if two seeds are equal

func (SharedSeed) GetBytes

func (s SharedSeed) GetBytes() []byte

get bytes

func (SharedSeed) Hash

func (s SharedSeed) Hash() uint64

convert ints to hash

func (SharedSeed) Hex

func (s SharedSeed) Hex() string

convert shared seed to string

func (SharedSeed) Sha256

func (s SharedSeed) Sha256(inputBytes []byte) string

TODO: find out why these are part of this struct sha256 the seed bytes, format as string

func (SharedSeed) TLV

func (s SharedSeed) TLV() tlv.Record

encode the tlv into a static record

func (SharedSeed) ToString

func (s SharedSeed) ToString() string

wrapper around hex

Directories

Path Synopsis
in a seperate package because this is used by beacon/locations and beacon/root this should probably be moved to internal if moneysocket (socket) is ever moved to its own package
in a seperate package because this is used by beacon/locations and beacon/root this should probably be moved to internal if moneysocket (socket) is ever moved to its own package

Jump to

Keyboard shortcuts

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