LacunaWebPKI.listCertificates example (jQuery)

HTML

<form>
    <button id="startButton" type="button">Start</button><br/>
    <select id="certificateSelect"></select>
    <button id="getSelectedCertButton" type="button">Get Selected Cert</button>
</form>
<div id="logPanel"></div>

JavaScript

// ------------------------------------------------------------------------------------------
// LacunaWebPKI.listCertificates example (jQuery)

function onWebPkiDetected() {
    log('Component detected, listing certificates ...');
    pki.listCertificates().success(function (certs) {
        log('Certificates listed!');
        var select = $("#certificateSelect");
        $.each(certs, function() {
            // Note that we place the thumbprint property of each item in the array in the
            // value property of each option tag. This will be useful on the function below.
            select.append(
                $("<option />")
                .val(this.thumbprint)
                .text(this.subjectName + ' (issued by ' + this.issuerName + ')')
            );
        });
    });
}

function getSelectedCert() {
    // Since we populated the certificateSelect tag with options putting each certificate's thumbprint
    // in the value attribute, now all we have to do to get the thumbprint of the selected certificate is:
    var selectedCertThumb = $('#certificateSelect').val();
    alert("The selected certificate's thumbprint is " + selectedCertThumb);
}

// ------------------------------------------------------------------------------------------
// The code from this point on is necessary for the example to run, but is not the focus of
// this specific example

var myLicense = {
    "format": 1,
    "allowedDomains": [
        "jsfiddle.net",
        "webpki.lacunasoftware.com"
    ],
    "expiration": null,
    "signature": "ClKvO1J22vAD+YmfANiKQLbcLE1lNraPKCel6tRM+ZxR+h6M/crtJYRRVGGz7hrdbM0Y0mfTu15RMYGqQMi1QNZS6GrT4vNzIayv552Fl0EFWQA7jWlctUwfYoHRHVEnCNx9YGXDiA9+yDoGlVwgTR7fjzNeS3Fen1MVIyKBF464gN0JvdiCRJMI47JGVDkPmKjcrYIvJs6y5Lg25RW4ZnBKVruS+HR2s3k8ZrV4y4RCQE4UYMKbukF9vsF+JqAEifRlPq2xLcrNdxBveVDSXS/LRHAcrZrMM+Iw4A79jl0ngWPcy+CwinAhT+3dxVo5ZWMRQFpmTkylEMDvTjV9wQ=="
};
var pki = new LacunaWebPKI({
    license: myLicense,
    defaultError:...