v4.2.0
New Feature
Support of Digital Identity share service
Yoti Digital ID is now being upgraded!
We have a new API that is improving the sharing flow, for both end-users and integrators like you.
- share is now session based (must create a share session on the server, using the SDK)
- share session details (status, progress) can be fetched anytime
- can subscribe to share session events notification
- share data can be retrieved anytime until expiration of the receipt
This comes as a replacement of the Dynamic Sharing and Profile services combination.
⚠️ You must use the new browser client to fully integrate this new version with your front-end
📖 How to
Here are some snippets of basic use cases.
Create a Digital Identity Client:
const {
DigitalIdentityClient,
} = require('yoti');
const client = new DigitalIdentityClient(
clientSdkId, // Your Yoti Client SDK ID
pemKey, // The content of your Yoti .pem key
);
Create a share session:
const {
DigitalIdentityBuilders: {
PolicyBuilder,
ShareSessionConfigurationBuilder,
ShareSessionNotificationBuilder
},
} = require('yoti');
const policy = new PolicyBuilder()
.withFullName()
.withEmail()
// any other methods supported
.build();
/*
OR with a IdentityProfileRequirements
.withIdentityProfileRequirements({
trust_framework: 'UK_TFIDA',
scheme: {
type: 'RTW',
},
});
*/
const subject = {
subject_id: 'this is a new share',
};
const notification = new ShareSessionNotificationBuilder()
.withHeader('X-CUSTOM', 'custom')
.withUrl('https://service.com/yoti-notifications')
.withMethod('GET')
.withVerifiedTls(true)
.build();
// const extension = new ExtensionBuilder().withType()
const config = new ShareSessionConfigurationBuilder()
.withRedirectUri('/profile')
.withPolicy(policy)
.withSubject(subject)
.withNotification(notification)
// .withExtension(extension)
.build();
const shareSession = await client.createShareSession(config);
// shareSession.getId()
// shareSession.getStatus()
// shareSession.getExpiry()
Get the receipt of a share session:
const sessionId = 'session-id'
const shareSession = await client.getShareSession(sessionId);
const receiptId = shareSession.getReceiptId()
// Assuming receiptId exists
const receipt = await client.getShareReceipt(receiptId);
// Checking error
const receiptError = receipt.getError();
// Assuming no error, getting profile
const profile = receipt.getProfile();
// profile.getSelfie()
// profile.getFullName()
// profile.getFamilyName()
// profile.getGivenNames()
// profile.getDateOfBirth()
// profile.getGender()
// profile.getNationality()
// profile.getPhoneNumber()
// profile.getEmailAddress()
// profile.getPostalAddress()
// profile.getStructuredPostalAddress()
// profile.getDocumentDetails()
// profile.getDocumentImages()
// profile.getIdentityProfileReport()