Hinkal API

Create Session

Open an authentication session

POST/create-session
https://api.hinkal.io/create-session

Registers a session for the caller's wallet using secp256k1 request signing.

Setup (all chains):

  1. Generate a secp256k1 key pair on the client (32 random bytes → private key; derive compressed 33-byte public key).
  2. Send clientPublicKey (compressed secp256k1, 33 bytes = 66 hex chars) in the request body.
  3. Sign the raw request body with the secp256k1 private key (SHA-256 hash then compact ECDSA signature) — no route binding. This is the only route not bound to a "<METHOD> <routePath>" prefix, since no session exists yet to bind against.
  4. Include x-hinkal-request-signature: <hex_compact_signature> in request headers.
  5. Use the same key pair to authenticate all subsequent requests for this session — every other route binds the signature to its own route path (see AuthFields).

Session mode (useEIP712, default false):

  • false = normal mode — secp256k1 request signature authenticates all requests including transactions. Session message includes the transaction consent line.
  • true = EIP-712 mode — secp256k1 request signature for reads; per-transaction EIP-712/ed25519 signature for transaction endpoints. Session message omits the consent line.

Session message (the clientPublicKey line binds the secp256k1 key to the wallet signature):

  • Normal mode: "Authorize Hinkal session\nSession ID: <sessionId>\nPublic Key: <clientPublicKey>\nThis signature can also be used to submit transactions."
  • EIP-712 mode: "Authorize Hinkal session\nSession ID: <sessionId>\nPublic Key: <clientPublicKey>"

EVM: sign message with EIP-191 personal_sign. Tron: sign with tronWeb.trx.signMessageV2. Solana: sign UTF-8 message bytes with ed25519.

Header parameters

NameTypeDescription
x-hinkal-request-signaturerequiredstringHex-encoded compact secp256k1 signature over the raw request body: secp256k1_sign(SHA256(JSON.stringify(body))). This is the one route with no action binding — no session exists yet to bind against. Every other route binds the signature to its own "<METHOD> <routePath>"; see Authentication.

Request body application/jsonrequired

NameTypeDescription
signaturerequiredstringChain-specific EIP-191 / ed25519 signature of the session message
addressrequiredstringCaller's wallet address: EVM hex address, Tron hex address (0x…), or Solana base58 public key
sessionIdrequiredstring (uuid)Session identifier — a UUID you generate, also embedded in the signed message. Used to look up this session in all subsequent requests.
noncerequiredstring (uuid)Per-request UUID. Echoed back in the response body.
clientPublicKeyrequiredstringCompressed secp256k1 public key (33 bytes, hex-encoded = 66 characters). The enclave stores this key and uses it to verify the x-hinkal-request-signature header on all subsequent requests for this session.
useEIP712booleanWhen false (default), opens a normal mode session — secp256k1 request signature authorizes all requests. When true, opens an EIP-712 mode session — each transaction requires a per-transaction typed-data signature.
Default: false
expiresAtstring (date-time)Optional ISO-8601 datetime at which the session should expire. Defaults to 24 hours from creation if omitted.

Responses

200Session created
NameTypeDescription
successrequiredboolean
One of: true
expiresAtrequiredstring (date-time)ISO-8601 session expiry
noncerequiredstringEchoed per-request nonce from the request body.
400Validation error
NameTypeDescription
successrequiredboolean
One of: false
errorrequiredstring
401Invalid signature or reused nonce
NameTypeDescription
successrequiredboolean
One of: false
errorrequiredstring
409Session ID already registered for a different owner.
NameTypeDescription
successrequiredboolean
One of: false
errorrequiredstring
500Server error
NameTypeDescription
successrequiredboolean
One of: false
errorrequiredstring