<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hi Gary, in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115077#M73829</link>
    <description>&lt;P&gt;Hi Gary,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The API are asynchronous, that means that the result of the API is in the success callback.&lt;/P&gt;

&lt;P&gt;For example, when you call intel.security.secureTransport.open you get instanceID, you should use it in the success callback and not outside of this scope.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Here is a modification that follows the asynchrony programming (please note that I haven’t tested it):&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;function startSMSVerificationCode(mobileNumber){
    var transportInstanceID = 0;
    intel.security.secureTransport.open(
        function(instanceID) {
            transportInstanceID = instanceID;
            console.log("tiid: "+ transportInstanceID);                                 
            intel.security.secureTransport.setHeaders(
                function (){
                    console.log("Setting Headers")                                                                                               
                    intel.security.secureTransport.sendRequest(
                        function(response){
                            intel.security.secureData.createFromData(
                                function (As1instanceID) {
                                    intel.security.secureStorage.write(true,true,{'id':'As1', 'instanceID':As1instanceID })},
                                function(error){console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);},  
                                {'data':response.responseBody}
                            );
                        },
                        function(error) {
                            console.log("Rtiid: "+ transportInstanceID);
                            console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);},
                        {instanceID: transportInstanceID, requestBody: "phone_number="+mobileNumber}
                    );                                          
                },
                function(error) {
                    console.log("htiid: "+ transportInstanceID);
                    console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);
                },
                {instanceID: transportInstanceID, 'headers':{"Content-type": "application/x-www-form-urlencoded"}}
            );                                                
        },
        function(error) {
            console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);
        },
        {url:"https://xxxxx", serverKey:publickey, method:"POST"}
    );          
}


&lt;/PRE&gt;

