-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #418 from getyoti/RELEASE-3.8.0
Release 3.8.0
- Loading branch information
Showing
89 changed files
with
5,180 additions
and
893 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
96 changes: 96 additions & 0 deletions
96
yoti-sdk-api/src/main/java/com/yoti/api/client/DigitalIdentityClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.