ecash-lib 1.2.2-rc1 → 1.2.2-rc3

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/dist/ecc.d.ts CHANGED
@@ -7,9 +7,18 @@ export interface Ecc {
7
7
  /** Sign a Schnorr signature. msg needs to be a 32-byte hash */
8
8
  schnorrSign(seckey: Uint8Array, msg: Uint8Array): Uint8Array;
9
9
  }
10
+ /** Uninitialized Ecc impl that throws an error asking for initWasm */
11
+ export declare class EccBeforeWasm implements Ecc {
12
+ constructor();
13
+ derivePubkey(_seckey: Uint8Array): Uint8Array;
14
+ ecdsaSign(_seckey: Uint8Array, _msg: Uint8Array): Uint8Array;
15
+ schnorrSign(_seckey: Uint8Array, _msg: Uint8Array): Uint8Array;
16
+ }
10
17
  /** Ecc implementation using WebAssembly */
11
18
  export declare let Ecc: {
12
19
  new (): Ecc;
20
+ } | {
21
+ new (): EccBeforeWasm;
13
22
  };
14
23
  /** Dummy Ecc impl that always returns 0, useful for measuring tx size */
15
24
  export declare class EccDummy implements Ecc {
package/dist/ecc.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ecc.d.ts","sourceRoot":"","sources":["../src/ecc.ts"],"names":[],"mappings":"AAIA,6DAA6D;AAC7D,MAAM,WAAW,GAAG;IAChB,2CAA2C;IAC3C,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;IAE7C,8DAA8D;IAC9D,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC;IAE3D,+DAA+D;IAC/D,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC;CAChE;AAED,2CAA2C;AAC3C,eAAO,IAAI,GAAG,EAAE;IAAE,QAAQ,GAAG,CAAA;CAAE,CAAC;AAEhC,yEAAyE;AACzE,qBAAa,QAAS,YAAW,GAAG;IAChC,YAAY,CAAC,OA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U,GAAG,UAAU;CAGjE;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE;IAAE,QAAQ,GAAG,CAAA;CAAE,QAS5C"}
package/dist/ecc.js CHANGED
@@ -3,7 +3,23 @@
3
3
  // Distributed under the MIT software license, see the accompanying
4
4
  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.__setEcc = exports.EccDummy = exports.Ecc = void 0;
6
+ exports.__setEcc = exports.EccDummy = exports.Ecc = exports.EccBeforeWasm = void 0;
7
+ /** Uninitialized Ecc impl that throws an error asking for initWasm */
8
+ class EccBeforeWasm {
9
+ constructor() {
10
+ throw new Error('Ecc is not initialized, initWasm() must be called');
11
+ }
12
+ derivePubkey(_seckey) {
13
+ throw new Error('Ecc is not initialized, initWasm() must be called');
14
+ }
15
+ ecdsaSign(_seckey, _msg) {
16
+ throw new Error('Ecc is not initialized, initWasm() must be called');
17
+ }
18
+ schnorrSign(_seckey, _msg) {
19
+ throw new Error('Ecc is not initialized, initWasm() must be called');
20
+ }
21
+ }
22
+ exports.EccBeforeWasm = EccBeforeWasm;
7
23
  /** Dummy Ecc impl that always returns 0, useful for measuring tx size */
8
24
  class EccDummy {
9
25
  derivePubkey(_seckey) {
package/dist/ecc.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ecc.js","sourceRoot":"","sources":["../src/ecc.ts"],"names":[],"mappings":";AAAA,4CAA4C;AAC5C,mEAAmE;AACnE,sEAAsE;;;AAiBtE,yEAAyE;AACzE,MAAa,QAAQ;IACjB,YAAY,CAAC,OAAmB;QAC5B,OAAO,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,SAAS,CAAC,OAAmB,EAAE,IAAgB;QAC3C,OAAO,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,WAAW,CAAC,OAAmB,EAAE,IAAgB;QAC7C,OAAO,IAAI,UAAU,CAAC,EAAE,C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M,CAAC,MAAM,CAAC,UAAU,EAAE;QACtB,QAAQ,EAAE;YACN,GAAG,CAAE,UAAkC,CAAC,QAAQ,IAAI,EAAE,CAAC;YACvD,GAAG,EAAE,GAAG;SACX;KAC0B,CAAC,CAAC;AACrC,CAAC;AATD,4BASC"}
package/global.d.ts CHANGED
@@ -2,7 +2,21 @@
2
2
  // Distributed under the MIT software license, see the accompanying
3
3
  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
 
5
- import { Ecc } from './src/ecc';
5
+ /**
6
+ * Note this is duplicated in src/ecc.ts
7
+ * We could not import it here as it leads to rel path errors in the
8
+ * published dependency when it is consumed by other apps
9
+ */
10
+ interface Ecc {
11
+ /** Derive a public key from secret key. */
12
+ derivePubkey(seckey: Uint8Array): Uint8Array;
13
+
14
+ /** Sign an ECDSA signature. msg needs to be a 32-byte hash */
15
+ ecdsaSign(seckey: Uint8Array, msg: Uint8Array): Uint8Array;
16
+
17
+ /** Sign a Schnorr signature. msg needs to be a 32-byte hash */
18
+ schnorrSign(seckey: Uint8Array, msg: Uint8Array): Uint8Array;
19
+ }
6
20
 
7
21
  export interface EcashLibHashes {
8
22
  sha256: (data: Uint8Array) => Uint8Array;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecash-lib",
3
- "version": "1.2.2-rc1",
3
+ "version": "1.2.2-rc3",
4
4
  "description": "Library for eCash transaction building",
5
5
  "main": "./dist/indexNodeJs.js",
6
6
  "browser": "./dist/indexBrowser.js",