diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/DigitalIdentityClient.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/DigitalIdentityClient.java
index 3729aaff..48c39fc9 100644
--- a/yoti-sdk-api/src/main/java/com/yoti/api/client/DigitalIdentityClient.java
+++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/DigitalIdentityClient.java
@@ -1,8 +1,5 @@
package com.yoti.api.client;
-import static com.yoti.validation.Validation.notNull;
-import static com.yoti.validation.Validation.notNullOrEmpty;
-
import java.io.IOException;
import java.security.KeyPair;
import java.security.Security;
@@ -13,6 +10,8 @@
import com.yoti.api.client.spi.remote.KeyStreamVisitor;
import com.yoti.api.client.spi.remote.call.identity.DigitalIdentityException;
import com.yoti.api.client.spi.remote.call.identity.DigitalIdentityService;
+import com.yoti.api.client.spi.remote.call.identity.Receipt;
+import com.yoti.validation.Validation;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
@@ -27,8 +26,8 @@ public class DigitalIdentityClient {
private final DigitalIdentityService identityService;
DigitalIdentityClient(String sdkId, KeyPairSource keyPair, DigitalIdentityService identityService) {
- notNullOrEmpty(sdkId, "SDK ID");
- notNull(keyPair, "Application Key Pair");
+ Validation.notNullOrEmpty(sdkId, "SDK ID");
+ Validation.notNull(keyPair, "Application Key Pair");
this.sdkId = sdkId;
this.keyPair = loadKeyPair(keyPair);
@@ -79,8 +78,17 @@ public ShareSessionQrCode fetchShareQrCode(String qrCodeId) throws DigitalIdenti
return identityService.fetchShareQrCode(sdkId, keyPair, qrCodeId);
}
- public Object fetchShareReceipt(String receiptId) {
- return identityService.fetchShareReceipt(receiptId);
+ /**
+ * Retrieve the decrypted share receipt.
+ *
+ *
A receipt will contain the shared user attributes.
+ *
+ * @param receiptId ID of the receipt
+ * @return Shared user attributes
+ * @throws DigitalIdentityException Thrown if the receipt retrieval is unsuccessful
+ */
+ public Receipt fetchShareReceipt(String receiptId) throws DigitalIdentityException {
+ return identityService.fetchShareReceipt(sdkId, keyPair, receiptId);
}
private KeyPair loadKeyPair(KeyPairSource keyPairSource) throws InitialisationException {
@@ -103,14 +111,14 @@ public static class Builder {
private Builder() { }
public Builder withClientSdkId(String sdkId) {
- notNullOrEmpty(sdkId, "SDK ID");
+ Validation.notNullOrEmpty(sdkId, "SDK ID");
this.sdkId = sdkId;
return this;
}
public Builder withKeyPairSource(KeyPairSource keyPairSource) {
- notNull(keyPairSource, "Key Pair Source");
+ Validation.notNull(keyPairSource, "Key Pair Source");
this.keyPairSource = keyPairSource;
return this;
diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/ShareSessionNotification.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/ShareSessionNotification.java
index 99aaada1..3c57702c 100644
--- a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/ShareSessionNotification.java
+++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/ShareSessionNotification.java
@@ -1,11 +1,11 @@
package com.yoti.api.client.identity;
-import static com.yoti.api.client.spi.remote.util.Validation.notNullOrEmpty;
-
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
+import com.yoti.validation.Validation;
+
import com.fasterxml.jackson.annotation.JsonProperty;
public final class ShareSessionNotification {
@@ -85,7 +85,7 @@ public Builder withHeader(String key, String value) {
}
public ShareSessionNotification build() {
- notNullOrEmpty(url, Property.URL);
+ Validation.notNullOrEmpty(url, Property.URL);
return new ShareSessionNotification(this);
}
diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/ShareSessionRequest.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/ShareSessionRequest.java
index ca50dc5a..7f8db0eb 100644
--- a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/ShareSessionRequest.java
+++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/ShareSessionRequest.java
@@ -1,8 +1,5 @@
package com.yoti.api.client.identity;
-import static com.yoti.api.client.spi.remote.util.Validation.notNull;
-import static com.yoti.api.client.spi.remote.util.Validation.notNullOrEmpty;
-
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
@@ -11,6 +8,7 @@
import com.yoti.api.client.identity.extension.Extension;
import com.yoti.api.client.identity.policy.Policy;
+import com.yoti.validation.Validation;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -23,7 +21,7 @@ public class ShareSessionRequest {
private final Policy policy;
@JsonProperty(Property.EXTENSIONS)
- private final List extensions;
+ private final List> extensions;
@JsonProperty(Property.REDIRECT_URI)
private final String redirectUri;
@@ -47,7 +45,7 @@ public Policy getPolicy() {
return policy;
}
- public List getExtensions() {
+ public List> getExtensions() {
return extensions;
}
@@ -67,7 +65,7 @@ public static final class Builder {
private Map subject;
private Policy policy;
- private List extensions;
+ private List> extensions;
private String redirectUri;
private ShareSessionNotification notification;
@@ -85,12 +83,12 @@ public Builder withPolicy(Policy policy) {
return this;
}
- public Builder withExtensions(List extensions) {
+ public Builder withExtensions(List> extensions) {
this.extensions = Collections.unmodifiableList(extensions);
return this;
}
- public Builder withExtension(Extension extension) {
+ public Builder withExtension(Extension> extension) {
extensions.add(extension);
return this;
}
@@ -106,8 +104,8 @@ public Builder withNotification(ShareSessionNotification notification) {
}
public ShareSessionRequest build() {
- notNull(policy, Property.POLICY);
- notNullOrEmpty(redirectUri, Property.REDIRECT_URI);
+ Validation.notNull(policy, Property.POLICY);
+ Validation.notNullOrEmpty(redirectUri, Property.REDIRECT_URI);
return new ShareSessionRequest(this);
}
diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/Extension.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/Extension.java
index b7ee1b2d..83e8e8f5 100644
--- a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/Extension.java
+++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/Extension.java
@@ -1,5 +1,6 @@
package com.yoti.api.client.identity.extension;
+import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Extension {
@@ -10,7 +11,8 @@ public class Extension {
@JsonProperty(Property.CONTENT)
private final T content;
- Extension(String type, T content) {
+ @JsonCreator
+ Extension(@JsonProperty(Property.TYPE) String type, @JsonProperty(Property.CONTENT) T content) {
this.type = type;
this.content = content;
}
diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/LocationConstraintExtensionBuilder.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/LocationConstraintExtensionBuilder.java
index 4ec60494..81248840 100644
--- a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/LocationConstraintExtensionBuilder.java
+++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/LocationConstraintExtensionBuilder.java
@@ -1,11 +1,9 @@
package com.yoti.api.client.identity.extension;
-import com.yoti.api.client.spi.remote.util.Validation;
+import com.yoti.validation.Validation;
public class LocationConstraintExtensionBuilder implements ExtensionBuilder {
- public static final String TYPE = "LOCATION_CONSTRAINT";
-
private double latitude;
private double longitude;
private double radius = 150d;
@@ -42,7 +40,7 @@ public LocationConstraintExtensionBuilder withMaxUncertainty(double maxUncertain
@Override
public Extension build() {
LocationConstraintContent content = new LocationConstraintContent(latitude, longitude, radius, maxUncertainty);
- return new Extension<>(TYPE, content);
+ return new Extension<>("LOCATION_CONSTRAINT", content);
}
private static final class Property {
diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/ThirdPartyAttributeContent.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/ThirdPartyAttributeContent.java
index 6948afb8..05eb6c7a 100644
--- a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/ThirdPartyAttributeContent.java
+++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/ThirdPartyAttributeContent.java
@@ -1,33 +1,27 @@
package com.yoti.api.client.identity.extension;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.time.OffsetDateTime;
import java.util.List;
-import java.util.TimeZone;
import com.yoti.api.client.AttributeDefinition;
-import com.yoti.api.client.spi.remote.call.YotiConstants;
import com.fasterxml.jackson.annotation.JsonProperty;
public class ThirdPartyAttributeContent {
- private final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(YotiConstants.RFC3339_PATTERN_MILLIS);
-
- private final Date expiryDate;
+ private final OffsetDateTime expiry;
@JsonProperty(Property.DEFINITIONS)
private final List definitions;
- ThirdPartyAttributeContent(Date expiryDate, List definitions) {
- this.expiryDate = expiryDate;
+ ThirdPartyAttributeContent(OffsetDateTime expiry, List definitions) {
+ this.expiry = expiry;
this.definitions = definitions;
}
@JsonProperty(Property.EXPIRY_DATE)
- public String getExpiryDate() {
- DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
- return DATE_FORMAT.format(expiryDate.getTime());
+ public OffsetDateTime getExpiryDate() {
+ return expiry;
}
public List getDefinitions() {
diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/ThirdPartyAttributeExtensionBuilder.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/ThirdPartyAttributeExtensionBuilder.java
index 614a13ab..0a53c09b 100644
--- a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/ThirdPartyAttributeExtensionBuilder.java
+++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/ThirdPartyAttributeExtensionBuilder.java
@@ -1,34 +1,30 @@
package com.yoti.api.client.identity.extension;
-import static com.yoti.api.client.spi.remote.util.Validation.notNull;
-import static com.yoti.api.client.spi.remote.util.Validation.notNullOrEmpty;
-
+import java.time.OffsetDateTime;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import com.yoti.api.client.AttributeDefinition;
+import com.yoti.validation.Validation;
public class ThirdPartyAttributeExtensionBuilder implements ExtensionBuilder {
- public static final String TYPE = "THIRD_PARTY_ATTRIBUTE";
-
- private Date expiryDate;
+ private OffsetDateTime expiryDate;
private List definitions;
public ThirdPartyAttributeExtensionBuilder() {
this.definitions = new ArrayList<>();
}
- public ThirdPartyAttributeExtensionBuilder withExpiryDate(Date expiryDate) {
- notNull(expiryDate, Property.EXPIRY_DATE);
+ public ThirdPartyAttributeExtensionBuilder withExpiryDate(OffsetDateTime expiryDate) {
+ Validation.notNull(expiryDate, Property.EXPIRY_DATE);
- this.expiryDate = new Date(expiryDate.getTime());
+ this.expiryDate = expiryDate;
return this;
}
public ThirdPartyAttributeExtensionBuilder withDefinition(String definition) {
- notNullOrEmpty(definition, Property.DEFINITION);
+ Validation.notNullOrEmpty(definition, Property.DEFINITION);
this.definitions.add(new AttributeDefinition(definition));
return this;
@@ -45,7 +41,7 @@ public ThirdPartyAttributeExtensionBuilder withDefinitions(List definiti
public Extension build() {
ThirdPartyAttributeContent thirdPartyAttributeContent = new ThirdPartyAttributeContent(expiryDate, definitions);
- return new Extension<>(TYPE, thirdPartyAttributeContent);
+ return new Extension<>("THIRD_PARTY_ATTRIBUTE", thirdPartyAttributeContent);
}
private static final class Property {
diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/TransactionalFlowExtensionBuilder.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/TransactionalFlowExtensionBuilder.java
index 8723c30c..913630ca 100644
--- a/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/TransactionalFlowExtensionBuilder.java
+++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/identity/extension/TransactionalFlowExtensionBuilder.java
@@ -1,11 +1,9 @@
package com.yoti.api.client.identity.extension;
-import com.yoti.api.client.spi.remote.util.Validation;
+import com.yoti.validation.Validation;
public class TransactionalFlowExtensionBuilder implements ExtensionBuilder