Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/3.11.0 #292

Merged
merged 15 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import "github.com/getyoti/yoti-go-sdk/v3"
```
or add the following line to your go.mod file (check https://github.com/getyoti/yoti-go-sdk/releases for the latest version)
```
require github.com/getyoti/yoti-go-sdk/v3 v3.10.0

require github.com/getyoti/yoti-go-sdk/v3 v3.11.0
```

## Setup
Expand Down
22 changes: 22 additions & 0 deletions _examples/idv/handlers.session.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ func showDBSPage(c *gin.Context) {
pageFromSessionSpec(c, sessionSpec)
}

func showAdvancedIdentityProfilePage(c *gin.Context) {
sessionSpec, err := buildAdvancedIdentityProfileSessionSpec()
if err != nil {
c.HTML(
http.StatusInternalServerError,
"error.html",
gin.H{
"ErrorTitle": "Error when building sessions spec",
"ErrorMessage": err.Error()})
return
}
pageFromSessionSpec(c, sessionSpec)
}

func pageFromSessionSpec(c *gin.Context, sessionSpec *create.SessionSpecification) {
err := initialiseDocScanClient()
if err != nil {
Expand Down Expand Up @@ -209,3 +223,11 @@ func showPrivacyPolicyPage(c *gin.Context) {
render(c, gin.H{}, "privacy.html")
return
}

func showErrorPage(c *gin.Context) {
render(c, gin.H{
"ErrorTitle": "Error Code",
"ErrorMessage": c.Request.URL.Query().Get("yotiErrorCode")},
"error.html")
return
}
76 changes: 67 additions & 9 deletions _examples/idv/models.sessionspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func buildSessionSpec() (sessionSpec *create.SessionSpecification, err error) {
var faceMatchCheck *check.RequestedFaceMatchCheck
faceMatchCheck, err = check.NewRequestedFaceMatchCheckBuilder().
WithManualCheckAlways().
WithManualCheckFallback().
Build()
if err != nil {
return nil, err
Expand All @@ -28,8 +28,8 @@ func buildSessionSpec() (sessionSpec *create.SessionSpecification, err error) {

var livenessCheck *check.RequestedLivenessCheck
livenessCheck, err = check.NewRequestedLivenessCheckBuilder().
ForZoomLiveness().
WithMaxRetries(5).
ForStaticLiveness().
WithMaxRetries(3).
Build()
if err != nil {
return nil, err
Expand Down Expand Up @@ -71,7 +71,7 @@ func buildSessionSpec() (sessionSpec *create.SessionSpecification, err error) {

var textExtractionTask *task.RequestedTextExtractionTask
textExtractionTask, err = task.NewRequestedTextExtractionTaskBuilder().
WithManualCheckAlways().
WithManualCheckFallback().
WithExpandedDocumentFields(true).
Build()
if err != nil {
Expand All @@ -80,7 +80,7 @@ func buildSessionSpec() (sessionSpec *create.SessionSpecification, err error) {

var supplementaryDocTextExtractionTask *task.RequestedSupplementaryDocTextExtractionTask
supplementaryDocTextExtractionTask, err = task.NewRequestedSupplementaryDocTextExtractionTaskBuilder().
WithManualCheckAlways().
WithManualCheckFallback().
Build()
if err != nil {
return nil, err
Expand All @@ -98,6 +98,7 @@ func buildSessionSpec() (sessionSpec *create.SessionSpecification, err error) {
WithErrorUrl("https://localhost:8080/error").
WithPrivacyPolicyUrl("https://localhost:8080/privacy-policy").
WithIdDocumentTextExtractionGenericAttempts(2).
WithAllowHandOff(true).
Build()
if err != nil {
return nil, err
Expand Down Expand Up @@ -158,7 +159,7 @@ func buildSessionSpec() (sessionSpec *create.SessionSpecification, err error) {

sessionSpec, err = create.NewSessionSpecificationBuilder().
WithClientSessionTokenTTL(600).
WithResourcesTTL(90000).
WithResourcesTTL(87000).
WithUserTrackingID("some-tracking-id").
WithRequestedCheck(faceMatchCheck).
WithRequestedCheck(documentAuthenticityCheck).
Expand Down Expand Up @@ -203,7 +204,8 @@ func buildDBSSessionSpec() (sessionSpec *create.SessionSpecification, err error)
identityProfile := []byte(`{
"trust_framework": "UK_TFIDA",
"scheme": {
"type": "RTW"
"type": "DBS",
"objective": "BASIC"
}
}`)

Expand All @@ -220,8 +222,8 @@ func buildDBSSessionSpec() (sessionSpec *create.SessionSpecification, err error)
}`)

