|
|
@@ -1,131 +1,52 @@
|
|
|
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
|
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
+ "http://www.w3.org/TR/html4/strict.dtd">
|
|
|
<html>
|
|
|
- <head>
|
|
|
- <!-- Change this if you want to allow scaling -->
|
|
|
- <meta name="viewport" content="width=default-width; user-scalable=no" />
|
|
|
-
|
|
|
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
|
|
-
|
|
|
- <title></title>
|
|
|
-
|
|
|
- <!-- iPad/iPhone specific css below, add after your main css >
|
|
|
- <link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="ipad.css" type="text/css" />
|
|
|
- <link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iphone.css" type="text/css" />
|
|
|
- -->
|
|
|
- <script type="text/javascript" charset="utf-8" src="cordova-2.2.0.js"></script>
|
|
|
- <script type="text/javascript" charset="utf-8" src="keychain.js"></script>
|
|
|
- <script type="text/javascript" charset="utf-8">
|
|
|
-
|
|
|
-
|
|
|
- // If you want to prevent dragging, uncomment this section
|
|
|
- /*
|
|
|
- function preventBehavior(e)
|
|
|
- {
|
|
|
- e.preventDefault();
|
|
|
- };
|
|
|
- document.addEventListener("touchmove", preventBehavior, false);
|
|
|
- */
|
|
|
-
|
|
|
- function onBodyLoad()
|
|
|
- {
|
|
|
- document.addEventListener("deviceready", onDeviceReady,false);
|
|
|
- }
|
|
|
-
|
|
|
- /* When this function is called, PhoneGap has been initialized and is ready to roll */
|
|
|
- function onDeviceReady()
|
|
|
- {
|
|
|
- try {
|
|
|
-
|
|
|
- // do your thing!
|
|
|
-
|
|
|
- } catch (e) {
|
|
|
- debug.error(e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- function onGet()
|
|
|
- {
|
|
|
- var kc = cordova.require("cordova/plugin/keychain");
|
|
|
-
|
|
|
- var key = document.getElementById("keytoget").value;
|
|
|
- var servicename = document.getElementById("servicename").value
|
|
|
-
|
|
|
- var win = function(value) {
|
|
|
- alert("GET SUCCESS - Key: " + key + " Value: " + value);
|
|
|
- };
|
|
|
- var fail = function(error) {
|
|
|
- alert("GET FAIL - Key: " + key + " Error: " + error);
|
|
|
- };
|
|
|
-
|
|
|
- kc.getForKey(win, fail, key, servicename);
|
|
|
- }
|
|
|
-
|
|
|
- function onSet()
|
|
|
- {
|
|
|
- var kc = cordova.require("cordova/plugin/keychain");
|
|
|
-
|
|
|
- var key = document.getElementById("keytoset").value;
|
|
|
- var value = document.getElementById("valuetoset").value;
|
|
|
- var servicename = document.getElementById("servicename").value;
|
|
|
-
|
|
|
- var win = function() {
|
|
|
- alert("SET SUCCESS - Key: " + key);
|
|
|
- };
|
|
|
- var fail = function(error) {
|
|
|
- alert("SET FAIL - Key: " + key + " Error: " + error);
|
|
|
- };
|
|
|
-
|
|
|
- kc.setForKey(win, fail, key, servicename, value);
|
|
|
- }
|
|
|
-
|
|
|
- function onRemove()
|
|
|
- {
|
|
|
- var kc = cordova.require("cordova/plugin/keychain");
|
|
|
-
|
|
|
- var key = document.getElementById("keytoremove").value;
|
|
|
- var servicename = document.getElementById("servicename").value
|
|
|
-
|
|
|
- var win = function() {
|
|
|
- alert("REMOVE SUCCESS - Key: " + key);
|
|
|
- };
|
|
|
- var fail = function(error) {
|
|
|
- alert("REMOVE FAIL - Key: " + key + " Error: " + error);
|
|
|
- };
|
|
|
-
|
|
|
- kc.removeForKey(win, fail, key, servicename);
|
|
|
- }
|
|
|
-
|
|
|
- </script>
|
|
|
- </head>
|
|
|
- <body onload="onBodyLoad()">
|
|
|
-
|
|
|
- <div style="color:red">(using servicename <input type="text" value="GOLDILOCKS" id="servicename" />)</div>
|
|
|
-
|
|
|
- <hr>
|
|
|
- <br />
|
|
|
-
|
|
|
- <div> GET FROM KEYCHAIN </div>
|
|
|
- <br />
|
|
|
- <label for="keytoget">Key to Get <input type="text" id="keytoget" value="ILLUMINATI" /></label>
|
|
|
- <button onclick="onGet();">GET</button>
|
|
|
-
|
|
|
- <br />
|
|
|
- <hr />
|
|
|
- <br />
|
|
|
-
|
|
|
- <div> SET TO KEYCHAIN </div> <br />
|
|
|
-
|
|
|
- <label for="keytoset">Key to Set <input type="text" id="keytoset" value="ILLUMINATI"/></label> <br />
|
|
|
- <label for="valuetoset">Value to Set <input type="text" id="valuetoset" value="SEKRIT" /></label>
|
|
|
- <button onclick="onSet();">SET</button>
|
|
|
-
|
|
|
- <br />
|
|
|
- <hr />
|
|
|
- <br />
|
|
|
- <div> REMOVE FROM KEYCHAIN </div> <br />
|
|
|
-
|
|
|
- <label for="keytoremove">Key to Remove<input type="text" id="keytoremove" value="ILLUMINATI"/></label>
|
|
|
- <button onclick="onRemove();">DEL</button>
|
|
|
-
|
|
|
- </body>
|
|
|
+ <head>
|
|
|
+ <!-- Change this if you want to allow scaling -->
|
|
|
+ <meta name="viewport" content="width=default-width; user-scalable=no">
|
|
|
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
|
|
+ <title></title>
|
|
|
+
|
|
|
+ <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
|
|
|
+ <script type="text/javascript" charset="utf-8" src="index.js"></script>
|
|
|
+ </head>
|
|
|
+ <body onload="onBodyLoad()">
|
|
|
+ <div style="color:red">
|
|
|
+ (using servicename <input type="text" value="GOLDILOCKS" id="servicename">)
|
|
|
+ </div>
|
|
|
+ <hr>
|
|
|
+ <p>
|
|
|
+ <br>
|
|
|
+ </p>
|
|
|
+ <div>
|
|
|
+ GET FROM KEYCHAIN
|
|
|
+ </div>
|
|
|
+ <p>
|
|
|
+ <br>
|
|
|
+ <label for="keytoget">Key to Get <input type="text" id="keytoget" value="ILLUMINATI"></label> <button onclick="onGet();">GET</button><br>
|
|
|
+ </p>
|
|
|
+ <hr>
|
|
|
+ <p>
|
|
|
+ <br>
|
|
|
+ </p>
|
|
|
+ <div>
|
|
|
+ SET TO KEYCHAIN
|
|
|
+ </div>
|
|
|
+ <p>
|
|
|
+ <br>
|
|
|
+ <label for="keytoset">Key to Set <input type="text" id="keytoset" value="ILLUMINATI"></label><br>
|
|
|
+ <label for="valuetoset">Value to Set <input type="text" id="valuetoset" value="SEKRIT"></label> <button onclick="onSet();">SET</button><br>
|
|
|
+ </p>
|
|
|
+ <hr>
|
|
|
+ <p>
|
|
|
+ <br>
|
|
|
+ </p>
|
|
|
+ <div>
|
|
|
+ REMOVE FROM KEYCHAIN
|
|
|
+ </div>
|
|
|
+ <p>
|
|
|
+ <br>
|
|
|
+ <label for="keytoremove">Key to Remove<input type="text" id="keytoremove" value="ILLUMINATI"></label> <button onclick="onRemove();">DEL</button>
|
|
|
+ </p>
|
|
|
+ </body>
|
|
|
</html>
|