thirdparty

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAsciiBaseDomain

func GetAsciiBaseDomain(domain string) (string, error)

GetAsciiBaseDomain gets the ASCII base domain for a given string.

func GetDomainDisplayName added in v1.1.5

func GetDomainDisplayName(domain string) (string, error)

GetDomainDisplayName gets the display version of a domain within UI elements of the Code app.

func VerifyDomainNameOwnership

func VerifyDomainNameOwnership(ctx context.Context, owner *common.Account, domain string) (bool, error)

VerifyDomainNameOwnership verifies a public key owns a domain. It is the official DomainValidator implementation.

todo: this needs caching todo: improve testing so we don't have to go out to app.getcode.com

Types

type BlockchainMessageType

type BlockchainMessageType uint8
const (
	NaclBoxType BlockchainMessageType = iota
	FiatOnrampPurchase
)

type DomainVerifier

type DomainVerifier func(ctx context.Context, owner *common.Account, domain string) (bool, error)

DomainVerifier is a validation function to verify if a public key is owned by a domain. Implementations are not responsible for verifying the owner account via a signature, and must occur at the system requiring domain verification.

type FiatOnrampPurchaseMessage added in v1.5.0

type FiatOnrampPurchaseMessage struct {
	Version uint8
	Flags   uint32
	Nonce   uuid.UUID
}

func DecodeFiatOnrampPurchaseMessage added in v1.5.0

func DecodeFiatOnrampPurchaseMessage(payload []byte) (*FiatOnrampPurchaseMessage, error)

DecodeFiatOnrampPurchaseMessage attempts to decode a byte payload into a FiatOnrampPurchaseMessage

func NewFiatOnrampPurchaseMessage added in v1.5.0

func NewFiatOnrampPurchaseMessage(nonce uuid.UUID) (*FiatOnrampPurchaseMessage, error)

NewFiatOnrampPurchaseMessage returns a new BlockchainMessage used to indicate fulfillmenet of a fiat purchase by an onramp provider.

func (*FiatOnrampPurchaseMessage) Encode added in v1.5.0

func (m *FiatOnrampPurchaseMessage) Encode() ([]byte, error)

Encode encodes the FiatOnrampPurchaseMessage into a format compatible with the Solana memo instruction.

type NaclBoxBlockchainMessage

type NaclBoxBlockchainMessage struct {
	Version          uint8
	Flags            uint32
	SenderDomain     string // Subdomains are allowed, but unused. There could be something there as a feature.
	ReceiverAccount  *common.Account
	Nonce            []byte
	EncryptedMessage []byte
}

NaclBoxBlockchainMessage is an encrypted message, plus associated metadata, sent over the blockchain.

func DecodeNaclBoxBlockchainMessage added in v1.5.0

func DecodeNaclBoxBlockchainMessage(payload []byte) (*NaclBoxBlockchainMessage, error)

DecodeNaclBoxBlockchainMessage attempts to decode a byte payload into a NaclBoxBlockchainMessage

func NewNaclBoxBlockchainMessage

func NewNaclBoxBlockchainMessage(
	senderDomain string,
	plaintextMessage string,
	sender *common.Account,
	receiver *common.Account,
) (*NaclBoxBlockchainMessage, error)

NewNaclBoxBlockchainMessage returns a new BlockchainMessage using a NACL box where the shared key is derived using ECDH.

func (*NaclBoxBlockchainMessage) Encode added in v1.5.0

func (m *NaclBoxBlockchainMessage) Encode() ([]byte, error)

Encode encodes the NaclBoxBlockchainMessage into a format compatible with the Solana memo instruction.

func (*NaclBoxBlockchainMessage) ToProto added in v1.5.0

func (m *NaclBoxBlockchainMessage) ToProto(
	sender *common.Account,
	signature string,
	ts time.Time,
) (*chatpb.ChatMessage, error)

ToProto creates the proto representation of a NaclBoxBlockchainMessage

Jump to

Keyboard shortcuts

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