This repository was archived by the owner on Mar 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
This repository was archived by the owner on Mar 19, 2025. It is now read-only.
Getting error 'not_allowed' when trying to getCertificate. #67
Copy link
Copy link
Open
Description
When trying to call this function I see this error.
Any ideas?
import { hwcrypto } from '../hwcrypto/hwcrypto';
const signEstonianIdCard = (offerId: string) => {
hwcrypto.getCertificate({ lang: 'en' }).then(function (certificate) {
const hash = hexToPem(certificate.hex);
hwcrypto
.sign(certificate, { type: 'SHA-256', hex: hash }, { lang: 'en' })
.then(
function (signature: any) {
request('customer', 'person')
.get()
.then((res) => {
request('loans', 'sign/contract').post({
offerId,
userId: res.data.personDetails.idPerson,
signatureHash: signature.hex,
signingParty: 'applicant',
});
});
},
function (error: any) {
console.log(`Signing failed: ${error.message}`);
}
);
});
};// Prepared function for easier exports
export const hwcrypto = function hwcrypto() {
"use strict";
var _debug = function(x) {};
_debug("hwcrypto.js activated");
window.addEventListener = window.addEventListener || window.attachEvent;
function hasPluginFor(mime) {
return navigator.mimeTypes && mime in navigator.mimeTypes;
}
[...]fields.getCertificate = function(options) {
if (typeof options !== "object") {
_debug("getCertificate options parameter must be an object");
return Promise.reject(new Error(INVALID_ARGUMENT));
}
if (options && !options.lang) {
options.lang = "en";
}
return _autodetect().then(function(result) {
// removed if statements because it was throwing errors on dev environment
return _backend.getCertificate(options).then(function(certificate) {
if (certificate.hex && !certificate.encoded) certificate.encoded = _hex2array(certificate.hex);
return certificate;
});
});
};Metadata
Metadata
Assignees
Labels
No labels

