thirdparty

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 22 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 BlockchainMessage

type BlockchainMessage struct {
	Type             BlockchainMessageType
	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
}

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

func DecodeBlockchainMessage

func DecodeBlockchainMessage(payload []byte) (*BlockchainMessage, error)

DecodeBlockchainMessages attempts to decode a byte payload into a BlockchainMessage

func NewNaclBoxBlockchainMessage

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

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

func (*BlockchainMessage) Encode

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

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

func (*BlockchainMessage) ToProto

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

ToProto creates the proto representation of a BlockchainMessage

type BlockchainMessageType

type BlockchainMessageType uint8
const (
	NaclBoxBlockchainMessage BlockchainMessageType = iota
)

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.

Jump to

Keyboard shortcuts

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