Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Nuts v6 #7

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: generate

generate:
mvn clean generate-sources
mvn clean process-sources

install:
mvn clean install
Expand Down
17 changes: 2 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,11 @@ It is generated from the latest version of the OpenAPI specifications of the Nut

Find all versions on [Maven central](https://search.maven.org/artifact/nl.reinkrul.nuts/java-client).

# Usage
The example below instantiates the API client for VDR and calls `getDID` for `subjectDID`:
```java
var apiClient = new nl.reinkrul.nuts.ApiClient();

var didApi = new nl.reinkrul.nuts.vdr.DidApi(apiClient);
var didDocument = didApi.getDID(subjectDID, null, null);

// do something with the resolved DID Document
```

# Usage and examples
Since each module in the Nuts Node has its own OpenAPI specification, there is a client API generated for each of them.
You can find in their own subpackage in `nl.reinkrul.nuts` (e.g. `nl.reinkrul.nuts.vdr`).

# Examples

See [src/test/java/CredentialExamples.java](src/test/java/CredentialExamples.java)
for how to issue `NutsOrganizationCredential`, `NutsAuthenticationCredential` and `NutsEmployeeCredential`.
See [src/test/java/nl/reinkrul/nuts/IntegrationTest.java](src/test/java/nl/reinkrul/nuts/IntegrationTest.java) for an example of how to use the client.

# Versioning

Expand Down
57 changes: 57 additions & 0 deletions nutsnode/discovery/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"id": "test",
"endpoint": "http://localhost:8080/discovery/test",
"presentation_max_validity": 2764800,
"presentation_definition": {
"id": "dev:eOverdracht2023",
"format": {
"ldp_vc": {
"proof_type": [
"JsonWebSignature2020"
]
},
"jwt_vp": {
"alg": ["ES256"]
},
"jwt_vc": {
"alg": ["ES256"]
}
},
"input_descriptors": [
{
"id": "SelfIssued_NutsUraCredential",
"constraints": {
"fields": [
{
"path": [
"$.type"
],
"filter": {
"type": "string",
"const": "NutsUraCredential"
}
},
{
"id": "organization.name",
"path": [
"$.credentialSubject.organization.name"
],
"filter": {
"type": "string"
}
},
{
"id": "organization.ura",
"path": [
"$.credentialSubject.organization.ura"
],
"filter": {
"type": "string"
}
}
]
}
}
]
}
}
19 changes: 19 additions & 0 deletions nutsnode/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
nuts-node:
image: nutsfoundation/nuts-node:master
ports:
- "8081:8081"
- "8080:8080"
volumes:
- ./discovery:/opt/nuts/discovery:ro
- ./policy:/opt/nuts/policy:ro
environment:
NUTS_CRYPTO_STORAGE: fs
NUTS_HTTP_INTERNAL_ADDRESS: :8081
NUTS_URL: http://localhost:8080
NUTS_STRICTMODE: false
NUTS_DISCOVERY_DEFINITIONS_DIRECTORY: /opt/nuts/discovery
NUTS_DISCOVERY_SERVER_IDS: test
NUTS_POLICY_DIRECTORY: /opt/nuts/policy
NUTS_AUTH_CONTRACTVALIDATORS: dummy
NUTS_VDR_DIDMETHODS: web
137 changes: 137 additions & 0 deletions nutsnode/policy/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"test": {
"organization": {
"format": {
"ldp_vc": {
"proof_type": [
"JsonWebSignature2020"
]
},
"jwt_vc": {
"alg": [
"ES256"
]
},
"ldp_vp": {
"proof_type": [
"JsonWebSignature2020"
]
},
"jwt_vp": {
"alg": [
"ES256"
]
}
},
"id": "pd_any_care_organization_with_employee",
"name": "Care organization with employee",
"purpose": "Finding a care organization with logged in user for authorizing access to medical metadata",
"input_descriptors": [
{
"id": "id_nuts_ura_credential",
"name": "Care organization",
"purpose": "Finding a care organization for authorizing access to medical metadata.",
"constraints": {
"fields": [
{
"path": [
"$.type"
],
"filter": {
"type": "string",
"const": "NutsUraCredential"
}
},
{
"id": "organization_name",
"path": [
"$.credentialSubject.organization.name",
"$.credentialSubject[0].organization.name"
],
"filter": {
"type": "string"
}
},
{
"id": "organization_ura",
"path": [
"$.credentialSubject.organization.ura",
"$.credentialSubject[0].organization.ura"
],
"filter": {
"type": "string"
}
},
{
"id": "organization_city",
"path": [
"$.credentialSubject.organization.city",
"$.credentialSubject[0].organization.city"
],
"filter": {
"type": "string"
}
}
]
}
},
{
"id": "id_employee_credential_cred",
"constraints": {
"fields": [
{
"path": [
"$.type"
],
"filter": {
"type": "string",
"const": "NutsEmployeeCredential"
}
},
{
"id": "employee_identifier",
"path": [
"$.credentialSubject.member.identifier",
"$.credentialSubject[0].member.identifier"
],
"filter": {
"type": "string"
}
},
{
"id": "employee_name",
"path": [
"$.credentialSubject.member.member.familyName",
"$.credentialSubject[0].member.member.familyName"
],
"filter": {
"type": "string"
}
},
{
"id": "employee_initials",
"path": [
"$.credentialSubject.member.member.initials",
"$.credentialSubject[0].member.member.initials"
],
"filter": {
"type": "string"
}
},
{
"id": "employee_role",
"path": [
"$.credentialSubject.member.roleName",
"$.credentialSubject[0].member.roleName"
],
"filter": {
"type": "string"
}
}
]
}
}
]
}
}
}
Loading
Loading