registerAccount

suspend fun registerAccount(address: String, request: Sep30Request, jwt: String): Sep30AccountResponse

Registers an account with the recovery server.

Creates a new account registration with the specified identity providers and authentication methods. The recovery server will generate signing keys for the registered identities that can later be used to sign recovery transactions.

Return

Sep30AccountResponse with registered identities and signing addresses

Parameters

address

The Stellar account address to register

request

The identity configuration with authentication methods

jwt

SEP-10 authentication token

Throws

If the request is malformed or contains invalid parameters (HTTP 400)

If the JWT token is missing, invalid, or expired (HTTP 401)

If the endpoint is not found (HTTP 404)

If the account is already registered (HTTP 409)

If the server returns HTTP 200 with a malformed body

If the server returns an unexpected HTTP status code

Example:

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

val response = sep30.registerAccount("GABC...", request, jwtToken)
println("Account: ${response.address}")
println("Signers: ${response.signers.map { it.key }}")