Connect to the DfG Professional sandbox
Six steps from an invitation link to a decision you can read back from the Evidence record. Allow 15 minutes. You need Node 22 or later.
| Sandbox address | https://dfgsandbox5b17fb5f-dfg-core-sandbox.functions.fnc.fr-par.scw.cloud |
|---|---|
| Token audience | dfg-core-sandbox |
| Limit | 120 calls a minute for each team |
| People | Test people only |
The technical names in this guide still say "dfg-core": the audience value, the package @dfg/core-sdk and the field core_url. Use them exactly as written.
1. Get your keys
Sign in on the sandbox and press Make a key on the page Your sandbox keys. With an invitation link from the organisers, open the link and press Accept and make my keys, or run this in an empty folder:
curl -fsSO https://developers.dfgfoundation.com/join.mjs
node join.mjs "PASTE-YOUR-INVITATION-LINK"
Every way leaves one file, dfg-sandbox.json. Put it in the folder you work in. It holds:
| Field | What it is |
|---|---|
| core_url, audience | The sandbox address and the audience every token must carry |
| client_id, private_jwk | Your system's name in DfG Professional and its private key |
| collaboration_id, recipient_org_id, role | Your collaboration, its test clinic and the role that may ask |
| purpose, workflow, output_kind, categories | The values a request in your collaboration uses |
| collaboration_key_hex | The key derivePseudonym turns your own account IDs into code names with. DfG Professional never sees it |
2. Install the SDK
npm init -y
npm install https://developers.dfgfoundation.com/sdk/dfg-core-sdk-0.1.0-draft.1.tgz
The package is @dfg/core-sdk, an ES module with no dependencies, licensed under Apache-2.0. Its README is written for the full developer kit: skip its install section, and the files it names under api/ are not part of this download.
3. Make a first call
curl -fsSO https://developers.dfgfoundation.com/first-call.mjs
node first-call.mjs
The script runs the diabetes follow-up from start to end with one test person and prints a line for each step:
- The sandbox answers and names its audience.
- The person grants the clinic four kinds of data:
tir,mean_g,sleepandsteps. Your system reports the consent. - A nurse asks to see the summary before a planned visit. DfG Professional answers permit and gives a ticket.
- Your system reports the summary's fingerprint against the ticket. DfG Professional answers released.
- You read the request's trail from the Evidence record and check every hash on your own machine. The rows are
config.published,consent.granted,request.decidedandresult.released. - The person withdraws. The nurse asks again. DfG Professional answers deny with the reason
CONSENT_WITHDRAWN.
4. Read the script
first-call.mjs is the shortest working use of each call. The client is set up like this:
import { readFileSync } from 'node:fs';
import { DfgCoreClient } from '@dfg/core-sdk';
const s = JSON.parse(readFileSync('dfg-sandbox.json', 'utf8'));
const core = new DfgCoreClient({
baseUrl: s.core_url,
clientId: s.client_id,
privateKey: s.private_jwk,
audience: s.audience, // the sandbox has its own; the default is for the live DfG Professional
});
| Call | What it does |
|---|---|
| core.recordConsentEvent(...) | Reports a grant or a withdrawal |
| core.submitGovernedRequest(...) | Asks whether a use of data may go ahead. The answer is permit or deny, with reasons |
| core.releaseResult(...) | Reports the output's SHA-256 against the ticket. DfG Professional never receives the output |
| core.evidenceTrail(requestId) | Reads every Evidence row of one request |
| core.evidenceVerify() | Asks DfG Professional to check its Evidence chain |
5. Build your own
Your client is consent source, requester and data holder in your collaboration, so one system can play all three parts. The collaboration lets a clinical_nurse at your test clinic ask for tir, mean_g, bolus, sleep, rhr, steps and exercise for the purpose planned_control.
- A person is a code name your system derives with
derivePseudonym. DfG Professional never sees a name, a number or an address. - A deny is an answer. A wrong purpose, category or collaboration, a missing consent and a withdrawn consent all come back as
denywith reason codes indecision.reasons. - A permit can be partial. Ask for three kinds of data when the person granted two, and DfG Professional answers
permitwith twopermitted_categories, onewithheld_categoriesand the reasonCATEGORY_NOT_GRANTED. Deliver only what was permitted. - An error is thrown only when the call itself is malformed, unsigned or over the limit. It carries a
codeand afixtext. - A grant needs an
expires_atin the future. The first-call script uses 90 days. - Every call needs a fresh token. The SDK makes one for each call.
6. Rules of the sandbox
- Test people only. Never send data about a real person, and never put a name, a number or an address in an ID.
- Your private key stays on your machine. The sandbox never asks for it.
request_id from the error. It finds the call in the sandbox's log.