Authentication
Two credentials that do different jobs, held by different parties, on purpose.
Why there are two
The agent's credential lets it ask. The operator's credential lets a person decide. If one credential could do both, an agent that got loose could approve its own spending, and every limit on this platform would be advisory.
- Bearer token
- The agent's. Sent as
Authorization: Beareron every call. It can ask to pay and can read back what happened. - Operator credential
- A person's. Required to approve a held payment, issue a refund, or pull the stop. Never held by the agent, and never on the same machine if you can help it.
curl https://api.generalliquidity.com/audit \
-H "Authorization: Bearer $GL_API_KEY"Instructions are signed
The credential says which account is calling. The signature on the instruction says the instruction was not altered on the way, and the two are separate on purpose.
Be aware of where each lives. The command line sends the credential and reads it from GL_API_KEY. The TypeScript client sends no credential at all: you give it a signer, an object with a sign(bytes) method, and it signs each instruction before submitting. Operator actions use a different key again, over the GL-Operator header, with a detached signature over the operation, method, URL, timestamp, nonce and body digest.
Sandbox
There is a separate host for test networks. Same API, same answers, no real money. Point at it while you are building and change one line when you are not.
https://api.generalliquidity.com # live
https://sandbox.api.generalliquidity.com # test networks