How to use the yoti.ConstraintsBuilder function in yoti

To help you get started, we’ve selected a few yoti examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github getyoti / yoti-node-sdk / examples / profile / index.js View on Github external
router.get('/dynamic-share', (req, res) => {
  const locationExtension = new Yoti.LocationConstraintExtensionBuilder()
    .withLatitude(51.5074)
    .withLongitude(-0.1278)
    .withRadius(6000)
    .build();

  const sourceConstraint = new Yoti.SourceConstraintBuilder()
    .withPassport()
    .withSoftPreference(false)
    .build();

  const constraints = new Yoti.ConstraintsBuilder()
    .withSourceConstraint(sourceConstraint)
    .build();

  const givenNamesWantedAttribute = new Yoti.WantedAttributeBuilder()
    .withName('given_names')
    .withConstraints(constraints)
    .withAcceptSelfAsserted()
    .build();

  const emailAddressWantedAttribute = new Yoti.WantedAttributeBuilder()
    .withName('email_address')
    .build();

  const dynamicPolicy = new Yoti.DynamicPolicyBuilder()
    .withWantedAttribute(givenNamesWantedAttribute)
    .withWantedAttribute(emailAddressWantedAttribute)