tabris 3.9.0-dev.20220709 → 3.9.0-dev.20220712
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 +2 -3
- package/package.json +1 -1
- package/tabris.d.ts +1 -1
- package/tabris.js +35 -9
- package/tabris.min.js +1 -1
package/boot.js
CHANGED
package/globals.d.ts
CHANGED
|
@@ -1069,15 +1069,14 @@ declare class SubtleCrypto {
|
|
|
1069
1069
|
|
|
1070
1070
|
/**
|
|
1071
1071
|
* Takes an external key in a portable format and returns a CryptoKey object that can be used with the
|
|
1072
|
-
* SubtleCrypto API.
|
|
1073
|
-
* may be in spki or pkcs8 format.
|
|
1072
|
+
* SubtleCrypto API. Keys may be in spki or pkcs8 format.
|
|
1074
1073
|
* @param format
|
|
1075
1074
|
* @param keyData
|
|
1076
1075
|
* @param algorithm
|
|
1077
1076
|
* @param extractable
|
|
1078
1077
|
* @param keyUsages
|
|
1079
1078
|
*/
|
|
1080
|
-
importKey(format: 'spki' | 'pkcs8', keyData: ArrayBuffer | TypedArray, algorithm: {name: 'ECDH', namedCurve: 'P-256'}, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
|
|
1079
|
+
importKey(format: 'spki' | 'pkcs8' | 'raw', keyData: ArrayBuffer | TypedArray, algorithm: {name: 'ECDH', namedCurve: 'P-256'} | {name: 'AES-GCM'} | 'HKDF' | 'AES-GCM', extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
|
|
1081
1080
|
}
|
|
1082
1081
|
|
|
1083
1082
|
|
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.20220712+0310
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2014, 2020 EclipseSource Inc.
|
|
5
5
|
* All rights reserved.
|
|
@@ -5035,7 +5035,7 @@ class Tabris extends NativeObject {
|
|
|
5035
5035
|
this.$publishProxies();
|
|
5036
5036
|
}
|
|
5037
5037
|
get version() {
|
|
5038
|
-
return '3.9.0-dev.
|
|
5038
|
+
return '3.9.0-dev.20220712+0310';
|
|
5039
5039
|
}
|
|
5040
5040
|
get started() {
|
|
5041
5041
|
return !!this._started;
|
|
@@ -10438,6 +10438,9 @@ class _CryptoKey extends NativeObject {
|
|
|
10438
10438
|
derive(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages) {
|
|
10439
10439
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10440
10440
|
return new Promise$1((onSuccess, onError) => {
|
|
10441
|
+
if (typeof algorithm === 'string') {
|
|
10442
|
+
throw new TypeError(algorithm + ' not supported');
|
|
10443
|
+
}
|
|
10441
10444
|
if (algorithm.name === 'ECDH') {
|
|
10442
10445
|
return this._nativeCall('derive', {
|
|
10443
10446
|
algorithm: Object.assign(Object.assign({}, algorithm), { public: getCid(algorithm.public) }),
|
|
@@ -10449,7 +10452,7 @@ class _CryptoKey extends NativeObject {
|
|
|
10449
10452
|
onError: wrapErrorCb(onError)
|
|
10450
10453
|
});
|
|
10451
10454
|
}
|
|
10452
|
-
else {
|
|
10455
|
+
else if (algorithm.name === 'HKDF') {
|
|
10453
10456
|
return this._nativeCall('derive', {
|
|
10454
10457
|
algorithm: Object.assign(Object.assign({}, algorithm), { salt: getBuffer(algorithm.salt), info: getBuffer(algorithm.info) }),
|
|
10455
10458
|
baseKey: getCid(baseKey),
|
|
@@ -10460,6 +10463,9 @@ class _CryptoKey extends NativeObject {
|
|
|
10460
10463
|
onError: wrapErrorCb(onError)
|
|
10461
10464
|
});
|
|
10462
10465
|
}
|
|
10466
|
+
else {
|
|
10467
|
+
throw new TypeError('Algorithm not supported');
|
|
10468
|
+
}
|
|
10463
10469
|
});
|
|
10464
10470
|
});
|
|
10465
10471
|
}
|
|
@@ -10528,17 +10534,31 @@ class SubtleCrypto {
|
|
|
10528
10534
|
if (arguments.length !== 5) {
|
|
10529
10535
|
throw new TypeError(`Expected 5 arguments, got ${arguments.length}`);
|
|
10530
10536
|
}
|
|
10531
|
-
allowOnlyValues(format, ['spki', 'pkcs8'], 'format');
|
|
10537
|
+
allowOnlyValues(format, ['spki', 'pkcs8', 'raw'], 'format');
|
|
10532
10538
|
checkType(getBuffer(keyData), ArrayBuffer, { name: 'keyData' });
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
|
|
10539
|
+
if (typeof algorithm === 'string') {
|
|
10540
|
+
allowOnlyValues(algorithm, ['ECDH', 'AES-GCM', 'HKDF'], 'algorithm');
|
|
10541
|
+
}
|
|
10542
|
+
else {
|
|
10543
|
+
checkType(algorithm, Object, { name: 'algorithm' });
|
|
10544
|
+
allowOnlyValues(algorithm.name, ['ECDH', 'AES-GCM'], 'algorithm.name');
|
|
10545
|
+
if (algorithm.name === 'ECDH') {
|
|
10546
|
+
allowOnlyKeys(algorithm, ['name', 'namedCurve']);
|
|
10547
|
+
allowOnlyValues(algorithm.namedCurve, ['P-256'], 'algorithm.namedCurve');
|
|
10548
|
+
}
|
|
10549
|
+
else {
|
|
10550
|
+
allowOnlyKeys(algorithm, ['name']);
|
|
10551
|
+
}
|
|
10552
|
+
}
|
|
10536
10553
|
checkType(extractable, Boolean, { name: 'extractable' });
|
|
10537
10554
|
checkType(keyUsages, Array, { name: 'keyUsages' });
|
|
10538
10555
|
const nativeObject = new _CryptoKey();
|
|
10539
|
-
|
|
10556
|
+
const algorithmKeys = Object.keys(algorithm);
|
|
10557
|
+
const algorithmInternal = algorithmKeys.length === 1 && algorithmKeys[0] === 'name'
|
|
10558
|
+
? algorithm.name : algorithm;
|
|
10559
|
+
yield nativeObject.import(format, keyData, algorithmInternal, extractable, keyUsages);
|
|
10540
10560
|
return new CryptoKey(nativeObject, {
|
|
10541
|
-
algorithm,
|
|
10561
|
+
algorithm: algorithmInternal,
|
|
10542
10562
|
extractable,
|
|
10543
10563
|
usages: Object.freeze(keyUsages.concat())
|
|
10544
10564
|
});
|
|
@@ -10713,6 +10733,12 @@ class NativeCrypto extends NativeObject {
|
|
|
10713
10733
|
}
|
|
10714
10734
|
}
|
|
10715
10735
|
function checkDeriveAlgorithm(algorithm) {
|
|
10736
|
+
if (algorithm === 'HKDF') {
|
|
10737
|
+
return;
|
|
10738
|
+
}
|
|
10739
|
+
if (algorithm === 'AES-GCM') {
|
|
10740
|
+
throw new TypeError('AES-GCM not supported for this function');
|
|
10741
|
+
}
|
|
10716
10742
|
allowOnlyKeys(algorithm, ['name', 'namedCurve', 'public', 'hash', 'salt', 'info']);
|
|
10717
10743
|
allowOnlyValues(algorithm.name, ['ECDH', 'HKDF'], 'algorithm.name');
|
|
10718
10744
|
if (algorithm.name === 'ECDH') {
|