tabris 3.9.0-dev.20211117 → 3.9.0-dev.20211121
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/boot.js +1 -1
- package/globals.d.ts +88 -0
- package/package.json +1 -1
- package/tabris.d.ts +1 -1
- package/tabris.js +232 -17
- package/tabris.min.js +1 -1
package/boot.js
CHANGED
package/globals.d.ts
CHANGED
|
@@ -590,6 +590,38 @@ declare class Crypto {
|
|
|
590
590
|
|
|
591
591
|
declare var crypto: Crypto;
|
|
592
592
|
|
|
593
|
+
// CryptoKey
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Represents an in-memory cryptographic key to be used with the ${doc:SubtleCrypto} API.
|
|
597
|
+
*/
|
|
598
|
+
declare class CryptoKey {
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Represents an in-memory cryptographic key to be used with the ${doc:SubtleCrypto} API.
|
|
602
|
+
*/
|
|
603
|
+
private constructor();
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* @constant
|
|
607
|
+
*/
|
|
608
|
+
readonly algorithm: {name: 'ECDH', namedCurve: 'P-256'};
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
extractable: boolean;
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* @constant
|
|
615
|
+
*/
|
|
616
|
+
readonly type: 'secret' | 'private' | 'public';
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* @constant
|
|
620
|
+
*/
|
|
621
|
+
readonly usages: string[];
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
|
|
593
625
|
// File
|
|
594
626
|
|
|
595
627
|
/**
|
|
@@ -956,6 +988,25 @@ declare class SubtleCrypto {
|
|
|
956
988
|
*/
|
|
957
989
|
private constructor();
|
|
958
990
|
|
|
991
|
+
/**
|
|
992
|
+
* Decrypts the given raw data. Currently only supports the AES-GCM algorithm.
|
|
993
|
+
* @param algorithm
|
|
994
|
+
* @param key
|
|
995
|
+
* @param data
|
|
996
|
+
*/
|
|
997
|
+
decrypt(algorithm: {name: 'AES-GCM', iv: ArrayBuffer | TypedArray, tagLength?: number}, key: CryptoKey, data: ArrayBuffer | TypedArray): Promise<ArrayBuffer>;
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Takes a master key and derives a secret key from it using the given algorithm. Currently only
|
|
1001
|
+
* supports the Elliptic Curve Diffie-Hellman (ECDH) algorithm.
|
|
1002
|
+
* @param algorithm
|
|
1003
|
+
* @param baseKey
|
|
1004
|
+
* @param derivedKeyAlgorithm
|
|
1005
|
+
* @param extractable
|
|
1006
|
+
* @param keyUsages
|
|
1007
|
+
*/
|
|
1008
|
+
deriveKey(algorithm: {name: 'ECDH', namedCurve: 'P-256', public: CryptoKey}, baseKey: CryptoKey, derivedKeyAlgorithm: {name: 'AES-GCM', length: number}, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
|
|
1009
|
+
|
|
959
1010
|
/**
|
|
960
1011
|
* Provides the digest value of the given data as an ArrayBuffer. Fo this the method uses the hashing
|
|
961
1012
|
* algorithms provided by the operating system.
|
|
@@ -963,6 +1014,43 @@ declare class SubtleCrypto {
|
|
|
963
1014
|
* @param data The data to be digested.
|
|
964
1015
|
*/
|
|
965
1016
|
digest(algorithm: 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512', data: TypedArray | ArrayBuffer): Promise<ArrayBuffer>;
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Encrypts the given raw data. Currently only supports the AES-GCM algorithm.
|
|
1020
|
+
* @param algorithm
|
|
1021
|
+
* @param key
|
|
1022
|
+
* @param data
|
|
1023
|
+
*/
|
|
1024
|
+
encrypt(algorithm: {name: 'AES-GCM', iv: ArrayBuffer | TypedArray, tagLength?: number}, key: CryptoKey, data: ArrayBuffer | TypedArray): Promise<ArrayBuffer>;
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Converts a CryptoKey instances into a portable format. To export a key, the key must have extractable
|
|
1028
|
+
* set to true. Supports the spki format or raw bytes.
|
|
1029
|
+
* @param format
|
|
1030
|
+
* @param key
|
|
1031
|
+
*/
|
|
1032
|
+
exportKey(format: 'raw' | 'spki', key: CryptoKey): Promise<ArrayBuffer>;
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* Generates new keys. Currently only supports the Elliptic Curve Diffie-Hellman (ECDH) algorithm to
|
|
1036
|
+
* generate key pairs.
|
|
1037
|
+
* @param algorithm
|
|
1038
|
+
* @param extractable
|
|
1039
|
+
* @param keyUsages
|
|
1040
|
+
*/
|
|
1041
|
+
generateKey(algorithm: {name: 'ECDH', namedCurve: 'P-256'}, extractable: boolean, keyUsages: string[]): Promise<{privateKey: CryptoKey, publicKey: CryptoKey}>;
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* Takes an external key in a portable format and returns a CryptoKey object that can be used with the
|
|
1045
|
+
* SubtleCrypto API. Currently only supports the Elliptic Curve Diffie-Hellman (ECDH) algorithm. Keys
|
|
1046
|
+
* may be in spki or pkcs8 format.
|
|
1047
|
+
* @param format
|
|
1048
|
+
* @param keyData
|
|
1049
|
+
* @param algorithm
|
|
1050
|
+
* @param extractable
|
|
1051
|
+
* @param keyUsages
|
|
1052
|
+
*/
|
|
1053
|
+
importKey(format: 'spki' | 'pkcs8', keyData: ArrayBuffer | TypedArray, algorithm: {name: 'ECDH', namedCurve: 'P-256'}, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
|
|
966
1054
|
}
|
|
967
1055
|
|
|
968
1056
|
|
package/package.json
CHANGED
package/tabris.d.ts
CHANGED
package/tabris.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Tabris.js 3.9.0-dev.
|
|
2
|
+
* Tabris.js 3.9.0-dev.20211121+0310
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2014, 2020 EclipseSource Inc.
|
|
5
5
|
* All rights reserved.
|
|
@@ -962,11 +962,11 @@ function setBytes(blob, bytes$$1) {
|
|
|
962
962
|
*/
|
|
963
963
|
function allowOnlyKeys(target, keys) {
|
|
964
964
|
if (typeof target !== 'object') {
|
|
965
|
-
throw new
|
|
965
|
+
throw new TypeError(toValueString(target) + ' is not an object');
|
|
966
966
|
}
|
|
967
967
|
for (const key in target) {
|
|
968
968
|
if (keys.indexOf(/** @type {U} */ (key)) === -1) {
|
|
969
|
-
throw new
|
|
969
|
+
throw new TypeError(`${toValueString(target)} contains unexpected entry "${key}"`);
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
972
|
return target;
|
|
@@ -979,8 +979,10 @@ function allowOnlyKeys(target, keys) {
|
|
|
979
979
|
*/
|
|
980
980
|
function allowOnlyValues(value, allowed, valueName = 'Value') {
|
|
981
981
|
if (allowed && allowed.indexOf(value) === -1) {
|
|
982
|
-
const expected =
|
|
983
|
-
|
|
982
|
+
const expected = allowed.length === 1
|
|
983
|
+
? `"${allowed}"`
|
|
984
|
+
: `"${allowed.slice(0, -1).join('", "')}" or "${allowed.slice(-1)}"`;
|
|
985
|
+
throw new TypeError(`${valueName} must be ${expected}, got ${toValueString(value)}`);
|
|
984
986
|
}
|
|
985
987
|
return value;
|
|
986
988
|
}
|
|
@@ -998,6 +1000,22 @@ function setNativeObject(object, nativeObject$$1) {
|
|
|
998
1000
|
function getNativeObject(object) {
|
|
999
1001
|
return object instanceof Object ? object[nativeObject] : null;
|
|
1000
1002
|
}
|
|
1003
|
+
/**
|
|
1004
|
+
* @param {object} object
|
|
1005
|
+
* @returns {string}
|
|
1006
|
+
*/
|
|
1007
|
+
function getCid(object) {
|
|
1008
|
+
return getNativeObject(object).cid;
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* @param {ArrayBuffer | ArrayLike<number>} data
|
|
1012
|
+
* @returns {ArrayBuffer}
|
|
1013
|
+
*/
|
|
1014
|
+
function getBuffer(object) {
|
|
1015
|
+
return object instanceof ArrayBuffer
|
|
1016
|
+
? object
|
|
1017
|
+
: ArrayBuffer.isView(object) ? object.buffer : null;
|
|
1018
|
+
}
|
|
1001
1019
|
/**
|
|
1002
1020
|
* @param {Function} cb
|
|
1003
1021
|
* @param {object=} target
|
|
@@ -5008,7 +5026,7 @@ class Tabris extends NativeObject {
|
|
|
5008
5026
|
this.$publishProxies();
|
|
5009
5027
|
}
|
|
5010
5028
|
get version() {
|
|
5011
|
-
return '3.9.0-dev.
|
|
5029
|
+
return '3.9.0-dev.20211121+0310';
|
|
5012
5030
|
}
|
|
5013
5031
|
get started() {
|
|
5014
5032
|
return !!this._started;
|
|
@@ -10378,6 +10396,69 @@ NativeObject.defineProperties(CameraView.prototype, {
|
|
|
10378
10396
|
}
|
|
10379
10397
|
});
|
|
10380
10398
|
|
|
10399
|
+
class CryptoKey {
|
|
10400
|
+
constructor(nativeObject, data) {
|
|
10401
|
+
if (!(nativeObject instanceof _CryptoKey)) {
|
|
10402
|
+
throw new TypeError('Illegal constructor');
|
|
10403
|
+
}
|
|
10404
|
+
setNativeObject(this, nativeObject);
|
|
10405
|
+
Object.assign(this, data);
|
|
10406
|
+
Object.freeze(this);
|
|
10407
|
+
}
|
|
10408
|
+
}
|
|
10409
|
+
class _CryptoKey extends NativeObject {
|
|
10410
|
+
constructor(keyPair, type) {
|
|
10411
|
+
super(keyPair ? { parent: keyPair.cid, type } : {});
|
|
10412
|
+
}
|
|
10413
|
+
get _nativeType() {
|
|
10414
|
+
return 'tabris.CryptoKey';
|
|
10415
|
+
}
|
|
10416
|
+
import(format, keyData, algorithm, extractable, keyUsages) {
|
|
10417
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10418
|
+
return new Promise$1((onSuccess, onError) => this._nativeCall('import', {
|
|
10419
|
+
format,
|
|
10420
|
+
keyData: getBuffer(keyData),
|
|
10421
|
+
algorithm,
|
|
10422
|
+
extractable,
|
|
10423
|
+
keyUsages,
|
|
10424
|
+
onSuccess,
|
|
10425
|
+
onError: wrapErrorCb(onError)
|
|
10426
|
+
}));
|
|
10427
|
+
});
|
|
10428
|
+
}
|
|
10429
|
+
derive(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages) {
|
|
10430
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10431
|
+
return new Promise$1((onSuccess, onError) => this._nativeCall('derive', {
|
|
10432
|
+
algorithm: Object.assign(Object.assign({}, algorithm), { public: getCid(algorithm.public) }),
|
|
10433
|
+
baseKey: getCid(baseKey),
|
|
10434
|
+
derivedKeyAlgorithm,
|
|
10435
|
+
extractable,
|
|
10436
|
+
keyUsages,
|
|
10437
|
+
onSuccess,
|
|
10438
|
+
onError: wrapErrorCb(onError)
|
|
10439
|
+
}));
|
|
10440
|
+
});
|
|
10441
|
+
}
|
|
10442
|
+
generate(algorithm, extractable, keyUsages) {
|
|
10443
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
10444
|
+
return new Promise$1((onSuccess, onError) => this._nativeCall('generate', {
|
|
10445
|
+
algorithm,
|
|
10446
|
+
extractable,
|
|
10447
|
+
keyUsages,
|
|
10448
|
+
onSuccess,
|
|
10449
|
+
onError: wrapErrorCb(onError)
|
|
10450
|
+
}));
|
|
10451
|
+
});
|
|
10452
|
+
}
|
|
10453
|
+
}
|
|
10454
|
+
NativeObject.defineProperties(_CryptoKey.prototype, {
|
|
10455
|
+
parent: { type: 'string', const: true, nocache: true },
|
|
10456
|
+
type: { type: 'string', const: true, nocache: true, choice: ['public', 'private'] }
|
|
10457
|
+
});
|
|
10458
|
+
function wrapErrorCb(onError) {
|
|
10459
|
+
return (reason) => onError(new Error(String(reason)));
|
|
10460
|
+
}
|
|
10461
|
+
|
|
10381
10462
|
class Crypto {
|
|
10382
10463
|
constructor() {
|
|
10383
10464
|
Object.defineProperties(this, {
|
|
@@ -10389,7 +10470,9 @@ class Crypto {
|
|
|
10389
10470
|
if (arguments.length === 0) {
|
|
10390
10471
|
throw new Error('Not enough arguments to Crypto.getRandomValues');
|
|
10391
10472
|
}
|
|
10392
|
-
if (!
|
|
10473
|
+
if (!ArrayBuffer.isView(typedArray)
|
|
10474
|
+
|| typedArray instanceof Float32Array
|
|
10475
|
+
|| typedArray instanceof Float64Array) {
|
|
10393
10476
|
throw new Error(`Argument ${toValueString(typedArray)} is not an accepted array type`);
|
|
10394
10477
|
}
|
|
10395
10478
|
return this._nativeObject.getRandomValues(typedArray);
|
|
@@ -10410,12 +10493,116 @@ class SubtleCrypto {
|
|
|
10410
10493
|
if (!validAlgorithms.has(algorithm)) {
|
|
10411
10494
|
return Promise$1.reject(new TypeError(`Algorithm: Unrecognized name ${algorithm}`));
|
|
10412
10495
|
}
|
|
10413
|
-
if (!
|
|
10496
|
+
if (!getBuffer(data)) {
|
|
10414
10497
|
return Promise$1.reject(new TypeError(`Argument ${toValueString(data)} is not an accepted array type`));
|
|
10415
10498
|
}
|
|
10416
10499
|
return new Promise$1((resolve, reject) => this._nativeObject.subtleDigest({ algorithm, data, resolve, reject }));
|
|
10417
10500
|
});
|
|
10418
10501
|
}
|
|
10502
|
+
importKey(format, keyData, algorithm, extractable, keyUsages) {
|
|
10503
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
10504
|
+
if (arguments.length !== 5) {
|
|
10505
|
+
throw new TypeError(`Expected 5 arguments, got ${arguments.length}`);
|
|
10506
|
+
}
|
|
10507
|
+
allowOnlyValues(format, ['spki', 'pkcs8'], 'format');
|
|
10508
|
+
checkType(getBuffer(keyData), ArrayBuffer, { name: 'keyData' });
|
|
10509
|
+
allowOnlyKeys(algorithm, ['name', 'namedCurve']);
|
|
10510
|
+
allowOnlyValues(algorithm.name, ['ECDH'], 'algorithm.name');
|
|
10511
|
+
allowOnlyValues(algorithm.namedCurve, ['P-256'], 'algorithm.namedCurve');
|
|
10512
|
+
checkType(extractable, Boolean, { name: 'extractable' });
|
|
10513
|
+
checkType(keyUsages, Array, { name: 'keyUsages' });
|
|
10514
|
+
const nativeObject = new _CryptoKey();
|
|
10515
|
+
yield nativeObject.import(format, keyData, algorithm, extractable, keyUsages);
|
|
10516
|
+
return new CryptoKey(nativeObject, {
|
|
10517
|
+
algorithm,
|
|
10518
|
+
extractable,
|
|
10519
|
+
usages: Object.freeze(keyUsages.concat())
|
|
10520
|
+
});
|
|
10521
|
+
});
|
|
10522
|
+
}
|
|
10523
|
+
deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages) {
|
|
10524
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
10525
|
+
if (arguments.length !== 5) {
|
|
10526
|
+
throw new TypeError(`Expected 5 arguments, got ${arguments.length}`);
|
|
10527
|
+
}
|
|
10528
|
+
allowOnlyKeys(algorithm, ['name', 'namedCurve', 'public']);
|
|
10529
|
+
allowOnlyValues(algorithm.name, ['ECDH'], 'algorithm.name');
|
|
10530
|
+
allowOnlyValues(algorithm.namedCurve, ['P-256'], 'algorithm.namedCurve');
|
|
10531
|
+
checkType(algorithm.public, CryptoKey, { name: 'algorithm.public' });
|
|
10532
|
+
allowOnlyKeys(derivedKeyAlgorithm, ['name', 'length']);
|
|
10533
|
+
allowOnlyValues(derivedKeyAlgorithm.name, ['AES-GCM'], 'derivedKeyAlgorithm.name');
|
|
10534
|
+
checkType(derivedKeyAlgorithm.length, Number, { name: 'derivedKeyAlgorithm.length' });
|
|
10535
|
+
checkType(baseKey, CryptoKey, { name: 'baseKey' });
|
|
10536
|
+
checkType(extractable, Boolean, { name: 'extractable' });
|
|
10537
|
+
checkType(keyUsages, Array, { name: 'keyUsages' });
|
|
10538
|
+
const nativeObject = new _CryptoKey();
|
|
10539
|
+
yield nativeObject.derive(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages);
|
|
10540
|
+
return new CryptoKey(nativeObject, {
|
|
10541
|
+
algorithm,
|
|
10542
|
+
extractable,
|
|
10543
|
+
type: 'secret',
|
|
10544
|
+
usages: Object.freeze(keyUsages.concat())
|
|
10545
|
+
});
|
|
10546
|
+
});
|
|
10547
|
+
}
|
|
10548
|
+
decrypt(algorithm, key, data) {
|
|
10549
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
10550
|
+
if (arguments.length !== 3) {
|
|
10551
|
+
throw new TypeError(`Expected 3 arguments, got ${arguments.length}`);
|
|
10552
|
+
}
|
|
10553
|
+
allowOnlyKeys(algorithm, ['name', 'iv', 'tagLength']);
|
|
10554
|
+
allowOnlyValues(algorithm.name, ['AES-GCM'], 'algorithm.name');
|
|
10555
|
+
checkType(algorithm.tagLength, Number, { name: 'algorithm.tagLength', nullable: true });
|
|
10556
|
+
checkType(getBuffer(algorithm.iv), ArrayBuffer, { name: 'algorithm.iv' });
|
|
10557
|
+
checkType(key, CryptoKey, { name: 'key' });
|
|
10558
|
+
checkType(getBuffer(data), ArrayBuffer, { name: 'data' });
|
|
10559
|
+
return new Promise$1((onSuccess, onReject) => this._nativeObject.subtleDecrypt(algorithm, key, data, onSuccess, onReject));
|
|
10560
|
+
});
|
|
10561
|
+
}
|
|
10562
|
+
encrypt(algorithm, key, data) {
|
|
10563
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
10564
|
+
if (arguments.length !== 3) {
|
|
10565
|
+
throw new TypeError(`Expected 3 arguments, got ${arguments.length}`);
|
|
10566
|
+
}
|
|
10567
|
+
allowOnlyKeys(algorithm, ['name', 'iv', 'tagLength']);
|
|
10568
|
+
allowOnlyValues(algorithm.name, ['AES-GCM'], 'algorithm.name');
|
|
10569
|
+
checkType(algorithm.tagLength, Number, { name: 'algorithm.tagLength', nullable: true });
|
|
10570
|
+
checkType(getBuffer(algorithm.iv), ArrayBuffer, { name: 'algorithm.iv' });
|
|
10571
|
+
checkType(key, CryptoKey, { name: 'key' });
|
|
10572
|
+
checkType(getBuffer(data), ArrayBuffer, { name: 'data' });
|
|
10573
|
+
return new Promise$1((onSuccess, onReject) => this._nativeObject.subtleEncrypt(algorithm, key, data, onSuccess, onReject));
|
|
10574
|
+
});
|
|
10575
|
+
}
|
|
10576
|
+
exportKey(format, key) {
|
|
10577
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
10578
|
+
if (arguments.length !== 2) {
|
|
10579
|
+
throw new TypeError(`Expected 2 arguments, got ${arguments.length}`);
|
|
10580
|
+
}
|
|
10581
|
+
allowOnlyValues(format, ['raw', 'spki'], 'format');
|
|
10582
|
+
checkType(key, CryptoKey, { name: 'key' });
|
|
10583
|
+
return new Promise$1((onSuccess, onReject) => this._nativeObject.subtleExportKey(format, key, onSuccess, onReject));
|
|
10584
|
+
});
|
|
10585
|
+
}
|
|
10586
|
+
generateKey(algorithm, extractable, keyUsages) {
|
|
10587
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
10588
|
+
if (arguments.length !== 3) {
|
|
10589
|
+
throw new TypeError(`Expected 3 arguments, got ${arguments.length}`);
|
|
10590
|
+
}
|
|
10591
|
+
allowOnlyKeys(algorithm, ['name', 'namedCurve']);
|
|
10592
|
+
allowOnlyValues(algorithm.name, ['ECDH'], 'algorithm.name');
|
|
10593
|
+
allowOnlyValues(algorithm.namedCurve, ['P-256'], 'algorithm.namedCurve');
|
|
10594
|
+
checkType(extractable, Boolean, { name: 'extractable' });
|
|
10595
|
+
checkType(keyUsages, Array, { name: 'keyUsages' });
|
|
10596
|
+
const nativeObject = new _CryptoKey();
|
|
10597
|
+
yield nativeObject.generate(algorithm, extractable, keyUsages);
|
|
10598
|
+
const nativePrivate = new _CryptoKey(nativeObject, 'private');
|
|
10599
|
+
const nativePublic = new _CryptoKey(nativeObject, 'public');
|
|
10600
|
+
return {
|
|
10601
|
+
privateKey: new CryptoKey(nativePrivate, { algorithm, extractable }),
|
|
10602
|
+
publicKey: new CryptoKey(nativePublic, { algorithm, extractable })
|
|
10603
|
+
};
|
|
10604
|
+
});
|
|
10605
|
+
}
|
|
10419
10606
|
}
|
|
10420
10607
|
class NativeCrypto extends NativeObject {
|
|
10421
10608
|
static getInstance() {
|
|
@@ -10449,15 +10636,42 @@ class NativeCrypto extends NativeObject {
|
|
|
10449
10636
|
onError: (reason) => arg.reject(new Error(String(reason)))
|
|
10450
10637
|
});
|
|
10451
10638
|
}
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10639
|
+
subtleDecrypt(algorithm, key, data, onSuccess, onError) {
|
|
10640
|
+
const { name, iv, tagLength } = algorithm;
|
|
10641
|
+
this._nativeCall('subtleDecrypt', {
|
|
10642
|
+
algorithm: {
|
|
10643
|
+
name,
|
|
10644
|
+
iv: getBuffer(iv),
|
|
10645
|
+
tagLength: isNaN(tagLength) ? 128 : tagLength
|
|
10646
|
+
},
|
|
10647
|
+
key: getNativeObject(key).cid,
|
|
10648
|
+
data: ArrayBuffer.isView(data) ? data.buffer : data,
|
|
10649
|
+
onSuccess,
|
|
10650
|
+
onError: (reason) => onError(new Error(String(reason)))
|
|
10651
|
+
});
|
|
10652
|
+
}
|
|
10653
|
+
subtleExportKey(format, key, onSuccess, onError) {
|
|
10654
|
+
this._nativeCall('subtleExportKey', {
|
|
10655
|
+
format,
|
|
10656
|
+
key: getCid(key),
|
|
10657
|
+
onSuccess,
|
|
10658
|
+
onError: (reason) => onError(new Error(String(reason)))
|
|
10659
|
+
});
|
|
10660
|
+
}
|
|
10661
|
+
subtleEncrypt(algorithm, key, data, onSuccess, onError) {
|
|
10662
|
+
const { name, iv, tagLength } = algorithm;
|
|
10663
|
+
this._nativeCall('subtleEncrypt', {
|
|
10664
|
+
algorithm: {
|
|
10665
|
+
name,
|
|
10666
|
+
iv: getBuffer(iv),
|
|
10667
|
+
tagLength: isNaN(tagLength) ? 128 : tagLength
|
|
10668
|
+
},
|
|
10669
|
+
key: getCid(key),
|
|
10670
|
+
data: getBuffer(data),
|
|
10671
|
+
onSuccess,
|
|
10672
|
+
onError: (reason) => onError(new Error(String(reason)))
|
|
10673
|
+
});
|
|
10674
|
+
}
|
|
10461
10675
|
}
|
|
10462
10676
|
|
|
10463
10677
|
class Drawer extends ContentView {
|
|
@@ -13211,6 +13425,7 @@ const POPUPS = Object.freeze({
|
|
|
13211
13425
|
const WHATWG = Object.freeze({
|
|
13212
13426
|
Blob,
|
|
13213
13427
|
Crypto,
|
|
13428
|
+
CryptoKey,
|
|
13214
13429
|
Event,
|
|
13215
13430
|
File,
|
|
13216
13431
|
FormData,
|