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

Commit 8caaef8

Browse files
author
Philipp Etschel
authored
Merge pull request #824 from boschresearch/feature/self-attested
model updates to prepare for selective disclosure and self attested attributes
2 parents cfbb4e0 + 8da30bb commit 8caaef8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+34540
-19241
lines changed

backend/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ If you want to run in web only mode you also have to set:
7474

7575
5. Access the UI
7676

77-
Swagger UI: http://localhost:8080/swagger-ui
77+
Swagger UI: http://localhost:8080/swagger-ui/
7878
Frontend: http://localhost:8080
7979

8080
##FAQ

backend/business-partner-agent/pom.xml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
<dependency>
103103
<groupId>io.micronaut.email</groupId>
104104
<artifactId>micronaut-email-mailjet</artifactId>
105-
<version>1.3.1</version>
105+
<version>1.3.2</version>
106106
<exclusions>
107107
<exclusion>
108108
<groupId>javax.activation</groupId>
@@ -123,7 +123,7 @@
123123
<dependency><!-- Overwrite for jakarta-annotations-api -->
124124
<groupId>org.apache.tomcat</groupId>
125125
<artifactId>tomcat-annotations-api</artifactId>
126-
<version>10.1.0-M17</version>
126+
<version>10.1.0</version>
127127
</dependency>
128128

129129
<!-- Logging -->
@@ -137,7 +137,7 @@
137137
</dependency>
138138
<dependency>
139139
<groupId>org.apache.logging.log4j</groupId>
140-
<artifactId>log4j-slf4j-impl</artifactId>
140+
<artifactId>log4j-slf4j2-impl</artifactId>
141141
</dependency>
142142
<!-- .yml log files -->
143143
<dependency>
@@ -149,7 +149,7 @@
149149
<dependency>
150150
<groupId>network.idu.acapy</groupId>
151151
<artifactId>aries-client-python</artifactId>
152-
<version>0.7.29</version>
152+
<version>0.7.30</version>
153153
</dependency>
154154
<dependency>
155155
<groupId>org.hyperledger.business-partner-agent</groupId>
@@ -267,7 +267,7 @@
267267
<version>${maven.compiler.plugin.version}</version>
268268
<configuration>
269269
<compilerArgs>
270-
<arg>-J-Dmicronaut.openapi.views.spec=redoc.enabled=true,rapidoc.enabled=true,swagger-ui.enabled=true,swagger-ui.theme=flattop</arg>
270+
<arg>-Amicronaut.openapi.views.spec=rapidoc.enabled=false,swagger-ui.enabled=true,swagger-ui.theme=flattop</arg>
271271
<arg>-Amicronaut.processing.group=org.hyperledger.business-partner-agent</arg>
272272
<arg>-Amicronaut.processing.module=business-partner-agent</arg>
273273
</compilerArgs>
@@ -282,26 +282,26 @@
282282
<artifactId>mapstruct-processor</artifactId>
283283
<version>${org.mapstruct.version}</version>
284284
</path>
285-
<path>
286-
<groupId>io.micronaut.openapi</groupId>
287-
<artifactId>micronaut-openapi</artifactId>
288-
<version>${micronaut.openapi.version}</version>
289-
</path>
290285
<path>
291286
<groupId>io.micronaut</groupId>
292287
<artifactId>micronaut-inject-java</artifactId>
293288
<version>${micronaut.version}</version>
294289
</path>
295-
<path>
296-
<groupId>io.micronaut.security</groupId>
297-
<artifactId>micronaut-security-annotations</artifactId>
298-
<version>${micronaut.security.version}</version>
299-
</path>
300290
<path>
301291
<groupId>io.micronaut.data</groupId>
302292
<artifactId>micronaut-data-processor</artifactId>
303293
<version>${micronaut.data.version}</version>
304294
</path>
295+
<path>
296+
<groupId>io.micronaut.openapi</groupId>
297+
<artifactId>micronaut-openapi</artifactId>
298+
<version>${micronaut.openapi.version}</version>
299+
</path>
300+
<path>
301+
<groupId>io.micronaut.security</groupId>
302+
<artifactId>micronaut-security-annotations</artifactId>
303+
<version>${micronaut.security.version}</version>
304+
</path>
305305
</annotationProcessorPaths>
306306
</configuration>
307307
</plugin>
@@ -443,8 +443,8 @@
443443
</goals>
444444
<configuration>
445445
<!-- See https://nodejs.org/en/download/ -->
446-
<nodeVersion>v16.15.1</nodeVersion>
447-
<npmVersion>8.11.0</npmVersion>
446+
<nodeVersion>v16.17.1</nodeVersion>
447+
<npmVersion>8.15.0</npmVersion>
448448
</configuration>
449449
</execution>
450450
<execution>

