tabris 3.9.0-dev.20231206 → 3.9.0-dev.20231208
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 +23 -4
- package/package.json +1 -1
- package/tabris.d.ts +1 -1
- package/tabris.js +83 -13
- package/tabris.min.js +1 -1
package/boot.js
CHANGED
package/globals.d.ts
CHANGED
|
@@ -605,7 +605,7 @@ declare class CryptoKey {
|
|
|
605
605
|
/**
|
|
606
606
|
* @constant
|
|
607
607
|
*/
|
|
608
|
-
readonly algorithm: {name: 'ECDH', namedCurve: 'P-256'};
|
|
608
|
+
readonly algorithm: {name: 'ECDH' | 'ECDSA', namedCurve: 'P-256'};
|
|
609
609
|
|
|
610
610
|
|
|
611
611
|
extractable: boolean;
|
|
@@ -1056,7 +1056,7 @@ declare class SubtleCrypto {
|
|
|
1056
1056
|
* @param format
|
|
1057
1057
|
* @param key
|
|
1058
1058
|
*/
|
|
1059
|
-
exportKey(format: 'raw' | 'spki', key: CryptoKey): Promise<ArrayBuffer>;
|
|
1059
|
+
exportKey(format: 'raw' | 'spki' | 'teeKeyHandle', key: CryptoKey): Promise<ArrayBuffer>;
|
|
1060
1060
|
|
|
1061
1061
|
/**
|
|
1062
1062
|
* Generates new keys. Currently only supports the Elliptic Curve Diffie-Hellman (ECDH) algorithm to
|
|
@@ -1064,8 +1064,9 @@ declare class SubtleCrypto {
|
|
|
1064
1064
|
* @param algorithm
|
|
1065
1065
|
* @param extractable
|
|
1066
1066
|
* @param keyUsages
|
|
1067
|
+
* @param options
|
|
1067
1068
|
*/
|
|
1068
|
-
generateKey(algorithm: {name: 'ECDH', namedCurve: 'P-256'}, extractable: boolean, keyUsages: string[]): Promise<{privateKey: CryptoKey, publicKey: CryptoKey}>;
|
|
1069
|
+
generateKey(algorithm: {name: 'ECDH' | 'ECDSA', namedCurve: 'P-256'}, extractable: boolean, keyUsages: string[], options?: {inTee?: boolean, usageRequiresAuth?: boolean}): Promise<{privateKey: CryptoKey, publicKey: CryptoKey}>;
|
|
1069
1070
|
|
|
1070
1071
|
/**
|
|
1071
1072
|
* Takes an external key in a portable format and returns a CryptoKey object that can be used with the
|
|
@@ -1076,7 +1077,25 @@ declare class SubtleCrypto {
|
|
|
1076
1077
|
* @param extractable
|
|
1077
1078
|
* @param keyUsages
|
|
1078
1079
|
*/
|
|
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>;
|
|
1080
|
+
importKey(format: 'spki' | 'pkcs8' | 'raw' | 'teeKeyHandle', keyData: ArrayBuffer | TypedArray, algorithm: {name: 'ECDH' | 'ECDSA', namedCurve: 'P-256'} | {name: 'AES-GCM'} | 'HKDF' | 'AES-GCM', extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* Signs the given data. Currently only supports creating ECDSA signatures in DER format.
|
|
1084
|
+
* @param algorithm
|
|
1085
|
+
* @param key
|
|
1086
|
+
* @param data
|
|
1087
|
+
*/
|
|
1088
|
+
sign(algorithm: {name: 'ECDSAinDERFormat', hash: 'SHA-256'}, key: CryptoKey, data: ArrayBuffer | TypedArray): Promise<ArrayBuffer>;
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* Verifies the given signature against the data. Currently only supports verifying ECDSA signatures in
|
|
1092
|
+
* DER format.
|
|
1093
|
+
* @param algorithm
|
|
1094
|
+
* @param key
|
|
1095
|
+
* @param signature
|
|
1096
|
+
* @param data
|
|
1097
|
+
*/
|
|
1098
|
+
verify(algorithm: {name: 'ECDSAinDERFormat', hash: 'SHA-256'}, key: CryptoKey, signature: ArrayBuffer | TypedArray, data: ArrayBuffer | TypedArray): Promise<boolean>;
|
|
1080
1099
|
}
|
|
1081
1100
|
|
|
1082
1101
|
|
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.20231208+0311
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2014, 2020 EclipseSource Inc.
|
|
5
5
|
* All rights reserved.
|
|
@@ -5034,7 +5034,7 @@ class Tabris extends NativeObject {
|
|
|
5034
5034
|
this.$publishProxies();
|
|
5035
5035
|
}
|
|
5036
5036
|
get version() {
|
|
5037
|
-
return '3.9.0-dev.
|
|
5037
|
+
return '3.9.0-dev.20231208+0311';
|
|
5038
5038
|
}
|
|
5039
5039
|
get started() {
|
|
5040
5040
|
return !!this._started;
|
|
@@ -10481,12 +10481,14 @@ class _CryptoKey extends NativeObject {
|
|
|
10481
10481
|
});
|
|
10482
10482
|
});
|
|
10483
10483
|
}
|
|
10484
|
-
generate(algorithm, extractable, keyUsages) {
|
|
10484
|
+
generate(algorithm, extractable, keyUsages, inTee, usageRequiresAuth) {
|
|
10485
10485
|
return __awaiter(this, void 0, void 0, function* () {
|
|
10486
10486
|
return new Promise$1((onSuccess, onError) => this._nativeCall('generate', {
|
|
10487
10487
|
algorithm,
|
|
10488
10488
|
extractable,
|
|
10489
10489
|
keyUsages,
|
|
10490
|
+
inTee,
|
|
10491
|
+
usageRequiresAuth,
|
|
10490
10492
|
onSuccess,
|
|
10491
10493
|
onError: wrapErrorCb(onError)
|
|
10492
10494
|
}));
|
|
@@ -10546,15 +10548,15 @@ class SubtleCrypto {
|
|
|
10546
10548
|
if (arguments.length !== 5) {
|
|
10547
10549
|
throw new TypeError(`Expected 5 arguments, got ${arguments.length}`);
|
|
10548
10550
|
}
|
|
10549
|
-
allowOnlyValues(format, ['spki', 'pkcs8', 'raw'], 'format');
|
|
10551
|
+
allowOnlyValues(format, ['spki', 'pkcs8', 'raw', 'teeKeyHandle'], 'format');
|
|
10550
10552
|
checkType(getBuffer(keyData), ArrayBuffer, { name: 'keyData' });
|
|
10551
10553
|
if (typeof algorithm === 'string') {
|
|
10552
|
-
allowOnlyValues(algorithm, ['
|
|
10554
|
+
allowOnlyValues(algorithm, ['AES-GCM', 'HKDF'], 'algorithm');
|
|
10553
10555
|
}
|
|
10554
10556
|
else {
|
|
10555
10557
|
checkType(algorithm, Object, { name: 'algorithm' });
|
|
10556
|
-
allowOnlyValues(algorithm.name, ['ECDH', 'AES-GCM'], 'algorithm.name');
|
|
10557
|
-
if (algorithm.name === 'ECDH') {
|
|
10558
|
+
allowOnlyValues(algorithm.name, ['ECDH', 'ECDSA', 'AES-GCM'], 'algorithm.name');
|
|
10559
|
+
if (algorithm.name === 'ECDH' || algorithm.name === 'ECDSA') {
|
|
10558
10560
|
allowOnlyKeys(algorithm, ['name', 'namedCurve']);
|
|
10559
10561
|
allowOnlyValues(algorithm.namedCurve, ['P-256'], 'algorithm.namedCurve');
|
|
10560
10562
|
}
|
|
@@ -10649,23 +10651,43 @@ class SubtleCrypto {
|
|
|
10649
10651
|
if (arguments.length !== 2) {
|
|
10650
10652
|
throw new TypeError(`Expected 2 arguments, got ${arguments.length}`);
|
|
10651
10653
|
}
|
|
10652
|
-
allowOnlyValues(format, ['raw', 'spki'], 'format');
|
|
10654
|
+
allowOnlyValues(format, ['raw', 'spki', 'teeKeyHandle'], 'format');
|
|
10653
10655
|
checkType(key, CryptoKey, { name: 'key' });
|
|
10654
10656
|
return new Promise$1((onSuccess, onReject) => this._nativeObject.subtleExportKey(format, key, onSuccess, onReject));
|
|
10655
10657
|
});
|
|
10656
10658
|
}
|
|
10657
|
-
generateKey(algorithm, extractable, keyUsages) {
|
|
10659
|
+
generateKey(algorithm, extractable, keyUsages, options) {
|
|
10658
10660
|
return __awaiter(this, arguments, void 0, function* () {
|
|
10659
|
-
if (arguments.length
|
|
10660
|
-
throw new TypeError(`Expected 3 arguments, got ${arguments.length}`);
|
|
10661
|
+
if (arguments.length < 3) {
|
|
10662
|
+
throw new TypeError(`Expected at least 3 arguments, got ${arguments.length}`);
|
|
10661
10663
|
}
|
|
10662
10664
|
allowOnlyKeys(algorithm, ['name', 'namedCurve']);
|
|
10663
|
-
allowOnlyValues(algorithm.name, ['ECDH'], 'algorithm.name');
|
|
10665
|
+
allowOnlyValues(algorithm.name, ['ECDH', 'ECDSA'], 'algorithm.name');
|
|
10664
10666
|
allowOnlyValues(algorithm.namedCurve, ['P-256'], 'algorithm.namedCurve');
|
|
10665
10667
|
checkType(extractable, Boolean, { name: 'extractable' });
|
|
10666
10668
|
checkType(keyUsages, Array, { name: 'keyUsages' });
|
|
10669
|
+
if (options != null) {
|
|
10670
|
+
allowOnlyKeys(options, ['inTee', 'usageRequiresAuth']);
|
|
10671
|
+
if ('inTee' in options) {
|
|
10672
|
+
checkType(options.inTee, Boolean, { name: 'options.inTee' });
|
|
10673
|
+
}
|
|
10674
|
+
if ('usageRequiresAuth' in options) {
|
|
10675
|
+
checkType(options.usageRequiresAuth, Boolean, { name: 'options.usageRequiresAuth' });
|
|
10676
|
+
}
|
|
10677
|
+
if (options.inTee && algorithm.name !== 'ECDSA') {
|
|
10678
|
+
throw new TypeError('options.inTee is only supported for ECDSA keys');
|
|
10679
|
+
}
|
|
10680
|
+
if (options.usageRequiresAuth && algorithm.name !== 'ECDSA') {
|
|
10681
|
+
throw new TypeError('options.usageRequiresAuth is only supported for ECDSA keys');
|
|
10682
|
+
}
|
|
10683
|
+
if (options.usageRequiresAuth && !options.inTee) {
|
|
10684
|
+
throw new TypeError('options.usageRequiresAuth is only supported for keys in TEE');
|
|
10685
|
+
}
|
|
10686
|
+
}
|
|
10687
|
+
const inTee = options === null || options === void 0 ? void 0 : options.inTee;
|
|
10688
|
+
const usageRequiresAuth = options === null || options === void 0 ? void 0 : options.usageRequiresAuth;
|
|
10667
10689
|
const nativeObject = new _CryptoKey();
|
|
10668
|
-
yield nativeObject.generate(algorithm, extractable, keyUsages);
|
|
10690
|
+
yield nativeObject.generate(algorithm, extractable, keyUsages, inTee, usageRequiresAuth);
|
|
10669
10691
|
const nativePrivate = new _CryptoKey(nativeObject, 'private');
|
|
10670
10692
|
const nativePublic = new _CryptoKey(nativeObject, 'public');
|
|
10671
10693
|
return {
|
|
@@ -10674,6 +10696,35 @@ class SubtleCrypto {
|
|
|
10674
10696
|
};
|
|
10675
10697
|
});
|
|
10676
10698
|
}
|
|
10699
|
+
sign(algorithm, key, data) {
|
|
10700
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
10701
|
+
if (arguments.length !== 3) {
|
|
10702
|
+
throw new TypeError(`Expected 3 arguments, got ${arguments.length}`);
|
|
10703
|
+
}
|
|
10704
|
+
allowOnlyKeys(algorithm, ['name', 'hash']);
|
|
10705
|
+
allowOnlyValues(algorithm.name, ['ECDSAinDERFormat'], 'algorithm.name');
|
|
10706
|
+
allowOnlyValues(algorithm.hash, ['SHA-256'], 'algorithm.hash');
|
|
10707
|
+
checkType(key, CryptoKey, { name: 'key' });
|
|
10708
|
+
checkType(algorithm.name, String, { name: 'algorithm.name' });
|
|
10709
|
+
checkType(algorithm.hash, String, { name: 'algorithm.hash' });
|
|
10710
|
+
checkType(getBuffer(data), ArrayBuffer, { name: 'data' });
|
|
10711
|
+
return new Promise$1((onSuccess, onError) => this._nativeObject.subtleSign(algorithm, key, data, onSuccess, onError));
|
|
10712
|
+
});
|
|
10713
|
+
}
|
|
10714
|
+
verify(algorithm, key, signature, data) {
|
|
10715
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
10716
|
+
if (arguments.length !== 4) {
|
|
10717
|
+
throw new TypeError(`Expected 4 arguments, got ${arguments.length}`);
|
|
10718
|
+
}
|
|
10719
|
+
allowOnlyKeys(algorithm, ['name', 'hash']);
|
|
10720
|
+
allowOnlyValues(algorithm.name, ['ECDSAinDERFormat'], 'algorithm.name');
|
|
10721
|
+
allowOnlyValues(algorithm.hash, ['SHA-256'], 'algorithm.hash');
|
|
10722
|
+
checkType(key, CryptoKey, { name: 'key' });
|
|
10723
|
+
checkType(getBuffer(signature), ArrayBuffer, { name: 'signature' });
|
|
10724
|
+
checkType(getBuffer(data), ArrayBuffer, { name: 'data' });
|
|
10725
|
+
return new Promise$1((onSuccess, onReject) => this._nativeObject.subtleVerify(algorithm, key, signature, data, onSuccess, onReject));
|
|
10726
|
+
});
|
|
10727
|
+
}
|
|
10677
10728
|
}
|
|
10678
10729
|
class NativeCrypto extends NativeObject {
|
|
10679
10730
|
static getInstance() {
|
|
@@ -10743,6 +10794,25 @@ class NativeCrypto extends NativeObject {
|
|
|
10743
10794
|
onError: (reason) => onError(new Error(String(reason)))
|
|
10744
10795
|
});
|
|
10745
10796
|
}
|
|
10797
|
+
subtleSign(algorithm, key, data, onSuccess, onError) {
|
|
10798
|
+
this._nativeCall('subtleSign', {
|
|
10799
|
+
algorithm,
|
|
10800
|
+
key: getCid(key),
|
|
10801
|
+
data: getBuffer(data),
|
|
10802
|
+
onSuccess,
|
|
10803
|
+
onError: (reason) => onError(new Error(String(reason)))
|
|
10804
|
+
});
|
|
10805
|
+
}
|
|
10806
|
+
subtleVerify(algorithm, key, signature, data, onSuccess, onError) {
|
|
10807
|
+
this._nativeCall('subtleVerify', {
|
|
10808
|
+
algorithm,
|
|
10809
|
+
key: getCid(key),
|
|
10810
|
+
signature: getBuffer(signature),
|
|
10811
|
+
data: getBuffer(data),
|
|
10812
|
+
onSuccess,
|
|
10813
|
+
onError: (reason) => onError(new Error(String(reason)))
|
|
10814
|
+
});
|
|
10815
|
+
}
|
|
10746
10816
|
}
|
|
10747
10817
|
function checkDeriveAlgorithm(algorithm) {
|
|
10748
10818
|
if (algorithm === 'HKDF') {
|