hcnettoml

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const HcnetTomlMaxSize = 100 * 1024

HcnetTomlMaxSize is the maximum size of hcnet.toml file

View Source
const WellKnownPath = "/.well-known/hcnet.toml"

WellKnownPath represents the url path at which the hcnet.toml file should exist to conform to the federation protocol.

Variables

View Source
var DefaultClient = &Client{HTTP: http.DefaultClient}

DefaultClient is a default client using the default parameters

Functions

This section is empty.

Types

type Client

type Client struct {
	// HTTP is the http client used when resolving a Hcnet.toml file
	HTTP HTTP

	// UseHTTP forces the client to resolve against servers using plain HTTP.
	// Useful for debugging.
	UseHTTP bool
}

Client represents a client that is capable of resolving a Hcnet.toml file using the internet.

func (*Client) GetHcnetToml added in v1.11.1

func (c *Client) GetHcnetToml(domain string) (resp *Response, err error)

GetHcnetToml returns hcnet.toml file for a given domain

Example

ExampleGetTOML gets the hcnet.toml file for coins.asia

_, err := DefaultClient.GetHcnetToml("coins.asia")
if err != nil {
	log.Fatal(err)
}
Output:

func (*Client) GetHcnetTomlByAddress added in v1.11.1

func (c *Client) GetHcnetTomlByAddress(addr string) (*Response, error)

GetHcnetTomlByAddress returns hcnet.toml file of a domain fetched from a given address

type ClientInterface

type ClientInterface interface {
	GetHcnetToml(domain string) (*Response, error)
	GetHcnetTomlByAddress(addr string) (*Response, error)
}

type Currency added in v1.11.1

type Currency struct {
	Code                        string   `toml:"code"`
	CodeTemplate                string   `toml:"code_template"`
	Issuer                      string   `toml:"issuer"`
	Status                      string   `toml:"status"`
	DisplayDecimals             int      `toml:"display_decimals"`
	Name                        string   `toml:"name"`
	Desc                        string   `toml:"desc"`
	Conditions                  string   `toml:"conditions"`
	Image                       string   `toml:"image"`
	FixedNumber                 int      `toml:"fixed_number"`
	MaxNumber                   int      `toml:"max_number"`
	IsUnlimited                 bool     `toml:"is_unlimited"`
	IsAssetAnchored             bool     `toml:"is_asset_anchored"`
	AnchorAsset                 string   `toml:"anchor_asset"`
	RedemptionInstructions      string   `toml:"redemption_instructions"`
	CollateralAddresses         []string `toml:"collateral_addresses"`
	CollateralAddressMessages   []string `toml:"collateral_address_messages"`
	CollateralAddressSignatures []string `toml:"collateral_address_signatures"`
	Regulated                   string   `toml:"regulated"`
	ApprovalServer              string   `toml:"APPROVAL_SERVER"`
	ApprovalCriteria            string   `toml:"APPROVAL_CRITERIA"`
}

type HTTP

type HTTP interface {
	Get(url string) (*http.Response, error)
}

HTTP represents the http client that a stellertoml resolver uses to make http requests.

type MockClient

type MockClient struct {
	mock.Mock
}

MockClient is a mockable hcnettoml client.

func (*MockClient) GetHcnetToml added in v1.11.1

func (m *MockClient) GetHcnetToml(domain string) (*Response, error)

GetHcnetToml is a mocking a method

func (*MockClient) GetHcnetTomlByAddress added in v1.11.1

func (m *MockClient) GetHcnetTomlByAddress(address string) (*Response, error)

GetHcnetTomlByAddress is a mocking a method

type Principal added in v1.11.1

type Principal struct {
	Name                  string `toml:"name"`
	Email                 string `toml:"email"`
	Keybase               string `toml:"keybase"`
	Telegram              string `toml:"telegram"`
	Twitter               string `toml:"twitter"`
	Github                string `toml:"github"`
	IdPhotoHash           string `toml:"id_photo_hash"`
	VerificationPhotoHash string `toml:"verification_photo_hash"`
}

type Response

type Response struct {
	Version                       string      `toml:"VERSION"`
	NetworkPassphrase             string      `toml:"NETWORK_PASSPHRASE"`
	FederationServer              string      `toml:"FEDERATION_SERVER"`
	AuthServer                    string      `toml:"AUTH_SERVER"`
	TransferServer                string      `toml:"TRANSFER_SERVER"`
	TransferServer0024            string      `toml:"TRANSFER_SERVER_0024"`
	KycServer                     string      `toml:"KYC_SERVER"`
	WebAuthEndpoint               string      `toml:"WEB_AUTH_ENDPOINT"`
	SigningKey                    string      `toml:"SIGNING_KEY"`
	AuroraUrl                     string      `toml:"HORIZON_URL"`
	Accounts                      []string    `toml:"ACCOUNTS"`
	UriRequestSigningKey          string      `toml:"URI_REQUEST_SIGNING_KEY"`
	DirectPaymentServer           string      `toml:"DIRECT_PAYMENT_SERVER"`
	OrgName                       string      `toml:"ORG_NAME"`
	OrgDba                        string      `toml:"ORG_DBA"`
	OrgUrl                        string      `toml:"ORG_URL"`
	OrgDescription                string      `toml:"ORG_DESCRIPTION"`
	OrgPhysicalAddress            string      `toml:"ORG_PHYSICAL_ADDRESS"`
	OrgPhysicalAddressAttestation string      `toml:"ORG_PHYSICAL_ADDRESS_ATTESTATION"`
	OrgPhoneNumber                string      `toml:"ORG_PHONE_NUMBER"`
	OrgPhoneNumberAttestation     string      `toml:"ORG_PHONE_NUMBER_ATTESTATION"`
	OrgKeybase                    string      `toml:"ORG_KEYBASE"`
	OrgTwitter                    string      `toml:"ORG_TWITTER"`
	OrgGithub                     string      `toml:"ORG_GITHUB"`
	OrgOfficialEmail              string      `toml:"ORG_OFFICIAL_EMAIL"`
	OrgLicensingAuthority         string      `toml:"ORG_LICENSING_AUTHORITY"`
	OrgLicenseType                string      `toml:"ORG_LICENSE_TYPE"`
	OrgLicenseNumber              string      `toml:"ORG_LICENSE_NUMBER"`
	Principals                    []Principal `toml:"PRINCIPALS"`
	Currencies                    []Currency  `toml:"CURRENCIES"`
	Validators                    []Validator `toml:"VALIDATORS"`
}

SEP-1 commit https://github.com/HashCash-Consultants/hcnet-protocol/blob/f8993e36fa6b5b8bba1254c21c2174d250af4958/ecosystem/sep-0001.md

func GetHcnetToml added in v1.11.1

func GetHcnetToml(domain string) (*Response, error)

GetHcnetToml returns hcnet.toml file for a given domain

func GetHcnetTomlByAddress added in v1.11.1

func GetHcnetTomlByAddress(addr string) (*Response, error)

GetHcnetTomlByAddress returns hcnet.toml file of a domain fetched from a given address

type Validator added in v1.11.1

type Validator struct {
	Alias       string `toml:"ALIAS"`
	DisplayName string `toml:"DISPLAY_NAME"`
	PublicKey   string `toml:"PUBLIC_KEY"`
	Host        string `toml:"HOST"`
	History     string `toml:"HISTORY"`
}

Jump to

Keyboard shortcuts

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