Documentation ¶
Index ¶
- func GetAsciiBaseDomain(domain string) (string, error)
- func GetDomainDisplayName(domain string) (string, error)
- func VerifyDomainNameOwnership(ctx context.Context, owner *common.Account, domain string) (bool, error)
- type BlockchainMessageType
- type DomainVerifier
- type FiatOnrampPurchaseMessage
- type NaclBoxBlockchainMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAsciiBaseDomain ¶
GetAsciiBaseDomain gets the ASCII base domain for a given string.
func GetDomainDisplayName ¶ added in v1.1.5
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 ¶
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
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.