2

I've read the documentation about the SEP-10 Authentication Protocol of the network but is kinda overwhelming for me.

Do have any available code snippets for the said process able to study thoroughly. Much appreciated if you are using the JS SDK.

2

Satoshipay has an open source SEP-10 library implementation: https://github.com/satoshipay/stellar-sep-10

Example from their README.md:

// Look up the stellar.toml for an issuing account, parse it, return data
import { Server } from "stellar-sdk"
import { fetchWebAuthData } from "@satoshipay/stellar-sep-10"

const horizon = new Server("https://stellar-horizon.satoshipay.io/")
const issuingAccountID =
  "GABWHTAVRYF2MCNDR5YC5SC3JTZQBGDZ3HKI4QAREV5533VU43W4HJUX"

const webauth = fetchWebAuthData(horizon, issuingAccountID)
// typeof webauth = { endpointURL: string, signingKey: string } | undefined

import { Keypair } from "stellar-sdk"
import { authenticate } from "@satoshipay/stellar-sep-10"

const accountKeypair = Keypair.fromSecret("S...")

const jwt = await authenticate(
  webauth.endpointURL,
  webauth.signingKey,
  accountKeypair,
  Network.current()
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.