diff --git a/README.md b/README.md index af145c3..d1c29e1 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,15 @@ Client tools for building Quarkus java DIDcomm Verifiable Credential powered conversational service (Chatbots) with [2060.io Service Agent](https://github.com/2060-io/2060-service-agent/blob/main/doc/service-agent-api.md) +## How to use +On dev mode use the command `mvn clean install -Dgpg.skip` to run the project + ## Releases | Version | Release Date | Type of Change | Description | |---------|--------------|---------------------|-----------------------------------------------------------------------------| -| 2.0.9 | 2024-10-DD | Patch | - add profile message parameters | +| 2.0.10 | 2024-10-02 | Patch | - add mrz message parameters | +| 2.0.9 | 2024-10-01 | Patch | - add profile message parameters | | 2.0.8 | 2024-09-27 | Patch | - add call's command | diff --git a/pom.xml b/pom.xml index 8066624..4d64d02 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 io.2060 service-agent-java-client - 2.0.9 + 2.0.10 UTF-8 17 diff --git a/src/main/java/io/twentysixty/sa/client/enums/Mrz.java b/src/main/java/io/twentysixty/sa/client/enums/Mrz.java new file mode 100644 index 0000000..85abaf3 --- /dev/null +++ b/src/main/java/io/twentysixty/sa/client/enums/Mrz.java @@ -0,0 +1,83 @@ +package io.twentysixty.sa.client.enums; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@Getter +@Setter +@ToString +public class Mrz { + public enum Format { + @JsonProperty("TD1") + TD1, + @JsonProperty("TD2") + TD2, + @JsonProperty("TD3") + TD3, + @JsonProperty("FRENCH_NATIONAL_ID") + FRENCH_NATIONAL_ID, + @JsonProperty("FRENCH_DRIVING_LICENSE") + FRENCH_DRIVING_LICENSE, + @JsonProperty("SWISS_DRIVING_LICENSE") + SWISS_DRIVING_LICENSE; + } + + public enum FieldName { + @JsonProperty("administrativeCode") + ADMINISTRATIVE_CODE, + @JsonProperty("administrativeCode2") + ADMINISTRATIVE_CODE2, + @JsonProperty("birthDate") + BIRTH_DATE, + @JsonProperty("birthDateCheckDigit") + BIRTH_DATE_CHECK_DIGIT, + @JsonProperty("compositeCheckDigit") + COMPOSITE_CHECK_DIGIT, + @JsonProperty("documentNumber") + DOCUMENT_NUMBER, + @JsonProperty("documentNumberCheckDigit") + DOCUMENT_NUMBER_CHECK_DIGIT, + @JsonProperty("documentCode") + DOCUMENT_CODE, + @JsonProperty("expirationDate") + EXPIRATION_DATE, + @JsonProperty("expirationDateCheckDigit") + EXPIRATION_DATE_CHECK_DIGIT, + @JsonProperty("firstName") + FIRST_NAME, + @JsonProperty("issueDate") + ISSUE_DATE, + @JsonProperty("issuingState") + ISSUING_STATE, + @JsonProperty("languageCode") + LANGUAGE_CODE, + @JsonProperty("lastName") + LAST_NAME, + @JsonProperty("nationality") + NATIONALITY, + @JsonProperty("optional") + OPTIONAL, + @JsonProperty("optional1") + OPTIONAL1, + @JsonProperty("optional2") + OPTIONAL2, + @JsonProperty("personalNumber") + PERSONAL_NUMBER, + @JsonProperty("personalNumberCheckDigit") + PERSONAL_NUMBER_CHECK_DIGIT, + @JsonProperty("pinCode") + PIN_CODE, + @JsonProperty("sex") + SEX, + @JsonProperty("versionNumber") + VERSION_NUMBER; + } +} diff --git a/src/main/java/io/twentysixty/sa/client/model/message/BaseMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/BaseMessage.java index ea6ce49..2ea6241 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/BaseMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/BaseMessage.java @@ -18,6 +18,8 @@ import io.twentysixty.sa.client.model.message.calls.CallEndRequestMessage; import io.twentysixty.sa.client.model.message.calls.CallOfferRequestMessage; import io.twentysixty.sa.client.model.message.calls.CallRejectRequestMessage; +import io.twentysixty.sa.client.model.message.mrtd.MrzDataRequestMessage; +import io.twentysixty.sa.client.model.message.mrtd.MrzDataSubmitMessage; import io.twentysixty.sa.client.util.InstantDeserializer; import io.twentysixty.sa.client.util.InstantSerializer; @@ -45,7 +47,9 @@ @Type(value = CallAcceptRequestMessage.class, name ="call-accept"), @Type(value = CallEndRequestMessage.class, name ="call-end"), @Type(value = CallOfferRequestMessage.class, name ="call-offer"), - @Type(value = CallRejectRequestMessage.class, name ="call-reject") + @Type(value = CallRejectRequestMessage.class, name ="call-reject"), + @Type(value = MrzDataRequestMessage.class, name ="mrz-data-request"), + @Type(value = MrzDataSubmitMessage.class, name ="mrz-data-submit") }) public abstract class BaseMessage implements Serializable { diff --git a/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzData.java b/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzData.java new file mode 100644 index 0000000..6efb10f --- /dev/null +++ b/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzData.java @@ -0,0 +1,45 @@ +package io.twentysixty.sa.client.model.message.mrtd; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +import io.twentysixty.sa.client.enums.Mrz; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@Getter +@Setter +@ToString +public class MrzData implements Serializable { + + private static final long serialVersionUID = -5234275638176689315L; + + private Object raw; + private ParsedData parsed; + + public String getRaw() { + if (raw instanceof List) { + return String.join(",", (List) raw); + } else if (raw instanceof String) { + return (String) raw; + } + return null; + } + + @Getter + @Setter + @ToString + public static class ParsedData { + private Mrz.Format format; + private Map fields; + private boolean valid; + } +} diff --git a/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataRequestMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataRequestMessage.java new file mode 100644 index 0000000..32a638d --- /dev/null +++ b/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataRequestMessage.java @@ -0,0 +1,23 @@ +package io.twentysixty.sa.client.model.message.mrtd; + +import java.util.UUID; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +import io.twentysixty.sa.client.model.message.BaseMessage; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class MrzDataRequestMessage extends BaseMessage { + + private static final long serialVersionUID = -2840211856886673672L; + + public static MrzDataRequestMessage build(UUID connectionId, UUID threadId) { + MrzDataRequestMessage mrzr = new MrzDataRequestMessage(); + mrzr.setConnectionId(connectionId); + mrzr.setThreadId(threadId); + return mrzr; + } +} diff --git a/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataSubmitMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataSubmitMessage.java new file mode 100644 index 0000000..46ccff7 --- /dev/null +++ b/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataSubmitMessage.java @@ -0,0 +1,23 @@ +package io.twentysixty.sa.client.model.message.mrtd; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +import io.twentysixty.sa.client.model.message.BaseMessage; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@Getter +@Setter +@ToString +public class MrzDataSubmitMessage extends BaseMessage { + + private static final long serialVersionUID = -2840411856886673672L; + + private MrzData mrzData; + +}