&lt;P&gt;You can use the code snippets as a&amp;nbsp;baseline for your application &lt;A href="https://software.intel.com/en-us/node/604512"&gt;https://software.intel.com/en-us/node/604512&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;A name="_MailAutoSig"&gt;Thanks,&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Ohad&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2016 08:00:53 GMT</pubDate>
    <dc:creator>Ohad_B_Intel</dc:creator>
    <dc:date>2016-05-05T08:00:53Z</dc:date>
    <item>
      <title>intel.security.secureTransport problem</title>
      <link>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115072#M73824</link>
      <description>&lt;P&gt;Hi, I was trying to use&amp;nbsp;intel.security.secureTransport in my hybrid app. It works OK if i emulate it in Intel XDK itself but when i debug in App Preview or as .apk file on the phone. It returns with a "error code is: 9, error message is: Invalid instance ID provided" in the setHeader and sendRequest method below. Is there a bug?&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;function startSMSVerificationCode(mobileNumber){
    var transportInstanceID = 0;
    intel.security.secureTransport.open(
        function(instanceID) {
            transportInstanceID = instanceID;
            console.log("tiid: "+ transportInstanceID);
        },
        function(error) {console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);},
        {url:"https://xxxxx", serverKey:publickey, method:"POST"}
    );
    intel.security.secureTransport.setHeaders(
        console.log("Setting Headers"),
        function(error) {
            console.log("htiid: "+ transportInstanceID);
            console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);},
        {instanceID: transportInstanceID, 'headers':{"Content-type": "application/x-www-form-urlencoded"}}
    );    
    intel.security.secureTransport.sendRequest(
        function(response){
            intel.security.secureData.createFromData(
                function (As1instanceID) {
                    intel.security.secureStorage.write(true,true,{'id':'As1', 'instanceID':As1instanceID })},
                function(error){console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);},  
                {'data':response.responseBody}
            );
        },
        function(error) {
            console.log("Rtiid: "+ transportInstanceID);
            console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);},
        {instanceID: transportInstanceID, requestBody: "phone_number="+mobileNumber}
    );  
}&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 18:09:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115072#M73824</guid>
      <dc:creator>gary_h_3</dc:creator>
      <dc:date>2016-05-03T18:09:41Z</dc:date>
    </item>
    <item>
      <title>Emulator has limitations:</title>
      <link>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115073#M73825</link>
      <description>&lt;P&gt;Emulator has limitations:&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 18.2px; background-color: rgb(230, 230, 230);"&gt;You should think of the Emulate tab as a&amp;nbsp;&lt;/SPAN&gt;&lt;EM style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 18.2px;"&gt;Cordova API simulator&lt;/EM&gt;&lt;SPAN style="color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 18.2px; background-color: rgb(230, 230, 230);"&gt;, not as a device emulator. It provides you with a convenient viewport to help you visualize the&amp;nbsp;&lt;/SPAN&gt;&lt;EM style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 18.2px;"&gt;approximate&lt;/EM&gt;&lt;SPAN style="color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 18.2px; background-color: rgb(230, 230, 230);"&gt;&amp;nbsp;layout of your app on various devices and it&amp;nbsp;&lt;/SPAN&gt;&lt;EM style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 18.2px;"&gt;simulates&lt;/EM&gt;&lt;SPAN style="color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 18.2px; background-color: rgb(230, 230, 230);"&gt;the&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://cordova.apache.org/docs/en/5.1.1/cordova/plugins/pluginapis.html" style="box-sizing: border-box; color: rgb(0, 113, 197); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 18.2px;" target="_blank"&gt;core Cordova APIs&lt;/A&gt;&lt;SPAN style="color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 18.2px; background-color: rgb(230, 230, 230);"&gt;&amp;nbsp;to make it easier to debug apps that use those APIs. It&amp;nbsp;&lt;/SPAN&gt;&lt;EM style="box-sizing: border-box; color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 18.2px;"&gt;does not&lt;/EM&gt;&lt;SPAN style="color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; font-size: 13px; line-height: 18.2px; background-color: rgb(230, 230, 230);"&gt;&amp;nbsp;simulate real devices nor does it simulate third-party Cordova plugin APIs. Getting your app to work in the Emulate tab is not a guarantee that it will work on a real device. Conversely, if things work on a real device but do not work in the Emulate tab, that is not an indication that your app is "broken." The only way to know with certainty that your app works as intended is to build it and install it on real devices.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13px; line-height: 18.2px; color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; background-color: rgb(230, 230, 230);"&gt;Please build to run on actual device and test the behaviour.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13px; line-height: 18.2px; color: rgb(102, 102, 102); font-family: Arial, Tahoma, Helvetica, sans-serif; background-color: rgb(230, 230, 230);"&gt;One of our sample uses similar kind of API which you can refer to:&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/xdk/article/my-private-photos-sample#app-security-api" target="_blank"&gt;https://software.intel.com/en-us/xdk/article/my-private-photos-sample#app-security-api&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 20:59:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115073#M73825</guid>
      <dc:creator>Amrita_C_Intel</dc:creator>
      <dc:date>2016-05-03T20:59:49Z</dc:date>
    </item>
    <item>
      <title>Gary -- we're not experts at</title>
      <link>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115074#M73826</link>
      <description>&lt;P&gt;Gary -- we're not experts at that API, so I rounded up several of the threads on this forum that have referenced the API and will ask the API expert to check your post. Please check these threads to see if there is anything useful for you:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;&lt;A href="https://software.intel.com/en-us/forums/intel-xdk/topic/562592" target="_blank"&gt;https://software.intel.com/en-us/forums/intel-xdk/topic/562592&lt;/A&gt;&lt;/LI&gt;
	&lt;LI&gt;&lt;A href="https://software.intel.com/en-us/forums/intel-xdk/topic/610997" target="_blank"&gt;https://software.intel.com/en-us/forums/intel-xdk/topic/610997&lt;/A&gt;&lt;/LI&gt;
	&lt;LI&gt;&lt;A href="https://software.intel.com/en-us/forums/intel-xdk/topic/594553" target="_blank"&gt;https://software.intel.com/en-us/forums/intel-xdk/topic/594553&lt;/A&gt;&lt;/LI&gt;
	&lt;LI&gt;&lt;A href="https://software.intel.com/en-us/forums/intel-xdk/topic/610997" target="_blank"&gt;https://software.intel.com/en-us/forums/intel-xdk/topic/610997&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2016 23:00:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115074#M73826</guid>
      <dc:creator>PaulF_IntelCorp</dc:creator>
      <dc:date>2016-05-03T23:00:44Z</dc:date>
    </item>
    <item>
      <title>Hi Amrita, Paul,</title>
      <link>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115075#M73827</link>
      <description>&lt;P&gt;Hi Amrita, Paul,&lt;/P&gt;

