tabris 3.9.0 → 3.10.0-dev.20250206

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/README.md CHANGED
@@ -36,12 +36,12 @@ The code of the application is loaded dynamically - nothing is precompiled. Java
36
36
 
37
37
  ## Getting started
38
38
 
39
- To start developing Tabris.js applications, visit [tabrisjs.com](http://tabrisjs.com) and check out the "[Getting Started](https://tabrisjs.com/documentation/latest/getting-started)" guide in the documentation. Be sure to also consult the code [snippets](https://github.com/eclipsesource/tabris-js/tree/master/snippets) in the Tabris.js Developer App (download from the app store for [Android](https://play.google.com/store/apps/details?id=com.eclipsesource.tabrisjs2) and [iOS](https://itunes.apple.com/us/app/tabris.js-2/id1166468326?mt=8)).
39
+ To start developing Tabris.js applications, visit [tabrisjs.com](http://tabrisjs.com) and check out the "[Getting Started](https://tabrisjs.com/documentation/latest/getting-started)" guide in the documentation. Be sure to also consult the code [snippets](https://github.com/eclipsesource/tabris-js/tree/master/snippets) in the Tabris.js Developer App (download from the app store for [Android](https://play.google.com/store/apps/details?id=com.eclipsesource.tabrisjs) and [iOS](https://apps.apple.com/us/app/tabris-js/id939600018)).
40
40
 
41
41
  ## Extensible
42
42
 
43
43
  Tabris.js can be extended with [Cordova plugins](https://cordova.apache.org/plugins/) to add support for additional native features. A cordova plugin is also able to directly interface with the native widgets (as can be seen e.g. in the [tabris-plugin-maps](https://github.com/eclipsesource/tabris-plugin-maps)).
44
-
44
+
45
45
  Additionally [npm modules](https://www.npmjs.com/) can be used to further enrich the available JS APIs.
46
46
 
47
47
  Tabris.js also adds support for many key web technologies including:
@@ -50,12 +50,6 @@ Tabris.js also adds support for many key web technologies including:
50
50
  - _WebSockets_
51
51
  - _localStorage_
52
52
 
53
-
54
- ## Online build
55
-
56
- To package your source into a installable app, Tabris.js features an online [build service](https://tabrisjs.com/documentation/latest/build). There is no need to download a huge SDK or use specific hardware for development (e.g. a Mac machine to build for iOS). A [local build](https://tabrisjs.com/documentation/latest/local-build) is also available as an option if more customization is needed.
57
-
58
-
59
53
  ## Build tabris npm module
60
54
 
61
55
  Follow these steps if you want to build the tabris module yourself.
package/boot.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Tabris.js 3.9.0
2
+ * Tabris.js 3.10.0-dev.20250206+1026
3
3
  *
4
4
  * Copyright (c) 2014, 2020 EclipseSource Inc.
5
5
  * All rights reserved.
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;
@@ -1002,8 +1002,9 @@ declare class SubtleCrypto {
1002
1002
  * @param algorithm
1003
1003
  * @param baseKey
1004
1004
  * @param length
1005
+ * @param options
1005
1006
  */
1006
- deriveBits(algorithm: {name: 'ECDH', namedCurve: 'P-256', public: CryptoKey}, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
1007
+ deriveBits(algorithm: {name: 'ECDH', namedCurve: 'P-256', public: CryptoKey}, baseKey: CryptoKey, length: number, options?: {authPromptTitle?: string, authPromptMessage?: string}): Promise<ArrayBuffer>;
1007
1008
 
1008
1009
  /**
1009
1010
  * Takes a base key and derives an array of bits from it using the HKDF algorithm.
@@ -1021,8 +1022,9 @@ declare class SubtleCrypto {
1021
1022
  * @param derivedKeyAlgorithm
1022
1023
  * @param extractable
1023
1024
  * @param keyUsages
1025
+ * @param options
1024
1026
  */
1025
- deriveKey(algorithm: {name: 'ECDH', namedCurve: 'P-256', public: CryptoKey}, baseKey: CryptoKey, derivedKeyAlgorithm: {name: 'AES-GCM', length: number}, extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
1027
+ deriveKey(algorithm: {name: 'ECDH', namedCurve: 'P-256', public: CryptoKey}, baseKey: CryptoKey, derivedKeyAlgorithm: {name: 'AES-GCM', length: number}, extractable: boolean, keyUsages: string[], options?: {authPromptTitle?: string, authPromptMessage?: string}): Promise<CryptoKey>;
1026
1028
 
1027
1029
  /**
1028
1030
  * Takes a base key and derives a secret key from it using the HKDF algorithm.
@@ -1051,21 +1053,27 @@ declare class SubtleCrypto {
1051
1053
  encrypt(algorithm: {name: 'AES-GCM', iv: ArrayBuffer | TypedArray, tagLength?: number}, key: CryptoKey, data: ArrayBuffer | TypedArray): Promise<ArrayBuffer>;
1052
1054
 
1053
1055
  /**
1054
- * Converts a CryptoKey instances into a portable format. To export a key, the key must have extractable
1055
- * set to true. Supports the spki format or raw bytes.
1056
+ * Converts `CryptoKey` instances into a portable format. If the key's `extractable` is set to `true`,
1057
+ * returns the raw key material in SPKI format or as raw bytes. If the key's `extractable` is set to
1058
+ * `false`, for ECDSA and ECDH keys returns an opaque handle to the key in the device's trusted
1059
+ * execution environment, and throws for other key formats.
1056
1060
  * @param format
1057
1061
  * @param key
1058
1062
  */
1059
1063
  exportKey(format: 'raw' | 'spki', key: CryptoKey): Promise<ArrayBuffer>;
1060
1064
 
1061
1065
  /**
1062
- * Generates new keys. Currently only supports the Elliptic Curve Diffie-Hellman (ECDH) algorithm to
1063
- * generate key pairs.
1066
+ * Generates new keys. Currently only supports the Elliptic Curve Diffie-Hellman (ECDH) and Elliptic
1067
+ * Curve Digital Signature Algorithm (ECDSA) algorithms to generate key pairs. When `extractable` is set
1068
+ * to `true`, the raw key material can be exported using `exportKey`. When `extractable` is set to
1069
+ * `false`, for ECDSA and ECDH keys `exportKey` returns an opaque handle to the key in the device's
1070
+ * trusted execution environment, and throws for other key formats.
1064
1071
  * @param algorithm
1065
1072
  * @param extractable
1066
1073
  * @param keyUsages
1074
+ * @param options
1067
1075
  */
1068
- generateKey(algorithm: {name: 'ECDH', namedCurve: 'P-256'}, extractable: boolean, keyUsages: string[]): Promise<{privateKey: CryptoKey, publicKey: CryptoKey}>;
1076
+ generateKey(algorithm: {name: 'ECDH' | 'ECDSA', namedCurve: 'P-256'}, extractable: boolean, keyUsages: string[], options?: {usageRequiresAuth?: boolean}): Promise<{privateKey: CryptoKey, publicKey: CryptoKey}>;
1069
1077
 
1070
1078
  /**
1071
1079
  * Takes an external key in a portable format and returns a CryptoKey object that can be used with the
@@ -1076,7 +1084,26 @@ declare class SubtleCrypto {
1076
1084
  * @param extractable
1077
1085
  * @param keyUsages
1078
1086
  */
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>;
1087
+ importKey(format: 'spki' | 'pkcs8' | 'raw', keyData: ArrayBuffer | TypedArray, algorithm: {name: 'ECDH' | 'ECDSA', namedCurve: 'P-256'} | {name: 'AES-GCM'} | 'HKDF' | 'AES-GCM', extractable: boolean, keyUsages: string[]): Promise<CryptoKey>;
1088
+
1089
+ /**
1090
+ * Signs the given data. Currently only supports creating ECDSA signatures in DER format.
1091
+ * @param algorithm
1092
+ * @param key
1093
+ * @param data
1094
+ * @param options
1095
+ */
1096
+ sign(algorithm: {name: 'ECDSAinDERFormat', hash: 'SHA-256'}, key: CryptoKey, data: ArrayBuffer | TypedArray, options?: {authPromptTitle?: string, authPromptMessage?: string}): Promise<ArrayBuffer>;
1097
+
1098
+ /**
1099
+ * Verifies the given signature against the data. Currently only supports verifying ECDSA signatures in
1100
+ * DER format.
1101
+ * @param algorithm
1102
+ * @param key
1103
+ * @param signature
1104
+ * @param data
1105
+ */
1106
+ verify(algorithm: {name: 'ECDSAinDERFormat', hash: 'SHA-256'}, key: CryptoKey, signature: ArrayBuffer | TypedArray, data: ArrayBuffer | TypedArray): Promise<boolean>;
1080
1107
  }
1081
1108
 
1082
1109
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tabris",
3
- "version": "3.9.0",
3
+ "version": "3.10.0-dev.20250206+1026",
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
1
+ // Type definitions for Tabris.js 3.10.0-dev.20250206+1026
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
2
+ * Tabris.js 3.10.0-dev.20250206+1026
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';
5037
+ return '3.10.0-dev.20250206+1026';
5038
5038
  }
5039
5039
  get started() {
5040
5040
  return !!this._started;
@@ -10447,7 +10447,7 @@ class _CryptoKey extends NativeObject {
10447
10447
  }));
10448
10448
  });
10449
10449
  }
10450
- derive(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages) {
10450
+ derive(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages, authPromptTitle, authPromptMessage) {
10451
10451
  return __awaiter(this, void 0, void 0, function* () {
10452
10452
  return new Promise$1((onSuccess, onError) => {
10453
10453
  if (typeof algorithm === 'string') {
@@ -10460,6 +10460,8 @@ class _CryptoKey extends NativeObject {
10460
10460
  derivedKeyAlgorithm,
10461
10461
  extractable,
10462
10462
  keyUsages,
10463
+ authPromptTitle,
10464
+ authPromptMessage,
10463
10465
  onSuccess,
10464
10466
  onError: wrapErrorCb(onError)
10465
10467
  });
@@ -10471,6 +10473,8 @@ class _CryptoKey extends NativeObject {
10471
10473
  derivedKeyAlgorithm,
10472
10474
  extractable,
10473
10475
  keyUsages,
10476
+ authPromptTitle,
10477
+ authPromptMessage,
10474
10478
  onSuccess,
10475
10479
  onError: wrapErrorCb(onError)
10476
10480
  });
@@ -10481,12 +10485,13 @@ class _CryptoKey extends NativeObject {
10481
10485
  });
10482
10486
  });
10483
10487
  }
10484
- generate(algorithm, extractable, keyUsages) {
10488
+ generate(algorithm, extractable, keyUsages, usageRequiresAuth) {
10485
10489
  return __awaiter(this, void 0, void 0, function* () {
10486
10490
  return new Promise$1((onSuccess, onError) => this._nativeCall('generate', {
10487
10491
  algorithm,
10488
10492
  extractable,
10489
10493
  keyUsages,
10494
+ usageRequiresAuth,
10490
10495
  onSuccess,
10491
10496
  onError: wrapErrorCb(onError)
10492
10497
  }));
@@ -10549,12 +10554,12 @@ class SubtleCrypto {
10549
10554
  allowOnlyValues(format, ['spki', 'pkcs8', 'raw'], 'format');
10550
10555
  checkType(getBuffer(keyData), ArrayBuffer, { name: 'keyData' });
10551
10556
  if (typeof algorithm === 'string') {
10552
- allowOnlyValues(algorithm, ['ECDH', 'AES-GCM', 'HKDF'], 'algorithm');
10557
+ allowOnlyValues(algorithm, ['AES-GCM', 'HKDF'], 'algorithm');
10553
10558
  }
10554
10559
  else {
10555
10560
  checkType(algorithm, Object, { name: 'algorithm' });
10556
- allowOnlyValues(algorithm.name, ['ECDH', 'AES-GCM'], 'algorithm.name');
10557
- if (algorithm.name === 'ECDH') {
10561
+ allowOnlyValues(algorithm.name, ['ECDH', 'ECDSA', 'AES-GCM'], 'algorithm.name');
10562
+ if (algorithm.name === 'ECDH' || algorithm.name === 'ECDSA') {
10558
10563
  allowOnlyKeys(algorithm, ['name', 'namedCurve']);
10559
10564
  allowOnlyValues(algorithm.namedCurve, ['P-256'], 'algorithm.namedCurve');
10560
10565
  }
@@ -10576,17 +10581,18 @@ class SubtleCrypto {
10576
10581
  });
10577
10582
  });
10578
10583
  }
10579
- deriveBits(algorithm, baseKey, length) {
10584
+ deriveBits(algorithm, baseKey, length, options = {}) {
10580
10585
  return __awaiter(this, arguments, void 0, function* () {
10581
- if (arguments.length !== 3) {
10582
- throw new TypeError(`Expected 3 arguments, got ${arguments.length}`);
10586
+ if (arguments.length < 3) {
10587
+ throw new TypeError(`Expected at least 3 arguments, got ${arguments.length}`);
10583
10588
  }
10584
10589
  checkDeriveAlgorithm(algorithm);
10585
10590
  checkType(baseKey, CryptoKey, { name: 'baseKey' });
10586
10591
  checkType(length, Number, { name: 'length' });
10592
+ checkAuthPromptOptions(options);
10587
10593
  const nativeObject = new _CryptoKey();
10588
10594
  try {
10589
- yield nativeObject.derive(algorithm, baseKey, { length, name: 'AES-GCM' }, true, []);
10595
+ yield nativeObject.derive(algorithm, baseKey, { length, name: 'AES-GCM' }, true, [], options.authPromptTitle, options.authPromptMessage);
10590
10596
  return new Promise$1((onSuccess, onReject) => this._nativeObject.subtleExportKey('raw', nativeObject, onSuccess, onReject));
10591
10597
  }
10592
10598
  finally {
@@ -10594,10 +10600,10 @@ class SubtleCrypto {
10594
10600
  }
10595
10601
  });
10596
10602
  }
10597
- deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages) {
10603
+ deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages, options = {}) {
10598
10604
  return __awaiter(this, arguments, void 0, function* () {
10599
- if (arguments.length !== 5) {
10600
- throw new TypeError(`Expected 5 arguments, got ${arguments.length}`);
10605
+ if (arguments.length < 5) {
10606
+ throw new TypeError(`Expected at least 5 arguments, got ${arguments.length}`);
10601
10607
  }
10602
10608
  checkDeriveAlgorithm(algorithm);
10603
10609
  allowOnlyKeys(derivedKeyAlgorithm, ['name', 'length']);
@@ -10606,8 +10612,9 @@ class SubtleCrypto {
10606
10612
  checkType(baseKey, CryptoKey, { name: 'baseKey' });
10607
10613
  checkType(extractable, Boolean, { name: 'extractable' });
10608
10614
  checkType(keyUsages, Array, { name: 'keyUsages' });
10615
+ checkAuthPromptOptions(options);
10609
10616
  const nativeObject = new _CryptoKey();
10610
- yield nativeObject.derive(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages);
10617
+ yield nativeObject.derive(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages, options.authPromptTitle, options.authPromptMessage);
10611
10618
  return new CryptoKey(nativeObject, {
10612
10619
  algorithm,
10613
10620
  extractable,
@@ -10654,18 +10661,28 @@ class SubtleCrypto {
10654
10661
  return new Promise$1((onSuccess, onReject) => this._nativeObject.subtleExportKey(format, key, onSuccess, onReject));
10655
10662
  });
10656
10663
  }
10657
- generateKey(algorithm, extractable, keyUsages) {
10664
+ generateKey(algorithm, extractable, keyUsages, options) {
10658
10665
  return __awaiter(this, arguments, void 0, function* () {
10659
- if (arguments.length !== 3) {
10660
- throw new TypeError(`Expected 3 arguments, got ${arguments.length}`);
10666
+ if (arguments.length < 3) {
10667
+ throw new TypeError(`Expected at least 3 arguments, got ${arguments.length}`);
10661
10668
  }
10662
10669
  allowOnlyKeys(algorithm, ['name', 'namedCurve']);
10663
- allowOnlyValues(algorithm.name, ['ECDH'], 'algorithm.name');
10670
+ allowOnlyValues(algorithm.name, ['ECDH', 'ECDSA'], 'algorithm.name');
10664
10671
  allowOnlyValues(algorithm.namedCurve, ['P-256'], 'algorithm.namedCurve');
10665
10672
  checkType(extractable, Boolean, { name: 'extractable' });
10666
10673
  checkType(keyUsages, Array, { name: 'keyUsages' });
10674
+ if (options != null) {
10675
+ allowOnlyKeys(options, ['usageRequiresAuth']);
10676
+ if ('usageRequiresAuth' in options) {
10677
+ checkType(options.usageRequiresAuth, Boolean, { name: 'options.usageRequiresAuth' });
10678
+ }
10679
+ if (options.usageRequiresAuth && (extractable || !algorithm.name.startsWith('EC'))) {
10680
+ throw new TypeError('options.usageRequiresAuth is only supported for non-extractable EC keys');
10681
+ }
10682
+ }
10683
+ const usageRequiresAuth = options === null || options === void 0 ? void 0 : options.usageRequiresAuth;
10667
10684
  const nativeObject = new _CryptoKey();
10668
- yield nativeObject.generate(algorithm, extractable, keyUsages);
10685
+ yield nativeObject.generate(algorithm, extractable, keyUsages, usageRequiresAuth);
10669
10686
  const nativePrivate = new _CryptoKey(nativeObject, 'private');
10670
10687
  const nativePublic = new _CryptoKey(nativeObject, 'public');
10671
10688
  return {
@@ -10674,6 +10691,36 @@ class SubtleCrypto {
10674
10691
  };
10675
10692
  });
10676
10693
  }
10694
+ sign(algorithm, key, data, options = {}) {
10695
+ return __awaiter(this, arguments, void 0, function* () {
10696
+ if (arguments.length < 3) {
10697
+ throw new TypeError(`Expected at least 3 arguments, got ${arguments.length}`);
10698
+ }
10699
+ allowOnlyKeys(algorithm, ['name', 'hash']);
10700
+ allowOnlyValues(algorithm.name, ['ECDSAinDERFormat'], 'algorithm.name');
10701
+ allowOnlyValues(algorithm.hash, ['SHA-256'], 'algorithm.hash');
10702
+ checkType(key, CryptoKey, { name: 'key' });
10703
+ checkType(algorithm.name, String, { name: 'algorithm.name' });
10704
+ checkType(algorithm.hash, String, { name: 'algorithm.hash' });
10705
+ checkType(getBuffer(data), ArrayBuffer, { name: 'data' });
10706
+ checkAuthPromptOptions(options);
10707
+ return new Promise$1((onSuccess, onError) => this._nativeObject.subtleSign(algorithm, key, data, options.authPromptTitle, options.authPromptMessage, onSuccess, onError));
10708
+ });
10709
+ }
10710
+ verify(algorithm, key, signature, data) {
10711
+ return __awaiter(this, arguments, void 0, function* () {
10712
+ if (arguments.length !== 4) {
10713
+ throw new TypeError(`Expected 4 arguments, got ${arguments.length}`);
10714
+ }
10715
+ allowOnlyKeys(algorithm, ['name', 'hash']);
10716
+ allowOnlyValues(algorithm.name, ['ECDSAinDERFormat'], 'algorithm.name');
10717
+ allowOnlyValues(algorithm.hash, ['SHA-256'], 'algorithm.hash');
10718
+ checkType(key, CryptoKey, { name: 'key' });
10719
+ checkType(getBuffer(signature), ArrayBuffer, { name: 'signature' });
10720
+ checkType(getBuffer(data), ArrayBuffer, { name: 'data' });
10721
+ return new Promise$1((onSuccess, onReject) => this._nativeObject.subtleVerify(algorithm, key, signature, data, onSuccess, onReject));
10722
+ });
10723
+ }
10677
10724
  }
10678
10725
  class NativeCrypto extends NativeObject {
10679
10726
  static getInstance() {
@@ -10743,6 +10790,35 @@ class NativeCrypto extends NativeObject {
10743
10790
  onError: (reason) => onError(new Error(String(reason)))
10744
10791
  });
10745
10792
  }
10793
+ subtleSign(algorithm, key, data, authPromptTitle, authPromptMessage, onSuccess, onError) {
10794
+ this._nativeCall('subtleSign', {
10795
+ algorithm,
10796
+ key: getCid(key),
10797
+ data: getBuffer(data),
10798
+ authPromptTitle,
10799
+ authPromptMessage,
10800
+ onSuccess,
10801
+ onError: (reason) => onError(new Error(String(reason)))
10802
+ });
10803
+ }
10804
+ subtleVerify(algorithm, key, signature, data, onSuccess, onError) {
10805
+ this._nativeCall('subtleVerify', {
10806
+ algorithm,
10807
+ key: getCid(key),
10808
+ signature: getBuffer(signature),
10809
+ data: getBuffer(data),
10810
+ onSuccess,
10811
+ onError: (reason) => onError(new Error(String(reason)))
10812
+ });
10813
+ }
10814
+ }
10815
+ function checkAuthPromptOptions(options) {
10816
+ if ('authPromptTitle' in options) {
10817
+ checkType(options.authPromptTitle, String, { name: 'options.authPromptTitle' });
10818
+ }
10819
+ if ('authPromptMessage' in options) {
10820
+ checkType(options.authPromptMessage, String, { name: 'options.authPromptMessage' });
10821
+ }
10746
10822
  }
10747
10823
  function checkDeriveAlgorithm(algorithm) {
10748
10824
  if (algorithm === 'HKDF') {