User Auth
Authenticate User with Signed Data
Exchange a signed message for a User-Session access token
POST
Authenticate user with signed data
Send this endpoint a signed message from your user, and you’ll get back a User-Session token. That token is what lets the user’s confidential balances and transaction history (
GET /v0/account/balances, GET /v0/account/history) be revealed. It’s separate from your Partner JWT, which authenticates your integration, not an individual user.
This is part of Confidential Intents. See Authenticating end users for the full guide.
Getting a signature to send
Your user’s NEAR wallet producespublic_key and signature. The steps:
- Build a NEP-413 payload:
recipientset to"intents.near", a fresh randomnonce, andmessageset to a stringified JSON object with an emptyintentsarray plus adeadlineand the user’ssigner_id. The emptyintentsarray is what makes this a proof of ownership instead of a real swap. - Have the user’s wallet sign that payload. The wallet returns the
publicKeythat signed it and the resultingsignature, both prefixeded25519:. - Send
payload,public_key, andsignaturetogether assignedDataon this endpoint.
@defuse-protocol/intents-sdk, createIntentSignerNEP413 and buildAndSign() do steps 1 and 2 for you, that’s what the TypeScript SDK example below uses.
Example request
Example response
Body
application/json
Assuming wallets want to interact with Intents protocol, besides preparing the data in a certain form, they have to have the capability to sign raw messages (off-chain signatures) using an algorithm we understand. This enum solves that problem.
For example, because we support ERC-191 and know how to verify messages with that standard, we can allow wallets, like Metamask, sign messages to perform intents without having to support new cryptographic primitives and signing standards.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
Authenticate user with signed data