2. Run the example
This runs the full protocol on your machine, in memory. It needs no server and no cloud account. It creates throwaway keys, so it is safe to run anywhere.
Requirements
- Node.js 22 or later
- pnpm (
corepack enableactivates it) - Git
Steps
bash
git clone https://github.com/pavancharak/dip.git
cd dip
pnpm install --frozen-lockfile
pnpm -r run build
node examples/sdk-quickstart.mjsWhat you should see
authorization: ALLOW
execution: SUCCEEDED demo-1
ledger valid: true entries: 1If any line differs, check 09-troubleshooting.md.
What the example does
The script in examples/sdk-quickstart.mjs does four things:
- Declares and publishes an authority. It allows payments up to 50,000 INR to one resource.
- Authorizes a request for 4,000 INR. The result is ALLOW.
- Executes the action through the boundary and records the evidence.
- Verifies the ledger it holds.
Read the file. Each numbered comment matches one step of 03, 04 and 06.
Run the full set of scenarios
bash
node examples/run.mjsThis runs four scenarios: an allowed payment, a payment over the limit (DENY), tampered evidence (INVALID), and an authority revoked after an earlier ALLOW.