Skip to content

Commit fdf2019

Browse files
coodosBekiboo
andauthored
Feat/binding documents (#821)
* feat: create binding document typedef * feat: add new binding document ontology * feat: binding document service * feat: graphql binding documents * tests: binding document tests * docs: binding documents docs for graphql mutations, and details * Feat/ecurrency overdraft toggle (#819) * fix: correct envDir path in Vite configuration * feat: add allowNegativeGroupOnly feature to currency management * feat: implement overdraft validation for group members and enhance negative balance checks * Feat/dev sandbox metaenvelope inspect view (#823) * feat: evault inspector * feat: sandbox config * chore: address code rabbit suggestions * fix: vulenrabilities --------- Co-authored-by: Julien Connault <julien.connault@gmail.com>
1 parent b672b59 commit fdf2019

21 files changed

Lines changed: 2220 additions & 473 deletions

File tree

docs/docs/Infrastructure/eVault.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ This flat graph structure allows:
9696
- More complex queries when reconstructing full objects
9797
- Potential performance impact with deeply nested structures
9898

99+
### Binding Documents
100+
101+
A **Binding Document** is a special type of MetaEnvelope that ties a user to their [eName](/docs/W3DS%20Basics/eName). It establishes identity verification or claims through cryptographic signatures. See [Binding Documents](/docs/W3DS%20Basics/Binding-Documents) for full details.
102+
103+
Key characteristics:
104+
- **Stored as MetaEnvelope**: Binding documents use the same MetaEnvelope structure, with ontology ID `b1d0a8c3-4e5f-6789-0abc-def012345678`
105+
- **ID is MetaEnvelope ID**: The binding document is identified by its MetaEnvelope ID (no separate ID field)
106+
- **Always signed**: Owner signature is required; counterparty signatures can be added
107+
- **Types**: `id_document`, `photograph`, `social_connection`, `self`
108+
99109
## GraphQL API
100110

101111
eVault exposes a GraphQL API at `/graphql` for all data operations. All operations require the `X-ENAME` header to identify the eVault owner.
@@ -337,6 +347,155 @@ The `skipWebhooks` parameter only suppresses webhooks when:
337347

338348
For regular platform requests, webhooks are always delivered regardless of this parameter.
339349

350+
### Binding Document Operations
351+
352+
eVault provides dedicated GraphQL operations for managing [Binding Documents](/docs/W3DS%20Basics/Binding-Documents) — MetaEnvelopes that tie users to their eNames.
353+
354+
#### bindingDocument Query
355+
356+
Retrieve a single binding document by its MetaEnvelope ID.
357+
358+
**Query**:
359+
```graphql
360+
query {
361+
bindingDocument(id: "meta-envelope-id") {
362+
subject
363+
type
364+
data
365+
signatures {
366+
signer
367+
signature
368+
timestamp
369+
}
370+
}
371+
}
372+
```
373+
374+
#### bindingDocuments Query
375+
376+
Retrieve binding documents with cursor-based pagination and optional filtering by type.
377+
378+
**Query**:
379+
```graphql
380+
query {
381+
bindingDocuments(
382+
type: id_document
383+
first: 10
384+
after: "cursor-string"
385+
) {
386+
edges {
387+
cursor
388+
node {
389+
subject
390+
type
391+
data
392+
signatures {
393+
signer
394+
signature
395+
timestamp
396+
}
397+
}
398+
}
399+
pageInfo {
400+
hasNextPage
401+
hasPreviousPage
402+
startCursor
403+
endCursor
404+
}
405+
totalCount
406+
}
407+
}
408+
```
409+
410+
**Filter Options**:
411+
- `type`: Filter by binding document type (`id_document`, `photograph`, `social_connection`, `self`)
412+
413+
**Pagination**:
414+
- `first` / `after`: Forward pagination
415+
- `last` / `before`: Backward pagination
416+
417+
#### createBindingDocument Mutation
418+
419+
Create a new binding document. This stores a MetaEnvelope with ontology `b1d0a8c3-4e5f-6789-0abc-def012345678`.
420+
421+
**Mutation**:
422+
```graphql
423+
mutation {
424+
createBindingDocument(input: {
425+
subject: "@e4d909c2-5d2f-4a7d-9473-b34b6c0f1a5a"
426+
type: id_document
427+
data: {
428+
vendor: "onfido"
429+
reference: "ref-12345"
430+
name: "John Doe"
431+
}
432+
ownerSignature: {
433+
signer: "@e4d909c2-5d2f-4a7d-9473-b34b6c0f1a5a"
434+
signature: "sig_abc123..."
435+
timestamp: "2025-01-24T10:00:00Z"
436+
}
437+
}) {
438+
metaEnvelopeId
439+
bindingDocument {
440+
subject
441+
type
442+
data
443+
signatures {
444+
signer
445+
signature
446+
timestamp
447+
}
448+
}
449+
errors {
450+
message
451+
code
452+
}
453+
}
454+
}
455+
```
456+
457+
**Input fields**:
458+
- `subject`: The eName being bound (will be normalized to include `@` prefix)
459+
- `type`: One of `id_document`, `photograph`, `social_connection`, `self`
460+
- `data`: Type-specific payload (see [Binding Documents](/docs/W3DS%20Basics/Binding-Documents))
461+
- `ownerSignature`: Required signature from the subject
462+
463+
#### createBindingDocumentSignature Mutation
464+
465+
Add a signature to an existing binding document. Used for counterparty verification.
466+
467+
**Mutation**:
468+
```graphql
469+
mutation {
470+
createBindingDocumentSignature(input: {
471+
bindingDocumentId: "meta-envelope-id"
472+
signature: {
473+
signer: "@counterparty-uuid"
474+
signature: "sig_counterparty_xyz..."
475+
timestamp: "2025-01-24T11:00:00Z"
476+
}
477+
}) {
478+
bindingDocument {
479+
subject
480+
type
481+
signatures {
482+
signer
483+
signature
484+
timestamp
485+
}
486+
}
487+
errors {
488+
message
489+
code
490+
}
491+
}
492+
}
493+
```
494+
495+
**Input fields**:
496+
- `bindingDocumentId`: The MetaEnvelope ID of the binding document
497+
- `signature`: The signature to add (signer, signature, timestamp)
498+
340499
### Legacy API
341500

342501
The following queries and mutations are preserved for backward compatibility but are considered legacy. New integrations should use the idiomatic API above.

0 commit comments

Comments
 (0)