Documentation ¶
Overview ¶
Package beacon provides moneysocket Beacon's for communicating various locations and a SharedSeed encoder for end-to-end encryption
Index ¶
- Constants
- type Beacon
- func (b *Beacon) AddLocation(loc location.Location)
- func (b Beacon) EncodeLocationListTlvs() []byte
- func (b Beacon) EncodeTLV() []byte
- func (b Beacon) GetSharedSeed() SharedSeed
- func (b Beacon) Locations() []location.Location
- func (b Beacon) ToBech32Str() string
- func (b Beacon) ToObject() map[string]interface{}
- type SharedSeed
- func (s SharedSeed) DeriveAES256Key() []byte
- func (s SharedSeed) DeriveRendezvousId() []byte
- func (s SharedSeed) DoubleSHA256(inputBytes []byte) []byte
- func (s SharedSeed) EncodedTLV() []byte
- func (s SharedSeed) Equal(seed SharedSeed) bool
- func (s SharedSeed) GetBytes() []byte
- func (s SharedSeed) Hash() uint64
- func (s SharedSeed) Hex() string
- func (s SharedSeed) SHA256(inputBytes []byte) string
- func (s SharedSeed) TLV() tlv.Record
- func (s SharedSeed) ToString() string
Constants ¶
const MoneysocketHrp = "moneysocket"
MoneysocketHrp is the human readable part (https://en.bitcoin.it/wiki/BIP_0173#Bech32 ) of the TLV (type-length-value, defined in BOLT #1: https://git.io/JLCRq )
SharedSeedLength defines the length of the shared seed
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Beacon ¶
type Beacon struct {
// contains filtered or unexported fields
}
Beacon contains a SharedSeed for end-to-end encryption and a list of location.Location's
func DecodeFromBech32Str ¶
DecodeFromBech32Str decodes a Beacon from a bech32 string (https://en.bitcoin.it/wiki/BIP_0173#Bech32 )
func DecodeTLV ¶ added in v0.40.0
DecodeTLV decodes a TLV (type-length-value, defined in BOLT #1: https://git.io/JLCRq) into a Beacon. Returns an error if Beacon cannot be decoded
func NewBeacon ¶
func NewBeacon() Beacon
NewBeacon creates a Beacon with no locations and an auto-generated SharedSeed
func NewBeaconFromSharedSeed ¶ added in v0.40.0
func NewBeaconFromSharedSeed(seed SharedSeed) Beacon
NewBeaconFromSharedSeed creates a Beacon with no locations and the given SharedSeed
func (*Beacon) AddLocation ¶
AddLocation appends a location to the beacon
func (Beacon) EncodeLocationListTlvs ¶
EncodeLocationListTlvs encodes a list of locations as tlvs
func (Beacon) GetSharedSeed ¶
func (b Beacon) GetSharedSeed() SharedSeed
GetSharedSeed fetches the shared seed from the beacon
func (Beacon) ToBech32Str ¶
ToBech32Str encodes the tlv to a bech32 string (https://en.bitcoin.it/wiki/BIP_0173#Bech32 )
type SharedSeed ¶
type SharedSeed struct {
// contains filtered or unexported fields
}
SharedSeed is a seed used for end-to-end encryption
func BytesToSharedSeed ¶
func BytesToSharedSeed(rawBytes []byte) (seed SharedSeed, err error)
BytesToSharedSeed creates a SharedSeed from a []byte slice returns an error when seed cannot be decoded
func HexToSharedSeed ¶
func HexToSharedSeed(rawHex string) (seed SharedSeed, err error)
HexToSharedSeed creates a shared seed from an input hex returns an error when this is not possible
func NewSharedSeed ¶
func NewSharedSeed() SharedSeed
NewSharedSeed generates a new random shared seed
func (SharedSeed) DeriveAES256Key ¶ added in v0.40.0
func (s SharedSeed) DeriveAES256Key() []byte
DeriveAES256Key will generate a DoubleSHA256 of the shared seed see https://en.wikipedia.org/wiki/Advanced_Encryption_Standard for details
func (SharedSeed) DeriveRendezvousId ¶
func (s SharedSeed) DeriveRendezvousId() []byte
DeriveRendezvousId will generate a DoubleSHA256 of the DeriveAES256Key
func (SharedSeed) DoubleSHA256 ¶ added in v0.40.0
func (s SharedSeed) DoubleSHA256(inputBytes []byte) []byte
DoubleSHA256 will generate SHA256(SHA256(inputBytes))
func (SharedSeed) EncodedTLV ¶
func (s SharedSeed) EncodedTLV() []byte
EncodedTLV will encode the TLV into a byte-slice (See BOLT #1: https://git.io/JLCRq )
func (SharedSeed) Equal ¶
func (s SharedSeed) Equal(seed SharedSeed) bool
Equal check if two seeds are equal
func (SharedSeed) GetBytes ¶
func (s SharedSeed) GetBytes() []byte
GetBytes gets the seedBytes from the shared seed
func (SharedSeed) Hash ¶
func (s SharedSeed) Hash() uint64
Hash converts the seed bytes to a big endian int
func (SharedSeed) Hex ¶
func (s SharedSeed) Hex() string
Hex converts the shared seed to string via hex encoding
func (SharedSeed) SHA256 ¶ added in v0.40.0
func (s SharedSeed) SHA256(inputBytes []byte) string
SHA256 the seed bytes, format as string
func (SharedSeed) TLV ¶
func (s SharedSeed) TLV() tlv.Record
TLV will encode the SharedSeed into a tlv.Record
func (SharedSeed) ToString ¶
func (s SharedSeed) ToString() string
ToString is a wrapper around Hex() for usability
Directories ¶
Path | Synopsis |
---|---|
Package location contains a common interface for interacting with various Location types and every Location TLV type in the moneysocket protocol
|
Package location contains a common interface for interacting with various Location types and every Location TLV type in the moneysocket protocol |
Package util contains helpers for encoding/decoding tlvs to maintain parity with other moneysocket implementations
|
Package util contains helpers for encoding/decoding tlvs to maintain parity with other moneysocket implementations |
bigsize
Package bigsize emulates the bigsize module of py-moneysocket to achieve parity on various kinds of tlv encodings
|
Package bigsize emulates the bigsize module of py-moneysocket to achieve parity on various kinds of tlv encodings |