Skip to content

Commit 25ae527

Browse files
authored
Merge pull request #418 from getyoti/RELEASE-3.8.0
Release 3.8.0
2 parents 2cfbdb2 + 7416cb9 commit 25ae527

File tree

89 files changed

+5180
-893
lines changed

Some content is hidden

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

89 files changed

+5180
-893
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ If you are using Maven, you need to add the following dependency:
101101
<dependency>
102102
<groupId>com.yoti</groupId>
103103
<artifactId>yoti-sdk-api</artifactId>
104-
<version>3.7.0</version>
104+
<version>3.8.0</version>
105105
</dependency>
106106
```
107107

108108
If you are using Gradle, here is the dependency to add:
109109

110-
`compile group: 'com.yoti', name: 'yoti-sdk-api', version: '3.7.0'`
110+
`compile group: 'com.yoti', name: 'yoti-sdk-api', version: '3.8.0'`
111111

112112
You will find all classes packaged under `com.yoti.api`
113113

examples/doc-scan/pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
5+
56
<parent>
67
<groupId>org.springframework.boot</groupId>
78
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.7.1</version>
9+
<version>2.7.16</version>
910
<relativePath/> <!-- lookup parent from repository -->
1011
</parent>
12+
1113
<groupId>com.yoti.docscan.demo</groupId>
1214
<artifactId>doc-scan-demo</artifactId>
1315
<version>1.0.0</version>
@@ -51,7 +53,7 @@
5153
<dependency>
5254
<groupId>com.yoti</groupId>
5355
<artifactId>yoti-sdk-api</artifactId>
54-
<version>3.7.0</version>
56+
<version>3.8.0</version>
5557
</dependency>
5658
</dependencies>
5759

pom.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>com.yoti</groupId>
66
<artifactId>yoti-sdk</artifactId>
77
<packaging>pom</packaging>
8-
<version>3.7.0</version>
8+
<version>3.8.0</version>
99
<name>Yoti SDK</name>
1010
<description>Java SDK for simple integration with the Yoti platform</description>
1111
<url>https://github.com/getyoti/yoti-java-sdk</url>
@@ -21,8 +21,9 @@
2121

2222
<properties>
2323
<!-- plugin versions -->
24-
<maven-deploy-plugin.version>3.0.0-M2</maven-deploy-plugin.version>
24+
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
2525
<properties-maven-plugin.version>1.1.0</properties-maven-plugin.version>
26+
<spotbugs-maven-plugin.version>4.7.3.4</spotbugs-maven-plugin.version>
2627
</properties>
2728

2829
<build>
@@ -56,6 +57,11 @@
5657
</executions>
5758
</plugin>
5859

60+
<plugin>
61+
<groupId>com.github.spotbugs</groupId>
62+
<artifactId>spotbugs-maven-plugin</artifactId>
63+
<version>${spotbugs-maven-plugin.version}</version>
64+
</plugin>
5965
</plugins>
6066
</build>
6167

yoti-sdk-api/findbugs-rules.xml

Lines changed: 0 additions & 94 deletions
This file was deleted.

yoti-sdk-api/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<parent>
1212
<groupId>com.yoti</groupId>
1313
<artifactId>yoti-sdk-parent</artifactId>
14-
<version>3.7.0</version>
14+
<version>3.8.0</version>
1515
<relativePath>../yoti-sdk-parent</relativePath>
1616
</parent>
1717

@@ -82,10 +82,6 @@
8282
<groupId>org.owasp</groupId>
8383
<artifactId>dependency-check-maven</artifactId>
8484
</plugin>
85-
<plugin>
86-
<groupId>org.codehaus.mojo</groupId>
87-
<artifactId>findbugs-maven-plugin</artifactId>
88-
</plugin>
8985
<plugin>
9086
<groupId>org.codehaus.mojo</groupId>
9187
<artifactId>animal-sniffer-maven-plugin</artifactId>
@@ -115,6 +111,10 @@
115111
</excludes>
116112
</configuration>
117113
</plugin>
114+
<plugin>
115+
<groupId>com.github.spotbugs</groupId>
116+
<artifactId>spotbugs-maven-plugin</artifactId>
117+
</plugin>
118118
</plugins>
119119
</build>
120120

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<FindBugsFilter>
4+
5+
<!-- These patterns became completely broken after 4.3 - ignored them -->
6+
<!-- See https://github.com/spotbugs/spotbugs/issues/1797 -->
7+
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
8+
9+
<!-- Exclude generated classes from protobuf -->
10+
<Match>
11+
<Package name="com.yoti.api.client.spi.remote.proto"/>
12+
</Match>
13+
14+
<!-- The IV comes from a trusted source -->
15+
<Match>
16+
<Class name="com.yoti.api.client.spi.remote.call.identity.ReceiptItemKey$Builder"/>
17+
<Bug pattern="STATIC_IV"/>
18+
</Match>
19+
20+
<!-- Legacy exclusions -->
21+
<Match>
22+
<Bug pattern="CRLF_INJECTION_LOGS"/>
23+
</Match>
24+
25+
<Match>
26+
<Class name="com.yoti.api.client.spi.remote.call.SignedRequest"/>
27+
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
28+
</Match>
29+
30+
<Match>
31+
<Class name="com.yoti.api.client.spi.remote.call.SignedRequestBuilder"/>
32+
<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
33+
</Match>
34+
35+
<Match>
36+
<Class name="com.yoti.api.client.spi.remote.EncryptedDataReader"/>
37+
<Bug pattern="CIPHER_INTEGRITY"/>
38+
</Match>
39+
40+
<Match>
41+
<Or>
42+
<Class name="com.yoti.api.client.UrlKeyPairSource"/>
43+
<Class name="com.yoti.api.client.spi.remote.call.UrlConnector"/>
44+
</Or>
45+
<Bug pattern="URLCONNECTION_SSRF_FD"/>
46+
</Match>
47+
48+
<Match>
49+
<Class name="com.yoti.api.client.docs.DocScanService"/>
50+
<Bug pattern="IMPROPER_UNICODE"/>
51+
</Match>
52+
53+
</FindBugsFilter>
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package com.yoti.api.client;
2+
3+
import java.io.IOException;
4+
import java.security.KeyPair;
5+
import java.security.Security;
6+
7+
import com.yoti.api.client.identity.ShareSession;
8+
import com.yoti.api.client.identity.ShareSessionQrCode;
9+
import com.yoti.api.client.identity.ShareSessionRequest;
10+
import com.yoti.api.client.spi.remote.KeyStreamVisitor;
11+
import com.yoti.api.client.spi.remote.call.identity.DigitalIdentityException;
12+
import com.yoti.api.client.spi.remote.call.identity.DigitalIdentityService;
13+
import com.yoti.api.client.spi.remote.call.identity.Receipt;
14+
import com.yoti.validation.Validation;
15+
16+
import org.bouncycastle.jce.provider.BouncyCastleProvider;
17+
18+
public class DigitalIdentityClient {
19+
20+
static {
21+
Security.addProvider(new BouncyCastleProvider());
22+
}
23+
24+
private final String sdkId;
25+
private final KeyPair keyPair;
26+
private final DigitalIdentityService identityService;
27+
28+
DigitalIdentityClient(String sdkId, KeyPairSource keyPair, DigitalIdentityService identityService) {
29+
Validation.notNullOrEmpty(sdkId, "SDK ID");
30+
Validation.notNull(keyPair, "Application Key Pair");
31+
32+
this.sdkId = sdkId;
33+
this.keyPair = loadKeyPair(keyPair);
34+
this.identityService = identityService;
35+
}
36+
37+
public ShareSession createShareSession(ShareSessionRequest request) throws DigitalIdentityException {
38+
return identityService.createShareSession(sdkId, keyPair, request);
39+
}
40+
41+
public ShareSession fetchShareSession(String sessionId) throws DigitalIdentityException {
42+
return identityService.fetchShareSession(sdkId, keyPair, sessionId);
43+
}
44+
45+
public ShareSessionQrCode createShareQrCode(String sessionId) throws DigitalIdentityException {
46+
return identityService.createShareQrCode(sdkId, keyPair, sessionId);
47+
}
48+
49+
public ShareSessionQrCode fetchShareQrCode(String qrCodeId) throws DigitalIdentityException {
50+
return identityService.fetchShareQrCode(sdkId, keyPair, qrCodeId);
51+
}
52+
53+
public Receipt fetchShareReceipt(String receiptId) throws DigitalIdentityException {
54+
return identityService.fetchShareReceipt(sdkId, keyPair, receiptId);
55+
}
56+
57+
private KeyPair loadKeyPair(KeyPairSource keyPairSource) throws InitialisationException {
58+
try {
59+
return keyPairSource.getFromStream(new KeyStreamVisitor());
60+
} catch (IOException ex) {
61+
throw new InitialisationException("Cannot load Key Pair", ex);
62+
}
63+
}
64+
65+
public static Builder builder() {
66+
return new Builder();
67+
}
68+
69+
public static class Builder {
70+
71+
private String sdkId;
72+
private KeyPairSource keyPairSource;
73+
74+
private Builder() { }
75+
76+
public Builder withClientSdkId(String sdkId) {
77+
Validation.notNullOrEmpty(sdkId, "SDK ID");
78+
79+
this.sdkId = sdkId;
80+
return this;
81+
}
82+
83+
public Builder withKeyPairSource(KeyPairSource keyPairSource) {
84+
Validation.notNull(keyPairSource, "Key Pair Source");
85+
86+
this.keyPairSource = keyPairSource;
87+
return this;
88+
}
89+
90+
public DigitalIdentityClient build() {
91+
return new DigitalIdentityClient(sdkId, keyPairSource, DigitalIdentityService.newInstance());
92+
}
93+
94+
}
95+
96+
}

yoti-sdk-api/src/main/java/com/yoti/api/client/InitialisationException.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ public InitialisationException(String message) {
1212
public InitialisationException(String message, Throwable cause) {
1313
super(message, cause);
1414
}
15+
1516
}

yoti-sdk-api/src/main/java/com/yoti/api/client/KeyPairSource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public interface KeyPairSource {
3030
*/
3131
KeyPair getFromStream(StreamVisitor streamVisitor) throws IOException, InitialisationException;
3232

33-
public static interface StreamVisitor {
33+
interface StreamVisitor {
3434
KeyPair accept(InputStream stream) throws IOException, InitialisationException;
3535
}
36+
3637
}

yoti-sdk-api/src/main/java/com/yoti/api/client/YotiClient.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ public ShareUrlResult createShareUrl(DynamicScenario dynamicScenario) throws Dyn
118118

119119
private KeyPair loadKeyPair(KeyPairSource kpSource) throws InitialisationException {
120120
try {
121-
LOG.debug("Loading key pair from '{}'", kpSource);
122121
return kpSource.getFromStream(new KeyStreamVisitor());
123122
} catch (IOException e) {
124123
throw new InitialisationException("Cannot load key pair", e);

0 commit comments

Comments
 (0)