sessionSpec, err = create.NewSessionSpecificationBuilder().
WithClientSessionTokenTTL(6000).
WithResourcesTTL(900000).
WithClientSessionTokenTTL(600).
WithResourcesTTL(87000).
WithUserTrackingID("some-tracking-id").
WithSDKConfig(sdkConfig).
WithIdentityProfileRequirements(identityProfile).
Expand All @@ -232,3 +234,59 @@ func buildDBSSessionSpec() (sessionSpec *create.SessionSpecification, err error)

return sessionSpec, nil
}

func buildAdvancedIdentityProfileSessionSpec() (sessionSpec *create.SessionSpecification, err error) {
var sdkConfig *create.SDKConfig
sdkConfig, err = create.NewSdkConfigBuilder().
WithAllowsCameraAndUpload().
WithPrimaryColour("#2d9fff").
WithSecondaryColour("#FFFFFF").
WithFontColour("#FFFFFF").
WithLocale("en-GB").
WithPresetIssuingCountry("GBR").
WithSuccessUrl("https://localhost:8080/success").
WithErrorUrl("https://localhost:8080/error").
WithPrivacyPolicyUrl("https://localhost:8080/privacy-policy").
Build()
if err != nil {
return nil, err
}

advancedIdentityProfile := []byte(`{
"profiles": [
{
"trust_framework": "UK_TFIDA",
"schemes": [
{
"label": "LB912",
"type": "RTW"
}
]
},
{
"trust_framework": "YOTI_GLOBAL",
"schemes": [
{
"label": "LB321",
"type": "IDENTITY",
"objective": "AL_L1"
}
]
}
]
}`)

subject := []byte(`{
"subject_id": "unique-user-id-for-examples"
}`)

return create.NewSessionSpecificationBuilder().
WithClientSessionTokenTTL(6000).
WithResourcesTTL(900000).
WithUserTrackingID("some-tracking-id").
WithSDKConfig(sdkConfig).
WithAdvancedIdentityProfileRequirements(advancedIdentityProfile).
WithCreateIdentityProfilePreview(true).
WithSubject(subject).
Build()
}
2 changes: 2 additions & 0 deletions _examples/idv/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ func initializeRoutes() {
// Handle the index route
router.GET("/", showIndexPage)
router.GET("/dbs", showDBSPage)
router.GET("/advanced", showAdvancedIdentityProfilePage)
router.GET("/success", showSuccessPage)
router.GET("/media", getMedia)
router.GET("/privacy-policy", showPrivacyPolicyPage)
router.GET("/error", showErrorPage)
}
66 changes: 59 additions & 7 deletions _examples/idv/templates/success.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,35 @@ <h2>Identity Profile</h2>
{{ end }}
{{ end }}
{{ end }}
{{ if .getSessionResult.AdvancedIdentityProfileResponse }}
<div class="row pt-4">
<div class="col">
<h2>Advanced Identity Profile</h2>
</div>
</div>
{{ $media := index .getSessionResult.AdvancedIdentityProfileResponse.Report "media"}}
{{ if $media }}
{{ $media_id := index $media "id" }}
{{ if $media_id }}
<div class="row pt-4">
<div class="col">
<table class="table table-striped table-light">
<tbody>
<tr>
<td>ID</td>
<td>
<a href='/media?mediaId={{ $media_id }}'>
{{ $media_id }}
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
{{ end }}
{{ end }}
{{ end }}
{{ if .getSessionResult.IdentityProfilePreview }}
<div class="row pt-4">
<div class="col">
Expand All @@ -99,6 +128,29 @@ <h2>Identity Profile Preview</h2>
</div>
</div>
{{ end }}
{{ if .getSessionResult.AdvancedIdentityProfilePreview }}
<div class="row pt-4">
<div class="col">
<h2>Advanced Identity Profile Preview</h2>
</div>
</div>
<div class="row pt-4">
<div class="col">
<table class="table table-striped table-light">
<tbody>
<tr>
<td>ID</td>
<td>
<a href='/media?mediaId={{ .getSessionResult.AdvancedIdentityProfilePreview.Media.ID }}'>
{{ .getSessionResult.AdvancedIdentityProfilePreview.Media.ID }}
</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
{{ end }}
{{ if .getSessionResult.ImportTokenResponse }}
<div class="row pt-4">
<div class="col">
Expand Down Expand Up @@ -812,15 +864,15 @@ <h2>Static Liveness Resources</h2>
<tr>
<td>ID</td>
<td>{{ $liveness.ID }}