backend/business-partner-agent/src/main/java/org/hyperledger/bpa/api/aries/AriesProofExchange.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import lombok.*;
2222
import org.hyperledger.aries.api.ExchangeVersion;
2323
import org.hyperledger.aries.api.present_proof.PresentProofRequest;
24+
import org.hyperledger.aries.api.present_proof.PresentProofRequest.ProofRequest.ProofRequestedPredicates;
25+
import org.hyperledger.aries.api.present_proof.PresentationExchangeRecord;
2426
import org.hyperledger.aries.api.present_proof.PresentationExchangeRole;
2527
import org.hyperledger.aries.api.present_proof.PresentationExchangeState;
2628
import org.hyperledger.bpa.api.CredentialType;
@@ -40,6 +42,7 @@ public class AriesProofExchange {
4042

4143
private UUID id;
4244
private UUID partnerId;
45+
private UUID proofTemplateId;
4346

4447
private ExchangeVersion exchangeVersion;
4548
private PresentationExchangeState state;
@@ -62,6 +65,7 @@ public static AriesProofExchange from(@NonNull PartnerProof p) {
6265
return b
6366
.id(p.getId())
6467
.partnerId(p.getPartner().getId())
68+
.proofTemplateId(p.getProofTemplate() != null ? p.getProofTemplate().getId() : null)
6569
.state(p.getState())
6670
.proofRequest(p.getProofRequest() != null ? p.getProofRequest().getIndy() : null)
6771
.role(p.getRole())
@@ -92,6 +96,8 @@ public static class Identifier {
9296
public static class RevealedAttributeGroup {
9397
@Singular
9498
private Map<String, String> revealedAttributes;
99+
private ProofRequestedPredicates requestedPredicates;
95100
private Identifier identifier;
101+
private PresentationExchangeRecord.RequestedProofType proofType;
96102
}
97103
}

backend/business-partner-agent/src/main/java/org/hyperledger/bpa/controller/ProofExchangeController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import org.hyperledger.bpa.config.BPAMessageSource;
3636
import org.hyperledger.bpa.controller.api.invitation.APICreateInvitationResponse;
3737
import org.hyperledger.bpa.controller.api.issuer.DeclineExchangeRequest;
38-
import org.hyperledger.bpa.controller.api.partner.ApproveProofRequest;
38+
import org.hyperledger.bpa.controller.api.proof.ApproveProofRequest;
3939
import org.hyperledger.bpa.controller.api.partner.RequestProofRequest;
4040
import org.hyperledger.bpa.controller.api.partner.SendProofRequest;
4141
import org.hyperledger.bpa.controller.api.proof.PresentationRequestCredentialsIndy;
@@ -96,7 +96,7 @@ public HttpResponse<List<PresentationRequestCredentialsIndy>> getMatchingLDCrede
9696
* @return HTTP status
9797
*/
9898
@Post("/{id}/prove")
99-
public HttpResponse<Void> responseToProofRequest(@PathVariable UUID id, @Body @Nullable ApproveProofRequest req) {
99+
public HttpResponse<Void> responseToProofRequest(@PathVariable UUID id, @Body @Valid ApproveProofRequest req) {
100100
proofM.presentProof(id, req);
101101
return HttpResponse.ok();
102102
}

backend/business-partner-agent/src/main/java/org/hyperledger/bpa/controller/api/activity/ActivityRole.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020-2021 - for information on the respective copyright owner
2+
* Copyright (c) 2020-2022 - for information on the respective copyright owner
33
* see the NOTICE file and/or the repository at
44
* https://github.com/hyperledger-labs/business-partner-agent
55
*
@@ -17,21 +17,14 @@
1717
*/
1818
package org.hyperledger.bpa.controller.api.activity;
1919

20-
import com.fasterxml.jackson.annotation.JsonProperty;
2120
import lombok.NoArgsConstructor;
2221

2322
@NoArgsConstructor
2423
public enum ActivityRole {
25-
@JsonProperty("connection_request_sender")
2624
CONNECTION_REQUEST_SENDER,
27-
@JsonProperty("connection_request_recipient")
2825
CONNECTION_REQUEST_RECIPIENT,
29-
@JsonProperty("credential_exchange_holder")
3026
CREDENTIAL_EXCHANGE_HOLDER,
31-
@JsonProperty("credential_exchange_issuer")
3227
CREDENTIAL_EXCHANGE_ISSUER,
33-
@JsonProperty("presentation_exchange_prover")
3428
PRESENTATION_EXCHANGE_PROVER,
35-
@JsonProperty("presentation_exchange_verifier")
3629
PRESENTATION_EXCHANGE_VERIFIER,
3730
}
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020-2021 - for information on the respective copyright owner
2+
* Copyright (c) 2020-2022 - for information on the respective copyright owner
33
* see the NOTICE file and/or the repository at
44
* https://github.com/hyperledger-labs/business-partner-agent
55
*
@@ -17,34 +17,20 @@
1717
*/
1818
package org.hyperledger.bpa.controller.api.activity;
1919

20-
import com.fasterxml.jackson.annotation.JsonProperty;
2120
import lombok.NoArgsConstructor;
2221

2322
@NoArgsConstructor
2423
public enum ActivityState {
25-
@JsonProperty("connection_request_received")
2624
CONNECTION_REQUEST_RECEIVED,
27-
@JsonProperty("connection_request_sent")
2825
CONNECTION_REQUEST_SENT,
29-
@JsonProperty("connection_request_accepted")
3026
CONNECTION_REQUEST_ACCEPTED,
31-
@JsonProperty("credential_exchange_sent")
3227
CREDENTIAL_EXCHANGE_SENT,
33-
@JsonProperty("credential_exchange_received")
3428
CREDENTIAL_EXCHANGE_RECEIVED,
35-
@JsonProperty("credential_exchange_accepted")
3629
CREDENTIAL_EXCHANGE_ACCEPTED,
37-
@JsonProperty("credential_exchange_declined")
3830
CREDENTIAL_EXCHANGE_DECLINED,
39-
@JsonProperty("credential_exchange_problem")
4031
CREDENTIAL_EXCHANGE_PROBLEM,
41-
@JsonProperty("presentation_exchange_sent")
4232
PRESENTATION_EXCHANGE_SENT,
43-
@JsonProperty("presentation_exchange_received")
4433
PRESENTATION_EXCHANGE_RECEIVED,
45-
@JsonProperty("presentation_exchange_accepted")
4634
PRESENTATION_EXCHANGE_ACCEPTED,
47-
@JsonProperty("presentation_exchange_declined")
4835
PRESENTATION_EXCHANGE_DECLINED,
49-
5036
}

backend/business-partner-agent/src/main/java/org/hyperledger/bpa/controller/api/activity/ActivityType.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020-2021 - for information on the respective copyright owner
2+
* Copyright (c) 2020-2022 - for information on the respective copyright owner
33
* see the NOTICE file and/or the repository at
44
* https://github.com/hyperledger-labs/business-partner-agent
55
*
@@ -17,15 +17,11 @@
1717
*/
1818
package org.hyperledger.bpa.controller.api.activity;
1919

20-
import com.fasterxml.jackson.annotation.JsonProperty;
2120
import lombok.NoArgsConstructor;
2221

2322
@NoArgsConstructor
2423
public enum ActivityType {
25-
@JsonProperty("connection_request")
2624
CONNECTION_REQUEST,
27-
@JsonProperty("credential_exchange")
2825
CREDENTIAL_EXCHANGE,
29-
@JsonProperty("presentation_exchange")
3026
PRESENTATION_EXCHANGE
3127
}

backend/business-partner-agent/src/main/java/org/hyperledger/bpa/controller/api/partner/ApproveProofRequest.java

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (c) 2020-2022 - for information on the respective copyright owner
3+
* see the NOTICE file and/or the repository at
4+
* https://github.com/hyperledger-labs/business-partner-agent
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package org.hyperledger.bpa.controller.api.proof;
19+
20+
import io.micronaut.core.annotation.Introspected;
21+
import lombok.Data;
22+
import lombok.NoArgsConstructor;
23+
import org.hyperledger.aries.api.present_proof.SendPresentationRequestHelper;
24+
25+
import javax.validation.constraints.NotEmpty;
26+
import java.util.List;
27+
import java.util.Map;
28+
import java.util.stream.Collectors;
29+
30+
@Data
31+
@NoArgsConstructor
32+
@Introspected
33+
public class ApproveProofRequest {
34+
35+
@NotEmpty
36+
private Map<String, SelectedReferent> selectedReferents;
37+
38+
@Data
39+
@NoArgsConstructor
40+
public static class SelectedReferent {
41+
private String referent;
42+
private Boolean revealed;
43+
private String selfAttestedValue;
44+
}
45+
46+
public Map<String, SendPresentationRequestHelper.SelectedMatch.ReferentInfo> toClientAPI() {
47+
return selectedReferents.entrySet().stream()
48+
.map(e -> Map.entry(e.getKey(),
49+
SendPresentationRequestHelper.SelectedMatch.ReferentInfo.builder()
50+
.referent(e.getValue().getReferent())
51+
.revealed(e.getValue().getRevealed())
52+
.selfAttestedValue(e.getValue().getSelfAttestedValue())
53+
.build()))
54+
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
55+
}
56+
57+
public List<String> collectReferents() {
58+
return selectedReferents.values().stream()
59+
.map(SelectedReferent::getReferent)
60+
.collect(Collectors.toList());
61+
}
62+
}

backend/business-partner-agent/src/main/java/org/hyperledger/bpa/impl/aries/proof/ProofEventHandler.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import lombok.extern.slf4j.Slf4j;
2626
import org.hyperledger.aries.api.present_proof.BasePresExRecord;
2727
import org.hyperledger.aries.api.present_proof.PresentProofRequest;
28-
import org.hyperledger.aries.api.present_proof.PresentationExchangeRecord;
2928
import org.hyperledger.aries.api.present_proof.PresentationExchangeState;
3029
import org.hyperledger.aries.api.present_proof_v2.V20PresExRecord;
3130
import org.hyperledger.aries.api.present_proof_v2.V2DIFProofRequest;
@@ -141,13 +140,11 @@ private void handleProofRequest(@NonNull BasePresExRecord proof) {
141140
pProof.setProofRequest(ExchangePayload.buildForProofRequest(dif));
142141
}
143142
pProofRepo.update(pProof);
144-
if (proof.isNotAutoPresent()) {
145-
if (proof instanceof V20PresExRecord dif) {
146-
proofManager.acceptDifCredentialsFromProposal(dif, pProof);
147-
} else if (proof instanceof PresentationExchangeRecord indy) {
148-
proofManager.acceptSelectedIndyCredentials(null, pProof.getExchangeVersion(),
149-
indy);
150-
}
143+
if (proof.isNotAutoPresent() && proof instanceof V20PresExRecord dif) {
144+
// anoncred based proposals are always set to auto-present
145+
// this does not work for dif exchanges, so they are handled
146+
// explicitly here
147+
proofManager.acceptDifCredentialsFromProposal(dif, pProof);
151148
}
152149
}
153150
}, () -> {

0 commit comments

Comments
 (0)