Skip to content

Commit

Permalink
Merge pull request #418 from getyoti/RELEASE-3.8.0
Browse files Browse the repository at this point in the history
Release 3.8.0
  • Loading branch information
irotech authored Oct 12, 2023
2 parents 2cfbdb2 + 7416cb9 commit 25ae527
Show file tree
Hide file tree
Showing 89 changed files with 5,180 additions and 893 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ If you are using Maven, you need to add the following dependency:
<dependency>
<groupId>com.yoti</groupId>
<artifactId>yoti-sdk-api</artifactId>
<version>3.7.0</version>
<version>3.8.0</version>
</dependency>
```

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

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

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

Expand Down
6 changes: 4 additions & 2 deletions examples/doc-scan/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<version>2.7.16</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<groupId>com.yoti.docscan.demo</groupId>
<artifactId>doc-scan-demo</artifactId>
<version>1.0.0</version>
Expand Down Expand Up @@ -51,7 +53,7 @@
<dependency>
<groupId>com.yoti</groupId>
<artifactId>yoti-sdk-api</artifactId>
<version>3.7.0</version>
<version>3.8.0</version>
</dependency>
</dependencies>

Expand Down
10 changes: 8 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.yoti</groupId>
<artifactId>yoti-sdk</artifactId>
<packaging>pom</packaging>
<version>3.7.0</version>
<version>3.8.0</version>
<name>Yoti SDK</name>
<description>Java SDK for simple integration with the Yoti platform</description>
<url>https://github.com/getyoti/yoti-java-sdk</url>
Expand All @@ -21,8 +21,9 @@

<properties>
<!-- plugin versions -->
<maven-deploy-plugin.version>3.0.0-M2</maven-deploy-plugin.version>
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
<properties-maven-plugin.version>1.1.0</properties-maven-plugin.version>
<spotbugs-maven-plugin.version>4.7.3.4</spotbugs-maven-plugin.version>
</properties>

<build>
Expand Down Expand Up @@ -56,6 +57,11 @@
</executions>
</plugin>

<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>${spotbugs-maven-plugin.version}</version>
</plugin>
</plugins>
</build>

Expand Down
94 changes: 0 additions & 94 deletions yoti-sdk-api/findbugs-rules.xml

This file was deleted.

10 changes: 5 additions & 5 deletions yoti-sdk-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.yoti</groupId>
<artifactId>yoti-sdk-parent</artifactId>
<version>3.7.0</version>
<version>3.8.0</version>
<relativePath>../yoti-sdk-parent</relativePath>
</parent>

Expand Down Expand Up @@ -82,10 +82,6 @@
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
Expand Down Expand Up @@ -115,6 +111,10 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down
53 changes: 53 additions & 0 deletions yoti-sdk-api/spotbugs/exclude-filter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>

<FindBugsFilter>

<!-- These patterns became completely broken after 4.3 - ignored them -->
<!-- See https://github.com/spotbugs/spotbugs/issues/1797 -->
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>

<!-- Exclude generated classes from protobuf -->
<Match>
<Package name="com.yoti.api.client.spi.remote.proto"/>
</Match>

<!-- The IV comes from a trusted source -->
<Match>
<Class name="com.yoti.api.client.spi.remote.call.identity.ReceiptItemKey$Builder"/>
<Bug pattern="STATIC_IV"/>
</Match>

<!-- Legacy exclusions -->
<Match>
<Bug pattern="CRLF_INJECTION_LOGS"/>
</Match>

<Match>
<Class name="com.yoti.api.client.spi.remote.call.SignedRequest"/>
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
</Match>

<Match>
<Class name="com.yoti.api.client.spi.remote.call.SignedRequestBuilder"/>
<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
</Match>

<Match>
<Class name="com.yoti.api.client.spi.remote.EncryptedDataReader"/>
<Bug pattern="CIPHER_INTEGRITY"/>
</Match>

<Match>
<Or>
<Class name="com.yoti.api.client.UrlKeyPairSource"/>
<Class name="com.yoti.api.client.spi.remote.call.UrlConnector"/>
</Or>
<Bug pattern="URLCONNECTION_SSRF_FD"/>
</Match>

<Match>
<Class name="com.yoti.api.client.docs.DocScanService"/>
<Bug pattern="IMPROPER_UNICODE"/>
</Match>

</FindBugsFilter>
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package com.yoti.api.client;

import java.io.IOException;
import java.security.KeyPair;
import java.security.Security;

import com.yoti.api.client.identity.ShareSession;
import com.yoti.api.client.identity.ShareSessionQrCode;
import com.yoti.api.client.identity.ShareSessionRequest;
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;

public class DigitalIdentityClient {

static {
Security.addProvider(new BouncyCastleProvider());
}

private final String sdkId;
private final KeyPair keyPair;
private final DigitalIdentityService identityService;

DigitalIdentityClient(String sdkId, KeyPairSource keyPair, DigitalIdentityService identityService) {
Validation.notNullOrEmpty(sdkId, "SDK ID");
Validation.notNull(keyPair, "Application Key Pair");

this.sdkId = sdkId;
this.keyPair = loadKeyPair(keyPair);
this.identityService = identityService;
}

public ShareSession createShareSession(ShareSessionRequest request) throws DigitalIdentityException {
return identityService.createShareSession(sdkId, keyPair, request);
}

public ShareSession fetchShareSession(String sessionId) throws DigitalIdentityException {
return identityService.fetchShareSession(sdkId, keyPair, sessionId);
}

public ShareSessionQrCode createShareQrCode(String sessionId) throws DigitalIdentityException {
return identityService.createShareQrCode(sdkId, keyPair, sessionId);
}

public ShareSessionQrCode fetchShareQrCode(String qrCodeId) throws DigitalIdentityException {
return identityService.fetchShareQrCode(sdkId, keyPair, qrCodeId);
}

public Receipt fetchShareReceipt(String receiptId) throws DigitalIdentityException {
return identityService.fetchShareReceipt(sdkId, keyPair, receiptId);
}

private KeyPair loadKeyPair(KeyPairSource keyPairSource) throws InitialisationException {
try {
return keyPairSource.getFromStream(new KeyStreamVisitor());
} catch (IOException ex) {
throw new InitialisationException("Cannot load Key Pair", ex);
}
}

public static Builder builder() {
return new Builder();
}

public static class Builder {

private String sdkId;
private KeyPairSource keyPairSource;

private Builder() { }

public Builder withClientSdkId(String sdkId) {
Validation.notNullOrEmpty(sdkId, "SDK ID");

this.sdkId = sdkId;
return this;
}

public Builder withKeyPairSource(KeyPairSource keyPairSource) {
Validation.notNull(keyPairSource, "Key Pair Source");

this.keyPairSource = keyPairSource;
return this;
}

public DigitalIdentityClient build() {
return new DigitalIdentityClient(sdkId, keyPairSource, DigitalIdentityService.newInstance());
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ public InitialisationException(String message) {
public InitialisationException(String message, Throwable cause) {
super(message, cause);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public interface KeyPairSource {
*/
KeyPair getFromStream(StreamVisitor streamVisitor) throws IOException, InitialisationException;

public static interface StreamVisitor {
interface StreamVisitor {
KeyPair accept(InputStream stream) throws IOException, InitialisationException;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public ShareUrlResult createShareUrl(DynamicScenario dynamicScenario) throws Dyn

private KeyPair loadKeyPair(KeyPairSource kpSource) throws InitialisationException {
try {
LOG.debug("Loading key pair from '{}'", kpSource);
return kpSource.getFromStream(new KeyStreamVisitor());
} catch (IOException e) {
throw new InitialisationException("Cannot load key pair", e);
Expand Down
Loading

0 comments on commit 25ae527

Please sign in to comment.