StellarToml

class StellarToml(val generalInformation: GeneralInformation, val documentation: Documentation? = null, val pointsOfContact: List<PointOfContact>? = null, val currencies: List<Currency>? = null, val validators: List<Validator>? = null)

Parses and provides access to stellar.toml files as defined in SEP-0001.

The stellar.toml file is a standardized configuration file that organizations publish at https://DOMAIN/.well-known/stellar.toml to provide information about their Stellar integration, including service endpoints, validators, currencies, and organizational details.

This class supports parsing stellar.toml from either a raw TOML string or by automatically fetching from a domain's well-known location.

The stellar.toml file serves several critical purposes:

  • Declares service endpoints for SEP implementations (WebAuth, Transfer, KYC, etc.)

  • Publishes organization information and contact details for transparency

  • Lists supported currencies/assets with their properties

  • Declares validator nodes and their configuration

  • Links Stellar accounts to a domain for identity verification

Example - Fetch from domain:

// Fetch and parse stellar.toml from a domain
val stellarToml = StellarToml.fromDomain("example.com")

// Access general information
println("WebAuth endpoint: ${stellarToml.generalInformation.webAuthEndpoint}")
println("Transfer server: ${stellarToml.generalInformation.transferServer}")

// Access organization documentation
stellarToml.documentation?.let { doc ->
println("Organization: ${doc.orgName}")
println("Support email: ${doc.orgSupportEmail}")
}

// Iterate through supported currencies
stellarToml.currencies?.forEach { currency ->
println("Currency: ${currency.code} issued by ${currency.issuer}")
println("Description: ${currency.desc}")
}

Example - Parse from string:

val tomlContent = """
NETWORK_PASSPHRASE = "Public Global Stellar Network ; September 2015"
WEB_AUTH_ENDPOINT = "https://example.com/auth"
SIGNING_KEY = "GBWMCCC3NHSKLAOJDBKKYW7SSH2PFTTNVFKWSGLWGDLEBKLOVP5JLBBP"

[DOCUMENTATION]
ORG_NAME = "Example Organization"
ORG_URL = "https://example.com"
""".trimIndent()

val stellarToml = StellarToml.parse(tomlContent)
println(stellarToml.generalInformation.webAuthEndpoint)

Example - Load currency from external TOML:

// Some currencies may be defined in separate files
val currency = stellarToml.currencies?.firstOrNull()
currency?.toml?.let { url ->
val fullCurrency = StellarToml.currencyFromUrl(url)
println("Full currency details: ${fullCurrency.desc}")
}

Security considerations:

  • Always verify HTTPS is used when fetching stellar.toml files

  • Validate signing keys match expected values for critical operations

  • Cross-reference account information with on-chain data

  • Be aware that stellar.toml content can change; cache appropriately

See also:

Supported Version: 2.7.0

Constructors

Link copied to clipboard
constructor(generalInformation: GeneralInformation, documentation: Documentation? = null, pointsOfContact: List<PointOfContact>? = null, currencies: List<Currency>? = null, validators: List<Validator>? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

List of currencies/assets supported by the organization

Link copied to clipboard

Organization documentation and contact information

Link copied to clipboard

General information including service endpoints and network configuration

Link copied to clipboard

List of principals/points of contact for the organization

Link copied to clipboard

List of validator nodes operated by the organization