Plugin Directory

Changeset 1920337


Ignore:
Timestamp:
08/06/2018 10:58:39 AM (8 years ago)
Author:
yotiwordpress
Message:

Update landing page summary and the banner

Location:
yoti
Files:
165 added
19 edited

Legend:

Unmodified
Added
Removed
  • yoti/trunk/YotiHelper.php

    r1840797 r1920337  
    2121     * Yoti SDK javascript library.
    2222     */
    23     const YOTI_SDK_JAVASCRIPT_LIBRARY = 'https://sdk.yoti.com/clients/browser.2.0.1.js';
     23    const YOTI_SDK_JAVASCRIPT_LIBRARY = 'https://sdk.yoti.com/clients/browser.2.1.0.js';
    2424
    2525    const AGE_VERIFICATION_ATTR = 'age_verified';
  • yoti/trunk/readme.txt

    r1852630 r1920337  
    66Tested up to: 4.9.1
    77Requires PHP: 5.6
    8 Stable tag: 1.1.8
     8Stable tag: 1.1.9
    99License: GNU v3
    1010License URI: https://www.gnu.org/licenses/gpl.txt
     
    1414== Description ==
    1515
    16 Yoti is a digital identity platform that allows users to log in to your WordPress site—simply, securely and password free! Using a combination of our free identity app and our web based dashboard, we verify customer details against government issued ID documents before securely sending their details to you. Click here to learn [more.](https://www.yoti.com)
    17 
    18 This plugin also allows functionality to link your current followers to their Yoti accounts making registration and blogging quicker with a fancy button!
     16Yoti is a digital identity app that lets people log in to websites without a password and prove their identity online.
     17Just click on the login with Yoti button, scan secure QR code with the Yoti app and that’s it.
     18Get the Yoti plugin and let people log in to your WordPress websites without entering a password. Click here to learn [more.](https://www.yoti.com)
    1919
    2020Here is a quick video on how to install the plugin in less than 5 minutes:
     
    2222https://www.youtube.com/watch?v=kzltLNws1cQ
    2323
    24 == Features ==
     24== Why does your website need Yoti ==
    2525
    26 * Faster logon using your Yoti app
    27 * KYC and verification of your users
    28 * Anonymous verification
    29 * Automatic login to create blogs with ease
    30 * No need for passwords
    31 * Remember me functionality
    32 * The ability for user to link and unlink WordPress account to Yoti account
     26* Stops keyloggers, by not having to type usernames and passwords.
     27* Stops phishing attacks, safer website access without usernames and passwords.
     28* Privacy by design. We use advanced hybrid 256-bit encryption to secure your personal information.
     29* No Passwords. Your users login securely by scanning a QR code.
     30* KYC checks. Verify the identities of your website users.
     31* Age verification. Verify the age of users of your website and control access to age-restricted content.
     32
     33Download the free Yoti app [Android](https://play.google.com/store/apps/details?id=com.yoti.mobile.android.live)
     34Download the free Yoti app [IOS](https://itunes.apple.com/us/app/yoti/id983980808?ls=1&mt=8)
    3335
    3436== Installation ==
    3537
    36 We have a few simple steps we need you to fill before you get started:
    37 
    38 = Requirements =
    39 
    40 * This plugin works with the WordPress Business Plan package.
    41 * You must also have downloaded the Yoti app with an ID document attached.
    42 
    4338= Step1: Installing the plugin =
    4439
    45 Import the plugin into your WordPress dashboard:
    46 
    47 1. Log on to your Wordpress Admin Dashboard: e.g. https://www.wordpress-url.org.uk/wp-admin
    48 2. Navigate on the left hand side to Plugins > Add New
    49 3. Search for Yoti and install it
    50 4. Activate the plugin on the same screen
     40* From the “Plugins” menu search for “Yoti”,
     41* click “Install Now” and then “Activate”.
    5142
    5243= Step 2: Setting up your Yoti Application =
    5344
    54 If you are a business, please create a Yoti organisation by visiting [here.](https://www.yoti.com/dashboard/login-organisations)
     45Visit the Yoti Dashboard [here](https://www.yoti.com/dashboard/login-organisations) to create a new application for your organisation/business.
    5546
    56 For information on how to create an organisation please visit our [developer site.](https://www.yoti.com/developers/documentation/#introduction)
     47Specify the basic details of your application such as the name, description and optional logo. These details can be whatever you desire and will not affect the plugin’s functionality.
    5748
    58 Once this is completed, or for personal use please access the [dashboard](https://www.yoti.com/dashboard/login) to create a new application. Note: if you have completed your organisation steps above you will need to ensure you are within your organisation dashboard by:
     49The main page - Edit the application and set your website URL in the 'Application domain' section, e.g https:yourwebsite.com
    5950
    60 * Clicking your profile photo on the top right
    61 * Select organisation
     51The Scenarios tab -  Scenarios are different instances where you request users for information using Yoti. e.g verify your users' age online or in person or quickly sign in users to your website without passwords. This plugin only support single scenario.
    6252
    63 This will then lead you to create a new application.
     53* Specify a name for your scenario.
     54* Specify what information you want to request with this scenario.
     55* And finally, provide a callback URL so we know where to send your users after they have used Yoti. This URL must be a subdomain of your applications' domain.
    6456
    65 Specify the basic details of your application such as the name, description and optional logo. These details can be whatever you desire and will not affect the plugin's functionality.
    66 
    67 The Data tab - Specify any attributes you'd like users to share. You must select at least one. If you plan to allow new user registrations, we recommended choosing Given Name(s), Family Name and Email Address at a minimum.
    68 
    69 The Integration tab - Here is where you specify the callback URL. The URL can be found by going to your Yoti settings page which is located in your WordPress admin dashboard.
    70 
    71 NOTE: If you get redirected to your WordPress frontpage instead of the Admin area, simply add /wp-admin to the URL.
    72 
    73 The Key tab - Here is where your keys are generated which will be inputted into the plugin settings. You will need to download your pem file and store it somewhere safe as it will be used as part of the plugin set up.
    74 
    75 = Step 3: Plugin Setup =
    76 
    77 To set things up, navigate on WordPress to Settings > Yoti. You will be asked to add the following information:
    78 
    79 * Yoti App ID is the unique identifier of your specific application.
    80 * Yoti Scenario ID is used to render the inline QR code.
    81 * Yoti SDK ID is the SDK identifier generated by Yoti Dashboard in the Key tab when you create your app. Note this is not your Application Identifier, which is needed by your client-side code.
    82 * Company Name will replace WordPress wording in the warning message displayed on the custom login form.
    83 * Yoti PEM File is the application pem file. It can be downloaded only once from the Keys tab in your Yoti Dashboard. Please do not include the Zip File, just the pem file is adequate.
    84 * Change your call back URL on Yoti Dashboard: Log in to your dashboard and change your call back URL to the one provided on your Yoti Settings page. This is located within your application, on the Integration tab
    85 
    86 = Step 4: Adding the widget =
    87 
    88 Now your Yoti plugin is all set up you will need to add the button to your WordPress page.
    89 
    90 To do this navigate to Appearance -> Widgets.
    91 
    92 Please place the Yoti Widget where you deem appropriate.
    93 
    94 = Step 5: Testing =
    95 
    96 Log out of your WordPress account and go back to your site.
    97 
    98 Test the Yoti button.
    99 
    100 = Extras: =
    101 
    102 The Yoti plugin has been developed to allow existing users to link their account with the below use cases:
    103 
    104 1) Only allow existing WordPress users to link their Yoti account - This setting will prevent a new user to register and/or login using Yoti if they don't already have an account on your WordPress website. If enabled, when a new user tries to scan the Yoti QR code, they will be redirected to the login/register page with an error message displayed.
    105 
    106 2) Attempt to link Yoti email address with Wordpress account for first time users - This setting enables linking a Yoti account to a WordPress user if the email from both platforms is identical.
    107 
    108 3) Prevent users who have not passed age verification to access your site - This setting will not allow someone who does not pass the age verification condition set in the Yoti Dashboard (e.g. over 18) to register or link their account with Yoti.
    109 
    110 This is found in Yoti plugin settings.
     57The Keys tab – Here is where your keys are generated which will be inputted into the plugin settings. You will need to download your pem file and store it somewhere safe as it will be used as part of the plugin set up.
    11158
    11259== Frequently Asked Questions ==
     
    12875
    12976Here you can find the changes for each version:
     77
     781.1.9
     79
     80Release Date - 1 August 2018
     81
     82* Update the Details and Installation section on the plugin page to reflect the changes from Yoti dashboard
     83* Update the banner on the plugin page
    13084
    131851.1.8
  • yoti/trunk/sdk/Yoti/ActivityDetails.php

    r1852630 r1920337  
    22namespace Yoti;
    33
    4 use attrpubapi_v1\Attribute;
    5 use attrpubapi_v1\AttributeList;
    64use Yoti\Entity\Selfie;
     5use Yoti\Entity\Profile;
     6use Yoti\Entity\Attribute;
     7use Attrpubapi_v1\AttributeList;
    78use Yoti\Helper\ActivityDetailsHelper;
     9use Yoti\Util\Age\AgeUnderOverProcessor;
     10use Yoti\Util\Profile\AnchorProcessor;
    811
    912/**
     
    3942
    4043    /**
     44     * @var \Yoti\Entity\Profile
     45     */
     46    private $profile;
     47
     48    /**
    4149     * @var ActivityDetailsHelper
    4250     */
     
    5967        }
    6068
     69        // Setting an empty profile here in case
     70        // the constructor is called directly
     71        $this->setProfile(new Profile([]));
     72
    6173        $this->helper = new ActivityDetailsHelper($this);
    6274    }
     
    7284    public static function constructFromAttributeList(AttributeList $attributeList, $rememberMeId)
    7385    {
    74         $attrs = array();
    75 
    76         foreach ($attributeList->getAttributesList() as $item) /** @var Attribute $item */
     86        // For ActivityDetails attributes
     87        $attrs = [];
     88        // For Profile attributes
     89        $profileAttributes = [];
     90        $ageConditionMetadata = [];
     91        $anchorProcessor = new AnchorProcessor();
     92
     93        foreach ($attributeList->getAttributes() as $item) /** @var Attribute $item */
    7794        {
    78             if($item->getName() === 'selfie')
    79             {
    80                 $attrs[$item->getName()] = new Selfie(
    81                     $item->getValue()->getContents(),
    82                     $item->getContentType()->name()
     95            $attrName = $item->getName();
     96            if ($attrName === 'selfie') {
     97                $attrs[$attrName] = new Selfie(
     98                    $item->getValue(),
     99                    $item->getName()
    83100                );
    84101            }
    85102            else {
    86                 $attrs[$item->getName()] = $item->getValue()->getContents();
     103                $attrs[$attrName] = $item->getValue();
    87104            }
     105            // Build attribute object for user profile
     106            $attrValue = $item->getValue();
     107            // Convert structured_postal_address value to an Array
     108            if ($attrName === 'structured_postal_address') {
     109                $attrValue = json_decode($attrValue, TRUE);
     110            }
     111
     112            $attributeAnchors = $anchorProcessor->process($item->getAnchors());
     113            $attribute = new Attribute(
     114                $attrName,
     115                $attrValue,
     116                $attributeAnchors['sources'],
     117                $attributeAnchors['verifiers']
     118            );
     119
     120            $profileAttributes[$attrName] = $attribute;
     121            // Add 'is_age_verified' and 'verified_age' attributes
     122            if (preg_match(AgeUnderOverProcessor::AGE_PATTERN, $attrName)) {
     123                $ageConditionMetadata['sources'] = $attributeAnchors['sources'];
     124                $ageConditionMetadata['verifiers'] = $attributeAnchors['verifiers'];
     125            }
    88126        }
    89127
    90128        $inst = new self($attrs, $rememberMeId);
     129        // Add 'age_condition' and 'verified_age' attributes values
     130        if (!empty($ageConditionMetadata)) {
     131            $profileAttributes[Attribute::AGE_CONDITION] = new Attribute(
     132                Attribute::AGE_CONDITION,
     133                $inst->isAgeVerified(),
     134                $ageConditionMetadata['sources'],
     135                $ageConditionMetadata['verifiers']
     136            );
     137
     138            $profileAttributes[Attribute::VERIFIED_AGE] = new Attribute(
     139                Attribute::VERIFIED_AGE,
     140                $inst->getVerifiedAge(),
     141                $ageConditionMetadata['sources'],
     142                $ageConditionMetadata['verifiers']
     143            );
     144        }
     145        $inst->setProfile(new Profile($profileAttributes));
    91146
    92147        return $inst;
     
    124179
    125180    /**
     181     * @param Profile $profile
     182     */
     183    protected function setProfile(Profile $profile)
     184    {
     185        $this->profile = $profile;
     186    }
     187
     188    /**
     189     * Get user profile object.
     190     *
     191     * @return Profile
     192     */
     193    public function getProfile()
     194    {
     195        return $this->profile;
     196    }
     197
     198    /**
    126199     * Check if attribute exists.
    127200     *
     
    148221     * Get family name.
    149222     *
     223     * @deprecated 1.2.0
     224     *  Use profile::getFamilyName()
     225     *
    150226     * @return null|string
    151227     */
     
    158234     * Get given names.
    159235     *
     236     * @deprecated 1.2.0
     237     *  Use profile::getGivenNames()
     238     *
    160239     * @return null|string
    161240     */
     
    168247     * Get full name.
    169248     *
     249     * @deprecated 1.2.0
     250     *  Use profile::getFullName()
     251     *
    170252     * @return null|string
    171253     */
     
    178260     * Get date of birth.
    179261     *
     262     * @deprecated 1.2.0
     263     *  Use profile::getDateOfBirth()
     264     *
    180265     * @return null|string
    181266     */
     
    188273     * Get gender.
    189274     *
     275     * @deprecated 1.2.0
     276     *  Use profile::getGender()
     277     *
    190278     * @return null|string
    191279     */
     
    198286     * Get user nationality.
    199287     *
     288     * @deprecated 1.2.0
     289     *  Use profile::getNationality()
     290     *
    200291     * @return null|string
    201292     */
     
    208299     * Get user phone number.
    209300     *
     301     * @deprecated 1.2.0
     302     *  Use profile::getPhoneNumber()
     303     *
    210304     * @return null|string
    211305     */
     
    217311    /**
    218312     * Get user selfie image data.
     313     *
     314     * @deprecated 1.2.0
     315     *  Use profile::getSelfie()
    219316     *
    220317     * @return null|string
     
    235332     * Get selfie image object.
    236333     *
     334     * @deprecated 1.2.0
     335     *
    237336     * @return null| \Yoti\Entity\Selfie $selfie
    238337     */
     
    247346     * Get user email address.
    248347     *
     348     * @deprecated 1.2.0
     349     *  Use profile::getEmailAddress()
     350     *
    249351     * @return null|string
    250352     */
     
    257359     * Get user address.
    258360     *
     361     * @deprecated 1.2.0
     362     *  Use profile::getPostalAddress()
     363     *
    259364     * @return null|string
    260365     */
    261366    public function getPostalAddress()
    262367    {
    263         return $this->getProfileAttribute(self::ATTR_POSTAL_ADDRESS);
    264     }
    265 
    266     /**
    267      * Get user structured postal address as a JSON string.
    268      *
    269      * @return null|string
     368        $postalAddress = $this->getProfileAttribute(self::ATTR_POSTAL_ADDRESS);
     369        if (NULL === $postalAddress) {
     370            // Get it from structured_postal_address.formatted_address
     371            $structuredPostalAddress = $this->getStructuredPostalAddress();
     372            if (
     373                is_array($structuredPostalAddress)
     374                && isset($structuredPostalAddress['formatted_address'])
     375            ) {
     376                $postalAddress = $structuredPostalAddress['formatted_address'];
     377            }
     378        }
     379        return $postalAddress;
     380    }
     381
     382    /**
     383     * Get user structured postal address as an array.
     384     *
     385     * @deprecated 1.2.0
     386     *  Use profile::getStructuredPostalAddress()
     387     *
     388     * @return null|array
    270389     */
    271390    public function getStructuredPostalAddress()
    272391    {
    273         return $this->getProfileAttribute(self::ATTR_STRUCTURED_POSTAL_ADDRESS);
     392        $structuredPostalAddress = $this->getProfileAttribute(self::ATTR_STRUCTURED_POSTAL_ADDRESS);
     393        return json_decode($structuredPostalAddress, true);
    274394    }
    275395
     
    278398     * Or null if the attribute is not set in the dashboard
    279399     *
     400     * @deprecated 1.2.0
     401     *  Use profile::getAgeCondition()
     402     *
    280403     * @return bool|null
    281404     */
     
    286409
    287410    /**
     411     * @deprecated 1.2.0
     412     *  Use profile::getVerifiedAge()
     413     *
    288414     * @return null|string
    289415     */
  • yoti/trunk/sdk/Yoti/YotiClient.php

    r1840797 r1920337  
    33namespace Yoti;
    44
    5 use compubapi_v1\EncryptedData;
     5use Compubapi_v1\EncryptedData;
    66use Yoti\Http\Payload;
    77use Yoti\Http\AmlResult;
     
    431431     * @param $profileContent
    432432     *
    433      * @return \compubapi_v1\EncryptedData
     433     * @return \Compubapi_v1\EncryptedData
    434434     */
    435435    private function getEncryptedData($profileContent)
    436436    {
    437437        // Get cipher_text and iv
    438         $encryptedData = new EncryptedData(base64_decode($profileContent));
     438        $encryptedData = new EncryptedData();
     439        $encryptedData->mergeFromString(base64_decode($profileContent));
    439440
    440441        return $encryptedData;
     
    447448     * @param $wrappedReceiptKey
    448449     *
    449      * @return \attrpubapi_v1\AttributeList
     450     * @return \Attrpubapi_v1\AttributeList
    450451     */
    451452    private function getAttributeList(EncryptedData $encryptedData, $wrappedReceiptKey)
     
    463464        );
    464465
    465         $attributeList = new \attrpubapi_v1\AttributeList($cipherText);
     466        $attributeList = new \Attrpubapi_v1\AttributeList();
     467        $attributeList->mergeFromString($cipherText);
    466468
    467469        return $attributeList;
  • yoti/trunk/sdk/attrpubapi_v1/Anchor.php

    r1707648 r1920337  
    11<?php
    2 /**
    3  * Generated by Protobuf protoc plugin.
    4  *
    5  * File descriptor : Attribute.proto
    6  */
     2# Generated by the protocol buffer compiler.  DO NOT EDIT!
     3# source: Attribute.proto
    74
     5namespace Attrpubapi_v1;
    86
    9 namespace attrpubapi_v1;
     7use Google\Protobuf\Internal\GPBUtil;
    108
    119/**
    12  * Protobuf message : attrpubapi_v1.Anchor
     10 * Generated from protobuf message <code>attrpubapi_v1.Anchor</code>
    1311 */
    14 class Anchor extends \Protobuf\AbstractMessage
     12class Anchor extends \Google\Protobuf\Internal\Message
    1513{
     14    /**
     15     * Generated from protobuf field <code>bytes artifact_link = 1;</code>
     16     */
     17    private $artifact_link = '';
     18    /**
     19     * Generated from protobuf field <code>repeated bytes origin_server_certs = 2;</code>
     20     */
     21    private $origin_server_certs;
     22    /**
     23     * Generated from protobuf field <code>bytes artifact_signature = 3;</code>
     24     */
     25    private $artifact_signature = '';
     26    /**
     27     * Generated from protobuf field <code>string sub_type = 4;</code>
     28     */
     29    private $sub_type = '';
     30    /**
     31     * Generated from protobuf field <code>bytes signature = 5;</code>
     32     */
     33    private $signature = '';
     34    /**
     35     * Generated from protobuf field <code>bytes signed_time_stamp = 6;</code>
     36     */
     37    private $signed_time_stamp = '';
    1638
    17     /**
    18      * @var \Protobuf\UnknownFieldSet
    19      */
    20     protected $unknownFieldSet = null;
    21 
    22     /**
    23      * @var \Protobuf\Extension\ExtensionFieldMap
    24      */
    25     protected $extensions = null;
    26 
    27     /**
    28      * artifact_link optional bytes = 1
    29      *
    30      * @var \Protobuf\Stream
    31      */
    32     protected $artifact_link = null;
    33 
    34     /**
    35      * origin_server_certs repeated bytes = 2
    36      *
    37      * @var \Protobuf\Collection
    38      */
    39     protected $origin_server_certs = null;
    40 
    41     /**
    42      * artifact_signature optional bytes = 3
    43      *
    44      * @var \Protobuf\Stream
    45      */
    46     protected $artifact_signature = null;
    47 
    48     /**
    49      * sub_type optional string = 4
    50      *
    51      * @var string
    52      */
    53     protected $sub_type = null;
    54 
    55     /**
    56      * signature optional bytes = 5
    57      *
    58      * @var \Protobuf\Stream
    59      */
    60     protected $signature = null;
    61 
    62     /**
    63      * signed_time_stamp optional bytes = 6
    64      *
    65      * @var \Protobuf\Stream
    66      */
    67     protected $signed_time_stamp = null;
    68 
    69     /**
    70      * Check if 'artifact_link' has a value
    71      *
    72      * @return bool
    73      */
    74     public function hasArtifactLink()
    75     {
    76         return $this->artifact_link !== null;
     39    public function __construct() {
     40        \GPBMetadata\Attribute::initOnce();
     41        parent::__construct();
    7742    }
    7843
    7944    /**
    80      * Get 'artifact_link' value
    81      *
    82      * @return \Protobuf\Stream
     45     * Generated from protobuf field <code>bytes artifact_link = 1;</code>
     46     * @return string
    8347     */
    8448    public function getArtifactLink()
     
    8852
    8953    /**
    90      * Set 'artifact_link' value
    91      *
    92      * @param \Protobuf\Stream $value
     54     * Generated from protobuf field <code>bytes artifact_link = 1;</code>
     55     * @param string $var
     56     * @return $this
    9357     */
    94     public function setArtifactLink($value = null)
     58    public function setArtifactLink($var)
    9559    {
    96         if ($value !== null && ! $value instanceof \Protobuf\Stream) {
    97             $value = \Protobuf\Stream::wrap($value);
    98         }
     60        GPBUtil::checkString($var, False);
     61        $this->artifact_link = $var;
    9962
    100         $this->artifact_link = $value;
     63        return $this;
    10164    }
    10265
    10366    /**
    104      * Check if 'origin_server_certs' has a value
    105      *
    106      * @return bool
     67     * Generated from protobuf field <code>repeated bytes origin_server_certs = 2;</code>
     68     * @return \Google\Protobuf\Internal\RepeatedField
    10769     */
    108     public function hasOriginServerCertsList()
    109     {
    110         return $this->origin_server_certs !== null;
    111     }
    112 
    113     /**
    114      * Get 'origin_server_certs' value
    115      *
    116      * @return \Protobuf\Collection
    117      */
    118     public function getOriginServerCertsList()
     70    public function getOriginServerCerts()
    11971    {
    12072        return $this->origin_server_certs;
     
    12274
    12375    /**
    124      * Set 'origin_server_certs' value
    125      *
    126      * @param \Protobuf\Collection $value
     76     * Generated from protobuf field <code>repeated bytes origin_server_certs = 2;</code>
     77     * @param string[]|\Google\Protobuf\Internal\RepeatedField $var
     78     * @return $this
    12779     */
    128     public function setOriginServerCertsList(\Protobuf\Collection $value = null)
     80    public function setOriginServerCerts($var)
    12981    {
    130         $this->origin_server_certs = $value;
     82        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::BYTES);
     83        $this->origin_server_certs = $arr;
     84
     85        return $this;
    13186    }
    13287
    13388    /**
    134      * Add a new element to 'origin_server_certs'
    135      *
    136      * @param \Protobuf\Stream $value
    137      */
    138     public function addOriginServerCerts($value)
    139     {
    140         if ($this->origin_server_certs === null) {
    141             $this->origin_server_certs = new \Protobuf\StreamCollection();
    142         }
    143 
    144         $this->origin_server_certs->add(\Protobuf\Stream::wrap($value));
    145     }
    146 
    147     /**
    148      * Check if 'artifact_signature' has a value
    149      *
    150      * @return bool
    151      */
    152     public function hasArtifactSignature()
    153     {
    154         return $this->artifact_signature !== null;
    155     }
    156 
    157     /**
    158      * Get 'artifact_signature' value
    159      *
    160      * @return \Protobuf\Stream
     89     * Generated from protobuf field <code>bytes artifact_signature = 3;</code>
     90     * @return string
    16191     */
    16292    public function getArtifactSignature()
     
    16696
    16797    /**
    168      * Set 'artifact_signature' value
    169      *
    170      * @param \Protobuf\Stream $value
     98     * Generated from protobuf field <code>bytes artifact_signature = 3;</code>
     99     * @param string $var
     100     * @return $this
    171101     */
    172     public function setArtifactSignature($value = null)
     102    public function setArtifactSignature($var)
    173103    {
    174         if ($value !== null && ! $value instanceof \Protobuf\Stream) {
    175             $value = \Protobuf\Stream::wrap($value);
    176         }
     104        GPBUtil::checkString($var, False);
     105        $this->artifact_signature = $var;
    177106
    178         $this->artifact_signature = $value;
     107        return $this;
    179108    }
    180109
    181110    /**
    182      * Check if 'sub_type' has a value
    183      *
    184      * @return bool
    185      */
    186     public function hasSubType()
    187     {
    188         return $this->sub_type !== null;
    189     }
    190 
    191     /**
    192      * Get 'sub_type' value
    193      *
     111     * Generated from protobuf field <code>string sub_type = 4;</code>
    194112     * @return string
    195113     */
     
    200118
    201119    /**
    202      * Set 'sub_type' value
    203      *
    204      * @param string $value
     120     * Generated from protobuf field <code>string sub_type = 4;</code>
     121     * @param string $var
     122     * @return $this
    205123     */
    206     public function setSubType($value = null)
     124    public function setSubType($var)
    207125    {
    208         $this->sub_type = $value;
     126        GPBUtil::checkString($var, True);
     127        $this->sub_type = $var;
     128
     129        return $this;
    209130    }
    210131
    211132    /**
    212      * Check if 'signature' has a value
    213      *
    214      * @return bool
    215      */
    216     public function hasSignature()
    217     {
    218         return $this->signature !== null;
    219     }
    220 
    221     /**
    222      * Get 'signature' value
    223      *
    224      * @return \Protobuf\Stream
     133     * Generated from protobuf field <code>bytes signature = 5;</code>
     134     * @return string
    225135     */
    226136    public function getSignature()
     
    230140
    231141    /**
    232      * Set 'signature' value
    233      *
    234      * @param \Protobuf\Stream $value
     142     * Generated from protobuf field <code>bytes signature = 5;</code>
     143     * @param string $var
     144     * @return $this
    235145     */
    236     public function setSignature($value = null)
     146    public function setSignature($var)
    237147    {
    238         if ($value !== null && ! $value instanceof \Protobuf\Stream) {
    239             $value = \Protobuf\Stream::wrap($value);
    240         }
     148        GPBUtil::checkString($var, False);
     149        $this->signature = $var;
    241150
    242         $this->signature = $value;
     151        return $this;
    243152    }
    244153
    245154    /**
    246      * Check if 'signed_time_stamp' has a value
    247      *
    248      * @return bool
    249      */
    250     public function hasSignedTimeStamp()
    251     {
    252         return $this->signed_time_stamp !== null;
    253     }
    254 
    255     /**
    256      * Get 'signed_time_stamp' value
    257      *
    258      * @return \Protobuf\Stream
     155     * Generated from protobuf field <code>bytes signed_time_stamp = 6;</code>
     156     * @return string
    259157     */
    260158    public function getSignedTimeStamp()
     
    264162
    265163    /**
    266      * Set 'signed_time_stamp' value
    267      *
    268      * @param \Protobuf\Stream $value
     164     * Generated from protobuf field <code>bytes signed_time_stamp = 6;</code>
     165     * @param string $var
     166     * @return $this
    269167     */
    270     public function setSignedTimeStamp($value = null)
     168    public function setSignedTimeStamp($var)
    271169    {
    272         if ($value !== null && ! $value instanceof \Protobuf\Stream) {
    273             $value = \Protobuf\Stream::wrap($value);
    274         }
     170        GPBUtil::checkString($var, False);
     171        $this->signed_time_stamp = $var;
    275172
    276         $this->signed_time_stamp = $value;
     173        return $this;
    277174    }
    278 
    279     /**
    280      * {@inheritdoc}
    281      */
    282     public function extensions()
    283     {
    284         if ( $this->extensions !== null) {
    285             return $this->extensions;
    286         }
    287 
    288         return $this->extensions = new \Protobuf\Extension\ExtensionFieldMap(__CLASS__);
    289     }
    290 
    291     /**
    292      * {@inheritdoc}
    293      */
    294     public function unknownFieldSet()
    295     {
    296         return $this->unknownFieldSet;
    297     }
    298 
    299     /**
    300      * {@inheritdoc}
    301      */
    302     public static function fromStream($stream, \Protobuf\Configuration $configuration = null)
    303     {
    304         return new self($stream, $configuration);
    305     }
    306 
    307     /**
    308      * {@inheritdoc}
    309      */
    310     public static function fromArray(array $values)
    311     {
    312         $message = new self();
    313         $values  = array_merge([
    314             'artifact_link' => null,
    315             'origin_server_certs' => [],
    316             'artifact_signature' => null,
    317             'sub_type' => null,
    318             'signature' => null,
    319             'signed_time_stamp' => null
    320         ], $values);
    321 
    322         $message->setArtifactLink($values['artifact_link']);
    323         $message->setArtifactSignature($values['artifact_signature']);
    324         $message->setSubType($values['sub_type']);
    325         $message->setSignature($values['signature']);
    326         $message->setSignedTimeStamp($values['signed_time_stamp']);
    327 
    328         foreach ($values['origin_server_certs'] as $item) {
    329             $message->addOriginServerCerts($item);
    330         }
    331 
    332         return $message;
    333     }
    334 
    335     /**
    336      * {@inheritdoc}
    337      */
    338     public static function descriptor()
    339     {
    340         return \google\protobuf\DescriptorProto::fromArray([
    341             'name'      => 'Anchor',
    342             'field'     => [
    343                 \google\protobuf\FieldDescriptorProto::fromArray([
    344                     'number' => 1,
    345                     'name' => 'artifact_link',
    346                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    347                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    348                 ]),
    349                 \google\protobuf\FieldDescriptorProto::fromArray([
    350                     'number' => 2,
    351                     'name' => 'origin_server_certs',
    352                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    353                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED()
    354                 ]),
    355                 \google\protobuf\FieldDescriptorProto::fromArray([
    356                     'number' => 3,
    357                     'name' => 'artifact_signature',
    358                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    359                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    360                 ]),
    361                 \google\protobuf\FieldDescriptorProto::fromArray([
    362                     'number' => 4,
    363                     'name' => 'sub_type',
    364                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(),
    365                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    366                 ]),
    367                 \google\protobuf\FieldDescriptorProto::fromArray([
    368                     'number' => 5,
    369                     'name' => 'signature',
    370                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    371                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    372                 ]),
    373                 \google\protobuf\FieldDescriptorProto::fromArray([
    374                     'number' => 6,
    375                     'name' => 'signed_time_stamp',
    376                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    377                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    378                 ]),
    379             ],
    380         ]);
    381     }
    382 
    383     /**
    384      * {@inheritdoc}
    385      */
    386     public function toStream(\Protobuf\Configuration $configuration = null)
    387     {
    388         $config  = $configuration ?: \Protobuf\Configuration::getInstance();
    389         $context = $config->createWriteContext();
    390         $stream  = $context->getStream();
    391 
    392         $this->writeTo($context);
    393         $stream->seek(0);
    394 
    395         return $stream;
    396     }
    397 
    398     /**
    399      * {@inheritdoc}
    400      */
    401     public function writeTo(\Protobuf\WriteContext $context)
    402     {
    403         $stream      = $context->getStream();
    404         $writer      = $context->getWriter();
    405         $sizeContext = $context->getComputeSizeContext();
    406 
    407         if ($this->artifact_link !== null) {
    408             $writer->writeVarint($stream, 10);
    409             $writer->writeByteStream($stream, $this->artifact_link);
    410         }
    411 
    412         if ($this->origin_server_certs !== null) {
    413             foreach ($this->origin_server_certs as $val) {
    414                 $writer->writeVarint($stream, 18);
    415                 $writer->writeByteStream($stream, $val);
    416             }
    417         }
    418 
    419         if ($this->artifact_signature !== null) {
    420             $writer->writeVarint($stream, 26);
    421             $writer->writeByteStream($stream, $this->artifact_signature);
    422         }
    423 
    424         if ($this->sub_type !== null) {
    425             $writer->writeVarint($stream, 34);
    426             $writer->writeString($stream, $this->sub_type);
    427         }
    428 
    429         if ($this->signature !== null) {
    430             $writer->writeVarint($stream, 42);
    431             $writer->writeByteStream($stream, $this->signature);
    432         }
    433 
    434         if ($this->signed_time_stamp !== null) {
    435             $writer->writeVarint($stream, 50);
    436             $writer->writeByteStream($stream, $this->signed_time_stamp);
    437         }
    438 
    439         if ($this->extensions !== null) {
    440             $this->extensions->writeTo($context);
    441         }
    442 
    443         return $stream;
    444     }
    445 
    446     /**
    447      * {@inheritdoc}
    448      */
    449     public function readFrom(\Protobuf\ReadContext $context)
    450     {
    451         $reader = $context->getReader();
    452         $length = $context->getLength();
    453         $stream = $context->getStream();
    454 
    455         $limit = ($length !== null)
    456             ? ($stream->tell() + $length)
    457             : null;
    458 
    459         while ($limit === null || $stream->tell() < $limit) {
    460 
    461             if ($stream->eof()) {
    462                 break;
    463             }
    464 
    465             $key  = $reader->readVarint($stream);
    466             $wire = \Protobuf\WireFormat::getTagWireType($key);
    467             $tag  = \Protobuf\WireFormat::getTagFieldNumber($key);
    468 
    469             if ($stream->eof()) {
    470                 break;
    471             }
    472 
    473             if ($tag === 1) {
    474                 \Protobuf\WireFormat::assertWireType($wire, 12);
    475 
    476                 $this->artifact_link = $reader->readByteStream($stream);
    477 
    478                 continue;
    479             }
    480 
    481             if ($tag === 2) {
    482                 \Protobuf\WireFormat::assertWireType($wire, 12);
    483 
    484                 if ($this->origin_server_certs === null) {
    485                     $this->origin_server_certs = new \Protobuf\StreamCollection();
    486                 }
    487 
    488                 $this->origin_server_certs->add($reader->readByteStream($stream));
    489 
    490                 continue;
    491             }
    492 
    493             if ($tag === 3) {
    494                 \Protobuf\WireFormat::assertWireType($wire, 12);
    495 
    496                 $this->artifact_signature = $reader->readByteStream($stream);
    497 
    498                 continue;
    499             }
    500 
    501             if ($tag === 4) {
    502                 \Protobuf\WireFormat::assertWireType($wire, 9);
    503 
    504                 $this->sub_type = $reader->readString($stream);
    505 
    506                 continue;
    507             }
    508 
    509             if ($tag === 5) {
    510                 \Protobuf\WireFormat::assertWireType($wire, 12);
    511 
    512                 $this->signature = $reader->readByteStream($stream);
    513 
    514                 continue;
    515             }
    516 
    517             if ($tag === 6) {
    518                 \Protobuf\WireFormat::assertWireType($wire, 12);
    519 
    520                 $this->signed_time_stamp = $reader->readByteStream($stream);
    521 
    522                 continue;
    523             }
    524 
    525             $extensions = $context->getExtensionRegistry();
    526             $extension  = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
    527 
    528             if ($extension !== null) {
    529                 $this->extensions()->add($extension, $extension->readFrom($context, $wire));
    530 
    531                 continue;
    532             }
    533 
    534             if ($this->unknownFieldSet === null) {
    535                 $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
    536             }
    537 
    538             $data    = $reader->readUnknown($stream, $wire);
    539             $unknown = new \Protobuf\Unknown($tag, $wire, $data);
    540 
    541             $this->unknownFieldSet->add($unknown);
    542 
    543         }
    544     }
    545 
    546     /**
    547      * {@inheritdoc}
    548      */
    549     public function serializedSize(\Protobuf\ComputeSizeContext $context)
    550     {
    551         $calculator = $context->getSizeCalculator();
    552         $size       = 0;
    553 
    554         if ($this->artifact_link !== null) {
    555             $size += 1;
    556             $size += $calculator->computeByteStreamSize($this->artifact_link);
    557         }
    558 
    559         if ($this->origin_server_certs !== null) {
    560             foreach ($this->origin_server_certs as $val) {
    561                 $size += 1;
    562                 $size += $calculator->computeByteStreamSize($val);
    563             }
    564         }
    565 
    566         if ($this->artifact_signature !== null) {
    567             $size += 1;
    568             $size += $calculator->computeByteStreamSize($this->artifact_signature);
    569         }
    570 
    571         if ($this->sub_type !== null) {
    572             $size += 1;
    573             $size += $calculator->computeStringSize($this->sub_type);
    574         }
    575 
    576         if ($this->signature !== null) {
    577             $size += 1;
    578             $size += $calculator->computeByteStreamSize($this->signature);
    579         }
    580 
    581         if ($this->signed_time_stamp !== null) {
    582             $size += 1;
    583             $size += $calculator->computeByteStreamSize($this->signed_time_stamp);
    584         }
    585 
    586         if ($this->extensions !== null) {
    587             $size += $this->extensions->serializedSize($context);
    588         }
    589 
    590         return $size;
    591     }
    592 
    593     /**
    594      * {@inheritdoc}
    595      */
    596     public function clear()
    597     {
    598         $this->artifact_link = null;
    599         $this->origin_server_certs = null;
    600         $this->artifact_signature = null;
    601         $this->sub_type = null;
    602         $this->signature = null;
    603         $this->signed_time_stamp = null;
    604     }
    605 
    606     /**
    607      * {@inheritdoc}
    608      */
    609     public function merge(\Protobuf\Message $message)
    610     {
    611         if ( ! $message instanceof \attrpubapi_v1\Anchor) {
    612             throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message)));
    613         }
    614 
    615         $this->artifact_link = ($message->artifact_link !== null) ? $message->artifact_link : $this->artifact_link;
    616         $this->origin_server_certs = ($message->origin_server_certs !== null) ? $message->origin_server_certs : $this->origin_server_certs;
    617         $this->artifact_signature = ($message->artifact_signature !== null) ? $message->artifact_signature : $this->artifact_signature;
    618         $this->sub_type = ($message->sub_type !== null) ? $message->sub_type : $this->sub_type;
    619         $this->signature = ($message->signature !== null) ? $message->signature : $this->signature;
    620         $this->signed_time_stamp = ($message->signed_time_stamp !== null) ? $message->signed_time_stamp : $this->signed_time_stamp;
    621     }
    622 
    623175
    624176}
  • yoti/trunk/sdk/attrpubapi_v1/Attribute.php

    r1707648 r1920337  
    11<?php
    2 /**
    3  * Generated by Protobuf protoc plugin.
    4  *
    5  * File descriptor : Attribute.proto
    6  */
     2# Generated by the protocol buffer compiler.  DO NOT EDIT!
     3# source: Attribute.proto
    74
     5namespace Attrpubapi_v1;
    86
    9 namespace attrpubapi_v1;
     7use Google\Protobuf\Internal\GPBUtil;
    108
    119/**
    12  * Protobuf message : attrpubapi_v1.Attribute
     10 * Generated from protobuf message <code>attrpubapi_v1.Attribute</code>
    1311 */
    14 class Attribute extends \Protobuf\AbstractMessage
     12class Attribute extends \Google\Protobuf\Internal\Message
    1513{
     14    /**
     15     * Generated from protobuf field <code>string name = 1;</code>
     16     */
     17    private $name = '';
     18    /**
     19     * Generated from protobuf field <code>bytes value = 2;</code>
     20     */
     21    private $value = '';
     22    /**
     23     * Generated from protobuf field <code>.attrpubapi_v1.ContentType content_type = 3;</code>
     24     */
     25    private $content_type = 0;
     26    /**
     27     * Generated from protobuf field <code>repeated .attrpubapi_v1.Anchor anchors = 4;</code>
     28     */
     29    private $anchors;
    1630
    17     /**
    18      * @var \Protobuf\UnknownFieldSet
    19      */
    20     protected $unknownFieldSet = null;
    21 
    22     /**
    23      * @var \Protobuf\Extension\ExtensionFieldMap
    24      */
    25     protected $extensions = null;
    26 
    27     /**
    28      * name optional string = 1
    29      *
    30      * @var string
    31      */
    32     protected $name = null;
    33 
    34     /**
    35      * value optional bytes = 2
    36      *
    37      * @var \Protobuf\Stream
    38      */
    39     protected $value = null;
    40 
    41     /**
    42      * content_type optional enum = 3
    43      *
    44      * @var \attrpubapi_v1\ContentType
    45      */
    46     protected $content_type = null;
    47 
    48     /**
    49      * anchors repeated message = 4
    50      *
    51      * @var \Protobuf\Collection<\attrpubapi_v1\Anchor>
    52      */
    53     protected $anchors = null;
    54 
    55     /**
    56      * Check if 'name' has a value
    57      *
    58      * @return bool
    59      */
    60     public function hasName()
    61     {
    62         return $this->name !== null;
     31    public function __construct() {
     32        \GPBMetadata\Attribute::initOnce();
     33        parent::__construct();
    6334    }
    6435
    6536    /**
    66      * Get 'name' value
    67      *
     37     * Generated from protobuf field <code>string name = 1;</code>
    6838     * @return string
    6939     */
     
    7444
    7545    /**
    76      * Set 'name' value
    77      *
    78      * @param string $value
     46     * Generated from protobuf field <code>string name = 1;</code>
     47     * @param string $var
     48     * @return $this
    7949     */
    80     public function setName($value = null)
     50    public function setName($var)
    8151    {
    82         $this->name = $value;
     52        GPBUtil::checkString($var, True);
     53        $this->name = $var;
     54
     55        return $this;
    8356    }
    8457
    8558    /**
    86      * Check if 'value' has a value
    87      *
    88      * @return bool
    89      */
    90     public function hasValue()
    91     {
    92         return $this->value !== null;
    93     }
    94 
    95     /**
    96      * Get 'value' value
    97      *
    98      * @return \Protobuf\Stream
     59     * Generated from protobuf field <code>bytes value = 2;</code>
     60     * @return string
    9961     */
    10062    public function getValue()
     
    10466
    10567    /**
    106      * Set 'value' value
    107      *
    108      * @param \Protobuf\Stream $value
     68     * Generated from protobuf field <code>bytes value = 2;</code>
     69     * @param string $var
     70     * @return $this
    10971     */
    110     public function setValue($value = null)
     72    public function setValue($var)
    11173    {
    112         if ($value !== null && ! $value instanceof \Protobuf\Stream) {
    113             $value = \Protobuf\Stream::wrap($value);
    114         }
     74        GPBUtil::checkString($var, False);
     75        $this->value = $var;
    11576
    116         $this->value = $value;
     77        return $this;
    11778    }
    11879
    11980    /**
    120      * Check if 'content_type' has a value
    121      *
    122      * @return bool
    123      */
    124     public function hasContentType()
    125     {
    126         return $this->content_type !== null;
    127     }
    128 
    129     /**
    130      * Get 'content_type' value
    131      *
    132      * @return \attrpubapi_v1\ContentType
     81     * Generated from protobuf field <code>.attrpubapi_v1.ContentType content_type = 3;</code>
     82     * @return int
    13383     */
    13484    public function getContentType()
     
    13888
    13989    /**
    140      * Set 'content_type' value
    141      *
    142      * @param \attrpubapi_v1\ContentType $value
     90     * Generated from protobuf field <code>.attrpubapi_v1.ContentType content_type = 3;</code>
     91     * @param int $var
     92     * @return $this
    14393     */
    144     public function setContentType(\attrpubapi_v1\ContentType $value = null)
     94    public function setContentType($var)
    14595    {
    146         $this->content_type = $value;
     96        GPBUtil::checkEnum($var, \Attrpubapi_v1\ContentType::class);
     97        $this->content_type = $var;
     98
     99        return $this;
    147100    }
    148101
    149102    /**
    150      * Check if 'anchors' has a value
    151      *
    152      * @return bool
     103     * Generated from protobuf field <code>repeated .attrpubapi_v1.Anchor anchors = 4;</code>
     104     * @return \Google\Protobuf\Internal\RepeatedField
    153105     */
    154     public function hasAnchorsList()
    155     {
    156         return $this->anchors !== null;
    157     }
    158 
    159     /**
    160      * Get 'anchors' value
    161      *
    162      * @return \Protobuf\Collection<\attrpubapi_v1\Anchor>
    163      */
    164     public function getAnchorsList()
     106    public function getAnchors()
    165107    {
    166108        return $this->anchors;
     
    168110
    169111    /**
    170      * Set 'anchors' value
    171      *
    172      * @param \Protobuf\Collection<\attrpubapi_v1\Anchor> $value
     112     * Generated from protobuf field <code>repeated .attrpubapi_v1.Anchor anchors = 4;</code>
     113     * @param \Attrpubapi_v1\Anchor[]|\Google\Protobuf\Internal\RepeatedField $var
     114     * @return $this
    173115     */
    174     public function setAnchorsList(\Protobuf\Collection $value = null)
     116    public function setAnchors($var)
    175117    {
    176         $this->anchors = $value;
     118        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Attrpubapi_v1\Anchor::class);
     119        $this->anchors = $arr;
     120
     121        return $this;
    177122    }
    178 
    179     /**
    180      * Add a new element to 'anchors'
    181      *
    182      * @param \attrpubapi_v1\Anchor $value
    183      */
    184     public function addAnchors(\attrpubapi_v1\Anchor $value)
    185     {
    186         if ($this->anchors === null) {
    187             $this->anchors = new \Protobuf\MessageCollection();
    188         }
    189 
    190         $this->anchors->add($value);
    191     }
    192 
    193     /**
    194      * {@inheritdoc}
    195      */
    196     public function extensions()
    197     {
    198         if ( $this->extensions !== null) {
    199             return $this->extensions;
    200         }
    201 
    202         return $this->extensions = new \Protobuf\Extension\ExtensionFieldMap(__CLASS__);
    203     }
    204 
    205     /**
    206      * {@inheritdoc}
    207      */
    208     public function unknownFieldSet()
    209     {
    210         return $this->unknownFieldSet;
    211     }
    212 
    213     /**
    214      * {@inheritdoc}
    215      */
    216     public static function fromStream($stream, \Protobuf\Configuration $configuration = null)
    217     {
    218         return new self($stream, $configuration);
    219     }
    220 
    221     /**
    222      * {@inheritdoc}
    223      */
    224     public static function fromArray(array $values)
    225     {
    226         $message = new self();
    227         $values  = array_merge([
    228             'name' => null,
    229             'value' => null,
    230             'content_type' => null,
    231             'anchors' => []
    232         ], $values);
    233 
    234         $message->setName($values['name']);
    235         $message->setValue($values['value']);
    236         $message->setContentType($values['content_type']);
    237 
    238         foreach ($values['anchors'] as $item) {
    239             $message->addAnchors($item);
    240         }
    241 
    242         return $message;
    243     }
    244 
    245     /**
    246      * {@inheritdoc}
    247      */
    248     public static function descriptor()
    249     {
    250         return \google\protobuf\DescriptorProto::fromArray([
    251             'name'      => 'Attribute',
    252             'field'     => [
    253                 \google\protobuf\FieldDescriptorProto::fromArray([
    254                     'number' => 1,
    255                     'name' => 'name',
    256                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(),
    257                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    258                 ]),
    259                 \google\protobuf\FieldDescriptorProto::fromArray([
    260                     'number' => 2,
    261                     'name' => 'value',
    262                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    263                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    264                 ]),
    265                 \google\protobuf\FieldDescriptorProto::fromArray([
    266                     'number' => 3,
    267                     'name' => 'content_type',
    268                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_ENUM(),
    269                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(),
    270                     'type_name' => '.attrpubapi_v1.ContentType'
    271                 ]),
    272                 \google\protobuf\FieldDescriptorProto::fromArray([
    273                     'number' => 4,
    274                     'name' => 'anchors',
    275                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(),
    276                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(),
    277                     'type_name' => '.attrpubapi_v1.Anchor'
    278                 ]),
    279             ],
    280         ]);
    281     }
    282 
    283     /**
    284      * {@inheritdoc}
    285      */
    286     public function toStream(\Protobuf\Configuration $configuration = null)
    287     {
    288         $config  = $configuration ?: \Protobuf\Configuration::getInstance();
    289         $context = $config->createWriteContext();
    290         $stream  = $context->getStream();
    291 
    292         $this->writeTo($context);
    293         $stream->seek(0);
    294 
    295         return $stream;
    296     }
    297 
    298     /**
    299      * {@inheritdoc}
    300      */
    301     public function writeTo(\Protobuf\WriteContext $context)
    302     {
    303         $stream      = $context->getStream();
    304         $writer      = $context->getWriter();
    305         $sizeContext = $context->getComputeSizeContext();
    306 
    307         if ($this->name !== null) {
    308             $writer->writeVarint($stream, 10);
    309             $writer->writeString($stream, $this->name);
    310         }
    311 
    312         if ($this->value !== null) {
    313             $writer->writeVarint($stream, 18);
    314             $writer->writeByteStream($stream, $this->value);
    315         }
    316 
    317         if ($this->content_type !== null) {
    318             $writer->writeVarint($stream, 24);
    319             $writer->writeVarint($stream, $this->content_type->value());
    320         }
    321 
    322         if ($this->anchors !== null) {
    323             foreach ($this->anchors as $val) {
    324                 $writer->writeVarint($stream, 34);
    325                 $writer->writeVarint($stream, $val->serializedSize($sizeContext));
    326                 $val->writeTo($context);
    327             }
    328         }
    329 
    330         if ($this->extensions !== null) {
    331             $this->extensions->writeTo($context);
    332         }
    333 
    334         return $stream;
    335     }
    336 
    337     /**
    338      * {@inheritdoc}
    339      */
    340     public function readFrom(\Protobuf\ReadContext $context)
    341     {
    342         $reader = $context->getReader();
    343         $length = $context->getLength();
    344         $stream = $context->getStream();
    345 
    346         $limit = ($length !== null)
    347             ? ($stream->tell() + $length)
    348             : null;
    349 
    350         while ($limit === null || $stream->tell() < $limit) {
    351 
    352             if ($stream->eof()) {
    353                 break;
    354             }
    355 
    356             $key  = $reader->readVarint($stream);
    357             $wire = \Protobuf\WireFormat::getTagWireType($key);
    358             $tag  = \Protobuf\WireFormat::getTagFieldNumber($key);
    359 
    360             if ($stream->eof()) {
    361                 break;
    362             }
    363 
    364             if ($tag === 1) {
    365                 \Protobuf\WireFormat::assertWireType($wire, 9);
    366 
    367                 $this->name = $reader->readString($stream);
    368 
    369                 continue;
    370             }
    371 
    372             if ($tag === 2) {
    373                 \Protobuf\WireFormat::assertWireType($wire, 12);
    374 
    375                 $this->value = $reader->readByteStream($stream);
    376 
    377                 continue;
    378             }
    379 
    380             if ($tag === 3) {
    381                 \Protobuf\WireFormat::assertWireType($wire, 14);
    382 
    383                 $this->content_type = \attrpubapi_v1\ContentType::valueOf($reader->readVarint($stream));
    384 
    385                 continue;
    386             }
    387 
    388             if ($tag === 4) {
    389                 \Protobuf\WireFormat::assertWireType($wire, 11);
    390 
    391                 $innerSize    = $reader->readVarint($stream);
    392                 $innerMessage = new \attrpubapi_v1\Anchor();
    393 
    394                 if ($this->anchors === null) {
    395                     $this->anchors = new \Protobuf\MessageCollection();
    396                 }
    397 
    398                 $this->anchors->add($innerMessage);
    399 
    400                 $context->setLength($innerSize);
    401                 $innerMessage->readFrom($context);
    402                 $context->setLength($length);
    403 
    404                 continue;
    405             }
    406 
    407             $extensions = $context->getExtensionRegistry();
    408             $extension  = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
    409 
    410             if ($extension !== null) {
    411                 $this->extensions()->add($extension, $extension->readFrom($context, $wire));
    412 
    413                 continue;
    414             }
    415 
    416             if ($this->unknownFieldSet === null) {
    417                 $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
    418             }
    419 
    420             $data    = $reader->readUnknown($stream, $wire);
    421             $unknown = new \Protobuf\Unknown($tag, $wire, $data);
    422 
    423             $this->unknownFieldSet->add($unknown);
    424 
    425         }
    426     }
    427 
    428     /**
    429      * {@inheritdoc}
    430      */
    431     public function serializedSize(\Protobuf\ComputeSizeContext $context)
    432     {
    433         $calculator = $context->getSizeCalculator();
    434         $size       = 0;
    435 
    436         if ($this->name !== null) {
    437             $size += 1;
    438             $size += $calculator->computeStringSize($this->name);
    439         }
    440 
    441         if ($this->value !== null) {
    442             $size += 1;
    443             $size += $calculator->computeByteStreamSize($this->value);
    444         }
    445 
    446         if ($this->content_type !== null) {
    447             $size += 1;
    448             $size += $calculator->computeVarintSize($this->content_type->value());
    449         }
    450 
    451         if ($this->anchors !== null) {
    452             foreach ($this->anchors as $val) {
    453                 $innerSize = $val->serializedSize($context);
    454 
    455                 $size += 1;
    456                 $size += $innerSize;
    457                 $size += $calculator->computeVarintSize($innerSize);
    458             }
    459         }
    460 
    461         if ($this->extensions !== null) {
    462             $size += $this->extensions->serializedSize($context);
    463         }
    464 
    465         return $size;
    466     }
    467 
    468     /**
    469      * {@inheritdoc}
    470      */
    471     public function clear()
    472     {
    473         $this->name = null;
    474         $this->value = null;
    475         $this->content_type = null;
    476         $this->anchors = null;
    477     }
    478 
    479     /**
    480      * {@inheritdoc}
    481      */
    482     public function merge(\Protobuf\Message $message)
    483     {
    484         if ( ! $message instanceof \attrpubapi_v1\Attribute) {
    485             throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message)));
    486         }
    487 
    488         $this->name = ($message->name !== null) ? $message->name : $this->name;
    489         $this->value = ($message->value !== null) ? $message->value : $this->value;
    490         $this->content_type = ($message->content_type !== null) ? $message->content_type : $this->content_type;
    491         $this->anchors = ($message->anchors !== null) ? $message->anchors : $this->anchors;
    492     }
    493 
    494123
    495124}
  • yoti/trunk/sdk/attrpubapi_v1/AttributeAndId.php

    r1707648 r1920337  
    11<?php
    2 /**
    3  * Generated by Protobuf protoc plugin.
    4  *
    5  * File descriptor : List.proto
    6  */
     2# Generated by the protocol buffer compiler.  DO NOT EDIT!
     3# source: List.proto
    74
     5namespace Attrpubapi_v1;
    86
    9 namespace attrpubapi_v1;
     7use Google\Protobuf\Internal\GPBUtil;
    108
    119/**
    12  * Protobuf message : attrpubapi_v1.AttributeAndId
     10 * AttributeAndId is a simple container for holding an attribute's value
     11 * alongside its ID.
     12 *
     13 * Generated from protobuf message <code>attrpubapi_v1.AttributeAndId</code>
    1314 */
    14 class AttributeAndId extends \Protobuf\AbstractMessage
     15class AttributeAndId extends \Google\Protobuf\Internal\Message
    1516{
     17    /**
     18     * Generated from protobuf field <code>.attrpubapi_v1.Attribute attribute = 1;</code>
     19     */
     20    private $attribute = null;
     21    /**
     22     * Generated from protobuf field <code>bytes attribute_id = 2;</code>
     23     */
     24    private $attribute_id = '';
    1625
    17     /**
    18      * @var \Protobuf\UnknownFieldSet
    19      */
    20     protected $unknownFieldSet = null;
    21 
    22     /**
    23      * @var \Protobuf\Extension\ExtensionFieldMap
    24      */
    25     protected $extensions = null;
    26 
    27     /**
    28      * attribute optional message = 1
    29      *
    30      * @var \attrpubapi_v1\Attribute
    31      */
    32     protected $attribute = null;
    33 
    34     /**
    35      * attribute_id optional bytes = 2
    36      *
    37      * @var \Protobuf\Stream
    38      */
    39     protected $attribute_id = null;
    40 
    41     /**
    42      * Check if 'attribute' has a value
    43      *
    44      * @return bool
    45      */
    46     public function hasAttribute()
    47     {
    48         return $this->attribute !== null;
     26    public function __construct() {
     27        \GPBMetadata\ProtoList::initOnce();
     28        parent::__construct();
    4929    }
    5030
    5131    /**
    52      * Get 'attribute' value
    53      *
    54      * @return \attrpubapi_v1\Attribute
     32     * Generated from protobuf field <code>.attrpubapi_v1.Attribute attribute = 1;</code>
     33     * @return \Attrpubapi_v1\Attribute
    5534     */
    5635    public function getAttribute()
     
    6039
    6140    /**
    62      * Set 'attribute' value
    63      *
    64      * @param \attrpubapi_v1\Attribute $value
     41     * Generated from protobuf field <code>.attrpubapi_v1.Attribute attribute = 1;</code>
     42     * @param \Attrpubapi_v1\Attribute $var
     43     * @return $this
    6544     */
    66     public function setAttribute(\attrpubapi_v1\Attribute $value = null)
     45    public function setAttribute($var)
    6746    {
    68         $this->attribute = $value;
     47        GPBUtil::checkMessage($var, \Attrpubapi_v1\Attribute::class);
     48        $this->attribute = $var;
     49
     50        return $this;
    6951    }
    7052
    7153    /**
    72      * Check if 'attribute_id' has a value
    73      *
    74      * @return bool
    75      */
    76     public function hasAttributeId()
    77     {
    78         return $this->attribute_id !== null;
    79     }
    80 
    81     /**
    82      * Get 'attribute_id' value
    83      *
    84      * @return \Protobuf\Stream
     54     * Generated from protobuf field <code>bytes attribute_id = 2;</code>
     55     * @return string
    8556     */
    8657    public function getAttributeId()
     
    9061
    9162    /**
    92      * Set 'attribute_id' value
    93      *
    94      * @param \Protobuf\Stream $value
     63     * Generated from protobuf field <code>bytes attribute_id = 2;</code>
     64     * @param string $var
     65     * @return $this
    9566     */
    96     public function setAttributeId($value = null)
     67    public function setAttributeId($var)
    9768    {
    98         if ($value !== null && ! $value instanceof \Protobuf\Stream) {
    99             $value = \Protobuf\Stream::wrap($value);
    100         }
     69        GPBUtil::checkString($var, False);
     70        $this->attribute_id = $var;
    10171
    102         $this->attribute_id = $value;
     72        return $this;
    10373    }
    104 
    105     /**
    106      * {@inheritdoc}
    107      */
    108     public function extensions()
    109     {
    110         if ( $this->extensions !== null) {
    111             return $this->extensions;
    112         }
    113 
    114         return $this->extensions = new \Protobuf\Extension\ExtensionFieldMap(__CLASS__);
    115     }
    116 
    117     /**
    118      * {@inheritdoc}
    119      */
    120     public function unknownFieldSet()
    121     {
    122         return $this->unknownFieldSet;
    123     }
    124 
    125     /**
    126      * {@inheritdoc}
    127      */
    128     public static function fromStream($stream, \Protobuf\Configuration $configuration = null)
    129     {
    130         return new self($stream, $configuration);
    131     }
    132 
    133     /**
    134      * {@inheritdoc}
    135      */
    136     public static function fromArray(array $values)
    137     {
    138         $message = new self();
    139         $values  = array_merge([
    140             'attribute' => null,
    141             'attribute_id' => null
    142         ], $values);
    143 
    144         $message->setAttribute($values['attribute']);
    145         $message->setAttributeId($values['attribute_id']);
    146 
    147         return $message;
    148     }
    149 
    150     /**
    151      * {@inheritdoc}
    152      */
    153     public static function descriptor()
    154     {
    155         return \google\protobuf\DescriptorProto::fromArray([
    156             'name'      => 'AttributeAndId',
    157             'field'     => [
    158                 \google\protobuf\FieldDescriptorProto::fromArray([
    159                     'number' => 1,
    160                     'name' => 'attribute',
    161                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(),
    162                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(),
    163                     'type_name' => '.attrpubapi_v1.Attribute'
    164                 ]),
    165                 \google\protobuf\FieldDescriptorProto::fromArray([
    166                     'number' => 2,
    167                     'name' => 'attribute_id',
    168                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    169                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    170                 ]),
    171             ],
    172         ]);
    173     }
    174 
    175     /**
    176      * {@inheritdoc}
    177      */
    178     public function toStream(\Protobuf\Configuration $configuration = null)
    179     {
    180         $config  = $configuration ?: \Protobuf\Configuration::getInstance();
    181         $context = $config->createWriteContext();
    182         $stream  = $context->getStream();
    183 
    184         $this->writeTo($context);
    185         $stream->seek(0);
    186 
    187         return $stream;
    188     }
    189 
    190     /**
    191      * {@inheritdoc}
    192      */
    193     public function writeTo(\Protobuf\WriteContext $context)
    194     {
    195         $stream      = $context->getStream();
    196         $writer      = $context->getWriter();
    197         $sizeContext = $context->getComputeSizeContext();
    198 
    199         if ($this->attribute !== null) {
    200             $writer->writeVarint($stream, 10);
    201             $writer->writeVarint($stream, $this->attribute->serializedSize($sizeContext));
    202             $this->attribute->writeTo($context);
    203         }
    204 
    205         if ($this->attribute_id !== null) {
    206             $writer->writeVarint($stream, 18);
    207             $writer->writeByteStream($stream, $this->attribute_id);
    208         }
    209 
    210         if ($this->extensions !== null) {
    211             $this->extensions->writeTo($context);
    212         }
    213 
    214         return $stream;
    215     }
    216 
    217     /**
    218      * {@inheritdoc}
    219      */
    220     public function readFrom(\Protobuf\ReadContext $context)
    221     {
    222         $reader = $context->getReader();
    223         $length = $context->getLength();
    224         $stream = $context->getStream();
    225 
    226         $limit = ($length !== null)
    227             ? ($stream->tell() + $length)
    228             : null;
    229 
    230         while ($limit === null || $stream->tell() < $limit) {
    231 
    232             if ($stream->eof()) {
    233                 break;
    234             }
    235 
    236             $key  = $reader->readVarint($stream);
    237             $wire = \Protobuf\WireFormat::getTagWireType($key);
    238             $tag  = \Protobuf\WireFormat::getTagFieldNumber($key);
    239 
    240             if ($stream->eof()) {
    241                 break;
    242             }
    243 
    244             if ($tag === 1) {
    245                 \Protobuf\WireFormat::assertWireType($wire, 11);
    246 
    247                 $innerSize    = $reader->readVarint($stream);
    248                 $innerMessage = new \attrpubapi_v1\Attribute();
    249 
    250                 $this->attribute = $innerMessage;
    251 
    252                 $context->setLength($innerSize);
    253                 $innerMessage->readFrom($context);
    254                 $context->setLength($length);
    255 
    256                 continue;
    257             }
    258 
    259             if ($tag === 2) {
    260                 \Protobuf\WireFormat::assertWireType($wire, 12);
    261 
    262                 $this->attribute_id = $reader->readByteStream($stream);
    263 
    264                 continue;
    265             }
    266 
    267             $extensions = $context->getExtensionRegistry();
    268             $extension  = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
    269 
    270             if ($extension !== null) {
    271                 $this->extensions()->add($extension, $extension->readFrom($context, $wire));
    272 
    273                 continue;
    274             }
    275 
    276             if ($this->unknownFieldSet === null) {
    277                 $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
    278             }
    279 
    280             $data    = $reader->readUnknown($stream, $wire);
    281             $unknown = new \Protobuf\Unknown($tag, $wire, $data);
    282 
    283             $this->unknownFieldSet->add($unknown);
    284 
    285         }
    286     }
    287 
    288     /**
    289      * {@inheritdoc}
    290      */
    291     public function serializedSize(\Protobuf\ComputeSizeContext $context)
    292     {
    293         $calculator = $context->getSizeCalculator();
    294         $size       = 0;
    295 
    296         if ($this->attribute !== null) {
    297             $innerSize = $this->attribute->serializedSize($context);
    298 
    299             $size += 1;
    300             $size += $innerSize;
    301             $size += $calculator->computeVarintSize($innerSize);
    302         }
    303 
    304         if ($this->attribute_id !== null) {
    305             $size += 1;
    306             $size += $calculator->computeByteStreamSize($this->attribute_id);
    307         }
    308 
    309         if ($this->extensions !== null) {
    310             $size += $this->extensions->serializedSize($context);
    311         }
    312 
    313         return $size;
    314     }
    315 
    316     /**
    317      * {@inheritdoc}
    318      */
    319     public function clear()
    320     {
    321         $this->attribute = null;
    322         $this->attribute_id = null;
    323     }
    324 
    325     /**
    326      * {@inheritdoc}
    327      */
    328     public function merge(\Protobuf\Message $message)
    329     {
    330         if ( ! $message instanceof \attrpubapi_v1\AttributeAndId) {
    331             throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message)));
    332         }
    333 
    334         $this->attribute = ($message->attribute !== null) ? $message->attribute : $this->attribute;
    335         $this->attribute_id = ($message->attribute_id !== null) ? $message->attribute_id : $this->attribute_id;
    336     }
    337 
    33874
    33975}
  • yoti/trunk/sdk/attrpubapi_v1/AttributeAndIdList.php

    r1707648 r1920337  
    11<?php
    2 /**
    3  * Generated by Protobuf protoc plugin.
    4  *
    5  * File descriptor : List.proto
    6  */
     2# Generated by the protocol buffer compiler.  DO NOT EDIT!
     3# source: List.proto
    74
     5namespace Attrpubapi_v1;
    86
    9 namespace attrpubapi_v1;
     7use Google\Protobuf\Internal\GPBUtil;
    108
    119/**
    12  * Protobuf message : attrpubapi_v1.AttributeAndIdList
     10 * Generated from protobuf message <code>attrpubapi_v1.AttributeAndIdList</code>
    1311 */
    14 class AttributeAndIdList extends \Protobuf\AbstractMessage
     12class AttributeAndIdList extends \Google\Protobuf\Internal\Message
    1513{
     14    /**
     15     * Generated from protobuf field <code>repeated .attrpubapi_v1.AttributeAndId attribute_and_id_list = 1;</code>
     16     */
     17    private $attribute_and_id_list;
    1618
    17     /**
    18      * @var \Protobuf\UnknownFieldSet
    19      */
    20     protected $unknownFieldSet = null;
    21 
    22     /**
    23      * @var \Protobuf\Extension\ExtensionFieldMap
    24      */
    25     protected $extensions = null;
    26 
    27     /**
    28      * attribute_and_id_list repeated message = 1
    29      *
    30      * @var \Protobuf\Collection<\attrpubapi_v1\AttributeAndId>
    31      */
    32     protected $attribute_and_id_list = null;
    33 
    34     /**
    35      * Check if 'attribute_and_id_list' has a value
    36      *
    37      * @return bool
    38      */
    39     public function hasAttributeAndIdListList()
    40     {
    41         return $this->attribute_and_id_list !== null;
     19    public function __construct() {
     20        \GPBMetadata\ProtoList::initOnce();
     21        parent::__construct();
    4222    }
    4323
    4424    /**
    45      * Get 'attribute_and_id_list' value
    46      *
    47      * @return \Protobuf\Collection<\attrpubapi_v1\AttributeAndId>
     25     * Generated from protobuf field <code>repeated .attrpubapi_v1.AttributeAndId attribute_and_id_list = 1;</code>
     26     * @return \Google\Protobuf\Internal\RepeatedField
    4827     */
    49     public function getAttributeAndIdListList()
     28    public function getAttributeAndIdList()
    5029    {
    5130        return $this->attribute_and_id_list;
     
    5332
    5433    /**
    55      * Set 'attribute_and_id_list' value
    56      *
    57      * @param \Protobuf\Collection<\attrpubapi_v1\AttributeAndId> $value
     34     * Generated from protobuf field <code>repeated .attrpubapi_v1.AttributeAndId attribute_and_id_list = 1;</code>
     35     * @param \Attrpubapi_v1\AttributeAndId[]|\Google\Protobuf\Internal\RepeatedField $var
     36     * @return $this
    5837     */
    59     public function setAttributeAndIdListList(\Protobuf\Collection $value = null)
     38    public function setAttributeAndIdList($var)
    6039    {
    61         $this->attribute_and_id_list = $value;
     40        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Attrpubapi_v1\AttributeAndId::class);
     41        $this->attribute_and_id_list = $arr;
     42
     43        return $this;
    6244    }
    63 
    64     /**
    65      * Add a new element to 'attribute_and_id_list'
    66      *
    67      * @param \attrpubapi_v1\AttributeAndId $value
    68      */
    69     public function addAttributeAndIdList(\attrpubapi_v1\AttributeAndId $value)
    70     {
    71         if ($this->attribute_and_id_list === null) {
    72             $this->attribute_and_id_list = new \Protobuf\MessageCollection();
    73         }
    74 
    75         $this->attribute_and_id_list->add($value);
    76     }
    77 
    78     /**
    79      * {@inheritdoc}
    80      */
    81     public function extensions()
    82     {
    83         if ( $this->extensions !== null) {
    84             return $this->extensions;
    85         }
    86 
    87         return $this->extensions = new \Protobuf\Extension\ExtensionFieldMap(__CLASS__);
    88     }
    89 
    90     /**
    91      * {@inheritdoc}
    92      */
    93     public function unknownFieldSet()
    94     {
    95         return $this->unknownFieldSet;
    96     }
    97 
    98     /**
    99      * {@inheritdoc}
    100      */
    101     public static function fromStream($stream, \Protobuf\Configuration $configuration = null)
    102     {
    103         return new self($stream, $configuration);
    104     }
    105 
    106     /**
    107      * {@inheritdoc}
    108      */
    109     public static function fromArray(array $values)
    110     {
    111         $message = new self();
    112         $values  = array_merge([
    113             'attribute_and_id_list' => []
    114         ], $values);
    115 
    116         foreach ($values['attribute_and_id_list'] as $item) {
    117             $message->addAttributeAndIdList($item);
    118         }
    119 
    120         return $message;
    121     }
    122 
    123     /**
    124      * {@inheritdoc}
    125      */
    126     public static function descriptor()
    127     {
    128         return \google\protobuf\DescriptorProto::fromArray([
    129             'name'      => 'AttributeAndIdList',
    130             'field'     => [
    131                 \google\protobuf\FieldDescriptorProto::fromArray([
    132                     'number' => 1,
    133                     'name' => 'attribute_and_id_list',
    134                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(),
    135                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(),
    136                     'type_name' => '.attrpubapi_v1.AttributeAndId'
    137                 ]),
    138             ],
    139         ]);
    140     }
    141 
    142     /**
    143      * {@inheritdoc}
    144      */
    145     public function toStream(\Protobuf\Configuration $configuration = null)
    146     {
    147         $config  = $configuration ?: \Protobuf\Configuration::getInstance();
    148         $context = $config->createWriteContext();
    149         $stream  = $context->getStream();
    150 
    151         $this->writeTo($context);
    152         $stream->seek(0);
    153 
    154         return $stream;
    155     }
    156 
    157     /**
    158      * {@inheritdoc}
    159      */
    160     public function writeTo(\Protobuf\WriteContext $context)
    161     {
    162         $stream      = $context->getStream();
    163         $writer      = $context->getWriter();
    164         $sizeContext = $context->getComputeSizeContext();
    165 
    166         if ($this->attribute_and_id_list !== null) {
    167             foreach ($this->attribute_and_id_list as $val) {
    168                 $writer->writeVarint($stream, 10);
    169                 $writer->writeVarint($stream, $val->serializedSize($sizeContext));
    170                 $val->writeTo($context);
    171             }
    172         }
    173 
    174         if ($this->extensions !== null) {
    175             $this->extensions->writeTo($context);
    176         }
    177 
    178         return $stream;
    179     }
    180 
    181     /**
    182      * {@inheritdoc}
    183      */
    184     public function readFrom(\Protobuf\ReadContext $context)
    185     {
    186         $reader = $context->getReader();
    187         $length = $context->getLength();
    188         $stream = $context->getStream();
    189 
    190         $limit = ($length !== null)
    191             ? ($stream->tell() + $length)
    192             : null;
    193 
    194         while ($limit === null || $stream->tell() < $limit) {
    195 
    196             if ($stream->eof()) {
    197                 break;
    198             }
    199 
    200             $key  = $reader->readVarint($stream);
    201             $wire = \Protobuf\WireFormat::getTagWireType($key);
    202             $tag  = \Protobuf\WireFormat::getTagFieldNumber($key);
    203 
    204             if ($stream->eof()) {
    205                 break;
    206             }
    207 
    208             if ($tag === 1) {
    209                 \Protobuf\WireFormat::assertWireType($wire, 11);
    210 
    211                 $innerSize    = $reader->readVarint($stream);
    212                 $innerMessage = new \attrpubapi_v1\AttributeAndId();
    213 
    214                 if ($this->attribute_and_id_list === null) {
    215                     $this->attribute_and_id_list = new \Protobuf\MessageCollection();
    216                 }
    217 
    218                 $this->attribute_and_id_list->add($innerMessage);
    219 
    220                 $context->setLength($innerSize);
    221                 $innerMessage->readFrom($context);
    222                 $context->setLength($length);
    223 
    224                 continue;
    225             }
    226 
    227             $extensions = $context->getExtensionRegistry();
    228             $extension  = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
    229 
    230             if ($extension !== null) {
    231                 $this->extensions()->add($extension, $extension->readFrom($context, $wire));
    232 
    233                 continue;
    234             }
    235 
    236             if ($this->unknownFieldSet === null) {
    237                 $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
    238             }
    239 
    240             $data    = $reader->readUnknown($stream, $wire);
    241             $unknown = new \Protobuf\Unknown($tag, $wire, $data);
    242 
    243             $this->unknownFieldSet->add($unknown);
    244 
    245         }
    246     }
    247 
    248     /**
    249      * {@inheritdoc}
    250      */
    251     public function serializedSize(\Protobuf\ComputeSizeContext $context)
    252     {
    253         $calculator = $context->getSizeCalculator();
    254         $size       = 0;
    255 
    256         if ($this->attribute_and_id_list !== null) {
    257             foreach ($this->attribute_and_id_list as $val) {
    258                 $innerSize = $val->serializedSize($context);
    259 
    260                 $size += 1;
    261                 $size += $innerSize;
    262                 $size += $calculator->computeVarintSize($innerSize);
    263             }
    264         }
    265 
    266         if ($this->extensions !== null) {
    267             $size += $this->extensions->serializedSize($context);
    268         }
    269 
    270         return $size;
    271     }
    272 
    273     /**
    274      * {@inheritdoc}
    275      */
    276     public function clear()
    277     {
    278         $this->attribute_and_id_list = null;
    279     }
    280 
    281     /**
    282      * {@inheritdoc}
    283      */
    284     public function merge(\Protobuf\Message $message)
    285     {
    286         if ( ! $message instanceof \attrpubapi_v1\AttributeAndIdList) {
    287             throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message)));
    288         }
    289 
    290         $this->attribute_and_id_list = ($message->attribute_and_id_list !== null) ? $message->attribute_and_id_list : $this->attribute_and_id_list;
    291     }
    292 
    29345
    29446}
  • yoti/trunk/sdk/attrpubapi_v1/AttributeList.php

    r1707648 r1920337  
    11<?php
    2 /**
    3  * Generated by Protobuf protoc plugin.
    4  *
    5  * File descriptor : List.proto
    6  */
     2# Generated by the protocol buffer compiler.  DO NOT EDIT!
     3# source: List.proto
    74
     5namespace Attrpubapi_v1;
    86
    9 namespace attrpubapi_v1;
     7use Google\Protobuf\Internal\GPBUtil;
    108
    119/**
    12  * Protobuf message : attrpubapi_v1.AttributeList
     10 * Generated from protobuf message <code>attrpubapi_v1.AttributeList</code>
    1311 */
    14 class AttributeList extends \Protobuf\AbstractMessage
     12class AttributeList extends \Google\Protobuf\Internal\Message
    1513{
     14    /**
     15     * Generated from protobuf field <code>repeated .attrpubapi_v1.Attribute attributes = 1;</code>
     16     */
     17    private $attributes;
    1618
    17     /**
    18      * @var \Protobuf\UnknownFieldSet
    19      */
    20     protected $unknownFieldSet = null;
    21 
    22     /**
    23      * @var \Protobuf\Extension\ExtensionFieldMap
    24      */
    25     protected $extensions = null;
    26 
    27     /**
    28      * attributes repeated message = 1
    29      *
    30      * @var \Protobuf\Collection<\attrpubapi_v1\Attribute>
    31      */
    32     protected $attributes = null;
    33 
    34     /**
    35      * Check if 'attributes' has a value
    36      *
    37      * @return bool
    38      */
    39     public function hasAttributesList()
    40     {
    41         return $this->attributes !== null;
     19    public function __construct() {
     20        \GPBMetadata\ProtoList::initOnce();
     21        parent::__construct();
    4222    }
    4323
    4424    /**
    45      * Get 'attributes' value
    46      *
    47      * @return \Protobuf\Collection<\attrpubapi_v1\Attribute>
     25     * Generated from protobuf field <code>repeated .attrpubapi_v1.Attribute attributes = 1;</code>
     26     * @return \Google\Protobuf\Internal\RepeatedField
    4827     */
    49     public function getAttributesList()
     28    public function getAttributes()
    5029    {
    5130        return $this->attributes;
     
    5332
    5433    /**
    55      * Set 'attributes' value
    56      *
    57      * @param \Protobuf\Collection<\attrpubapi_v1\Attribute> $value
     34     * Generated from protobuf field <code>repeated .attrpubapi_v1.Attribute attributes = 1;</code>
     35     * @param \Attrpubapi_v1\Attribute[]|\Google\Protobuf\Internal\RepeatedField $var
     36     * @return $this
    5837     */
    59     public function setAttributesList(\Protobuf\Collection $value = null)
     38    public function setAttributes($var)
    6039    {
    61         $this->attributes = $value;
     40        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Attrpubapi_v1\Attribute::class);
     41        $this->attributes = $arr;
     42
     43        return $this;
    6244    }
    63 
    64     /**
    65      * Add a new element to 'attributes'
    66      *
    67      * @param \attrpubapi_v1\Attribute $value
    68      */
    69     public function addAttributes(\attrpubapi_v1\Attribute $value)
    70     {
    71         if ($this->attributes === null) {
    72             $this->attributes = new \Protobuf\MessageCollection();
    73         }
    74 
    75         $this->attributes->add($value);
    76     }
    77 
    78     /**
    79      * {@inheritdoc}
    80      */
    81     public function extensions()
    82     {
    83         if ( $this->extensions !== null) {
    84             return $this->extensions;
    85         }
    86 
    87         return $this->extensions = new \Protobuf\Extension\ExtensionFieldMap(__CLASS__);
    88     }
    89 
    90     /**
    91      * {@inheritdoc}
    92      */
    93     public function unknownFieldSet()
    94     {
    95         return $this->unknownFieldSet;
    96     }
    97 
    98     /**
    99      * {@inheritdoc}
    100      */
    101     public static function fromStream($stream, \Protobuf\Configuration $configuration = null)
    102     {
    103         return new self($stream, $configuration);
    104     }
    105 
    106     /**
    107      * {@inheritdoc}
    108      */
    109     public static function fromArray(array $values)
    110     {
    111         $message = new self();
    112         $values  = array_merge([
    113             'attributes' => []
    114         ], $values);
    115 
    116         foreach ($values['attributes'] as $item) {
    117             $message->addAttributes($item);
    118         }
    119 
    120         return $message;
    121     }
    122 
    123     /**
    124      * {@inheritdoc}
    125      */
    126     public static function descriptor()
    127     {
    128         return \google\protobuf\DescriptorProto::fromArray([
    129             'name'      => 'AttributeList',
    130             'field'     => [
    131                 \google\protobuf\FieldDescriptorProto::fromArray([
    132                     'number' => 1,
    133                     'name' => 'attributes',
    134                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_MESSAGE(),
    135                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(),
    136                     'type_name' => '.attrpubapi_v1.Attribute'
    137                 ]),
    138             ],
    139         ]);
    140     }
    141 
    142     /**
    143      * {@inheritdoc}
    144      */
    145     public function toStream(\Protobuf\Configuration $configuration = null)
    146     {
    147         $config  = $configuration ?: \Protobuf\Configuration::getInstance();
    148         $context = $config->createWriteContext();
    149         $stream  = $context->getStream();
    150 
    151         $this->writeTo($context);
    152         $stream->seek(0);
    153 
    154         return $stream;
    155     }
    156 
    157     /**
    158      * {@inheritdoc}
    159      */
    160     public function writeTo(\Protobuf\WriteContext $context)
    161     {
    162         $stream      = $context->getStream();
    163         $writer      = $context->getWriter();
    164         $sizeContext = $context->getComputeSizeContext();
    165 
    166         if ($this->attributes !== null) {
    167             foreach ($this->attributes as $val) {
    168                 $writer->writeVarint($stream, 10);
    169                 $writer->writeVarint($stream, $val->serializedSize($sizeContext));
    170                 $val->writeTo($context);
    171             }
    172         }
    173 
    174         if ($this->extensions !== null) {
    175             $this->extensions->writeTo($context);
    176         }
    177 
    178         return $stream;
    179     }
    180 
    181     /**
    182      * {@inheritdoc}
    183      */
    184     public function readFrom(\Protobuf\ReadContext $context)
    185     {
    186         $reader = $context->getReader();
    187         $length = $context->getLength();
    188         $stream = $context->getStream();
    189 
    190         $limit = ($length !== null)
    191             ? ($stream->tell() + $length)
    192             : null;
    193 
    194         while ($limit === null || $stream->tell() < $limit) {
    195 
    196             if ($stream->eof()) {
    197                 break;
    198             }
    199 
    200             $key  = $reader->readVarint($stream);
    201             $wire = \Protobuf\WireFormat::getTagWireType($key);
    202             $tag  = \Protobuf\WireFormat::getTagFieldNumber($key);
    203 
    204             if ($stream->eof()) {
    205                 break;
    206             }
    207 
    208             if ($tag === 1) {
    209                 \Protobuf\WireFormat::assertWireType($wire, 11);
    210 
    211                 $innerSize    = $reader->readVarint($stream);
    212                 $innerMessage = new \attrpubapi_v1\Attribute();
    213 
    214                 if ($this->attributes === null) {
    215                     $this->attributes = new \Protobuf\MessageCollection();
    216                 }
    217 
    218                 $this->attributes->add($innerMessage);
    219 
    220                 $context->setLength($innerSize);
    221                 $innerMessage->readFrom($context);
    222                 $context->setLength($length);
    223 
    224                 continue;
    225             }
    226 
    227             $extensions = $context->getExtensionRegistry();
    228             $extension  = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
    229 
    230             if ($extension !== null) {
    231                 $this->extensions()->add($extension, $extension->readFrom($context, $wire));
    232 
    233                 continue;
    234             }
    235 
    236             if ($this->unknownFieldSet === null) {
    237                 $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
    238             }
    239 
    240             $data    = $reader->readUnknown($stream, $wire);
    241             $unknown = new \Protobuf\Unknown($tag, $wire, $data);
    242 
    243             $this->unknownFieldSet->add($unknown);
    244 
    245         }
    246     }
    247 
    248     /**
    249      * {@inheritdoc}
    250      */
    251     public function serializedSize(\Protobuf\ComputeSizeContext $context)
    252     {
    253         $calculator = $context->getSizeCalculator();
    254         $size       = 0;
    255 
    256         if ($this->attributes !== null) {
    257             foreach ($this->attributes as $val) {
    258                 $innerSize = $val->serializedSize($context);
    259 
    260                 $size += 1;
    261                 $size += $innerSize;
    262                 $size += $calculator->computeVarintSize($innerSize);
    263             }
    264         }
    265 
    266         if ($this->extensions !== null) {
    267             $size += $this->extensions->serializedSize($context);
    268         }
    269 
    270         return $size;
    271     }
    272 
    273     /**
    274      * {@inheritdoc}
    275      */
    276     public function clear()
    277     {
    278         $this->attributes = null;
    279     }
    280 
    281     /**
    282      * {@inheritdoc}
    283      */
    284     public function merge(\Protobuf\Message $message)
    285     {
    286         if ( ! $message instanceof \attrpubapi_v1\AttributeList) {
    287             throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message)));
    288         }
    289 
    290         $this->attributes = ($message->attributes !== null) ? $message->attributes : $this->attributes;
    291     }
    292 
    29345
    29446}
  • yoti/trunk/sdk/attrpubapi_v1/AttributeSigning.php

    r1707648 r1920337  
    11<?php
    2 /**
    3  * Generated by Protobuf protoc plugin.
    4  *
    5  * File descriptor : Signing.proto
    6  */
     2# Generated by the protocol buffer compiler.  DO NOT EDIT!
     3# source: Signing.proto
    74
     5namespace Attrpubapi_v1;
    86
    9 namespace attrpubapi_v1;
     7use Google\Protobuf\Internal\GPBUtil;
    108
    119/**
    12  * Protobuf message : attrpubapi_v1.AttributeSigning
     10 * Generated from protobuf message <code>attrpubapi_v1.AttributeSigning</code>
    1311 */
    14 class AttributeSigning extends \Protobuf\AbstractMessage
     12class AttributeSigning extends \Google\Protobuf\Internal\Message
    1513{
     14    /**
     15     * Generated from protobuf field <code>string name = 1;</code>
     16     */
     17    private $name = '';
     18    /**
     19     * Generated from protobuf field <code>bytes value = 2;</code>
     20     */
     21    private $value = '';
     22    /**
     23     * Generated from protobuf field <code>.attrpubapi_v1.ContentType content_type = 3;</code>
     24     */
     25    private $content_type = 0;
     26    /**
     27     * Generated from protobuf field <code>bytes artifact_signature = 4;</code>
     28     */
     29    private $artifact_signature = '';
     30    /**
     31     * Generated from protobuf field <code>string sub_type = 5;</code>
     32     */
     33    private $sub_type = '';
     34    /**
     35     * Generated from protobuf field <code>bytes signed_time_stamp = 6;</code>
     36     */
     37    private $signed_time_stamp = '';
    1638
    17     /**
    18      * @var \Protobuf\UnknownFieldSet
    19      */
    20     protected $unknownFieldSet = null;
    21 
    22     /**
    23      * @var \Protobuf\Extension\ExtensionFieldMap
    24      */
    25     protected $extensions = null;
    26 
    27     /**
    28      * name optional string = 1
    29      *
    30      * @var string
    31      */
    32     protected $name = null;
    33 
    34     /**
    35      * value optional bytes = 2
    36      *
    37      * @var \Protobuf\Stream
    38      */
    39     protected $value = null;
    40 
    41     /**
    42      * content_type optional enum = 3
    43      *
    44      * @var \attrpubapi_v1\ContentType
    45      */
    46     protected $content_type = null;
    47 
    48     /**
    49      * artifact_signature optional bytes = 4
    50      *
    51      * @var \Protobuf\Stream
    52      */
    53     protected $artifact_signature = null;
    54 
    55     /**
    56      * sub_type optional string = 5
    57      *
    58      * @var string
    59      */
    60     protected $sub_type = null;
    61 
    62     /**
    63      * signed_time_stamp optional bytes = 6
    64      *
    65      * @var \Protobuf\Stream
    66      */
    67     protected $signed_time_stamp = null;
    68 
    69     /**
    70      * Check if 'name' has a value
    71      *
    72      * @return bool
    73      */
    74     public function hasName()
    75     {
    76         return $this->name !== null;
     39    public function __construct() {
     40        \GPBMetadata\Signing::initOnce();
     41        parent::__construct();
    7742    }
    7843
    7944    /**
    80      * Get 'name' value
    81      *
     45     * Generated from protobuf field <code>string name = 1;</code>
    8246     * @return string
    8347     */
     
    8852
    8953    /**
    90      * Set 'name' value
    91      *
    92      * @param string $value
     54     * Generated from protobuf field <code>string name = 1;</code>
     55     * @param string $var
     56     * @return $this
    9357     */
    94     public function setName($value = null)
     58    public function setName($var)
    9559    {
    96         $this->name = $value;
     60        GPBUtil::checkString($var, True);
     61        $this->name = $var;
     62
     63        return $this;
    9764    }
    9865
    9966    /**
    100      * Check if 'value' has a value
    101      *
    102      * @return bool
    103      */
    104     public function hasValue()
    105     {
    106         return $this->value !== null;
    107     }
    108 
    109     /**
    110      * Get 'value' value
    111      *
    112      * @return \Protobuf\Stream
     67     * Generated from protobuf field <code>bytes value = 2;</code>
     68     * @return string
    11369     */
    11470    public function getValue()
     
    11874
    11975    /**
    120      * Set 'value' value
    121      *
    122      * @param \Protobuf\Stream $value
     76     * Generated from protobuf field <code>bytes value = 2;</code>
     77     * @param string $var
     78     * @return $this
    12379     */
    124     public function setValue($value = null)
     80    public function setValue($var)
    12581    {
    126         if ($value !== null && ! $value instanceof \Protobuf\Stream) {
    127             $value = \Protobuf\Stream::wrap($value);
    128         }
     82        GPBUtil::checkString($var, False);
     83        $this->value = $var;
    12984
    130         $this->value = $value;
     85        return $this;
    13186    }
    13287
    13388    /**
    134      * Check if 'content_type' has a value
    135      *
    136      * @return bool
    137      */
    138     public function hasContentType()
    139     {
    140         return $this->content_type !== null;
    141     }
    142 
    143     /**
    144      * Get 'content_type' value
    145      *
    146      * @return \attrpubapi_v1\ContentType
     89     * Generated from protobuf field <code>.attrpubapi_v1.ContentType content_type = 3;</code>
     90     * @return int
    14791     */
    14892    public function getContentType()
     
    15296
    15397    /**
    154      * Set 'content_type' value
    155      *
    156      * @param \attrpubapi_v1\ContentType $value
     98     * Generated from protobuf field <code>.attrpubapi_v1.ContentType content_type = 3;</code>
     99     * @param int $var
     100     * @return $this
    157101     */
    158     public function setContentType(\attrpubapi_v1\ContentType $value = null)
     102    public function setContentType($var)
    159103    {
    160         $this->content_type = $value;
     104        GPBUtil::checkEnum($var, \Attrpubapi_v1\ContentType::class);
     105        $this->content_type = $var;
     106
     107        return $this;
    161108    }
    162109
    163110    /**
    164      * Check if 'artifact_signature' has a value
    165      *
    166      * @return bool
    167      */
    168     public function hasArtifactSignature()
    169     {
    170         return $this->artifact_signature !== null;
    171     }
    172 
    173     /**
    174      * Get 'artifact_signature' value
    175      *
    176      * @return \Protobuf\Stream
     111     * Generated from protobuf field <code>bytes artifact_signature = 4;</code>
     112     * @return string
    177113     */
    178114    public function getArtifactSignature()
     
    182118
    183119    /**
    184      * Set 'artifact_signature' value
    185      *
    186      * @param \Protobuf\Stream $value
     120     * Generated from protobuf field <code>bytes artifact_signature = 4;</code>
     121     * @param string $var
     122     * @return $this
    187123     */
    188     public function setArtifactSignature($value = null)
     124    public function setArtifactSignature($var)
    189125    {
    190         if ($value !== null && ! $value instanceof \Protobuf\Stream) {
    191             $value = \Protobuf\Stream::wrap($value);
    192         }
     126        GPBUtil::checkString($var, False);
     127        $this->artifact_signature = $var;
    193128
    194         $this->artifact_signature = $value;
     129        return $this;
    195130    }
    196131
    197132    /**
    198      * Check if 'sub_type' has a value
    199      *
    200      * @return bool
    201      */
    202     public function hasSubType()
    203     {
    204         return $this->sub_type !== null;
    205     }
    206 
    207     /**
    208      * Get 'sub_type' value
    209      *
     133     * Generated from protobuf field <code>string sub_type = 5;</code>
    210134     * @return string
    211135     */
     
    216140
    217141    /**
    218      * Set 'sub_type' value
    219      *
    220      * @param string $value
     142     * Generated from protobuf field <code>string sub_type = 5;</code>
     143     * @param string $var
     144     * @return $this
    221145     */
    222     public function setSubType($value = null)
     146    public function setSubType($var)
    223147    {
    224         $this->sub_type = $value;
     148        GPBUtil::checkString($var, True);
     149        $this->sub_type = $var;
     150
     151        return $this;
    225152    }
    226153
    227154    /**
    228      * Check if 'signed_time_stamp' has a value
    229      *
    230      * @return bool
    231      */
    232     public function hasSignedTimeStamp()
    233     {
    234         return $this->signed_time_stamp !== null;
    235     }
    236 
    237     /**
    238      * Get 'signed_time_stamp' value
    239      *
    240      * @return \Protobuf\Stream
     155     * Generated from protobuf field <code>bytes signed_time_stamp = 6;</code>
     156     * @return string
    241157     */
    242158    public function getSignedTimeStamp()
     
    246162
    247163    /**
    248      * Set 'signed_time_stamp' value
    249      *
    250      * @param \Protobuf\Stream $value
     164     * Generated from protobuf field <code>bytes signed_time_stamp = 6;</code>
     165     * @param string $var
     166     * @return $this
    251167     */
    252     public function setSignedTimeStamp($value = null)
     168    public function setSignedTimeStamp($var)
    253169    {
    254         if ($value !== null && ! $value instanceof \Protobuf\Stream) {
    255             $value = \Protobuf\Stream::wrap($value);
    256         }
     170        GPBUtil::checkString($var, False);
     171        $this->signed_time_stamp = $var;
    257172
    258         $this->signed_time_stamp = $value;
     173        return $this;
    259174    }
    260 
    261     /**
    262      * {@inheritdoc}
    263      */
    264     public function extensions()
    265     {
    266         if ( $this->extensions !== null) {
    267             return $this->extensions;
    268         }
    269 
    270         return $this->extensions = new \Protobuf\Extension\ExtensionFieldMap(__CLASS__);
    271     }
    272 
    273     /**
    274      * {@inheritdoc}
    275      */
    276     public function unknownFieldSet()
    277     {
    278         return $this->unknownFieldSet;
    279     }
    280 
    281     /**
    282      * {@inheritdoc}
    283      */
    284     public static function fromStream($stream, \Protobuf\Configuration $configuration = null)
    285     {
    286         return new self($stream, $configuration);
    287     }
    288 
    289     /**
    290      * {@inheritdoc}
    291      */
    292     public static function fromArray(array $values)
    293     {
    294         $message = new self();
    295         $values  = array_merge([
    296             'name' => null,
    297             'value' => null,
    298             'content_type' => null,
    299             'artifact_signature' => null,
    300             'sub_type' => null,
    301             'signed_time_stamp' => null
    302         ], $values);
    303 
    304         $message->setName($values['name']);
    305         $message->setValue($values['value']);
    306         $message->setContentType($values['content_type']);
    307         $message->setArtifactSignature($values['artifact_signature']);
    308         $message->setSubType($values['sub_type']);
    309         $message->setSignedTimeStamp($values['signed_time_stamp']);
    310 
    311         return $message;
    312     }
    313 
    314     /**
    315      * {@inheritdoc}
    316      */
    317     public static function descriptor()
    318     {
    319         return \google\protobuf\DescriptorProto::fromArray([
    320             'name'      => 'AttributeSigning',
    321             'field'     => [
    322                 \google\protobuf\FieldDescriptorProto::fromArray([
    323                     'number' => 1,
    324                     'name' => 'name',
    325                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(),
    326                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    327                 ]),
    328                 \google\protobuf\FieldDescriptorProto::fromArray([
    329                     'number' => 2,
    330                     'name' => 'value',
    331                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    332                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    333                 ]),
    334                 \google\protobuf\FieldDescriptorProto::fromArray([
    335                     'number' => 3,
    336                     'name' => 'content_type',
    337                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_ENUM(),
    338                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL(),
    339                     'type_name' => '.attrpubapi_v1.ContentType'
    340                 ]),
    341                 \google\protobuf\FieldDescriptorProto::fromArray([
    342                     'number' => 4,
    343                     'name' => 'artifact_signature',
    344                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    345                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    346                 ]),
    347                 \google\protobuf\FieldDescriptorProto::fromArray([
    348                     'number' => 5,
    349                     'name' => 'sub_type',
    350                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(),
    351                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    352                 ]),
    353                 \google\protobuf\FieldDescriptorProto::fromArray([
    354                     'number' => 6,
    355                     'name' => 'signed_time_stamp',
    356                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    357                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    358                 ]),
    359             ],
    360         ]);
    361     }
    362 
    363     /**
    364      * {@inheritdoc}
    365      */
    366     public function toStream(\Protobuf\Configuration $configuration = null)
    367     {
    368         $config  = $configuration ?: \Protobuf\Configuration::getInstance();
    369         $context = $config->createWriteContext();
    370         $stream  = $context->getStream();
    371 
    372         $this->writeTo($context);
    373         $stream->seek(0);
    374 
    375         return $stream;
    376     }
    377 
    378     /**
    379      * {@inheritdoc}
    380      */
    381     public function writeTo(\Protobuf\WriteContext $context)
    382     {
    383         $stream      = $context->getStream();
    384         $writer      = $context->getWriter();
    385         $sizeContext = $context->getComputeSizeContext();
    386 
    387         if ($this->name !== null) {
    388             $writer->writeVarint($stream, 10);
    389             $writer->writeString($stream, $this->name);
    390         }
    391 
    392         if ($this->value !== null) {
    393             $writer->writeVarint($stream, 18);
    394             $writer->writeByteStream($stream, $this->value);
    395         }
    396 
    397         if ($this->content_type !== null) {
    398             $writer->writeVarint($stream, 24);
    399             $writer->writeVarint($stream, $this->content_type->value());
    400         }
    401 
    402         if ($this->artifact_signature !== null) {
    403             $writer->writeVarint($stream, 34);
    404             $writer->writeByteStream($stream, $this->artifact_signature);
    405         }
    406 
    407         if ($this->sub_type !== null) {
    408             $writer->writeVarint($stream, 42);
    409             $writer->writeString($stream, $this->sub_type);
    410         }
    411 
    412         if ($this->signed_time_stamp !== null) {
    413             $writer->writeVarint($stream, 50);
    414             $writer->writeByteStream($stream, $this->signed_time_stamp);
    415         }
    416 
    417         if ($this->extensions !== null) {
    418             $this->extensions->writeTo($context);
    419         }
    420 
    421         return $stream;
    422     }
    423 
    424     /**
    425      * {@inheritdoc}
    426      */
    427     public function readFrom(\Protobuf\ReadContext $context)
    428     {
    429         $reader = $context->getReader();
    430         $length = $context->getLength();
    431         $stream = $context->getStream();
    432 
    433         $limit = ($length !== null)
    434             ? ($stream->tell() + $length)
    435             : null;
    436 
    437         while ($limit === null || $stream->tell() < $limit) {
    438 
    439             if ($stream->eof()) {
    440                 break;
    441             }
    442 
    443             $key  = $reader->readVarint($stream);
    444             $wire = \Protobuf\WireFormat::getTagWireType($key);
    445             $tag  = \Protobuf\WireFormat::getTagFieldNumber($key);
    446 
    447             if ($stream->eof()) {
    448                 break;
    449             }
    450 
    451             if ($tag === 1) {
    452                 \Protobuf\WireFormat::assertWireType($wire, 9);
    453 
    454                 $this->name = $reader->readString($stream);
    455 
    456                 continue;
    457             }
    458 
    459             if ($tag === 2) {
    460                 \Protobuf\WireFormat::assertWireType($wire, 12);
    461 
    462                 $this->value = $reader->readByteStream($stream);
    463 
    464                 continue;
    465             }
    466 
    467             if ($tag === 3) {
    468                 \Protobuf\WireFormat::assertWireType($wire, 14);
    469 
    470                 $this->content_type = \attrpubapi_v1\ContentType::valueOf($reader->readVarint($stream));
    471 
    472                 continue;
    473             }
    474 
    475             if ($tag === 4) {
    476                 \Protobuf\WireFormat::assertWireType($wire, 12);
    477 
    478                 $this->artifact_signature = $reader->readByteStream($stream);
    479 
    480                 continue;
    481             }
    482 
    483             if ($tag === 5) {
    484                 \Protobuf\WireFormat::assertWireType($wire, 9);
    485 
    486                 $this->sub_type = $reader->readString($stream);
    487 
    488                 continue;
    489             }
    490 
    491             if ($tag === 6) {
    492                 \Protobuf\WireFormat::assertWireType($wire, 12);
    493 
    494                 $this->signed_time_stamp = $reader->readByteStream($stream);
    495 
    496                 continue;
    497             }
    498 
    499             $extensions = $context->getExtensionRegistry();
    500             $extension  = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
    501 
    502             if ($extension !== null) {
    503                 $this->extensions()->add($extension, $extension->readFrom($context, $wire));
    504 
    505                 continue;
    506             }
    507 
    508             if ($this->unknownFieldSet === null) {
    509                 $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
    510             }
    511 
    512             $data    = $reader->readUnknown($stream, $wire);
    513             $unknown = new \Protobuf\Unknown($tag, $wire, $data);
    514 
    515             $this->unknownFieldSet->add($unknown);
    516 
    517         }
    518     }
    519 
    520     /**
    521      * {@inheritdoc}
    522      */
    523     public function serializedSize(\Protobuf\ComputeSizeContext $context)
    524     {
    525         $calculator = $context->getSizeCalculator();
    526         $size       = 0;
    527 
    528         if ($this->name !== null) {
    529             $size += 1;
    530             $size += $calculator->computeStringSize($this->name);
    531         }
    532 
    533         if ($this->value !== null) {
    534             $size += 1;
    535             $size += $calculator->computeByteStreamSize($this->value);
    536         }
    537 
    538         if ($this->content_type !== null) {
    539             $size += 1;
    540             $size += $calculator->computeVarintSize($this->content_type->value());
    541         }
    542 
    543         if ($this->artifact_signature !== null) {
    544             $size += 1;
    545             $size += $calculator->computeByteStreamSize($this->artifact_signature);
    546         }
    547 
    548         if ($this->sub_type !== null) {
    549             $size += 1;
    550             $size += $calculator->computeStringSize($this->sub_type);
    551         }
    552 
    553         if ($this->signed_time_stamp !== null) {
    554             $size += 1;
    555             $size += $calculator->computeByteStreamSize($this->signed_time_stamp);
    556         }
    557 
    558         if ($this->extensions !== null) {
    559             $size += $this->extensions->serializedSize($context);
    560         }
    561 
    562         return $size;
    563     }
    564 
    565     /**
    566      * {@inheritdoc}
    567      */
    568     public function clear()
    569     {
    570         $this->name = null;
    571         $this->value = null;
    572         $this->content_type = null;
    573         $this->artifact_signature = null;
    574         $this->sub_type = null;
    575         $this->signed_time_stamp = null;
    576     }
    577 
    578     /**
    579      * {@inheritdoc}
    580      */
    581     public function merge(\Protobuf\Message $message)
    582     {
    583         if ( ! $message instanceof \attrpubapi_v1\AttributeSigning) {
    584             throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message)));
    585         }
    586 
    587         $this->name = ($message->name !== null) ? $message->name : $this->name;
    588         $this->value = ($message->value !== null) ? $message->value : $this->value;
    589         $this->content_type = ($message->content_type !== null) ? $message->content_type : $this->content_type;
    590         $this->artifact_signature = ($message->artifact_signature !== null) ? $message->artifact_signature : $this->artifact_signature;
    591         $this->sub_type = ($message->sub_type !== null) ? $message->sub_type : $this->sub_type;
    592         $this->signed_time_stamp = ($message->signed_time_stamp !== null) ? $message->signed_time_stamp : $this->signed_time_stamp;
    593     }
    594 
    595175
    596176}
  • yoti/trunk/sdk/attrpubapi_v1/ContentType.php

    r1707648 r1920337  
    11<?php
    2 /**
    3  * Generated by Protobuf protoc plugin.
    4  *
    5  * File descriptor : Attribute.proto
    6  */
     2# Generated by the protocol buffer compiler.  DO NOT EDIT!
     3# source: Attribute.proto
    74
    8 
    9 namespace attrpubapi_v1;
     5namespace Attrpubapi_v1;
    106
    117/**
    12  * Protobuf enum : attrpubapi_v1.ContentType
     8 * ContentType indicates how to interpret the ‘Value’ field of an Attribute.
     9 *
     10 * Protobuf enum <code>Attrpubapi_v1\ContentType</code>
    1311 */
    14 class ContentType extends \Protobuf\Enum
     12class ContentType
    1513{
    16 
    1714    /**
    18      * UNDEFINED = 0
     15     * UNDEFINED should not be seen, and is used as an error placeholder
     16     * value.
     17     *
     18     * Generated from protobuf enum <code>UNDEFINED = 0;</code>
    1919     */
    20     const UNDEFINED_VALUE = 0;
    21 
     20    const UNDEFINED = 0;
    2221    /**
    23      * STRING = 1
     22     * STRING means the value is UTF-8 encoded text.
     23     *
     24     * Generated from protobuf enum <code>STRING = 1;</code>
    2425     */
    25     const STRING_VALUE = 1;
    26 
     26    const STRING = 1;
    2727    /**
    28      * JPEG = 2
     28     * JPEG indicates a standard .jpeg image.
     29     *
     30     * Generated from protobuf enum <code>JPEG = 2;</code>
    2931     */
    30     const JPEG_VALUE = 2;
    31 
     32    const JPEG = 2;
    3233    /**
    33      * DATE = 3
     34     * Date as string in RFC3339 format (YYYY-MM-DD).
     35     *
     36     * Generated from protobuf enum <code>DATE = 3;</code>
    3437     */
    35     const DATE_VALUE = 3;
    36 
     38    const DATE = 3;
    3739    /**
    38      * PNG = 4
     40     * PNG indicates a standard .png image.
     41     *
     42     * Generated from protobuf enum <code>PNG = 4;</code>
    3943     */
    40     const PNG_VALUE = 4;
    41 
    42     /**
    43      * @var \attrpubapi_v1\ContentType
    44      */
    45     protected static $UNDEFINED = null;
    46 
    47     /**
    48      * @var \attrpubapi_v1\ContentType
    49      */
    50     protected static $STRING = null;
    51 
    52     /**
    53      * @var \attrpubapi_v1\ContentType
    54      */
    55     protected static $JPEG = null;
    56 
    57     /**
    58      * @var \attrpubapi_v1\ContentType
    59      */
    60     protected static $DATE = null;
    61 
    62     /**
    63      * @var \attrpubapi_v1\ContentType
    64      */
    65     protected static $PNG = null;
    66 
    67     /**
    68      * @return \attrpubapi_v1\ContentType
    69      */
    70     public static function UNDEFINED()
    71     {
    72         if (self::$UNDEFINED !== null) {
    73             return self::$UNDEFINED;
    74         }
    75 
    76         return self::$UNDEFINED = new self('UNDEFINED', self::UNDEFINED_VALUE);
    77     }
    78 
    79     /**
    80      * @return \attrpubapi_v1\ContentType
    81      */
    82     public static function STRING()
    83     {
    84         if (self::$STRING !== null) {
    85             return self::$STRING;
    86         }
    87 
    88         return self::$STRING = new self('STRING', self::STRING_VALUE);
    89     }
    90 
    91     /**
    92      * @return \attrpubapi_v1\ContentType
    93      */
    94     public static function JPEG()
    95     {
    96         if (self::$JPEG !== null) {
    97             return self::$JPEG;
    98         }
    99 
    100         return self::$JPEG = new self('JPEG', self::JPEG_VALUE);
    101     }
    102 
    103     /**
    104      * @return \attrpubapi_v1\ContentType
    105      */
    106     public static function DATE()
    107     {
    108         if (self::$DATE !== null) {
    109             return self::$DATE;
    110         }
    111 
    112         return self::$DATE = new self('DATE', self::DATE_VALUE);
    113     }
    114 
    115     /**
    116      * @return \attrpubapi_v1\ContentType
    117      */
    118     public static function PNG()
    119     {
    120         if (self::$PNG !== null) {
    121             return self::$PNG;
    122         }
    123 
    124         return self::$PNG = new self('PNG', self::PNG_VALUE);
    125     }
    126 
    127     /**
    128      * @param int $value
    129      * @return \attrpubapi_v1\ContentType
    130      */
    131     public static function valueOf($value)
    132     {
    133         switch ($value) {
    134             case 0: return self::UNDEFINED();
    135             case 1: return self::STRING();
    136             case 2: return self::JPEG();
    137             case 3: return self::DATE();
    138             case 4: return self::PNG();
    139             default: return null;
    140         }
    141     }
    142 
    143 
     44    const PNG = 4;
    14445}
    14546
  • yoti/trunk/sdk/boot.php

    r1840797 r1920337  
    55 */
    66
    7 require_once __DIR__ . '/protobuf-php/protobuf/src/Message.php';
    8 require_once __DIR__ . '/protobuf-php/protobuf/src/AbstractMessage.php';
    9 require_once __DIR__ . '/protobuf-php/protobuf/src/Unknown.php';
    10 require_once __DIR__ . '/protobuf-php/protobuf/src/Enum.php';
    11 require_once __DIR__ . '/protobuf-php/protobuf/src/Configuration.php';
    12 require_once __DIR__ . '/protobuf-php/protobuf/src/Binary/StreamReader.php';
    13 require_once __DIR__ . '/protobuf-php/protobuf/src/Binary/Platform/BigEndian.php';
    14 require_once __DIR__ . '/protobuf-php/protobuf/src/ReadContext.php';
    15 require_once __DIR__ . '/protobuf-php/protobuf/src/Stream.php';
    16 require_once __DIR__ . '/protobuf-php/protobuf/src/WireFormat.php';
    17 require_once __DIR__ . '/protobuf-php/protobuf/src/Field.php';
    18 require_once __DIR__ . '/protobuf-php/protobuf/src/Collection.php';
    19 require_once __DIR__ . '/protobuf-php/protobuf/src/MessageCollection.php';
    20 require_once __DIR__ . '/protobuf-php/protobuf/src/StreamCollection.php';
    21 require_once __DIR__ . '/protobuf-php/protobuf/src/UnknownFieldSet.php';
     7// PHP Secure files
     8require_once __DIR__ . '/phpseclib/bootstrap.php';
    229
    23 require_once __DIR__ . '/attrpubapi_v1/Anchor.php';
    24 require_once __DIR__ . '/attrpubapi_v1/Attribute.php';
    25 require_once __DIR__ . '/attrpubapi_v1/AttributeList.php';
    26 require_once __DIR__ . '/attrpubapi_v1/ContentType.php';
    27 require_once __DIR__ . '/compubapi_v1/EncryptedData.php';
     10// Autoload Yoti classes and other dependencies
     11spl_autoload_register(function($className) {
     12    if (strpos($className, 'Google\Protobuf') !== false || strpos($className, 'GPBMetadata') !== false) {
    2813
    29 // Autoload Yoti classes
    30 spl_autoload_register(function($className) {
     14        $className = 'protobuflib\\' .  $className;
     15    }
    3116    $file = __DIR__ . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $className).'.php';
    3217    if (file_exists($file)) {
  • yoti/trunk/sdk/compubapi_v1/EncryptedData.php

    r1707648 r1920337  
    11<?php
    2 /**
    3  * Generated by Protobuf protoc plugin.
    4  *
    5  * File descriptor : EncryptedData.proto
    6  */
     2# Generated by the protocol buffer compiler.  DO NOT EDIT!
     3# source: EncryptedData.proto
    74
     5namespace Compubapi_v1;
    86
    9 namespace compubapi_v1;
     7use Google\Protobuf\Internal\GPBUtil;
    108
    119/**
    12  * Protobuf message : compubapi_v1.EncryptedData
     10 * Generated from protobuf message <code>compubapi_v1.EncryptedData</code>
    1311 */
    14 class EncryptedData extends \Protobuf\AbstractMessage
     12class EncryptedData extends \Google\Protobuf\Internal\Message
    1513{
     14    /**
     15     * the iv will be used in conjunction with the secret key
     16     * received via other channel in order to decrypt the cipher_text
     17     *
     18     * Generated from protobuf field <code>bytes iv = 1;</code>
     19     */
     20    private $iv = '';
     21    /**
     22     * block of bytes to be decrypted
     23     *
     24     * Generated from protobuf field <code>bytes cipher_text = 2;</code>
     25     */
     26    private $cipher_text = '';
    1627
    17     /**
    18      * @var \Protobuf\UnknownFieldSet
    19      */
    20     protected $unknownFieldSet = null;
    21 
    22     /**
    23      * @var \Protobuf\Extension\ExtensionFieldMap
    24      */
    25     protected $extensions = null;
    26 
    27     /**
    28      * iv optional bytes = 1
    29      *
    30      * @var \Protobuf\Stream
    31      */
    32     protected $iv = null;
    33 
    34     /**
    35      * cipher_text optional bytes = 2
    36      *
    37      * @var \Protobuf\Stream
    38      */
    39     protected $cipher_text = null;
    40 
    41     /**
    42      * Check if 'iv' has a value
    43      *
    44      * @return bool
    45      */
    46     public function hasIv()
    47     {
    48         return $this->iv !== null;
     28    public function __construct() {
     29        \GPBMetadata\EncryptedData::initOnce();
     30        parent::__construct();
    4931    }
    5032
    5133    /**
    52      * Get 'iv' value
     34     * the iv will be used in conjunction with the secret key
     35     * received via other channel in order to decrypt the cipher_text
    5336     *
    54      * @return \Protobuf\Stream
     37     * Generated from protobuf field <code>bytes iv = 1;</code>
     38     * @return string
    5539     */
    5640    public function getIv()
     
    6044
    6145    /**
    62      * Set 'iv' value
     46     * the iv will be used in conjunction with the secret key
     47     * received via other channel in order to decrypt the cipher_text
    6348     *
    64      * @param \Protobuf\Stream $value
     49     * Generated from protobuf field <code>bytes iv = 1;</code>
     50     * @param string $var
     51     * @return $this
    6552     */
    66     public function setIv($value = null)
     53    public function setIv($var)
    6754    {
    68         if ($value !== null && ! $value instanceof \Protobuf\Stream) {
    69             $value = \Protobuf\Stream::wrap($value);
    70         }
     55        GPBUtil::checkString($var, False);
     56        $this->iv = $var;
    7157
    72         $this->iv = $value;
     58        return $this;
    7359    }
    7460
    7561    /**
    76      * Check if 'cipher_text' has a value
     62     * block of bytes to be decrypted
    7763     *
    78      * @return bool
    79      */
    80     public function hasCipherText()
    81     {
    82         return $this->cipher_text !== null;
    83     }
    84 
    85     /**
    86      * Get 'cipher_text' value
    87      *
    88      * @return \Protobuf\Stream
     64     * Generated from protobuf field <code>bytes cipher_text = 2;</code>
     65     * @return string
    8966     */
    9067    public function getCipherText()
     
    9471
    9572    /**
    96      * Set 'cipher_text' value
     73     * block of bytes to be decrypted
    9774     *
    98      * @param \Protobuf\Stream $value
     75     * Generated from protobuf field <code>bytes cipher_text = 2;</code>
     76     * @param string $var
     77     * @return $this
    9978     */
    100     public function setCipherText($value = null)
     79    public function setCipherText($var)
    10180    {
    102         if ($value !== null && ! $value instanceof \Protobuf\Stream) {
    103             $value = \Protobuf\Stream::wrap($value);
    104         }
     81        GPBUtil::checkString($var, False);
     82        $this->cipher_text = $var;
    10583
    106         $this->cipher_text = $value;
     84        return $this;
    10785    }
    108 
    109     /**
    110      * {@inheritdoc}
    111      */
    112     public function extensions()
    113     {
    114         if ( $this->extensions !== null) {
    115             return $this->extensions;
    116         }
    117 
    118         return $this->extensions = new \Protobuf\Extension\ExtensionFieldMap(__CLASS__);
    119     }
    120 
    121     /**
    122      * {@inheritdoc}
    123      */
    124     public function unknownFieldSet()
    125     {
    126         return $this->unknownFieldSet;
    127     }
    128 
    129     /**
    130      * {@inheritdoc}
    131      */
    132     public static function fromStream($stream, \Protobuf\Configuration $configuration = null)
    133     {
    134         return new self($stream, $configuration);
    135     }
    136 
    137     /**
    138      * {@inheritdoc}
    139      */
    140     public static function fromArray(array $values)
    141     {
    142         $message = new self();
    143         $values  = array_merge([
    144             'iv' => null,
    145             'cipher_text' => null
    146         ], $values);
    147 
    148         $message->setIv($values['iv']);
    149         $message->setCipherText($values['cipher_text']);
    150 
    151         return $message;
    152     }
    153 
    154     /**
    155      * {@inheritdoc}
    156      */
    157     public static function descriptor()
    158     {
    159         return \google\protobuf\DescriptorProto::fromArray([
    160             'name'      => 'EncryptedData',
    161             'field'     => [
    162                 \google\protobuf\FieldDescriptorProto::fromArray([
    163                     'number' => 1,
    164                     'name' => 'iv',
    165                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    166                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    167                 ]),
    168                 \google\protobuf\FieldDescriptorProto::fromArray([
    169                     'number' => 2,
    170                     'name' => 'cipher_text',
    171                     'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BYTES(),
    172                     'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
    173                 ]),
    174             ],
    175         ]);
    176     }
    177 
    178     /**
    179      * {@inheritdoc}
    180      */
    181     public function toStream(\Protobuf\Configuration $configuration = null)
    182     {
    183         $config  = $configuration ?: \Protobuf\Configuration::getInstance();
    184         $context = $config->createWriteContext();
    185         $stream  = $context->getStream();
    186 
    187         $this->writeTo($context);
    188         $stream->seek(0);
    189 
    190         return $stream;
    191     }
    192 
    193     /**
    194      * {@inheritdoc}
    195      */
    196     public function writeTo(\Protobuf\WriteContext $context)
    197     {
    198         $stream      = $context->getStream();
    199         $writer      = $context->getWriter();
    200         $sizeContext = $context->getComputeSizeContext();
    201 
    202         if ($this->iv !== null) {
    203             $writer->writeVarint($stream, 10);
    204             $writer->writeByteStream($stream, $this->iv);
    205         }
    206 
    207         if ($this->cipher_text !== null) {
    208             $writer->writeVarint($stream, 18);
    209             $writer->writeByteStream($stream, $this->cipher_text);
    210         }
    211 
    212         if ($this->extensions !== null) {
    213             $this->extensions->writeTo($context);
    214         }
    215 
    216         return $stream;
    217     }
    218 
    219     /**
    220      * {@inheritdoc}
    221      */
    222     public function readFrom(\Protobuf\ReadContext $context)
    223     {
    224         $reader = $context->getReader();
    225         $length = $context->getLength();
    226         $stream = $context->getStream();
    227 
    228         $limit = ($length !== null)
    229             ? ($stream->tell() + $length)
    230             : null;
    231 
    232         while ($limit === null || $stream->tell() < $limit) {
    233 
    234             if ($stream->eof()) {
    235                 break;
    236             }
    237 
    238             $key  = $reader->readVarint($stream);
    239             $wire = \Protobuf\WireFormat::getTagWireType($key);
    240             $tag  = \Protobuf\WireFormat::getTagFieldNumber($key);
    241 
    242             if ($stream->eof()) {
    243                 break;
    244             }
    245 
    246             if ($tag === 1) {
    247                 \Protobuf\WireFormat::assertWireType($wire, 12);
    248 
    249                 $this->iv = $reader->readByteStream($stream);
    250 
    251                 continue;
    252             }
    253 
    254             if ($tag === 2) {
    255                 \Protobuf\WireFormat::assertWireType($wire, 12);
    256 
    257                 $this->cipher_text = $reader->readByteStream($stream);
    258 
    259                 continue;
    260             }
    261 
    262             $extensions = $context->getExtensionRegistry();
    263             $extension  = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;
    264 
    265             if ($extension !== null) {
    266                 $this->extensions()->add($extension, $extension->readFrom($context, $wire));
    267 
    268                 continue;
    269             }
    270 
    271             if ($this->unknownFieldSet === null) {
    272                 $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
    273             }
    274 
    275             $data    = $reader->readUnknown($stream, $wire);
    276             $unknown = new \Protobuf\Unknown($tag, $wire, $data);
    277 
    278             $this->unknownFieldSet->add($unknown);
    279 
    280         }
    281     }
    282 
    283     /**
    284      * {@inheritdoc}
    285      */
    286     public function serializedSize(\Protobuf\ComputeSizeContext $context)
    287     {
    288         $calculator = $context->getSizeCalculator();
    289         $size       = 0;
    290 
    291         if ($this->iv !== null) {
    292             $size += 1;
    293             $size += $calculator->computeByteStreamSize($this->iv);
    294         }
    295 
    296         if ($this->cipher_text !== null) {
    297             $size += 1;
    298             $size += $calculator->computeByteStreamSize($this->cipher_text);
    299         }
    300 
    301         if ($this->extensions !== null) {
    302             $size += $this->extensions->serializedSize($context);
    303         }
    304 
    305         return $size;
    306     }
    307 
    308     /**
    309      * {@inheritdoc}
    310      */
    311     public function clear()
    312     {
    313         $this->iv = null;
    314         $this->cipher_text = null;
    315     }
    316 
    317     /**
    318      * {@inheritdoc}
    319      */
    320     public function merge(\Protobuf\Message $message)
    321     {
    322         if ( ! $message instanceof \compubapi_v1\EncryptedData) {
    323             throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message)));
    324         }
    325 
    326         $this->iv = ($message->iv !== null) ? $message->iv : $this->iv;
    327         $this->cipher_text = ($message->cipher_text !== null) ? $message->cipher_text : $this->cipher_text;
    328     }
    329 
    33086
    33187}
  • yoti/trunk/sdk/proto/Attribute.proto

    r1707648 r1920337  
    1 //syntax = "proto2";
     1syntax = "proto3";
    22
    33package attrpubapi_v1;
     
    2828
    2929message Attribute {
    30     optional string name = 1;
     30    string name = 1;
    3131
    32     optional bytes value = 2;
     32    bytes value = 2;
    3333
    34     optional ContentType content_type = 3;
     34    ContentType content_type = 3;
    3535
    3636    repeated Anchor anchors = 4;
     
    3939
    4040message Anchor {
    41     optional bytes artifact_link = 1;
     41    bytes artifact_link = 1;
    4242
    4343    repeated bytes origin_server_certs = 2;
    4444
    45     optional bytes artifact_signature = 3;
     45    bytes artifact_signature = 3;
    4646
    47     optional string sub_type = 4;
     47    string sub_type = 4;
    4848
    49     optional bytes signature = 5;
     49    bytes signature = 5;
    5050
    51     optional bytes signed_time_stamp = 6;
     51    bytes signed_time_stamp = 6;
    5252}
  • yoti/trunk/sdk/proto/EncryptedData.proto

    r1707648 r1920337  
    1 // syntax = "proto2";
     1syntax = "proto3";
    22
    33package compubapi_v1;
     
    99    // the iv will be used in conjunction with the secret key
    1010    // received via other channel in order to decrypt the cipher_text
    11     optional bytes iv = 1;
     11    bytes iv = 1;
    1212
    1313    // block of bytes to be decrypted
    14     optional bytes cipher_text = 2;
     14    bytes cipher_text = 2;
    1515}
  • yoti/trunk/sdk/proto/List.proto

    r1707648 r1920337  
    1 //syntax = "proto2";
     1syntax = "proto3";
    22
    33package attrpubapi_v1;
     
    1212// alongside its ID.
    1313message AttributeAndId {
    14     optional Attribute attribute = 1;
     14    Attribute attribute = 1;
    1515
    16     optional bytes attribute_id = 2;
     16    bytes attribute_id = 2;
    1717}
    1818
  • yoti/trunk/sdk/proto/Signing.proto

    r1707648 r1920337  
    1 //syntax = "proto2";
     1syntax = "proto3";
    22
    33package attrpubapi_v1;
     
    1010
    1111message AttributeSigning {
    12     optional string name = 1;
     12    string name = 1;
    1313
    14     optional bytes value = 2;
     14    bytes value = 2;
    1515
    16     optional ContentType content_type = 3;
     16    ContentType content_type = 3;
    1717
    18     optional bytes artifact_signature = 4;
     18    bytes artifact_signature = 4;
    1919
    20     optional string sub_type = 5;
     20    string sub_type = 5;
    2121
    22     optional bytes signed_time_stamp = 6;
     22    bytes signed_time_stamp = 6;
    2323}
  • yoti/trunk/views/admin-options.php

    r1840797 r1920337  
    1515    <h1>Yoti Settings</h1>
    1616    <p>You need to first create a Yoti App at <?php echo $dashboardLink ?>.</p>
    17     <p>Note: On the Yoti Dashboard the callback URL should be set to: <code><?php echo site_url('wp-login.php?yoti-select=1&action=link', 'https'); ?></code></p>
     17    <p>Note: On the Yoti Dashboard the application domain should be set to <code><?php echo site_url('', 'https'); ?></code>, <br>And the scenario callback URL should be set to: <code><?php echo site_url('wp-login.php?yoti-select=1&action=link', 'https'); ?></code></p>
     18    <p>Warning: User IDs provided by Yoti are unique to each Yoti Application. Using a different Yoti Application means you will receive a different Yoti User ID for all of your users.</p>
    1819    <?php
    1920    if ($updateMessage) {
  • yoti/trunk/yoti.php

    r1852630 r1920337  
    55Plugin URI: https://wordpress.org/plugins/yoti/
    66Description: Let Yoti users quickly register on your site.
    7 Version: 1.1.8
     7Version: 1.1.9
    88Author: Yoti SDK.
    99Author URI: https://yoti.com
Note: See TracChangeset for help on using the changeset viewer.