Hinkal API
Create Session
Open an authentication session
POST
/create-sessionhttps://api.hinkal.io/create-session
Registers a session for the caller's wallet using secp256k1 request signing.
Setup (all chains):
- Generate a secp256k1 key pair on the client (32 random bytes → private key; derive compressed 33-byte public key).
- Send
clientPublicKey(compressed secp256k1, 33 bytes = 66 hex chars) in the request body. - 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. - Include
x-hinkal-request-signature: <hex_compact_signature>in request headers. - 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
| Name | Type | Description |
|---|---|---|
x-hinkal-request-signaturerequired | string | Hex-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
| Name | Type | Description |
|---|---|---|
signaturerequired | string | Chain-specific EIP-191 / ed25519 signature of the session message |
addressrequired | string | Caller's wallet address: EVM hex address, Tron hex address (0x…), or Solana base58 public key |
sessionIdrequired | string (uuid) | Session identifier — a UUID you generate, also embedded in the signed message. Used to look up this session in all subsequent requests. |
noncerequired | string (uuid) | Per-request UUID. Echoed back in the response body. |
clientPublicKeyrequired | string | Compressed 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. |
useEIP712 | boolean | When 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. |
expiresAt | string (date-time) | Optional ISO-8601 datetime at which the session should expire. Defaults to 24 hours from creation if omitted. |
Responses
200Session created
| Name | Type | Description |
|---|---|---|
successrequired | boolean | |
expiresAtrequired | string (date-time) | ISO-8601 session expiry |
noncerequired | string | Echoed per-request nonce from the request body. |
400Validation error
| Name | Type | Description |
|---|---|---|
successrequired | boolean | |
errorrequired | string |
401Invalid signature or reused nonce
| Name | Type | Description |
|---|---|---|
successrequired | boolean | |
errorrequired | string |
409Session ID already registered for a different owner.
| Name | Type | Description |
|---|---|---|
successrequired | boolean | |
errorrequired | string |
500Server error
| Name | Type | Description |
|---|---|---|
successrequired | boolean | |
errorrequired | string |