</td>
</tr>

</tbody>
</table>

<div class="accordion mt-3">

<div class="card">
<div class="card-header" id="liveness-{{ $livenessNum }}-frames">
<h3 class="mb-0">
Expand All @@ -835,18 +887,18 @@ <h3 class="mb-0">
<div id="collapse-liveness-{{ $livenessNum }}-frames" class="collapse"
aria-labelledby="liveness-{{ $livenessNum }}-frames">
<div class="card-group">

<div class="card">
<img class="card-img-top"
src="/media?mediaId={{ $liveness.Image.Media.ID }}"/>
</div>

</div>
</div>
</div>

</div>

</div>
</div>
{{ end }}
Expand Down
2 changes: 2 additions & 0 deletions _examples/profile/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
YOTI_SCENARIO_ID=
YOTI_CLIENT_SDK_ID=
YOTI_KEY_FILE_PATH=
# Optional configuration
YOTI_API_URL=
65 changes: 65 additions & 0 deletions _examples/profile/advancedIdentityProfile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package main

import (
"context"
"fmt"
"net/http"

"github.com/getyoti/yoti-go-sdk/v3/dynamic"
)

func advancedIdentityProfile(w http.ResponseWriter, req *http.Request) {
advancedIdentityProfile := []byte(`{
"profiles": [
{
"trust_framework": "UK_TFIDA",
"schemes": [
{
"label": "LB912",
"type": "RTW"
}
]
},
{
"trust_framework": "YOTI_GLOBAL",
"schemes": [
{
"label": "LB321",
"type": "IDENTITY",
"objective": "AL_L1"
}
]
}
]
}`)

policy, err := (&dynamic.PolicyBuilder{}).
WithAdvancedIdentityProfileRequirements(advancedIdentityProfile).
Build()
if err != nil {
errorPage(w, req.WithContext(context.WithValue(
req.Context(),
contextKey("yotiError"),
fmt.Sprintf(scenarioBuilderErr, err),
)))
return
}

subject := []byte(`{
"subject_id": "my_subject_id"
}`)
scenario, err := (&dynamic.ScenarioBuilder{}).
WithPolicy(policy).
WithSubject(subject).
WithCallbackEndpoint(profileEndpoint).Build()
if err != nil {
errorPage(w, req.WithContext(context.WithValue(
req.Context(),
contextKey("yotiError"),
fmt.Sprintf(scenarioBuilderErr, err),
)))
return
}

pageFromScenario(w, req, "Advanced Identity Profile Example", scenario)
}
1 change: 1 addition & 0 deletions _examples/profile/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func main() {
http.HandleFunc("/dynamic-share", dynamicShare)
http.HandleFunc("/source-constraints", sourceConstraints)
http.HandleFunc("/dbs-check", dbsCheck)
http.HandleFunc("/advanced", advancedIdentityProfile)

rootdir, err := os.Getwd()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion consts/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package consts

const (
SDKIdentifier = "Go"
SDKVersionIdentifier = "3.10.0"
SDKVersionIdentifier = "3.11.0"
)
Loading