crypto-pro-js/example/cert-list.js
2017-11-29 12:50:54 +03:00

26 lines
742 B
JavaScript

;(function () {
'use strict';
var $certs = document.querySelector('#certList');
/**
* Пример получения списка сертификатов
* */
window.CryptoPro.call('getCertsList').then(function (list) {
list.forEach(function (cert) {
var $certOption = document.createElement('option');
if (typeof $certOption.textContent !== 'undefined') {
$certOption.textContent = cert.label;
} else {
$certOption.innerText = cert.label;
}
$certOption.value = cert.thumbprint;
$certs.appendChild($certOption);
});
}, function (error) {
console.error(error);
});
}());