tabris 3.9.0-dev.20220708 → 3.9.0-dev.20220709

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Tabris.js 3.9.0-dev.20220708+0310
2
+ * Tabris.js 3.9.0-dev.20220709+0310
3
3
  *
4
4
  * Copyright (c) 2014, 2020 EclipseSource Inc.
5
5
  * All rights reserved.
package/globals.d.ts CHANGED
@@ -997,7 +997,24 @@ declare class SubtleCrypto {
997
997
  decrypt(algorithm: {name: 'AES-GCM', iv: ArrayBuffer | TypedArray, tagLength?: number}, key: CryptoKey, data: ArrayBuffer | TypedArray): Promise<ArrayBuffer>;
998
998
 
999
999
  /**
1000
- * Takes a master key and derives a secret key from it using the Elliptic Curve Diffie-Hellman (ECDH)
1000
+ * Takes a base key and derives an array of bits from it using the Elliptic Curve Diffie-Hellman (ECDH)
1001
+ * algorithm.
1002
+ * @param algorithm
1003
+ * @param baseKey
1004
+ * @param length
1005
+ */
1006
+ deriveBits(algorithm: {name: 'ECDH', namedCurve: 'P-256', public: CryptoKey}, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
1007
+
1008
+ /**
1009
+ * Takes a base key and derives an array of bits from it using the HKDF algorithm.
1010
+ * @param algorithm
1011
+ * @param baseKey
1012
+ * @param length
1013
+ */
1014
+ deriveBits(algorithm: {name: 'HKDF', hash: 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512', salt: ArrayBuffer | TypedArray, info: ArrayBuffer | TypedArray}, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
1015
+
1016
+ /**
1017
+ * Takes a base key and derives a secret key from it using the Elliptic Curve Diffie-Hellman (ECDH)
1001
1018
  * algorithm.
1002
1019
  * @param algorithm
1003
1020
  * @param baseKey
@@ -1008,7 +1025,7 @@ declare class SubtleCrypto {
1008
1025
  deriveKey(algorithm: {name: 'ECDH', namedCurve: 'P-256', public: CryptoKey}, baseKey: CryptoKey, derivedKeyAlgorithm: {name: 'AES-GCM', length: number}, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
1009
1026
 
1010
1027
  /**
1011
- * Takes a master key and derives a secret key from it using the HKDF algorithm.
1028
+ * Takes a base key and derives a secret key from it using the HKDF algorithm.
1012
1029
  * @param algorithm
1013
1030
  * @param baseKey
1014
1031
  * @param derivedKeyAlgorithm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabris",
3
- "version": "3.9.0-dev.20220708+0310",
3
+ "version": "3.9.0-dev.20220709+0310",
4
4
  "description": "Mobile apps with native UIs in JavaScript",
5
5
  "keywords": [
6
6
  "native",
package/tabris.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for Tabris.js 3.9.0-dev.20220708+0310
1
+ // Type definitions for Tabris.js 3.9.0-dev.20220709+0310
2
2
  /// <reference path="globals.d.ts" />
3
3
 
4
4
  // General helper types
package/tabris.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Tabris.js 3.9.0-dev.20220708+0310
2
+ * Tabris.js 3.9.0-dev.20220709+0310
3
3
  *
4
4
  * Copyright (c) 2014, 2020 EclipseSource Inc.
5
5
  * All rights reserved.
@@ -998,7 +998,16 @@ function setNativeObject(object, nativeObject$$1) {
998
998
  * @returns {{cid: string, isDisposed: () => boolean, dispose: () => void}}
999
999
  */
1000
1000
  function getNativeObject(object) {
1001
- return object instanceof Object ? object[nativeObject] : null;
1001
+ if (!(object instanceof Object)) {
1002
+ return null;
1003
+ }
1004
+ if (object[nativeObject]) {
1005
+ return object[nativeObject];
1006
+ }
1007
+ if (typeof object.cid === 'string' && object.isDisposed instanceof Function) {
1008
+ return object;
1009
+ }
1010
+ return null;
1002
1011
  }
1003
1012
  /**
1004
1013
  * @param {object} object
@@ -5026,7 +5035,7 @@ class Tabris extends NativeObject {
5026
5035
  this.$publishProxies();
5027
5036
  }
5028
5037
  get version() {
5029
- return '3.9.0-dev.20220708+0310';
5038
+ return '3.9.0-dev.20220709+0310';
5030
5039
  }
5031
5040
  get started() {
5032
5041
  return !!this._started;
@@ -10535,22 +10544,30 @@ class SubtleCrypto {
10535
10544
  });
10536
10545
  });
10537
10546
  }
10547
+ deriveBits(algorithm, baseKey, length) {
10548
+ return __awaiter(this, arguments, void 0, function* () {
10549
+ if (arguments.length !== 3) {
10550
+ throw new TypeError(`Expected 3 arguments, got ${arguments.length}`);
10551
+ }
10552
+ checkDeriveAlgorithm(algorithm);
10553
+ checkType(baseKey, CryptoKey, { name: 'baseKey' });
10554
+ checkType(length, Number, { name: 'length' });
10555
+ const nativeObject = new _CryptoKey();
10556
+ try {
10557
+ yield nativeObject.derive(algorithm, baseKey, { length, name: 'AES-GCM' }, true, []);
10558
+ return new Promise$1((onSuccess, onReject) => this._nativeObject.subtleExportKey('raw', nativeObject, onSuccess, onReject));
10559
+ }
10560
+ finally {
10561
+ nativeObject.dispose();
10562
+ }
10563
+ });
10564
+ }
10538
10565
  deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages) {
10539
10566
  return __awaiter(this, arguments, void 0, function* () {
10540
10567
  if (arguments.length !== 5) {
10541
10568
  throw new TypeError(`Expected 5 arguments, got ${arguments.length}`);
10542
10569
  }
10543
- allowOnlyKeys(algorithm, ['name', 'namedCurve', 'public', 'hash', 'salt', 'info']);
10544
- allowOnlyValues(algorithm.name, ['ECDH', 'HKDF'], 'algorithm.name');
10545
- if (algorithm.name === 'ECDH') {
10546
- allowOnlyValues(algorithm.namedCurve, ['P-256'], 'algorithm.namedCurve');
10547
- checkType(algorithm.public, CryptoKey, { name: 'algorithm.public' });
10548
- }
10549
- else if (algorithm.name === 'HKDF') {
10550
- checkType(algorithm.hash, String, { name: 'algorithm.hash' });
10551
- checkType(getBuffer(algorithm.salt), ArrayBuffer, { name: 'algorithm.salt' });
10552
- checkType(getBuffer(algorithm.info), ArrayBuffer, { name: 'algorithm.info' });
10553
- }
10570
+ checkDeriveAlgorithm(algorithm);
10554
10571
  allowOnlyKeys(derivedKeyAlgorithm, ['name', 'length']);
10555
10572
  allowOnlyValues(derivedKeyAlgorithm.name, ['AES-GCM'], 'derivedKeyAlgorithm.name');
10556
10573
  checkType(derivedKeyAlgorithm.length, Number, { name: 'derivedKeyAlgorithm.length' });
@@ -10694,6 +10711,19 @@ class NativeCrypto extends NativeObject {
10694
10711
  onError: (reason) => onError(new Error(String(reason)))
10695
10712
  });
10696
10713
  }
10714
+ }
10715
+ function checkDeriveAlgorithm(algorithm) {
10716
+ allowOnlyKeys(algorithm, ['name', 'namedCurve', 'public', 'hash', 'salt', 'info']);
10717
+ allowOnlyValues(algorithm.name, ['ECDH', 'HKDF'], 'algorithm.name');
10718
+ if (algorithm.name === 'ECDH') {
10719
+ allowOnlyValues(algorithm.namedCurve, ['P-256'], 'algorithm.namedCurve');
10720
+ checkType(algorithm.public, CryptoKey, { name: 'algorithm.public' });
10721
+ }
10722
+ else if (algorithm.name === 'HKDF') {
10723
+ checkType(algorithm.hash, String, { name: 'algorithm.hash' });
10724
+ checkType(getBuffer(algorithm.salt), ArrayBuffer, { name: 'algorithm.salt' });
10725
+ checkType(getBuffer(algorithm.info), ArrayBuffer, { name: 'algorithm.info' });
10726
+ }
10697
10727
  }
10698
10728
 
10699
10729
  class Drawer extends ContentView {