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

model updates to prepare for selective disclosure and self attested attributes #824

Merged
merged 26 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4663610
https://github.com/hyperledger-labs/business-partner-agent/issues/800
etschelp Sep 9, 2022
73218c4
activated request validation
etschelp Sep 9, 2022
70b3ea1
version updates. fixed annotation processor order. fixed accessors. s…
etschelp Sep 27, 2022
0ec2743
using Files... to load the test files.
etschelp Sep 27, 2022
0d7af30
recreated default schemas
etschelp Sep 27, 2022
0e31037
renamed class
etschelp Sep 27, 2022
2f7820d
simple reveal checkbox
etschelp Sep 27, 2022
7be2fab
Merge branch 'main' into feature/self-attested
etschelp Sep 27, 2022
b080ab9
- checkbox only visible on anoncred attribute groups
etschelp Sep 28, 2022
0f9355c
referent is not always a UUID
etschelp Sep 28, 2022
1c19dd2
license header
etschelp Sep 28, 2022
d80c61f
only render if there is data
etschelp Sep 28, 2022
9a8000a
fixed no warning displayed for v2
etschelp Sep 28, 2022
f6d9b7b
added role to isVerified() checks
etschelp Sep 29, 2022
dbdb623
fixed check
etschelp Sep 29, 2022
109de2c
adjusting to client changes
etschelp Sep 30, 2022
589f571
spotbugs
etschelp Sep 30, 2022
c37a2ea
Merge branch 'main' into feature/self-attested
etschelp Oct 3, 2022
dcd11dc
updating some of the UI dependencies
etschelp Oct 3, 2022
3385312
- updated node version in pom
etschelp Oct 3, 2022
8b6e542
adding predicate proof support to CredentialCard
etschelp Oct 3, 2022
5e6cce3
- added link to proof template
etschelp Oct 4, 2022
44e0da4
Merge branch 'main' into feature/self-attested
etschelp Oct 5, 2022
2ec759e
micronaut-openapi now creates the swagger yaml as it is rendered
etschelp Oct 5, 2022
73f3b23
- fixed all schemas displayed in case of there being nor OrgProfile
etschelp Oct 6, 2022
8da30bb
headers
etschelp Oct 6, 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
2 changes: 1 addition & 1 deletion backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ If you want to run in web only mode you also have to set:

5. Access the UI

Swagger UI: http://localhost:8080/swagger-ui
Swagger UI: http://localhost:8080/swagger-ui/
Frontend: http://localhost:8080

##FAQ
Expand Down
34 changes: 17 additions & 17 deletions backend/business-partner-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
<dependency>
<groupId>io.micronaut.email</groupId>
<artifactId>micronaut-email-mailjet</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
<exclusions>
<exclusion>
<groupId>javax.activation</groupId>
Expand All @@ -123,7 +123,7 @@
<dependency><!-- Overwrite for jakarta-annotations-api -->
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-annotations-api</artifactId>
<version>10.1.0-M17</version>
<version>10.1.0</version>
</dependency>

