Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

issue, request and receive w3c credentials #701

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
681b446
working exchange payload converter
etschelp Jan 6, 2022
d0d97a3
started with basic receive ld credential flow
etschelp Jan 7, 2022
44fa830
pushing shared holder logic to abstract base class
etschelp Jan 10, 2022
08c22c3
simple first store ld version. needs tests and cleaning up
etschelp Jan 13, 2022
f5dd74a
Merge branch 'main' into feature/store-ld-credential
etschelp Jan 14, 2022
1fb5c0a
fixed warnings
etschelp Jan 14, 2022
e7d05db
renamed migration
etschelp Jan 14, 2022
84def74
clean up
etschelp Jan 14, 2022
68b4b57
ld label strategy with test
etschelp Jan 17, 2022
53c43bd
started with the view models
etschelp Jan 17, 2022
bcdf2c3
joining schema to credential exchange
etschelp Jan 19, 2022
c12f335
Merge branch 'main' into feature/store-ld-credential
etschelp Feb 1, 2022
2c5bea7
fix imports after merging
etschelp Feb 1, 2022
fbb3751
merging packages
etschelp Feb 1, 2022
9b20dc6
moved the base holder
etschelp Feb 4, 2022
11f0650
Merge branch 'main' into feature/store-ld-credential
etschelp Feb 4, 2022
8bc052c
small fixes
etschelp Feb 4, 2022
5f74c50
api cleanup, wiring baic issue ld method
etschelp Feb 7, 2022
21e9198
cleaning up annotations
etschelp Feb 7, 2022
f99b340
persisting ld issuer state changes and credential issued
etschelp Feb 7, 2022
5e41576
typo in test
etschelp Feb 7, 2022
d9f31df
stash
etschelp Feb 8, 2022
6cf715e
Merge branch 'main' into feature/store-ld-credential
etschelp Feb 8, 2022
2c3c99c
revert until release
etschelp Feb 8, 2022
32f75c1
Merge branch 'main' into feature/store-ld-credential
etschelp Feb 8, 2022
2974b36
ld implementation for credential request, receive proposal and receiv…
etschelp Feb 9, 2022
30c694e
pushing all shared logic up to base classes
etschelp Feb 10, 2022
3a4ec16
separate counter offer implementations for indy and json-ld
etschelp Feb 10, 2022
17a1515
fixes
etschelp Feb 10, 2022
7b962c7
switching from abstract classes to multiple classes that delegate the…
etschelp Feb 11, 2022
8c0ec28
same class structure as with the issuers
etschelp Feb 11, 2022
5515ce2
split up send proposal into indy and ld part
etschelp Feb 11, 2022
ca02684
fixing states
etschelp Feb 11, 2022
a7fc5f5
added missing counter proposal. basic ui fix
etschelp Feb 14, 2022
2d5fccd
pmd
etschelp Feb 14, 2022
5a5f56b
working proposal and offer flows. ui needs more corrections.
etschelp Feb 15, 2022
0f8f53d
removing not needed classes
etschelp Feb 15, 2022
26fc338
fixed: credDef not selectable when proposal is received. hiding credD…
etschelp Feb 15, 2022
eb5f7be
renaming
etschelp Feb 15, 2022
6361a4b
more test files
etschelp Feb 16, 2022
afafa3d
setting holder did on credential request if ld.
etschelp Feb 16, 2022
f23e15d
issuer proposal flow test
etschelp Feb 16, 2022
cb7a05b
tests for ld issuer flows
etschelp Feb 16, 2022
bca5aa4
started with tests for holder ld flows
etschelp Feb 16, 2022
c18d7c0
rest of the ld holder flow tests
etschelp Feb 16, 2022
ec82ed7
missing header
etschelp Feb 16, 2022
bc56a85
updated readme
etschelp Feb 16, 2022
fc01725
added basic attribute validation
etschelp Feb 17, 2022
a3b2d99
hiding v2 slider for ld documents
etschelp Feb 17, 2022
88bcf68
Hiding credential definition tab in the UI when schema type is LD. Di…
etschelp Feb 17, 2022
d6ea47f
fixed filter, fixed circular reference
etschelp Feb 18, 2022
07d28fc
ld credentials in public profile
etschelp Feb 18, 2022
8141e4d
- fixed document label not editable if no default attribute is set, -…
etschelp Feb 21, 2022
7fcd4a5
validating default attribute name when creating the schema
etschelp Feb 21, 2022
e987c7a
version updates
etschelp Feb 21, 2022
a014ba8
reverting, needs to be cleaned up another time
etschelp Feb 21, 2022
9892655
filtering indy types when sending proof presentation
etschelp Feb 21, 2022
9db4d2d
using did:indy instead of did:key
etschelp Feb 21, 2022
6ceead3
test fixes
etschelp Feb 21, 2022
b07fcbe
adding id to subject
etschelp Feb 21, 2022
3e9d720
readme
etschelp Feb 21, 2022
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
88 changes: 45 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,48 +30,50 @@ The Business Partner Agent is built on top of the Hyperledger Self-Sovereign Ide

