Sep30Service

class Sep30Service(val serviceUrl: String, httpClient: HttpClient? = null, httpRequestHeaders: Map<String, String>? = null)

SEP-30 Account Recovery service client.

Provides support for multi-party recovery of Stellar accounts. Recovery servers hold signing keys for registered accounts and can sign recovery transactions after the account owner authenticates via one or more identity verification methods.

This service handles:

  • Registering accounts with identity providers and authentication methods

  • Updating identity configurations for registered accounts

  • Requesting transaction signatures from recovery signers

  • Querying account recovery details and listing registered accounts

  • Deleting account recovery registrations

All endpoints require a SEP-10 JWT authentication token.

Typical workflow:

  1. Create service instance with the recovery server URL

  2. Authenticate via SEP-10 to obtain a JWT token

  3. Register an account with identity providers via registerAccount

  4. When recovery is needed, authenticate identities

  5. Request transaction signatures via signTransaction

Example - Register an account:

val sep30 = Sep30Service("https://recovery.example.com")

val emailAuth = Sep30AuthMethod(type = "email", value = "user@example.com")
val phoneAuth = Sep30AuthMethod(type = "phone_number", value = "+14155551234")
val ownerIdentity = Sep30RequestIdentity(
role = "owner",
authMethods = listOf(emailAuth, phoneAuth)
)
val request = Sep30Request(identities = listOf(ownerIdentity))

val response = sep30.registerAccount(accountAddress, request, jwtToken)
println("Registered: ${response.address}")
response.signers.forEach { println("Signer: ${it.key}") }

Example - Sign a recovery transaction:

val signatureResponse = sep30.signTransaction(
address = accountAddress,
signingAddress = response.signers.first().key,
transaction = transaction.toEnvelopeXdrBase64(),
jwt = jwtToken
)
println("Signature: ${signatureResponse.signature}")
println("Network: ${signatureResponse.networkPassphrase}")

Example - List registered accounts:

val accountsResponse = sep30.accounts(jwt = jwtToken)
accountsResponse.accounts.forEach { account ->
println("Account: ${account.address}")
}

See also:

Parameters

httpClient

Optional custom HTTP client for testing or custom configuration

httpRequestHeaders

Optional custom headers applied to all requests

Constructors

Link copied to clipboard
constructor(serviceUrl: String, httpClient: HttpClient? = null, httpRequestHeaders: Map<String, String>? = null)

Properties

Link copied to clipboard

The base URL of the SEP-30 recovery server

Functions

Link copied to clipboard
suspend fun accountDetails(address: String, jwt: String): Sep30AccountResponse

Retrieves the recovery details for a registered account.

Link copied to clipboard
suspend fun accounts(jwt: String, after: String? = null): Sep30AccountsResponse

Lists all accounts accessible by the authenticated user.

Link copied to clipboard
suspend fun deleteAccount(address: String, jwt: String): Sep30AccountResponse

Deletes an account's recovery registration from the server.

Link copied to clipboard
suspend fun registerAccount(address: String, request: Sep30Request, jwt: String): Sep30AccountResponse

Registers an account with the recovery server.

Link copied to clipboard
suspend fun signTransaction(address: String, signingAddress: String, transaction: String, jwt: String): Sep30SignatureResponse

Requests the recovery server to sign a transaction.

Link copied to clipboard

Updates the identity configuration for a registered account.