web-pki 2.14.4 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lacuna-web-pki.d.ts +170 -8
- package/lacuna-web-pki.js +54 -34
- package/package.json +1 -1
package/lacuna-web-pki.d.ts
CHANGED
|
@@ -341,7 +341,9 @@ export declare class LacunaWebPKI {
|
|
|
341
341
|
/** The Array of Base64 encoded hashes to be signed. */
|
|
342
342
|
batch: string[],
|
|
343
343
|
/** The digest algorithm identifier of the hashes on `batch` parameter. It can be the algorithm name or OID (i.e. `'SHA-256'` or `'2.16.840.1.101.3.4.2.1'`). */
|
|
344
|
-
digestAlgorithm: string
|
|
344
|
+
digestAlgorithm: string,
|
|
345
|
+
/** Set to be able to call [[preauthorizeSignatures]] in order to call [[signHashBatch]] multiple times.*/
|
|
346
|
+
usePreauthorizedSignatures?: boolean
|
|
345
347
|
}): Promise<SignHashBatchResponse>;
|
|
346
348
|
|
|
347
349
|
/**************************************************************
|
|
@@ -530,6 +532,9 @@ export declare class LacunaWebPKI {
|
|
|
530
532
|
/** The PDF signature policy. */
|
|
531
533
|
policy: LacunaWebPKI.PadesPolicies,
|
|
532
534
|
|
|
535
|
+
/** A timestamp requester for signature policies which require timestamping */
|
|
536
|
+
timestampRequester?: TimestampRequester,
|
|
537
|
+
|
|
533
538
|
/** An optional signer certificate validation level to execute. Default is a signer certificate full validation. */
|
|
534
539
|
certificateValidationLevel?: LacunaWebPKI.CertificateValidationLevels
|
|
535
540
|
}): Promise<PdfSignResult>;
|
|
@@ -576,6 +581,9 @@ export declare class LacunaWebPKI {
|
|
|
576
581
|
/** The CAdES signature policy. */
|
|
577
582
|
policy: LacunaWebPKI.CadesPolicies,
|
|
578
583
|
|
|
584
|
+
/** A timestamp requester for signature policies which require timestamping */
|
|
585
|
+
timestampRequester?: TimestampRequester,
|
|
586
|
+
|
|
579
587
|
/** An optional signer certificate validation level to execute. Default is a signer certificate full validation. */
|
|
580
588
|
certificateValidationLevel?: LacunaWebPKI.CertificateValidationLevels
|
|
581
589
|
}): Promise<CadesSignResult>;
|
|
@@ -607,6 +615,9 @@ export declare class LacunaWebPKI {
|
|
|
607
615
|
/** The XML signature policy. */
|
|
608
616
|
policy: LacunaWebPKI.XmlPolicies,
|
|
609
617
|
|
|
618
|
+
/** A timestamp requester parameters for signature policies which require timestamping */
|
|
619
|
+
timestampRequester?: TimestampRequester,
|
|
620
|
+
|
|
610
621
|
/** An optional signer certificate validation level to execute. Default is a signer certificate full validation. */
|
|
611
622
|
certificateValidationLevel?: LacunaWebPKI.CertificateValidationLevels,
|
|
612
623
|
|
|
@@ -639,7 +650,7 @@ export declare class LacunaWebPKI {
|
|
|
639
650
|
idResolutionTable?: XmlIdResolutionTableModel
|
|
640
651
|
|
|
641
652
|
/** The selected XML [[FileModel.id]], as returned by [[showFileBrowser]] method. */
|
|
642
|
-
fileId
|
|
653
|
+
fileId?: string,
|
|
643
654
|
|
|
644
655
|
/** The signer certificate thumbprint. Available in [[CertificateModel.thumbprint]] property returned by [[listCertificates]] method. */
|
|
645
656
|
certificateThumbprint: string,
|
|
@@ -659,6 +670,9 @@ export declare class LacunaWebPKI {
|
|
|
659
670
|
/** The XML signature policy. */
|
|
660
671
|
policy: LacunaWebPKI.XmlPolicies,
|
|
661
672
|
|
|
673
|
+
/** A timestamp requester for signature policies which require timestamping */
|
|
674
|
+
timestampRequester?: TimestampRequester,
|
|
675
|
+
|
|
662
676
|
/** An optional signer certificate validation level to execute. Default is a signer certificate full validation. */
|
|
663
677
|
certificateValidationLevel?: LacunaWebPKI.CertificateValidationLevels,
|
|
664
678
|
|
|
@@ -678,7 +692,10 @@ export declare class LacunaWebPKI {
|
|
|
678
692
|
*/
|
|
679
693
|
openPades(args: {
|
|
680
694
|
/** The signed PDF [[FileModel.id]], as returned by [[showFileBrowser]] method. */
|
|
681
|
-
signatureFileId
|
|
695
|
+
signatureFileId?: string,
|
|
696
|
+
|
|
697
|
+
/** The signed PDF content (Base64 encoded bytes) to open. It can be passed optionally to `signatureFileId`. */
|
|
698
|
+
signatureContent?: string,
|
|
682
699
|
|
|
683
700
|
/** Whether or not to validate the PDF sinatures. */
|
|
684
701
|
validate: boolean,
|
|
@@ -702,7 +719,10 @@ export declare class LacunaWebPKI {
|
|
|
702
719
|
*/
|
|
703
720
|
openCades(args: {
|
|
704
721
|
/** The signed document (.p7s) [[FileModel.id]], as returned by [[showFileBrowser]] method. */
|
|
705
|
-
signatureFileId
|
|
722
|
+
signatureFileId?: string,
|
|
723
|
+
|
|
724
|
+
/** The signed PDF content (Base64 encoded bytes) to open. It can be passed optionally to `signatureFileId`. */
|
|
725
|
+
signatureContent?: string,
|
|
706
726
|
|
|
707
727
|
/** The original file. Only applies if the passed `signatureFileId` does not have the encapsulated content. */
|
|
708
728
|
originalFileId?: string,
|
|
@@ -734,7 +754,7 @@ export declare class LacunaWebPKI {
|
|
|
734
754
|
/** The signed XML [[FileModel.id]], as returned by [[showFileBrowser]] method. */
|
|
735
755
|
signatureFileId?: string,
|
|
736
756
|
|
|
737
|
-
/**
|
|
757
|
+
/** The signed XML content (UTF-8 string or Base64 encoded bytes) to open. It can be passed optionally to `signatureFileId`. */
|
|
738
758
|
signatureContent?: string,
|
|
739
759
|
|
|
740
760
|
/** Whether or not to validate the CAdES sinatures. */
|
|
@@ -1016,6 +1036,11 @@ export namespace LacunaWebPKI {
|
|
|
1016
1036
|
Unknown = 'Unknown'
|
|
1017
1037
|
}
|
|
1018
1038
|
|
|
1039
|
+
export const enum CertificatePolicyQualifierTypes {
|
|
1040
|
+
Cps = 'Cps',
|
|
1041
|
+
UserNotice = 'UserNotice'
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1019
1044
|
export const enum MobileIntegrationModes {
|
|
1020
1045
|
/** Redirects and continue execution inside Web PKI App. Direct integration without bouncing between Browser App and Web PKI App. */
|
|
1021
1046
|
AppIntegration = 'appIntegration',
|
|
@@ -1041,14 +1066,27 @@ export namespace LacunaWebPKI {
|
|
|
1041
1066
|
/** PAdES-BES policy */
|
|
1042
1067
|
Basic = 'basic',
|
|
1043
1068
|
/** ICP-Brasil AD-RB policy */
|
|
1044
|
-
BrazilAdrBasica = 'brazilAdrBasica'
|
|
1069
|
+
BrazilAdrBasica = 'brazilAdrBasica',
|
|
1070
|
+
PadesT = 'padesT',
|
|
1071
|
+
BrazilAdrTempo = 'brazilAdrTempo'
|
|
1045
1072
|
}
|
|
1046
1073
|
|
|
1047
1074
|
export const enum CadesPolicies {
|
|
1075
|
+
Cms = 'cms',
|
|
1048
1076
|
/** CAdES-BES policy */
|
|
1049
1077
|
Bes = 'cadesBes',
|
|
1078
|
+
/** CAdES-T policy */
|
|
1079
|
+
CadesT = 'cadesT',
|
|
1050
1080
|
/** ICP-Brasil AD-RB policy */
|
|
1051
|
-
BrazilAdrBasica = 'brazilAdrBasica'
|
|
1081
|
+
BrazilAdrBasica = 'brazilAdrBasica',
|
|
1082
|
+
/** ICP-Brasil AD-RT policy */
|
|
1083
|
+
BrazilAdrTempo = 'brazilAdrTempo',
|
|
1084
|
+
/** ICP-Brasil AD-RV policy */
|
|
1085
|
+
BrazilAdrValidacao = 'brazilAdrValidacao',
|
|
1086
|
+
/** ICP-Brasil AD-RC policy */
|
|
1087
|
+
BrazilAdrCompleta = 'brazilAdrCompleta',
|
|
1088
|
+
/** ICP-Brasil AD-RA policy */
|
|
1089
|
+
BrazilAdrArquivamento = 'brazilAdrArquivamento',
|
|
1052
1090
|
}
|
|
1053
1091
|
|
|
1054
1092
|
export const enum XmlPolicies {
|
|
@@ -1057,9 +1095,11 @@ export namespace LacunaWebPKI {
|
|
|
1057
1095
|
/** XAdES-BES policy */
|
|
1058
1096
|
XadesBes = 'xadesBes',
|
|
1059
1097
|
/** Brazil national NFe policy */
|
|
1098
|
+
XadesT = 'xadesT',
|
|
1060
1099
|
BrazilNFe = 'brazilNFe',
|
|
1061
1100
|
/** ICP-Brasil AD-RB policy */
|
|
1062
1101
|
BrazilAdrBasica = 'brazilAdrBasica',
|
|
1102
|
+
BrazilAdrTempo = 'brazilAdrTempo',
|
|
1063
1103
|
}
|
|
1064
1104
|
|
|
1065
1105
|
export const enum XmlSignedEntityTypes {
|
|
@@ -1177,6 +1217,17 @@ export namespace LacunaWebPKI {
|
|
|
1177
1217
|
SpecialCharacters = 4
|
|
1178
1218
|
}
|
|
1179
1219
|
|
|
1220
|
+
export const enum AuthenticationMethods {
|
|
1221
|
+
/** No authentication */
|
|
1222
|
+
None = 'none',
|
|
1223
|
+
/** Basic authentication: a username and password parameters must be set */
|
|
1224
|
+
Basic = 'basic',
|
|
1225
|
+
/** OAuth Bearer token authentication: a bearerToken parameter must be set */
|
|
1226
|
+
BearerToken = 'bearerToken',
|
|
1227
|
+
/** Mutual TLS authentication: a client certificate thumbprint parameter must be set */
|
|
1228
|
+
Mutual = 'mutual'
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1180
1231
|
|
|
1181
1232
|
|
|
1182
1233
|
}
|
|
@@ -1230,10 +1281,14 @@ export interface ExceptionModel {
|
|
|
1230
1281
|
* Each property on the [[PkiBrazilModel]] and [[PkiItalyModel]] objects may be null, but the objects themselves (`cert.pkiBrazil` or `cert.pkiItaly`) are **never** null.
|
|
1231
1282
|
*/
|
|
1232
1283
|
export interface CertificateModel {
|
|
1233
|
-
/** The Common Name (CN) part of the certificate's subject name field. */
|
|
1284
|
+
/** The Common Name (CN) part of the certificate's subject DN name field. */
|
|
1234
1285
|
subjectName: string,
|
|
1286
|
+
/** The subject Distinguished Name (DN) formatted string */
|
|
1287
|
+
subjectDN: string,
|
|
1235
1288
|
/** The Common Name (CN) part of the certificate's issuer name field. */
|
|
1236
1289
|
issuerName: string,
|
|
1290
|
+
/** The issuer Distinguished Name (DN) formatted string */
|
|
1291
|
+
issuerDN: string,
|
|
1237
1292
|
/** `true` if the certificate is stored on Web PKI mobile app. `null` or `false` otherwise. */
|
|
1238
1293
|
isRemote?: boolean,
|
|
1239
1294
|
/** The subject e-mail address. */
|
|
@@ -1242,10 +1297,20 @@ export interface CertificateModel {
|
|
|
1242
1297
|
thumbprint: string,
|
|
1243
1298
|
/** Object with boolean properties indicating wether each possible key usage is set on the certificate. */
|
|
1244
1299
|
keyUsage: KeyUsagesModel,
|
|
1300
|
+
/** Array with certificate policies info */
|
|
1301
|
+
certificatePolicies: CertificatePolicyModel[],
|
|
1245
1302
|
/** Object with Brazil-specific fields. */
|
|
1246
1303
|
pkiBrazil: PkiBrazilModel,
|
|
1304
|
+
/** Object with Argentina-specific fields. */
|
|
1305
|
+
pkiArgentina: PkiArgentinaModel,
|
|
1306
|
+
/** Object with Ecuador-specific fields. */
|
|
1307
|
+
pkiEcuador: PkiEcuadorModel,
|
|
1247
1308
|
/** Object with Italy-specific fields. */
|
|
1248
1309
|
pkiItaly: PkiItalyModel,
|
|
1310
|
+
/** Object with Paraguay-specific fields. */
|
|
1311
|
+
pkiParaguay: PkiParaguayModel,
|
|
1312
|
+
/** Object with Peru-specific fields. */
|
|
1313
|
+
pkiPeru: PkiPeruModel,
|
|
1249
1314
|
/** The not before field of the certificate. */
|
|
1250
1315
|
validityStart: Date,
|
|
1251
1316
|
/** The not after field of the certificate. */
|
|
@@ -1309,6 +1374,81 @@ export interface PkiItalyModel {
|
|
|
1309
1374
|
codiceFiscale: string
|
|
1310
1375
|
}
|
|
1311
1376
|
|
|
1377
|
+
/**************************************************************
|
|
1378
|
+
* Object with PKI Argentina specific fields.
|
|
1379
|
+
*/
|
|
1380
|
+
export interface PkiArgentinaModel {
|
|
1381
|
+
/** Clave Única de Identificación Laboral */
|
|
1382
|
+
cuil: string,
|
|
1383
|
+
/** Clave Única de Identificación Tributaria */
|
|
1384
|
+
cuit: string
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
/**************************************************************
|
|
1388
|
+
* Object with PKI Ecuador specific fields.
|
|
1389
|
+
*/
|
|
1390
|
+
export interface PkiEcuadorModel {
|
|
1391
|
+
/** */
|
|
1392
|
+
certificateType: string,
|
|
1393
|
+
cedulaDeIdentidad: string,
|
|
1394
|
+
pasaporte: string,
|
|
1395
|
+
/** Registro Único de Proveedores */
|
|
1396
|
+
rup: string,
|
|
1397
|
+
/** Registro Único de Contribuyentes */
|
|
1398
|
+
ruc: string,
|
|
1399
|
+
nombres: string,
|
|
1400
|
+
apellidos: string,
|
|
1401
|
+
razonSocial: string
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
/**************************************************************
|
|
1405
|
+
* Object with PKI Paraguay specific fields.
|
|
1406
|
+
*/
|
|
1407
|
+
export interface PkiParaguayModel {
|
|
1408
|
+
personCertificateType: string,
|
|
1409
|
+
certificateType: string,
|
|
1410
|
+
/** Cédula de identidad */
|
|
1411
|
+
ci: string,
|
|
1412
|
+
/** Cédula de identidad para extranjero */
|
|
1413
|
+
cie: string,
|
|
1414
|
+
/** Registro Único de Contribuyente. Número de Cédula Tributaria correspondiente al Titular */
|
|
1415
|
+
ruc: string,
|
|
1416
|
+
pasaporte: string,
|
|
1417
|
+
/** Nombre y apellido del responsable del certificado */
|
|
1418
|
+
responsable: string
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
/**************************************************************
|
|
1422
|
+
* Object with PKI Peru specific fields.
|
|
1423
|
+
*/
|
|
1424
|
+
export interface PkiPeruModel {
|
|
1425
|
+
/** Documento Nacional de Identidad */
|
|
1426
|
+
dni: string,
|
|
1427
|
+
/** Registro Único de Contribuyentes */
|
|
1428
|
+
ruc: string
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
/**************************************************************
|
|
1432
|
+
* Object with certificate policy info
|
|
1433
|
+
*/
|
|
1434
|
+
export interface CertificatePolicyModel {
|
|
1435
|
+
/** Certificate Policy Identifier */
|
|
1436
|
+
id: string,
|
|
1437
|
+
/** Certificate Policy Qualifiers */
|
|
1438
|
+
qualifiers: CertificatePolicyQualifierModel[]
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
/**************************************************************
|
|
1442
|
+
* Object with certificate policy qualifier
|
|
1443
|
+
*/
|
|
1444
|
+
export interface CertificatePolicyQualifierModel {
|
|
1445
|
+
type: LacunaWebPKI.CertificatePolicyQualifierTypes,
|
|
1446
|
+
cpsUri: string,
|
|
1447
|
+
unOrganization: string,
|
|
1448
|
+
unExplicitText: string,
|
|
1449
|
+
unNoticeNumbers: number[],
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1312
1452
|
// Common Functions
|
|
1313
1453
|
|
|
1314
1454
|
export interface SuccessCallback<T> {
|
|
@@ -1700,4 +1840,26 @@ export interface PadesPageOptimization {
|
|
|
1700
1840
|
pageOrientation: LacunaWebPKI.PadesPageOrientations
|
|
1701
1841
|
}
|
|
1702
1842
|
|
|
1843
|
+
export interface AuthenticationParameters {
|
|
1844
|
+
method: LacunaWebPKI.AuthenticationMethods,
|
|
1845
|
+
username?: string,
|
|
1846
|
+
password?: string
|
|
1847
|
+
bearerToken?: string,
|
|
1848
|
+
certificateThumbprint?: string,
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
export interface TimestampRequester {
|
|
1852
|
+
/** The Timestamp Authority (TSA) endpoint */
|
|
1853
|
+
url: string,
|
|
1854
|
+
/** An authentication method and parameters, if required by the TSA */
|
|
1855
|
+
authentication?: AuthenticationParameters
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
export interface GeolocationInfo {
|
|
1859
|
+
accuracy: number,
|
|
1860
|
+
latitude: number,
|
|
1861
|
+
longitude: number,
|
|
1862
|
+
timestamp: Date
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1703
1865
|
|
package/lacuna-web-pki.js
CHANGED
|
@@ -21,6 +21,17 @@ LacunaWebPKI = function (license) {
|
|
|
21
21
|
if (license) {
|
|
22
22
|
this.license = license;
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
// check for JQuery blockUI presence causing mobile touch blocking
|
|
26
|
+
if (this.isSupportedMobile && window.$ && window.$.blockUI) {
|
|
27
|
+
try {
|
|
28
|
+
window.$.blockUI.defaults.bindEvents = false;
|
|
29
|
+
this._log('blockUI bindEvents disabled');
|
|
30
|
+
|
|
31
|
+
} catch (ex) {
|
|
32
|
+
this._log('Error disabling blockUI bindEvents: ', ex);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
24
35
|
};
|
|
25
36
|
|
|
26
37
|
// Inject class prototype
|
|
@@ -115,20 +126,21 @@ LacunaWebPKI = function (license) {
|
|
|
115
126
|
|
|
116
127
|
$._installUrl = 'https://get.webpkiplugin.com/';
|
|
117
128
|
$._chromeExtensionId = 'dcngeagmmhegagicpcmpinaoklddcgon';
|
|
118
|
-
$._firefoxExtensionId = 'webpki@lacunasoftware.com';
|
|
119
|
-
$._edgeExtensionId = '
|
|
129
|
+
$._firefoxExtensionId = 'webpki-beta@lacunasoftware.com';
|
|
130
|
+
$._edgeExtensionId = 'nedeegdmhlnmboboahchfpkmdnnemapd';
|
|
131
|
+
$._edgeLegacyProductId = 'd2798a85-9698-425a-add7-3db79a39ca8a';
|
|
120
132
|
$._chromeExtensionFirstVersionWithSelfUpdate = '2.0.20';
|
|
121
|
-
$._jslibVersion = '2.
|
|
133
|
+
$._jslibVersion = '2.15.0';
|
|
122
134
|
$._mobileSupported = 'true' === 'true';
|
|
123
135
|
$._buildChannel = 'stable';
|
|
124
136
|
|
|
125
137
|
// latest components version ----------------------
|
|
126
138
|
$._extensionRequiredVersion = '2.15.0';
|
|
127
|
-
$._chromeNativeWinRequiredVersion = '2.10.
|
|
139
|
+
$._chromeNativeWinRequiredVersion = '2.10.3';
|
|
128
140
|
$._chromeNativeLinuxRequiredVersion = '2.10.0';
|
|
129
141
|
$._chromeNativeMacRequiredVersion = '2.10.0';
|
|
130
|
-
$._ieAddonRequiredVersion = '2.7.
|
|
131
|
-
$._mobileRequiredVersion = '
|
|
142
|
+
$._ieAddonRequiredVersion = '2.7.3';
|
|
143
|
+
$._mobileRequiredVersion = '3.0.0';
|
|
132
144
|
// ------------------------------------------------
|
|
133
145
|
|
|
134
146
|
$._chromeInstallationStates = {
|
|
@@ -469,7 +481,7 @@ LacunaWebPKI = function (license) {
|
|
|
469
481
|
if (!p11Modules || !p11Modules.length) {
|
|
470
482
|
return null;
|
|
471
483
|
}
|
|
472
|
-
osModules = [];
|
|
484
|
+
var osModules = [];
|
|
473
485
|
for (var i = 0; i < p11Modules.length; i++) {
|
|
474
486
|
if ($._nativeInfo.os === 'Windows') {
|
|
475
487
|
osModules.push(p11Modules[i].win);
|
|
@@ -658,7 +670,7 @@ LacunaWebPKI = function (license) {
|
|
|
658
670
|
this.brand = args.brand;
|
|
659
671
|
}
|
|
660
672
|
if (args.restPkiUrl) {
|
|
661
|
-
|
|
673
|
+
this.restPkiUrl = args.restPkiUrl[args.restPkiUrl.length - 1] === '/' ? args.restPkiUrl : args.restPkiUrl + '/';
|
|
662
674
|
}
|
|
663
675
|
|
|
664
676
|
this.useDomainNativePool = args.useDomainNativePool === true;
|
|
@@ -987,6 +999,7 @@ LacunaWebPKI = function (license) {
|
|
|
987
999
|
var request = {
|
|
988
1000
|
certificateThumbprint: args.certificateThumbprint,
|
|
989
1001
|
digestAlgorithm: args.digestAlgorithm,
|
|
1002
|
+
usePreauthorizedSignatures: args.usePreauthorizedSignatures,
|
|
990
1003
|
batch: args.batch
|
|
991
1004
|
};
|
|
992
1005
|
$._requestHandler.sendCommand(context, 'signHashBatch', request);
|
|
@@ -1127,6 +1140,7 @@ LacunaWebPKI = function (license) {
|
|
|
1127
1140
|
trustArbitrators: args.trustArbitrators,
|
|
1128
1141
|
clearPolicyTrustArbitrators: args.clearPolicyTrustArbitrators,
|
|
1129
1142
|
certificateValidationLevel: args.certificateValidationLevel,
|
|
1143
|
+
timestampRequester: args.timestampRequester,
|
|
1130
1144
|
policy: args.policy
|
|
1131
1145
|
};
|
|
1132
1146
|
};
|
|
@@ -1311,9 +1325,19 @@ LacunaWebPKI = function (license) {
|
|
|
1311
1325
|
return context.promise;
|
|
1312
1326
|
};
|
|
1313
1327
|
|
|
1328
|
+
$.getGeolocation = function (args) {
|
|
1329
|
+
var context = this._createContext(args);
|
|
1330
|
+
var request = {
|
|
1331
|
+
certificateThumbprint: args.certificateThumbprint
|
|
1332
|
+
};
|
|
1333
|
+
$._requestHandler.sendCommand(context, 'getGeolocation', request);
|
|
1334
|
+
return context.promise;
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1314
1337
|
|
|
1315
1338
|
// -------------------- Browser detection --------------------
|
|
1316
|
-
// http://stackoverflow.com/questions/2400935/browser-detection-in-javascript
|
|
1339
|
+
// Based on http://stackoverflow.com/questions/2400935/browser-detection-in-javascript
|
|
1340
|
+
// with new Edge UA 'Edg' changes
|
|
1317
1341
|
$.detectedBrowser = (function () {
|
|
1318
1342
|
var ua = navigator.userAgent, tem,
|
|
1319
1343
|
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
|
|
@@ -1322,7 +1346,7 @@ LacunaWebPKI = function (license) {
|
|
|
1322
1346
|
return 'IE ' + (tem[1] || '');
|
|
1323
1347
|
}
|
|
1324
1348
|
if (M[1] === 'Chrome') {
|
|
1325
|
-
tem = ua.match(/\b(OPR|Edge)\/(\d+)/);
|
|
1349
|
+
tem = ua.match(/\b(OPR|Edge|Edg)\/(\d+)/);
|
|
1326
1350
|
if (tem !== null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
|
|
1327
1351
|
}
|
|
1328
1352
|
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
|
|
@@ -1331,24 +1355,24 @@ LacunaWebPKI = function (license) {
|
|
|
1331
1355
|
})();
|
|
1332
1356
|
|
|
1333
1357
|
$._supportedMobileDetected = false;
|
|
1334
|
-
var
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1358
|
+
var hasMultiTouchPoints = window.navigator.maxTouchPoints > 3;
|
|
1359
|
+
var mobileOs = '';
|
|
1360
|
+
var clientStrings = [
|
|
1361
|
+
{ getName: function () { return 'Android'; }, r: /Android/ },
|
|
1362
|
+
{ getName: function () { return 'iOS'; }, r: /(iPhone|iPad|iPod)/ },
|
|
1363
|
+
|
|
1364
|
+
// iPad iOS running on Desktop mode
|
|
1365
|
+
{ getName: function () { return hasMultiTouchPoints ? 'iOS' : ''; }, r: /(Mac OS|MacPPC|MacIntel|Mac_PowerPC|Macintosh)/ }
|
|
1366
|
+
];
|
|
1367
|
+
for (var i = 0; i < clientStrings.length; i++) {
|
|
1368
|
+
var cs = clientStrings[i];
|
|
1369
|
+
if (cs.r.test(window.navigator.userAgent)) {
|
|
1370
|
+
mobileOs = cs.getName();
|
|
1371
|
+
break;
|
|
1348
1372
|
}
|
|
1349
|
-
|
|
1350
|
-
})();
|
|
1373
|
+
}
|
|
1351
1374
|
|
|
1375
|
+
$._supportedMobileDetected = $._mobileSupported && mobileOs !== '';
|
|
1352
1376
|
$.isSupportedMobile = $._supportedMobileDetected;
|
|
1353
1377
|
|
|
1354
1378
|
|
|
@@ -1399,7 +1423,7 @@ LacunaWebPKI = function (license) {
|
|
|
1399
1423
|
isIE = ($.detectedBrowser.indexOf('IE') >= 0);
|
|
1400
1424
|
isChrome = ($.detectedBrowser.indexOf('Chrome') >= 0);
|
|
1401
1425
|
isFirefox = ($.detectedBrowser.indexOf('Firefox') >= 0);
|
|
1402
|
-
isEdge = ($.detectedBrowser.indexOf('
|
|
1426
|
+
isEdge = ($.detectedBrowser.indexOf('Edg') >= 0);
|
|
1403
1427
|
isSafari = ($.detectedBrowser.indexOf('Safari') >= 0);
|
|
1404
1428
|
// mobile os
|
|
1405
1429
|
isAndroid = ($._supportedMobileDetected && mobileOs === 'Android');
|
|
@@ -1447,13 +1471,9 @@ LacunaWebPKI = function (license) {
|
|
|
1447
1471
|
command: command,
|
|
1448
1472
|
request: request
|
|
1449
1473
|
};
|
|
1450
|
-
if (isChrome) {
|
|
1451
|
-
var eventC = new CustomEvent(
|
|
1452
|
-
eventC.initEvent(requestEventName);
|
|
1474
|
+
if (isChrome || isEdge) {
|
|
1475
|
+
var eventC = new CustomEvent(requestEventName, { 'detail': message });
|
|
1453
1476
|
document.dispatchEvent(eventC);
|
|
1454
|
-
} else if (isEdge) {
|
|
1455
|
-
var eventE = new CustomEvent(requestEventName, { 'detail': message });
|
|
1456
|
-
document.dispatchEvent(eventE);
|
|
1457
1477
|
} else {
|
|
1458
1478
|
window.postMessage({
|
|
1459
1479
|
port: requestEventName,
|
|
@@ -1469,7 +1489,7 @@ LacunaWebPKI = function (license) {
|
|
|
1469
1489
|
|
|
1470
1490
|
var pollExtension = function (context, tryCount) {
|
|
1471
1491
|
$._log('polling extension');
|
|
1472
|
-
var meta = document.getElementById($._chromeExtensionId) || document.getElementById($._firefoxExtensionId.replace(/[^A-Za-z0-9_]/g, '_')) || document.getElementById($._edgeExtensionId);
|
|
1492
|
+
var meta = document.getElementById($._chromeExtensionId) || document.getElementById($._firefoxExtensionId.replace(/[^A-Za-z0-9_]/g, '_')) || document.getElementById($._edgeExtensionId) || document.getElementById($._edgeLegacyProductId);
|
|
1473
1493
|
if (meta === null) {
|
|
1474
1494
|
if (tryCount > 1) {
|
|
1475
1495
|
setTimeout(function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-pki",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "The Lacuna Web PKI component enables web applications to interact with digital certificates through javascript, without the need of Java.",
|
|
5
5
|
"main": "lacuna-web-pki.js",
|
|
6
6
|
"types": "lacuna-web-pki.d.ts",
|