## Features in Detail

| Role/Feature | Flow | Protocol Version |
|------------------|-------------------------------------------------------------------------|-----------------------------------|
| Issuer | | |
| | auto: issue credential | indy: v1, v2 |
| | manual: send credential offer to holder | indy: v1, v2 |
| | manual: receive credential proposal from holder | indy: v1, v2 |
| | manual: decline credential proposal from holder and provide reason | indy: v1, v2 |
| | revoke issued credential (requires tails server) | n/a |
| Holder | | |
| | auto: receive credential | indy: v1, v2 |
| | manual: send credential proposal to issuer (based on document) | indy: v1, v2 |
| | manual: receive credential offer from issuer | indy: v1, v2 |
| | manual: decline credential offer from issuer | indy: v1, v2 |
| | scheduled revocation check on all received credentials | n/a |
| Prover | | |
| | auto: send presentation to verifier | indy: v1, v2 |
| | auto: answer presentation request | indy: v1, v2 |
| | manual: accept/decline presentation request and provide reason | indy: v1, v2 |
| Verifier | | |
| | auto: request presentation from prover based on proof template | indy: v1, v2 |
| | auto: receive and verify presentation from prover | indy: v1, v2 |
| Connection | | |
| | connect by did:sov, did:web (if endpoint is aca-py) | did-exchange |
| | receive invitation by URL | connection-protocol, OOB |
| | create invitation (barcode or URL) | connection-protocol, OOB |
| | auto: accept incoming connection | did-exchange, connection-protocol |
| | manual: accept incoming connection | did-exchange, connection-protocol |
| | optional: scheduled trust ping to check connection status | n/a |
| | tag a connection, e.g. as trusted issuer | n/a |
| Ledger | | |
| | send schema to the ledger (requires endorser role) | n/a |
| | create a credential definition on the ledger (requires endorser role) | n/a |
| Basic Message | | |
| | send and receive basic messages via chat window | n/a |
| Tasks/Activities | | |
| | list of tasks that need attention, and list of past activities | n/a |
| TAA | | |
| | if ledger is configured with a TAA, show it and give option to accept | n/a |
| Read Only Ledger | | |
| | if mode is set to web only | n/a |
| Public Profile | | |
| | web accessible (self signed) imprint based on credentials or documents | n/a |
| Role/Feature | Flow | Protocol Version |
|------------------|------------------------------------------------------------------------|-----------------------------------|
| Issuer | | |
| | auto: issue credential | indy: v1, v2 <br/>w3c: v2 |
| | manual: send credential offer to holder | indy: v1, v2 <br/>w3c: v2 |
| | manual: receive credential proposal from holder | indy: v1, v2 <br/>w3c: v2 |
| | manual: decline credential proposal from holder and provide reason | indy: v1, v2 <br/>w3c: v2 |
| | revoke issued credential (requires tails server) | indy: v1, v2 <br/>w3c: n/a |
| | send revocation notification | indy: v1, v2 <br/>w3c: n/a |
| Holder | | |
| | auto: receive credential | indy: v1, v2 <br/>w3c: v2 |
| | manual: send credential proposal to issuer (based on document) | indy: v1, v2 <br/>w3c: v2 |
| | manual: receive credential offer from issuer | indy: v1, v2 <br/>w3c: v2 |
| | manual: decline credential offer from issuer | indy: v1, v2 <br/>w3c: v2 |
| | scheduled revocation check on all received credentials | indy: v1, v2 <br/>w3c: n/a |
| | receive revocation notification | indy: v1, v2 <br/>w3c: n/a |
| Prover | | |
| | auto: send presentation to verifier | indy: v1, v2 |
| | auto: answer presentation request | indy: v1, v2 |
| | manual: accept/decline presentation request and provide reason | indy: v1, v2 |
| Verifier | | |
| | auto: request presentation from prover based on proof template | indy: v1, v2 |
| | auto: receive and verify presentation from prover | indy: v1, v2 |
| Connection | | |
| | connect by did:sov, did:web (if endpoint is aca-py) | did-exchange |
| | receive invitation by URL | connection-protocol, OOB |
| | create invitation (barcode or URL) | connection-protocol, OOB |
| | auto: accept incoming connection | did-exchange, connection-protocol |
| | manual: accept incoming connection | did-exchange, connection-protocol |
| | optional: scheduled trust ping to check connection status | n/a |
| | tag a connection, e.g. as trusted issuer | n/a |
| Ledger | | |
| | send schema to the ledger (requires endorser role) | n/a |
| | create a credential definition on the ledger (requires endorser role) | n/a |
| Basic Message | | |
| | send and receive basic messages via chat window | n/a |
| Tasks/Activities | | |
| | list of tasks that need attention, and list of past activities | n/a |
| TAA | | |
| | if ledger is configured with a TAA, show it and give option to accept | n/a |
| Read Only Ledger | | |
| | if mode is set to web only | n/a |
| Public Profile | | |
| | web accessible (self signed) imprint based on credentials or documents | n/a |