<!-- Logging -->
Expand All @@ -137,7 +137,7 @@
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<artifactId>log4j-slf4j2-impl</artifactId>
</dependency>
<!-- .yml log files -->
<dependency>
Expand All @@ -149,7 +149,7 @@
<dependency>
<groupId>network.idu.acapy</groupId>
<artifactId>aries-client-python</artifactId>
<version>0.7.29</version>
<version>0.7.30</version>
</dependency>
<dependency>
<groupId>org.hyperledger.business-partner-agent</groupId>
Expand Down Expand Up @@ -267,7 +267,7 @@
<version>${maven.compiler.plugin.version}</version>
<configuration>
<compilerArgs>
<arg>-J-Dmicronaut.openapi.views.spec=redoc.enabled=true,rapidoc.enabled=true,swagger-ui.enabled=true,swagger-ui.theme=flattop</arg>
<arg>-Amicronaut.openapi.views.spec=rapidoc.enabled=false,swagger-ui.enabled=true,swagger-ui.theme=flattop</arg>
<arg>-Amicronaut.processing.group=org.hyperledger.business-partner-agent</arg>
<arg>-Amicronaut.processing.module=business-partner-agent</arg>
</compilerArgs>
Expand All @@ -282,26 +282,26 @@
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>io.micronaut.openapi</groupId>
<artifactId>micronaut-openapi</artifactId>
<version>${micronaut.openapi.version}</version>
</path>
<path>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-inject-java</artifactId>
<version>${micronaut.version}</version>
</path>
<path>
<groupId>io.micronaut.security</groupId>
<artifactId>micronaut-security-annotations</artifactId>
<version>${micronaut.security.version}</version>
</path>
<path>
<groupId>io.micronaut.data</groupId>
<artifactId>micronaut-data-processor</artifactId>
<version>${micronaut.data.version}</version>
</path>
<path>
<groupId>io.micronaut.openapi</groupId>
<artifactId>micronaut-openapi</artifactId>
<version>${micronaut.openapi.version}</version>
</path>
<path>
<groupId>io.micronaut.security</groupId>
<artifactId>micronaut-security-annotations</artifactId>
<version>${micronaut.security.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Expand Down Expand Up @@ -443,8 +443,8 @@
</goals>
<configuration>
<!-- See https://nodejs.org/en/download/ -->
<nodeVersion>v16.15.1</nodeVersion>
<npmVersion>8.11.0</npmVersion>
<nodeVersion>v16.17.1</nodeVersion>
<npmVersion>8.15.0</npmVersion>
</configuration>
</execution>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import lombok.*;
import org.hyperledger.aries.api.ExchangeVersion;
import org.hyperledger.aries.api.present_proof.PresentProofRequest;
import org.hyperledger.aries.api.present_proof.PresentProofRequest.ProofRequest.ProofRequestedPredicates;
import org.hyperledger.aries.api.present_proof.PresentationExchangeRecord;
import org.hyperledger.aries.api.present_proof.PresentationExchangeRole;
import org.hyperledger.aries.api.present_proof.PresentationExchangeState;
import org.hyperledger.bpa.api.CredentialType;
Expand All @@ -40,6 +42,7 @@ public class AriesProofExchange {

private UUID id;
private UUID partnerId;
private UUID proofTemplateId;

private ExchangeVersion exchangeVersion;
private PresentationExchangeState state;
Expand All @@ -62,6 +65,7 @@ public static AriesProofExchange from(@NonNull PartnerProof p) {
return b
.id(p.getId())
.partnerId(p.getPartner().getId())
.proofTemplateId(p.getProofTemplate() != null ? p.getProofTemplate().getId() : null)
.state(p.getState())
.proofRequest(p.getProofRequest() != null ? p.getProofRequest().getIndy() : null)
.role(p.getRole())
Expand Down Expand Up @@ -92,6 +96,8 @@ public static class Identifier {
public static class RevealedAttributeGroup {
@Singular
private Map<String, String> revealedAttributes;
private ProofRequestedPredicates requestedPredicates;
private Identifier identifier;
private PresentationExchangeRecord.RequestedProofType proofType;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.hyperledger.bpa.config.BPAMessageSource;
import org.hyperledger.bpa.controller.api.invitation.APICreateInvitationResponse;
import org.hyperledger.bpa.controller.api.issuer.DeclineExchangeRequest;
import org.hyperledger.bpa.controller.api.partner.ApproveProofRequest;
import org.hyperledger.bpa.controller.api.proof.ApproveProofRequest;
import org.hyperledger.bpa.controller.api.partner.RequestProofRequest;
import org.hyperledger.bpa.controller.api.partner.SendProofRequest;
import org.hyperledger.bpa.controller.api.proof.PresentationRequestCredentialsIndy;
Expand Down Expand Up @@ -96,7 +96,7 @@ public HttpResponse<List<PresentationRequestCredentialsIndy>> getMatchingLDCrede
* @return HTTP status
*/
@Post("/{id}/prove")
public HttpResponse<Void> responseToProofRequest(@PathVariable UUID id, @Body @Nullable ApproveProofRequest req) {
public HttpResponse<Void> responseToProofRequest(@PathVariable UUID id, @Body @Valid ApproveProofRequest req) {
proofM.presentProof(id, req);
return HttpResponse.ok();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021 - for information on the respective copyright owner
* Copyright (c) 2020-2022 - for information on the respective copyright owner
* see the NOTICE file and/or the repository at
* https://github.com/hyperledger-labs/business-partner-agent
*
Expand All @@ -17,21 +17,14 @@
*/
package org.hyperledger.bpa.controller.api.activity;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.NoArgsConstructor;

@NoArgsConstructor
public enum ActivityRole {
@JsonProperty("connection_request_sender")
CONNECTION_REQUEST_SENDER,
@JsonProperty("connection_request_recipient")
CONNECTION_REQUEST_RECIPIENT,
@JsonProperty("credential_exchange_holder")
CREDENTIAL_EXCHANGE_HOLDER,
@JsonProperty("credential_exchange_issuer")
CREDENTIAL_EXCHANGE_ISSUER,
@JsonProperty("presentation_exchange_prover")
PRESENTATION_EXCHANGE_PROVER,
@JsonProperty("presentation_exchange_verifier")
PRESENTATION_EXCHANGE_VERIFIER,
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021 - for information on the respective copyright owner
* Copyright (c) 2020-2022 - for information on the respective copyright owner
* see the NOTICE file and/or the repository at
* https://github.com/hyperledger-labs/business-partner-agent
*
Expand All @@ -17,34 +17,20 @@
*/
package org.hyperledger.bpa.controller.api.activity;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.NoArgsConstructor;

@NoArgsConstructor
public enum ActivityState {
@JsonProperty("connection_request_received")
CONNECTION_REQUEST_RECEIVED,
@JsonProperty("connection_request_sent")
CONNECTION_REQUEST_SENT,
@JsonProperty("connection_request_accepted")
CONNECTION_REQUEST_ACCEPTED,
@JsonProperty("credential_exchange_sent")
CREDENTIAL_EXCHANGE_SENT,
@JsonProperty("credential_exchange_received")
CREDENTIAL_EXCHANGE_RECEIVED,
@JsonProperty("credential_exchange_accepted")
CREDENTIAL_EXCHANGE_ACCEPTED,
@JsonProperty("credential_exchange_declined")
CREDENTIAL_EXCHANGE_DECLINED,
@JsonProperty("credential_exchange_problem")
CREDENTIAL_EXCHANGE_PROBLEM,
@JsonProperty("presentation_exchange_sent")
PRESENTATION_EXCHANGE_SENT,
@JsonProperty("presentation_exchange_received")
PRESENTATION_EXCHANGE_RECEIVED,
@JsonProperty("presentation_exchange_accepted")
PRESENTATION_EXCHANGE_ACCEPTED,
@JsonProperty("presentation_exchange_declined")
PRESENTATION_EXCHANGE_DECLINED,

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021 - for information on the respective copyright owner
* Copyright (c) 2020-2022 - for information on the respective copyright owner
* see the NOTICE file and/or the repository at
* https://github.com/hyperledger-labs/business-partner-agent
*
Expand All @@ -17,15 +17,11 @@
*/
package org.hyperledger.bpa.controller.api.activity;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.NoArgsConstructor;

@NoArgsConstructor
public enum ActivityType {
@JsonProperty("connection_request")
CONNECTION_REQUEST,
@JsonProperty("credential_exchange")
CREDENTIAL_EXCHANGE,
@JsonProperty("presentation_exchange")
PRESENTATION_EXCHANGE
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright (c) 2020-2022 - for information on the respective copyright owner
* see the NOTICE file and/or the repository at
* https://github.com/hyperledger-labs/business-partner-agent
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.hyperledger.bpa.controller.api.proof;

import io.micronaut.core.annotation.Introspected;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hyperledger.aries.api.present_proof.SendPresentationRequestHelper;

import javax.validation.constraints.NotEmpty;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Data
@NoArgsConstructor
@Introspected
public class ApproveProofRequest {

@NotEmpty
private Map<String, SelectedReferent> selectedReferents;

@Data
@NoArgsConstructor
public static class SelectedReferent {
private String referent;
private Boolean revealed;
private String selfAttestedValue;
}

public Map<String, SendPresentationRequestHelper.SelectedMatch.ReferentInfo> toClientAPI() {
return selectedReferents.entrySet().stream()
.map(e -> Map.entry(e.getKey(),
SendPresentationRequestHelper.SelectedMatch.ReferentInfo.builder()
.referent(e.getValue().getReferent())
.revealed(e.getValue().getRevealed())
.selfAttestedValue(e.getValue().getSelfAttestedValue())
.build()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}

public List<String> collectReferents() {
return selectedReferents.values().stream()
.map(SelectedReferent::getReferent)
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import lombok.extern.slf4j.Slf4j;
import org.hyperledger.aries.api.present_proof.BasePresExRecord;
import org.hyperledger.aries.api.present_proof.PresentProofRequest;
import org.hyperledger.aries.api.present_proof.PresentationExchangeRecord;
import org.hyperledger.aries.api.present_proof.PresentationExchangeState;
import org.hyperledger.aries.api.present_proof_v2.V20PresExRecord;
import org.hyperledger.aries.api.present_proof_v2.V2DIFProofRequest;
Expand Down Expand Up @@ -141,13 +140,11 @@ private void handleProofRequest(@NonNull BasePresExRecord proof) {
pProof.setProofRequest(ExchangePayload.buildForProofRequest(dif));
}
pProofRepo.update(pProof);
if (proof.isNotAutoPresent()) {
if (proof instanceof V20PresExRecord dif) {
proofManager.acceptDifCredentialsFromProposal(dif, pProof);
} else if (proof instanceof PresentationExchangeRecord indy) {
proofManager.acceptSelectedIndyCredentials(null, pProof.getExchangeVersion(),
indy);
}
if (proof.isNotAutoPresent() && proof instanceof V20PresExRecord dif) {
// anoncred based proposals are always set to auto-present
// this does not work for dif exchanges, so they are handled
// explicitly here
proofManager.acceptDifCredentialsFromProposal(dif, pProof);
}
}
}, () -> {
Expand Down
Loading