&lt;P&gt;Thanks for the reply. Ironically, as i stated above. it works in the 'emulate' tab but does not work in actual device (both using the debug tab and building the .apk and installing on the device)&lt;/P&gt;

&lt;P&gt;Have i used the intel.security api the wrong way? Is there anything wrong in the way i code it?&lt;/P&gt;

&lt;P&gt;- Gary&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2016 03:28:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115075#M73827</guid>
      <dc:creator>gary_h_3</dc:creator>
      <dc:date>2016-05-04T03:28:37Z</dc:date>
    </item>
    <item>
      <title>Hi Gary -- as I noted,</title>
      <link>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115076#M73828</link>
      <description>&lt;P&gt;Hi Gary -- as I noted, neither of us is an expert with that API, so we've asked the real experts to respond to your post. Please also see the links I provided, which received help from those same experts, there might be some hints in there.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2016 17:35:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115076#M73828</guid>
      <dc:creator>PaulF_IntelCorp</dc:creator>
      <dc:date>2016-05-04T17:35:03Z</dc:date>
    </item>
    <item>
      <title>Hi Gary,</title>
      <link>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115077#M73829</link>
      <description>&lt;P&gt;Hi Gary,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The API are asynchronous, that means that the result of the API is in the success callback.&lt;/P&gt;

&lt;P&gt;For example, when you call intel.security.secureTransport.open you get instanceID, you should use it in the success callback and not outside of this scope.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Here is a modification that follows the asynchrony programming (please note that I haven’t tested it):&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;function startSMSVerificationCode(mobileNumber){
    var transportInstanceID = 0;
    intel.security.secureTransport.open(
        function(instanceID) {
            transportInstanceID = instanceID;
            console.log("tiid: "+ transportInstanceID);                                 
            intel.security.secureTransport.setHeaders(
                function (){
                    console.log("Setting Headers")                                                                                               
                    intel.security.secureTransport.sendRequest(
                        function(response){
                            intel.security.secureData.createFromData(
                                function (As1instanceID) {
                                    intel.security.secureStorage.write(true,true,{'id':'As1', 'instanceID':As1instanceID })},
                                function(error){console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);},  
                                {'data':response.responseBody}
                            );
                        },
                        function(error) {
                            console.log("Rtiid: "+ transportInstanceID);
                            console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);},
                        {instanceID: transportInstanceID, requestBody: "phone_number="+mobileNumber}
                    );                                          
                },
                function(error) {
                    console.log("htiid: "+ transportInstanceID);
                    console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);
                },
                {instanceID: transportInstanceID, 'headers':{"Content-type": "application/x-www-form-urlencoded"}}
            );                                                
        },
        function(error) {
            console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);
        },
        {url:"https://xxxxx", serverKey:publickey, method:"POST"}
    );          
}


&lt;/PRE&gt;

&lt;P&gt;You can use the code snippets as a&amp;nbsp;baseline for your application &lt;A href="https://software.intel.com/en-us/node/604512"&gt;https://software.intel.com/en-us/node/604512&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;A name="_MailAutoSig"&gt;Thanks,&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Ohad&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2016 08:00:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115077#M73829</guid>
      <dc:creator>Ohad_B_Intel</dc:creator>
      <dc:date>2016-05-05T08:00:53Z</dc:date>
    </item>
    <item>
      <title>Hi Ohad,</title>
      <link>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115078#M73830</link>
      <description>&lt;P&gt;Hi Ohad, Amrita, Paul&lt;/P&gt;

&lt;P&gt;Thanks all, yes. I got it resolved :)&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2016 05:40:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/intel-security-secureTransport-problem/m-p/1115078#M73830</guid>
      <dc:creator>gary_h_3</dc:creator>
      <dc:date>2016-05-07T05:40:00Z</dc:date>
    </item>
  </channel>
</rss>