## Upcoming Features

Expand Down Expand Up @@ -113,7 +115,7 @@ Learn how to contribute in [Contributing](CONTRIBUTING.md). You can also start b

Regarding release process, we do not follow a strict process yet, nevertheless we follow the guidelines described in [Publishing](PUBLISHING.md).

Learn what aries protocols can be controlled by the BPA in [aca-py-args](scripts/aca-py-args.md)
Learn what aries protocols can be controlled by the BPA in [aca-py-args](scripts/acapy-static-args.yml)

## Business Partner Agent in Action
- [COP26 Presented by BC Goverment and OpenEarth Foundation](https://www.youtube.com/watch?v=q0Jml3isSh8)
Expand Down
4 changes: 2 additions & 2 deletions backend/business-partner-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<dependency>
<groupId>network.idu.acapy</groupId>
<artifactId>aries-client-python</artifactId>
<version>0.7.20</version>
<version>0.7.22</version>
</dependency>
<dependency>
<groupId>org.hyperledger.business-partner-agent</groupId>
Expand Down Expand Up @@ -170,7 +170,7 @@
<dependency>
<groupId>io.micronaut.email</groupId>
<artifactId>micronaut-email-mailjet</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<exclusions>
<exclusion>
<groupId>javax.activation</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.commons.lang3.StringUtils;
import org.hyperledger.aries.api.ExchangeVersion;
import org.hyperledger.aries.api.issue_credential_v1.CredentialExchangeState;
import org.hyperledger.bpa.impl.aries.jsonld.LDContextHelper;
import org.hyperledger.bpa.persistence.model.BPACredentialExchange;

import java.util.Map;
Expand Down Expand Up @@ -52,12 +53,17 @@ public class AriesCredential {
public static AriesCredential fromBPACredentialExchange(@NonNull BPACredentialExchange c,
@Nullable String typeLabel) {
AriesCredentialBuilder b = AriesCredential.builder();
if (c.getCredential() != null) {
if (c.typeIsIndy() && c.getIndyCredential() != null) {
b
.schemaId(c.getCredential().getSchemaId())
.credentialDefinitionId(c.getCredential().getCredentialDefinitionId())
.revocable(StringUtils.isNotEmpty(c.getCredential().getRevRegId()))
.credentialData(c.getCredential().getAttrs());
.schemaId(c.getIndyCredential().getSchemaId())
.credentialDefinitionId(c.getIndyCredential().getCredentialDefinitionId())
.revocable(StringUtils.isNotEmpty(c.getIndyCredential().getRevRegId()));
} else if (c.typeIsJsonLd()) {
b
.schemaId(LDContextHelper.findSchemaId(
c.exchangePayloadByState() != null ? c.exchangePayloadByState().getLdProof() : null))
.revocable(false) // not supported with ld-credentials
;
}
return b
.id(c.getId())
Expand All @@ -70,6 +76,7 @@ public static AriesCredential fromBPACredentialExchange(@NonNull BPACredentialEx
.label(c.getLabel())
.typeLabel(typeLabel)
.exchangeVersion(c.getExchangeVersion())
.credentialData(c.attributesByState())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public class SchemaAPI {

private Set<String> schemaAttributeNames;

private String defaultAttributeName;

private List<TrustedIssuer> trustedIssuer;

// ld only
Expand Down Expand Up @@ -103,6 +105,7 @@ public static SchemaAPI from(BPASchema s, boolean includeRestrictions, boolean i
.label(s.getLabel())
.schemaId(s.getSchemaId())
.schemaAttributeNames(s.getSchemaAttributeNames() != null ? s.getSchemaAttributeNames() : Set.of())
.defaultAttributeName(s.getDefaultAttributeName())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.hyperledger.bpa.impl.aries.schema.SchemaService;
import org.hyperledger.bpa.impl.mode.indy.EndpointService;

import javax.validation.Valid;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
Expand Down Expand Up @@ -77,7 +78,7 @@ public HttpResponse<List<SchemaAPI>> listSchemas() {
}

/**
* Get a configured schema
* Get a configured schema by id
*
* @param id {@link UUID} the schema id
* @return {@link HttpResponse}
Expand All @@ -89,13 +90,13 @@ public HttpResponse<SchemaAPI> getSchema(@PathVariable UUID id) {
}

/**
* Add a schema configuration
* Import an existing indy or json-ld schema as schema configuration
*
* @param req {@link AddSchemaRequest}
* @return {@link HttpResponse}
*/
@Post("/schema")
public HttpResponse<SchemaAPI> addSchema(@Body AddSchemaRequest req) {
public HttpResponse<SchemaAPI> addSchema(@Body @Valid AddSchemaRequest req) {
if (req instanceof AddSchemaRequest.AddIndySchema) {
return HttpResponse.ok(schemaService.addIndySchema(req.getSchemaId(), req.getLabel(),
req.getDefaultAttributeName(), ((AddSchemaRequest.AddIndySchema) req).getTrustedIssuer()));
Expand Down
Loading