-
Notifications
You must be signed in to change notification settings - Fork 19
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/4.3.0 #364
Merged
Merged
Release/4.3.0 #364
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5b3c526
SDK-2265 Retrieve Receipt (#323)
LuborRod 399e849
SDK-2377 added failure reasons to idv (#356)
mehmet-yoti d9442d5
Sdk 2420 php add support for advanced identity profiles to share v 2 …
mehmet-yoti f454c03
SDK-2371 added advanced identity profile to sharev1,example and updat…
mehmet-yoti 726139a
Update README.md (#345)
nikhilPank 3f90ff4
Added example for dbs and updated failure details (#362)
mehmet-yoti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ coverage | |
.scannerwork | ||
|
||
.DS_Store | ||
.php-cs-fixer.cache |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This file is a template for defining the environment variables | ||
# Set the application config values here | ||
|
||
YOTI_SDK_ID=xxxxxxxxxxxxxxxxxxxxx | ||
|
||
# Below is the private key (in .pem format) associated with the Yoti Application you created on Yoti Hub | ||
YOTI_KEY_FILE_PATH=./keys/php-sdk-access-security.pem | ||
|
||
# Laravel config: | ||
APP_NAME=yoti.sdk.digitalidentity.demo | ||
APP_ENV=local | ||
APP_KEY= | ||
APP_DEBUG=true | ||
APP_URL=http://localhost |
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,16 @@ | ||
/node_modules | ||
/public/hot | ||
/public/storage | ||
/storage/*.key | ||
/vendor | ||
.env | ||
.env.backup | ||
.phpunit.result.cache | ||
Homestead.json | ||
Homestead.yaml | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
*.pem | ||
keys/*.pem | ||
sdk |
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,24 @@ | ||
# Digital Identity Example | ||
|
||
## Requirements | ||
|
||
This example requires [Docker](https://docs.docker.com/) | ||
|
||
## Setup | ||
|
||
* Create your application in the [Yoti Hub](https://hub.yoti.com) (this requires having a Yoti account) | ||
* Set the application domain of your app to `localhost:4002` | ||
* Do the steps below inside the [examples/digitalidentity](./) folder | ||
* Put `your-application-pem-file.pem` file inside the [keys](keys) folder, as Docker requires the `.pem` file to reside within the same location where it's run from. | ||
* Copy `.env.example` to `.env` | ||
* Open `.env` file and fill in the environment variable `YOTI_SDK_ID` | ||
* Set `YOTI_KEY_FILE_PATH` to `./keys/your-application-pem-file.pem` | ||
* Install dependencies `docker-compose up composer` | ||
* Run the `docker-compose up --build` command | ||
* Visit [https://localhost:4002](https://localhost:4002) | ||
* Run the `docker-compose stop` command to stop the containers. | ||
|
||
> To see how to retrieve activity details using the one time use token, refer to the [digitalidentity controller](app/Http/Controllers/IdentityController.php) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no activity details or one time use token in Share v2. Please update it to something like the following: Also, I think it should point to ReceiptController.php |
||
|
||
## Digital Identity Example | ||
* Visit [/generate-share](https://localhost:4002/generate-share) |
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,41 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
// | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// $schedule->command('inspire')->hourly(); | ||
} | ||
|
||
/** | ||
* Register the commands for the application. | ||
* | ||
* @return void | ||
*/ | ||
protected function commands() | ||
{ | ||
$this->load(__DIR__.'/Commands'); | ||
|
||
require base_path('routes/console.php'); | ||
} | ||
} |
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,55 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
use Throwable; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that are not reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
// | ||
]; | ||
|
||
/** | ||
* A list of the inputs that are never flashed for validation exceptions. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontFlash = [ | ||
'password', | ||
'password_confirmation', | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* @param \Throwable $exception | ||
* @return void | ||
* | ||
* @throws \Exception | ||
*/ | ||
public function report(Throwable $exception) | ||
{ | ||
parent::report($exception); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Throwable $exception | ||
* @return \Symfony\Component\HttpFoundation\Response | ||
* | ||
* @throws \Throwable | ||
*/ | ||
public function render($request, Throwable $exception) | ||
{ | ||
return parent::render($request, $exception); | ||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
examples/digitalidentity/app/Http/Controllers/AdvancedIdentityController.php
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,71 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Support\Facades\Log; | ||
use mysql_xdevapi\Exception; | ||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | ||
use Yoti\DigitalIdentityClient; | ||
use Yoti\Identity\Policy\PolicyBuilder; | ||
use Yoti\Identity\ShareSessionRequestBuilder; | ||
use Yoti\YotiClient; | ||
|
||
class AdvancedIdentityController extends BaseController | ||
{ | ||
public function generateSession(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
$advancedIdentityProfileJson = | ||
(object)[ | ||
"profiles" => [(object)[ | ||
|
||
"trust_framework" => "YOTI_GLOBAL", | ||
"schemes" => [(object)[ | ||
|
||
"label" => "identity-AL-L1", | ||
"type" => "IDENTITY", | ||
"objective"=> "AL_L1" | ||
], | ||
[ | ||
"label" => "identity-AL-M1", | ||
"type" => "IDENTITY", | ||
"objective" => "AL_M1" | ||
] | ||
] | ||
] | ||
] | ||
] | ||
; | ||
|
||
$policy = (new PolicyBuilder()) | ||
->withAdvancedIdentityProfileRequirements((object)$advancedIdentityProfileJson) | ||
->build(); | ||
|
||
$redirectUri = 'https://host/redirect/'; | ||
|
||
$shareSessionRequest = (new ShareSessionRequestBuilder()) | ||
->withPolicy($policy) | ||
->withRedirectUri($redirectUri) | ||
->build(); | ||
$session = $client->createShareSession($shareSessionRequest); | ||
return $session->getId(); | ||
} | ||
catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
public function show(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
return view('advancedidentity', [ | ||
'title' => 'Digital Identity(Advanced) Complete Example', | ||
'sdkId' => $client->id | ||
]); | ||
} catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
examples/digitalidentity/app/Http/Controllers/DbsController.php
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 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Support\Facades\Log; | ||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | ||
use Yoti\DigitalIdentityClient; | ||
use Yoti\Identity\Policy\PolicyBuilder; | ||
use Yoti\Identity\ShareSessionRequestBuilder; | ||
|
||
class DbsController extends BaseController | ||
{ | ||
public function generateSession(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
$policy = (new PolicyBuilder()) | ||
->withIdentityProfileRequirements((object)[ | ||
'trust_framework' => 'UK_TFIDA', | ||
'scheme' => [ | ||
'type' => 'DBS', | ||
'objective' => 'BASIC' | ||
] | ||
]) | ||
->build(); | ||
|
||
$redirectUri = 'https://host/redirect/'; | ||
|
||
$shareSessionRequest = (new ShareSessionRequestBuilder()) | ||
->withPolicy($policy) | ||
->withRedirectUri($redirectUri) | ||
->build(); | ||
$session = $client->createShareSession($shareSessionRequest); | ||
return $session->getId(); | ||
} | ||
catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
public function show(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
return view('dbs', [ | ||
'title' => 'Digital Identity DBS Check Example', | ||
'sdkId' => $client->id | ||
]); | ||
} catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
examples/digitalidentity/app/Http/Controllers/IdentityController.php
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,60 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Support\Facades\Log; | ||
use mysql_xdevapi\Exception; | ||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | ||
use Yoti\DigitalIdentityClient; | ||
use Yoti\Identity\Policy\PolicyBuilder; | ||
use Yoti\Identity\ShareSessionRequestBuilder; | ||
use Yoti\YotiClient; | ||
|
||
class IdentityController extends BaseController | ||
{ | ||
public function generateSession(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
|
||
$policy = (new PolicyBuilder()) | ||
->withFamilyName() | ||
->withGivenNames() | ||
->withFullName() | ||
->withDateOfBirth() | ||
->withGender() | ||
->withNationality() | ||
->withPhoneNumber() | ||
->withSelfie() | ||
->withEmail() | ||
->withDocumentDetails() | ||
->withDocumentImages() | ||
->build(); | ||
|
||
$redirectUri = 'https://host/redirect/'; | ||
|
||
$shareSessionRequest = (new ShareSessionRequestBuilder()) | ||
->withPolicy($policy) | ||
->withRedirectUri($redirectUri) | ||
->build(); | ||
$session = $client->createShareSession($shareSessionRequest); | ||
return $session->getId(); | ||
} | ||
catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
public function show(DigitalIdentityClient $client) | ||
{ | ||
try { | ||
return view('identity', [ | ||
'title' => 'Digital Identity Complete Example', | ||
'sdkId' => $client->id | ||
]); | ||
} catch (\Throwable $e) { | ||
Log::error($e->getTraceAsString()); | ||
throw new BadRequestHttpException($e->getMessage()); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the version to 4.3.0.