From 2c4ae43e688a9873e86211ea0e7aeb9ba770dd77 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 18 Oct 2022 08:59:09 +0200 Subject: Update --- alarm/node_modules/node-forge/tests/loginDemo.js | 149 +++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 alarm/node_modules/node-forge/tests/loginDemo.js (limited to 'alarm/node_modules/node-forge/tests/loginDemo.js') diff --git a/alarm/node_modules/node-forge/tests/loginDemo.js b/alarm/node_modules/node-forge/tests/loginDemo.js new file mode 100644 index 0000000..859e1f0 --- /dev/null +++ b/alarm/node_modules/node-forge/tests/loginDemo.js @@ -0,0 +1,149 @@ +/** + * Forge Web ID Tests + * + * @author Dave Longley + * + * Copyright (c) 2010 Digital Bazaar, Inc. All rights reserved. + */ +(function($) +{ + // load flash socket pool + window.forge.socketPool = {}; + window.forge.socketPool.ready = function() + { + // init page + init($); + }; + swfobject.embedSWF( + 'forge/SocketPool.swf', 'socketPool', '0', '0', '9.0.0', + false, {}, {allowscriptaccess: 'always'}, {}); +})(jQuery); + +var init = function($) +{ + // logging category + var cat = 'forge.tests.loginDemo'; + + // local alias + var forge = window.forge; + try + { + // get query variables + var query = forge.util.getQueryVariables(); + var domain = query.domain || ''; + var auth = query.auth || ''; + var redirect = query.redirect || ''; + var pport = query.pport || 843; + redirect = 'https://' + domain + '/' + redirect; + if(domain) + { + $('#domain').html('`' + domain + '`'); + } + + // for chosen webid + var chosen = null; + + // init forge xhr + forge.xhr.init({ + flashId: 'socketPool', + msie: $.browser.msie, + url: 'https://' + domain, + policyPort: pport, + connections: 1, + caCerts: [], + verify: function(c, verified, depth, certs) + { + // don't care about cert verification for test + return true; + }, + getCertificate: function(c) + { + forge.log.debug(cat, 'using cert', chosen.certificate); + return chosen.certificate; + }, + getPrivateKey: function(c) + { + //forge.log.debug(cat, 'using private key', chosen.privateKey); + return chosen.privateKey; + } + }); + + // get flash API + var flashApi = document.getElementById('socketPool'); + + // get web ids collection + var webids = forge.util.getItem( + flashApi, 'forge.test.webid', 'webids'); + webids = webids || {}; + + var id = 0; + var list = $('