Client configuration
ThePagFinanceClient receives a configuration object at construction time:
Configuration options
string
required
API host (Next.js proxy). Point it to your app today or to a dedicated BFF in the future. The contract stays the same.
string
required
Identifier of the application consuming the API.
object
Host application metadata.
string
Default blockchain used when not specified per call (for example,
solana).Authentication model (challenge-response, no crypto)
The Web3 login is a challenge-response in the SIWS (Sign In With Solana) style. The SDK orchestrates the whole flow, and the host application only provides asigner that signs the challenge with the user’s wallet:
Internally the flow is:
POST /api/auth/challenge, then signer(challenge), then POST /api/auth/verify. There is no cryptography or key in the client. The only proof is the signature, and all the logic (nonce, verification, token issuance) lives on the server.Providing a token obtained elsewhere
If you already have a JWT token (obtained through another channel or reused from a previous session), just hand it to the client:Transparent re-login on 401
The SDK can sign in again automatically when the API responds401, transparently to the application: