tabris 3.9.0-dev.20220523 → 3.9.0-dev.20220524

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.20220523+0310
2
+ * Tabris.js 3.9.0-dev.20220524+0310
3
3
  *
4
4
  * Copyright (c) 2014, 2020 EclipseSource Inc.
5
5
  * All rights reserved.
package/globals.d.ts CHANGED
@@ -997,8 +997,8 @@ 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 given algorithm. Currently only
1001
- * supports the Elliptic Curve Diffie-Hellman (ECDH) algorithm.
1000
+ * Takes a master key and derives a secret key from it using the Elliptic Curve Diffie-Hellman (ECDH)
1001
+ * algorithm.
1002
1002
  * @param algorithm
1003
1003
  * @param baseKey
1004
1004
  * @param derivedKeyAlgorithm
@@ -1007,6 +1007,16 @@ declare class SubtleCrypto {
1007
1007
  */
1008
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
1009
 
1010
+ /**
1011
+ * Takes a master key and derives a secret key from it using the HKDF algorithm.
1012
+ * @param algorithm
1013
+ * @param baseKey
1014
+ * @param derivedKeyAlgorithm
1015
+ * @param extractable
1016
+ * @param keyUsages
1017
+ */
1018
+ deriveKey(algorithm: {name: 'HKDF', hash: 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512', salt: ArrayBuffer | TypedArray, info: ArrayBuffer | TypedArray}, baseKey: CryptoKey, derivedKeyAlgorithm: {name: 'AES-GCM', length: number}, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
1019
+
1010
1020
  /**
1011
1021
  * Provides the digest value of the given data as an ArrayBuffer. Fo this the method uses the hashing
1012
1022
  * algorithms provided by the operating system.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabris",
3
- "version": "3.9.0-dev.20220523+0310",
3
+ "version": "3.9.0-dev.20220524+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.20220523+0310
1
+ // Type definitions for Tabris.js 3.9.0-dev.20220524+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.20220523+0310
2
+ * Tabris.js 3.9.0-dev.20220524+0310
3
3
  *
4
4
  * Copyright (c) 2014, 2020 EclipseSource Inc.
5
5
  * All rights reserved.
@@ -5026,7 +5026,7 @@ class Tabris extends NativeObject {
5026
5026
  this.$publishProxies();
5027
5027
  }
5028
5028
  get version() {
5029
- return '3.9.0-dev.20220523+0310';
5029
+ return '3.9.0-dev.20220524+0310';
5030
5030
  }
5031
5031
  get started() {
5032
5032
  return !!this._started;
@@ -10428,15 +10428,30 @@ class _CryptoKey extends NativeObject {
10428
10428
  }
10429
10429
  derive(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages) {
10430
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
- }));
10431
+ return new Promise$1((onSuccess, onError) => {
10432
+ if (algorithm.name === 'ECDH') {
10433
+ return this._nativeCall('derive', {
10434
+ algorithm: Object.assign(Object.assign({}, algorithm), { public: getCid(algorithm.public) }),
10435
+ baseKey: getCid(baseKey),
10436
+ derivedKeyAlgorithm,
10437
+ extractable,
10438
+ keyUsages,
10439
+ onSuccess,
10440
+ onError: wrapErrorCb(onError)
10441
+ });
10442
+ }
10443
+ else {
10444
+ return this._nativeCall('derive', {
10445
+ algorithm,
10446
+ baseKey: getCid(baseKey),
10447
+ derivedKeyAlgorithm,
10448
+ extractable,
10449
+ keyUsages,
10450
+ onSuccess,
10451
+ onError: wrapErrorCb(onError)
10452
+ });
10453
+ }
10454
+ });
10440
10455
  });
10441
10456
  }
10442
10457
  generate(algorithm, extractable, keyUsages) {
@@ -10525,10 +10540,16 @@ class SubtleCrypto {
10525
10540
  if (arguments.length !== 5) {
10526
10541
  throw new TypeError(`Expected 5 arguments, got ${arguments.length}`);
10527
10542
  }
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' });
10543
+ allowOnlyKeys(algorithm, ['name', 'namedCurve', 'public', 'info', 'salt']);
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(getBuffer(algorithm.salt), ArrayBuffer, { name: 'algorithm.salt' });
10551
+ checkType(getBuffer(algorithm.info), ArrayBuffer, { name: 'algorithm.info' });
10552
+ }
10532
10553
  allowOnlyKeys(derivedKeyAlgorithm, ['name', 'length']);
10533
10554
  allowOnlyValues(derivedKeyAlgorithm.name, ['AES-GCM'], 'derivedKeyAlgorithm.name');
10534
10555
  checkType(derivedKeyAlgorithm.length, Number, { name: 'derivedKeyAlgorithm.length' });