Skip to content

Instantly share code, notes, and snippets.

@antonio-ivanovski
Created August 14, 2024 15:19
Show Gist options
  • Save antonio-ivanovski/f071db1a0495b426efbd2390a34790cf to your computer and use it in GitHub Desktop.
Save antonio-ivanovski/f071db1a0495b426efbd2390a34790cf to your computer and use it in GitHub Desktop.
@iden3 invalid builds patches
diff --git a/dist/node/esm/babyjub/babyjub.js b/dist/node/esm/babyjub/babyjub.js
index c29562ec059c1e410d84489093625ccfe6e030ae..b7fb79306f7d184fa471abc357db23093d1d0a13 100644
--- a/dist/node/esm/babyjub/babyjub.js
+++ b/dist/node/esm/babyjub/babyjub.js
@@ -1,4 +1,4 @@
-import { Scalar, F1Field } from '../ff';
+import { Scalar, F1Field } from '../ff/index.js';
// circomlibjs BabyJub
export class BabyJub {
constructor(F) {
diff --git a/dist/node/esm/babyjub/eddsa-keys.js b/dist/node/esm/babyjub/eddsa-keys.js
index a472bdbfaafd3454206dce7045d961015a928683..3b78478cf31aaa81e89c71c8a5f0a3e2015a84d2 100644
--- a/dist/node/esm/babyjub/eddsa-keys.js
+++ b/dist/node/esm/babyjub/eddsa-keys.js
@@ -1,6 +1,6 @@
-import { babyJub } from './babyjub';
-import { eddsa } from './eddsa';
-import { Hex } from '../hex';
+import { babyJub } from './babyjub.js';
+import { eddsa } from './eddsa.js';
+import { Hex } from '../hex.js';
export class Signature {
constructor(r8, s) {
this.R8 = r8;
diff --git a/dist/node/esm/babyjub/eddsa.js b/dist/node/esm/babyjub/eddsa.js
index f5c8ff8b997e45cf23d846c9db5673ad6ee00de0..e1d9df2f1e8f19ba42aad44fbef318bfe5cc44af 100644
--- a/dist/node/esm/babyjub/eddsa.js
+++ b/dist/node/esm/babyjub/eddsa.js
@@ -1,7 +1,7 @@
-import { babyJub } from './babyjub';
-import { poseidon } from '../poseidon';
-import { F1Field, Scalar, utils } from '../ff';
-import { Blake512 } from '../blake';
+import { babyJub } from './babyjub.js';
+import { poseidon } from '../poseidon/index.js';
+import { F1Field, Scalar, utils } from '../ff/index.js';
+import { Blake512 } from '../blake.js';
export class Eddsa {
constructor() {
this.babyJub = babyJub;
diff --git a/dist/node/esm/babyjub/index.js b/dist/node/esm/babyjub/index.js
index 839d6ecf38ffe308a9756430a315447107b95307..27d6637e5aa41302d7210cf96efebf09b8c1eee6 100644
--- a/dist/node/esm/babyjub/index.js
+++ b/dist/node/esm/babyjub/index.js
@@ -1,4 +1,4 @@
-export * from './eddsa';
-export * from './babyjub';
-export * from './eddsa-keys';
+export * from './eddsa.js';
+export * from './babyjub.js';
+export * from './eddsa-keys.js';
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/dist/node/esm/ff/f1field.js b/dist/node/esm/ff/f1field.js
index 4490365e71b9cb4fff95abf340861490743e4f9d..2437c2210cb98d77486a9860974d2e09eb4810d9 100644
--- a/dist/node/esm/ff/f1field.js
+++ b/dist/node/esm/ff/f1field.js
@@ -1,5 +1,5 @@
-import * as Scalar from './scalar';
-import { getRandomBytes } from './random';
+import * as Scalar from './scalar.js';
+import { getRandomBytes } from './random.js';
export class F1Field {
constructor(p) {
this.type = 'F1';
diff --git a/dist/node/esm/ff/index.js b/dist/node/esm/ff/index.js
index 1bc771f76681df0a24e502f7234808a58601eb60..b6a2c7a36a73901f12b4b32fad4507e3756b31e0 100644
--- a/dist/node/esm/ff/index.js
+++ b/dist/node/esm/ff/index.js
@@ -1,6 +1,6 @@
-import * as utils from './utils';
-import * as Scalar from './scalar';
-import { F1Field } from './f1field';
-import { getRandomBytes } from './random';
+import * as utils from './utils.js';
+import * as Scalar from './scalar.js';
+import { F1Field } from './f1field.js';
+import { getRandomBytes } from './random.js';
export { utils, Scalar, F1Field, getRandomBytes };
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/dist/node/esm/ff/utils.js b/dist/node/esm/ff/utils.js
index 86f93dd5a4e90429f961a56c05004dd8eb84e775..9c47a1c0151e4eda1e93434926019f1d28afffd1 100644
--- a/dist/node/esm/ff/utils.js
+++ b/dist/node/esm/ff/utils.js
@@ -1,4 +1,4 @@
-import * as Scalar from './scalar';
+import * as Scalar from './scalar.js';
export function unstringifyBigInts(o) {
if (Array.isArray(o)) {
return o.map(unstringifyBigInts);
diff --git a/dist/node/esm/index.js b/dist/node/esm/index.js
index 2b8607651464f35b64eaea28a132db78b7f23b3e..e7ee8dd7c463f81e8505ac3edcd53d0595dd7610 100644
--- a/dist/node/esm/index.js
+++ b/dist/node/esm/index.js
@@ -1,8 +1,8 @@
-export * from './babyjub';
-export * from './poseidon';
-export * from './hex';
-export * from './blake';
-export * from './base58';
-export * from './sha256';
-export { utils as ffUtils, getRandomBytes } from './ff';
+export * from './babyjub/index.js';
+export * from './poseidon/index.js';
+export * from './hex.js';
+export * from './blake.js';
+export * from './base58.js';
+export * from './sha256.js';
+export { utils as ffUtils, getRandomBytes } from './ff/index.js';
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/dist/node/esm/poseidon/index.js b/dist/node/esm/poseidon/index.js
index c8ea8a9c4ba7087706b5b2b659990d70618939f5..71cc56912a5dfe89da1ac12e3955f2690e56baf5 100644
--- a/dist/node/esm/poseidon/index.js
+++ b/dist/node/esm/poseidon/index.js
@@ -1,2 +1,2 @@
-export * from './poseidon-opt';
+export * from './poseidon-opt.js';
//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/dist/node/esm/poseidon/poseidon-opt.js b/dist/node/esm/poseidon/poseidon-opt.js
index 25fcb75a64d2f0e16be75a12cf389c86858941ff..96d91d855e22cef86b8dfae1e710a3dc21f50918 100644
--- a/dist/node/esm/poseidon/poseidon-opt.js
+++ b/dist/node/esm/poseidon/poseidon-opt.js
@@ -1,5 +1,5 @@
-import { F1Field, Scalar, utils } from '../ff';
-import op from './poseidon-constants-opt.json';
+import { F1Field, Scalar, utils } from '../ff/index.js';
+import op from './poseidon-constants-opt.json' with { type: 'json' };
export const OPT = utils.unstringifyBigInts(op);
const N_ROUNDS_F = 8;
const N_ROUNDS_P = [56, 57, 56, 60, 60, 63, 64, 63, 60, 66, 60, 65, 70, 60, 64, 68];
diff --git a/package.json b/package.json
index dc04c8ff45e0d97f2396b0b50ad6cb520d040a76..47e9e639ef888b18be965013961add82fe8c306d 100644
--- a/package.json
+++ b/package.json
@@ -3,6 +3,7 @@
"version": "1.1.0",
"description": "Crypto primitives for iden3",
"source": "./src/index.ts",
+ "type": "module",
"exports": {
".": {
"node": {
diff --git a/dist/node/esm/claim.js b/dist/node/esm/claim.js
index 839becfdc0212d9abdc6f62aa5f3ca2f86d5f27a..7a8b0ca7a149dba29481d265b1c29673470099f4 100644
--- a/dist/node/esm/claim.js
+++ b/dist/node/esm/claim.js
@@ -1,8 +1,8 @@
-import { SchemaHash } from './schemaHash';
-import { ElemBytes } from './elemBytes';
-import { Constants } from './constants';
-import { Id } from './id';
-import { checkBigIntArrayInField, checkBigIntInField, getDateFromUnixTimestamp, getUint32, getUint64, getUnixTimestamp, putUint32, putUint64 as getBytesFromUint64 } from './utils';
+import { SchemaHash } from './schemaHash.js';
+import { ElemBytes } from './elemBytes.js';
+import { Constants } from './constants.js';
+import { Id } from './id.js';
+import { checkBigIntArrayInField, checkBigIntInField, getDateFromUnixTimestamp, getUint32, getUint64, getUnixTimestamp, putUint32, putUint64 as getBytesFromUint64 } from './utils.js';
import { Hex, poseidon } from '@iden3/js-crypto';
/*
Claim structure
diff --git a/dist/node/esm/did/did-helper.js b/dist/node/esm/did/did-helper.js
index 876ae3a57a37484e187065cfdb06fed24389341e..8da68056acdfd6776137d729cfe13200cbeaac3d 100644
--- a/dist/node/esm/did/did-helper.js
+++ b/dist/node/esm/did/did-helper.js
@@ -1,4 +1,4 @@
-import { Constants, DidMethodByte, DidMethodNetwork } from '../constants';
+import { Constants, DidMethodByte, DidMethodNetwork } from '../constants.js';
// DIDNetworkFlag is a structure to represent DID blockchain and network id
export class DIDNetworkFlag {
constructor(blockchain, networkId) {
diff --git a/dist/node/esm/did/did-parser.js b/dist/node/esm/did/did-parser.js
index 5be4c9dee235ccfd113083b63d37a7c54d54fee0..69f077bc720ea2dade43d1e41de7bc3923eba309 100644
--- a/dist/node/esm/did/did-parser.js
+++ b/dist/node/esm/did/did-parser.js
@@ -1,5 +1,5 @@
-import { Param, initDIDParams } from './types';
-import { StringUtils } from '../utils';
+import { Param, initDIDParams } from './types.js';
+import { StringUtils } from '../utils.js';
export class Parser {
constructor(input) {
this.input = input;
diff --git a/dist/node/esm/did/did.js b/dist/node/esm/did/did.js
index 57fc8788f5a1ff5fe42b478e5a18fe304631ed75..0552cbecdfc2def59a18f6e43a9ded7f995ed369 100644
--- a/dist/node/esm/did/did.js
+++ b/dist/node/esm/did/did.js
@@ -1,10 +1,10 @@
-import { Id } from '../id';
-import { Blockchain, Constants, DidMethodByte, DidMethodNetwork, DidMethod, NetworkId } from '../constants';
-import { BytesHelper } from '../elemBytes';
-import { DIDNetworkFlag, findBlockchainForDIDMethodByValue, findDIDMethodByValue, findNetworkIDForDIDMethodByValue } from './did-helper';
-import { Parser } from './did-parser';
+import { Id } from '../id.js';
+import { Blockchain, Constants, DidMethodByte, DidMethodNetwork, DidMethod, NetworkId } from '../constants.js';
+import { BytesHelper } from '../elemBytes.js';
+import { DIDNetworkFlag, findBlockchainForDIDMethodByValue, findDIDMethodByValue, findNetworkIDForDIDMethodByValue } from './did-helper.js';
+import { Parser } from './did-parser.js';
import { sha256 } from '@iden3/js-crypto';
-import { encoder } from '../utils';
+import { encoder } from '../utils.js';
// DID Decentralized Identifiers (DIDs)
// https://w3c.github.io/did-core/#did-syntax
export class DID {
diff --git a/dist/node/esm/did/index.js b/dist/node/esm/did/index.js
index e1d6c59cfdcef22aaf2ab71a4947d2b690af7fcf..c770546292061496b289d14af415e8e2a4d8fd5d 100644
--- a/dist/node/esm/did/index.js
+++ b/dist/node/esm/did/index.js
@@ -1,4 +1,4 @@
-export * from './did-helper';
-export * from './did-parser';
-export * from './types';
-export * from './did';
+export * from './did-helper.js';
+export * from './did-parser.js';
+export * from './types.js';
+export * from './did.js';
diff --git a/dist/node/esm/elemBytes.js b/dist/node/esm/elemBytes.js
index e1214a48c684b48efdf4af4f4c5b139ebb3f5cd9..5dbcbeb1ccbac08a4da481cf69adc8bd4d365055 100644
--- a/dist/node/esm/elemBytes.js
+++ b/dist/node/esm/elemBytes.js
@@ -1,5 +1,5 @@
-import { Constants } from './constants';
-import { checkBigIntInField, fromLittleEndian, toLittleEndian, encoder } from './utils';
+import { Constants } from './constants.js';
+import { checkBigIntInField, fromLittleEndian, toLittleEndian, encoder } from './utils.js';
import { Hex, sha256 } from '@iden3/js-crypto';
export class BytesHelper {
static intToBytes(int) {
diff --git a/dist/node/esm/id.js b/dist/node/esm/id.js
index f8d3f636815bf52eceb70e09283eeea765a222e5..1d99e2e562ddf803d1045e19fdde523773239165 100644
--- a/dist/node/esm/id.js
+++ b/dist/node/esm/id.js
@@ -1,6 +1,6 @@
-import { Constants } from './constants';
-import { fromLittleEndian } from './utils';
-import { BytesHelper, ElemBytes } from './elemBytes';
+import { Constants } from './constants.js';
+import { fromLittleEndian } from './utils.js';
+import { BytesHelper, ElemBytes } from './elemBytes.js';
import { poseidon, base58ToBytes, base58FromBytes } from '@iden3/js-crypto';
// ID is a byte array with
// [ type | root_genesis | checksum ]
diff --git a/dist/node/esm/index.js b/dist/node/esm/index.js
index 489d4517bbd510e319a97b122705000a9d884612..3ebd5405954e9f5aa9b343eced5a43abcb0e168c 100644
--- a/dist/node/esm/index.js
+++ b/dist/node/esm/index.js
@@ -1,8 +1,8 @@
-export * from './claim';
-export * from './constants';
-export * from './did';
-export * from './elemBytes';
-export * from './id';
-export * from './schemaHash';
-export * from './utils';
-export * from './registration';
+export * from './claim.js';
+export * from './constants.js';
+export * from './did/index.js';
+export * from './elemBytes.js';
+export * from './id.js';
+export * from './schemaHash.js';
+export * from './utils.js';
+export * from './registration.js';
diff --git a/dist/node/esm/registration.js b/dist/node/esm/registration.js
index fd4faa2972ce319b2c2239f67f8b32dd2e83ac85..c1fb9de70c2feb14b730fa26a303888a3a93d495 100644
--- a/dist/node/esm/registration.js
+++ b/dist/node/esm/registration.js
@@ -1,5 +1,5 @@
-import { Blockchain, ChainIds, DidMethod, DidMethodByte, DidMethodNetwork, NetworkId } from './constants';
-import { DID } from './did';
+import { Blockchain, ChainIds, DidMethod, DidMethodByte, DidMethodNetwork, NetworkId } from './constants.js';
+import { DID } from './did/index.js';
export const registerBlockchain = (blockchain) => {
Blockchain[blockchain] = blockchain;
};
diff --git a/dist/node/esm/schemaHash.js b/dist/node/esm/schemaHash.js
index 85324ea217f816f30f4b4cfac1aad4db73f9e12e..0de3611db2ecc747cb9c97fbef79e184bc96959e 100644
--- a/dist/node/esm/schemaHash.js
+++ b/dist/node/esm/schemaHash.js
@@ -1,6 +1,6 @@
import { Hex } from '@iden3/js-crypto';
-import { Constants } from './constants';
-import { BytesHelper } from './elemBytes';
+import { Constants } from './constants.js';
+import { BytesHelper } from './elemBytes.js';
export class SchemaHash {
/**
* Constructor
diff --git a/dist/node/esm/utils.js b/dist/node/esm/utils.js
index 2ead533f968438f1c10903ca458890bd0c44083c..8391bb83608408f7ffb7b2c14fc1afa6f3be7c52 100644
--- a/dist/node/esm/utils.js
+++ b/dist/node/esm/utils.js
@@ -1,5 +1,5 @@
import { poseidon } from '@iden3/js-crypto';
-import { Constants } from './constants';
+import { Constants } from './constants.js';
// eslint-disable-next-line @typescript-eslint/no-var-requires
export const encoder = new TextEncoder();
export function fromLittleEndian(bytes) {
diff --git a/package.json b/package.json
index a7d39393831c6295c5914cee2805793328e2ab60..87f291d265199553175a9a0d9495104c62affb20 100644
--- a/package.json
+++ b/package.json
@@ -6,6 +6,7 @@
"types": "dist/types/index.d.ts",
"main": "dist/node/cjs/index.js",
"module": "dist/node/esm/index.js",
+ "type": "module",
"exports": {
".": {
"node": {
diff --git a/dist/node/esm/constants/index.js b/dist/node/esm/constants/index.js
index 7c7277a0e7e50f2e25a744caceee723375fe3099..6a0624e1876fb765f04ea192afe74240db878913 100644
--- a/dist/node/esm/constants/index.js
+++ b/dist/node/esm/constants/index.js
@@ -1,5 +1,5 @@
-export * from './hash';
-export * from './node';
-export * from './data';
-export * from './proof';
-export * from './field';
+export * from './hash.js';
+export * from './node.js';
+export * from './data.js';
+export * from './proof.js';
+export * from './field.js';
diff --git a/dist/node/esm/constants/proof.js b/dist/node/esm/constants/proof.js
index f6900c11318b7b5a979479e695dd5c432f9aec57..48db732512e2ce87b9fee81b1303bd82e037c634 100644
--- a/dist/node/esm/constants/proof.js
+++ b/dist/node/esm/constants/proof.js
@@ -1,3 +1,3 @@
-import { ELEM_BYTES_LEN } from './data';
+import { ELEM_BYTES_LEN } from './data.js';
export const PROOF_FLAG_LEN = 2;
export const NOT_EMPTIES_LEN = ELEM_BYTES_LEN - PROOF_FLAG_LEN;
diff --git a/dist/node/esm/index.js b/dist/node/esm/index.js
index 522fa1ca0e5e59b7f1b889988fe9be384c79dc2e..28812986393d67cad563e252fba303cf8574a4de 100644
--- a/dist/node/esm/index.js
+++ b/dist/node/esm/index.js
@@ -1,3 +1,3 @@
-export * from './constants';
-export * from './lib';
-export * from './types';
+export * from './constants/index.js';
+export * from './lib/index.js';
+export * from './types/index.js';
diff --git a/dist/node/esm/lib/db/inMemory.js b/dist/node/esm/lib/db/inMemory.js
index a7cb7c7d9795bf98e7ade18c0c6ad550db00e93a..f5cdc85b19d1304834b4321df26fda83a4ec2bb9 100644
--- a/dist/node/esm/lib/db/inMemory.js
+++ b/dist/node/esm/lib/db/inMemory.js
@@ -11,7 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _InMemoryDB_kvMap, _InMemoryDB_currentRoot;
-import { ZERO_HASH } from '../hash/hash';
+import { ZERO_HASH } from '../hash/hash.js';
export class InMemoryDB {
constructor(_prefix) {
_InMemoryDB_kvMap.set(this, void 0);
diff --git a/dist/node/esm/lib/db/index.js b/dist/node/esm/lib/db/index.js
index e9e35c021c2a1db86fdd837ac67f34fef095d881..90ac0df4a493e2348877dcac982e1a04274c52be 100644
--- a/dist/node/esm/lib/db/index.js
+++ b/dist/node/esm/lib/db/index.js
@@ -1,3 +1,3 @@
-export * from './inMemory';
-export * from './localStorage';
-export * from './indexedDB';
+export * from './inMemory.js';
+export * from './localStorage.js';
+export * from './indexedDB.js';
diff --git a/dist/node/esm/lib/db/indexedDB.js b/dist/node/esm/lib/db/indexedDB.js
index a63a87947d7ddcb592445db1c1b55565a098e75d..2aad0b06e15bd639f59dbd972098dee5c444d99b 100644
--- a/dist/node/esm/lib/db/indexedDB.js
+++ b/dist/node/esm/lib/db/indexedDB.js
@@ -10,11 +10,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _IndexedDBStorage_currentRoot;
-import { Hash, ZERO_HASH } from '../hash/hash';
-import { bytes2Hex } from '../utils';
+import { Hash, ZERO_HASH } from '../hash/hash.js';
+import { bytes2Hex } from '../utils/index.js';
import { get, set, createStore } from 'idb-keyval';
-import { NODE_TYPE_EMPTY, NODE_TYPE_LEAF, NODE_TYPE_MIDDLE } from '../../constants';
-import { NodeEmpty, NodeLeaf, NodeMiddle } from '../node/node';
+import { NODE_TYPE_EMPTY, NODE_TYPE_LEAF, NODE_TYPE_MIDDLE } from '../../constants/index.js';
+import { NodeEmpty, NodeLeaf, NodeMiddle } from '../node/node.js';
export class IndexedDBStorage {
constructor(_prefix, databaseName) {
this._prefix = _prefix;
diff --git a/dist/node/esm/lib/db/localStorage.js b/dist/node/esm/lib/db/localStorage.js
index d3b491fa8eac93152a0065385926087945be1d61..262cb4aea143e39a2cd8b81e1e6ea3517052fd1f 100644
--- a/dist/node/esm/lib/db/localStorage.js
+++ b/dist/node/esm/lib/db/localStorage.js
@@ -11,10 +11,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _LocalStorageDB_currentRoot;
-import { Hash, ZERO_HASH } from '../hash/hash';
-import { NODE_TYPE_EMPTY, NODE_TYPE_LEAF, NODE_TYPE_MIDDLE } from '../../constants';
-import { NodeEmpty, NodeLeaf, NodeMiddle } from '../node/node';
-import { bytes2Hex } from '../utils';
+import { Hash, ZERO_HASH } from '../hash/hash.js';
+import { NODE_TYPE_EMPTY, NODE_TYPE_LEAF, NODE_TYPE_MIDDLE } from '../../constants/index.js';
+import { NodeEmpty, NodeLeaf, NodeMiddle } from '../node/node.js';
+import { bytes2Hex } from '../utils/index.js';
export class LocalStorageDB {
constructor(_prefix) {
this._prefix = _prefix;
diff --git a/dist/node/esm/lib/entry/data.js b/dist/node/esm/lib/entry/data.js
index ab6c18787d3af057e407da697da7854a38926f4f..bf03fa5ca0fc3670bbe10788f560f4d41021e1fe 100644
--- a/dist/node/esm/lib/entry/data.js
+++ b/dist/node/esm/lib/entry/data.js
@@ -10,9 +10,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _Data_value;
-import { ElemBytes } from './elemBytes';
-import { DATA_LEN, DATA_LEN_BYTES, ELEM_BYTES_LEN } from '../../constants';
-import { bytesEqual } from '../utils';
+import { ElemBytes } from './elemBytes.js';
+import { DATA_LEN, DATA_LEN_BYTES, ELEM_BYTES_LEN } from '../../constants/index.js';
+import { bytesEqual } from '../utils/index.js';
export class Data {
constructor() {
_Data_value.set(this, void 0);
diff --git a/dist/node/esm/lib/entry/elemBytes.js b/dist/node/esm/lib/entry/elemBytes.js
index 7d88919237fb556265790682620a39672669491a..69c5b712b03e748fcb97b027b10e5d69a228c177 100644
--- a/dist/node/esm/lib/entry/elemBytes.js
+++ b/dist/node/esm/lib/entry/elemBytes.js
@@ -10,8 +10,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _ElemBytes_bytes;
-import { ELEM_BYTES_LEN } from '../../constants';
-import { bytes2Hex, newBigIntFromBytes, swapEndianness } from '../utils';
+import { ELEM_BYTES_LEN } from '../../constants/index.js';
+import { bytes2Hex, newBigIntFromBytes, swapEndianness } from '../utils/index.js';
export class ElemBytes {
constructor() {
// Little Endian
diff --git a/dist/node/esm/lib/entry/entry.js b/dist/node/esm/lib/entry/entry.js
index 4aece28d7774e4e127ea31be45e8cbad2a3b5d20..1d41623ff95a6396e876a8388f7c0a4e9831a015 100644
--- a/dist/node/esm/lib/entry/entry.js
+++ b/dist/node/esm/lib/entry/entry.js
@@ -10,9 +10,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _Entry_data, _Entry_hIndex, _Entry_hValue;
-import { Data } from '../entry/data';
-import { ZERO_HASH, hashElems } from '../hash/hash';
-import { checkBigIntInField } from '../utils';
+import { Data } from '../entry/data.js';
+import { ZERO_HASH, hashElems } from '../hash/hash.js';
+import { checkBigIntInField } from '../utils/index.js';
export class Entry {
constructor(_data) {
_Entry_data.set(this, void 0);
diff --git a/dist/node/esm/lib/entry/index.js b/dist/node/esm/lib/entry/index.js
index b94142c230eea0528441d4fa3b7e3450d3c295b4..a15c17bb34db27eb13afbcbdd0ea955a024883fc 100644
--- a/dist/node/esm/lib/entry/index.js
+++ b/dist/node/esm/lib/entry/index.js
@@ -1,3 +1,3 @@
-export * from './data';
-export * from './elemBytes';
-export * from './entry';
+export * from './data.js';
+export * from './elemBytes.js';
+export * from './entry.js';
diff --git a/dist/node/esm/lib/errors/index.js b/dist/node/esm/lib/errors/index.js
index 345f727cb3b2e65ad046144d94717721a1eed03e..b946c4a20f5464ea005f5981260bb8e347635cd5 100644
--- a/dist/node/esm/lib/errors/index.js
+++ b/dist/node/esm/lib/errors/index.js
@@ -1,3 +1,3 @@
-export * from './merkletree';
-export * from './db';
-export * from './db';
+export * from './merkletree.js';
+export * from './db.js';
+export * from './db.js';
diff --git a/dist/node/esm/lib/hash/hash.js b/dist/node/esm/lib/hash/hash.js
index 00d8799a64644e35debcf7eed646c1b3433439fa..a22cde132136e267c54f835fc7c8b9fbfda36e2e 100644
--- a/dist/node/esm/lib/hash/hash.js
+++ b/dist/node/esm/lib/hash/hash.js
@@ -1,5 +1,5 @@
-import { HASH_BYTES_LENGTH } from '../../constants';
-import { bytesEqual, swapEndianness, bytes2Hex, bytes2BinaryString, checkBigIntInField, bigIntToUINT8Array } from '../utils';
+import { HASH_BYTES_LENGTH } from '../../constants/index.js';
+import { bytesEqual, swapEndianness, bytes2Hex, bytes2BinaryString, checkBigIntInField, bigIntToUINT8Array } from '../utils/index.js';
import { Hex, poseidon } from '@iden3/js-crypto';
export class Hash {
constructor(_bytes) {
diff --git a/dist/node/esm/lib/index.js b/dist/node/esm/lib/index.js
index bef50f6af13cc54f63afb4bf05648cf52be8418a..d4e90e3fd8be7eb207ebc9da6122ca161c59121c 100644
--- a/dist/node/esm/lib/index.js
+++ b/dist/node/esm/lib/index.js
@@ -1,7 +1,7 @@
-export * from './db';
-export * from './entry';
-export * from './errors';
-export * from './hash/hash';
-export * from './merkletree';
-export * from './node/node';
-export * from './utils';
+export * from './db/index.js';
+export * from './entry/index.js';
+export * from './errors/index.js';
+export * from './hash/hash.js';
+export * from './merkletree/index.js';
+export * from './node/node.js';
+export * from './utils/index.js';
diff --git a/dist/node/esm/lib/merkletree/circom.js b/dist/node/esm/lib/merkletree/circom.js
index f90cb42090aabff7b086f541e342c93537889887..eb563c71c9f043f30af8b374d15eeb30a7ef51d8 100644
--- a/dist/node/esm/lib/merkletree/circom.js
+++ b/dist/node/esm/lib/merkletree/circom.js
@@ -1,4 +1,4 @@
-import { ZERO_HASH } from '../hash/hash';
+import { ZERO_HASH } from '../hash/hash.js';
export class CircomVerifierProof {
constructor(_root = ZERO_HASH, _siblings = [], _oldKey = ZERO_HASH, _oldValue = ZERO_HASH, _isOld0 = false, _key = ZERO_HASH, _value = ZERO_HASH, _fnc = 0) {
this.root = _root;
diff --git a/dist/node/esm/lib/merkletree/index.js b/dist/node/esm/lib/merkletree/index.js
index b4d9f82111a1881af87d2c67d3f00af7a25a7779..12271fd7715236fa1d4141cf1abaf364a22dd91a 100644
--- a/dist/node/esm/lib/merkletree/index.js
+++ b/dist/node/esm/lib/merkletree/index.js
@@ -1,3 +1,3 @@
-export * from './circom';
-export * from './merkletree';
-export * from './proof';
+export * from './circom.js';
+export * from './merkletree.js';
+export * from './proof.js';
diff --git a/dist/node/esm/lib/merkletree/merkletree.js b/dist/node/esm/lib/merkletree/merkletree.js
index cda217a82e07149d0e1597229c14f460ef9e064b..38abdce6646fc01ea145931ca02457f8494520a6 100644
--- a/dist/node/esm/lib/merkletree/merkletree.js
+++ b/dist/node/esm/lib/merkletree/merkletree.js
@@ -10,15 +10,15 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _Merkletree_db, _Merkletree_root, _Merkletree_writable, _Merkletree_maxLevel;
-import { Hash, ZERO_HASH, circomSiblingsFromSiblings } from '../hash/hash';
-import { NODE_TYPE_EMPTY, NODE_TYPE_LEAF, NODE_TYPE_MIDDLE } from '../../constants';
-import { NodeEmpty, NodeLeaf, NodeMiddle } from '../node/node';
-import { bytesEqual, getPath } from '../utils';
-import { checkBigIntInField } from '../utils/crypto';
-import { CircomProcessorProof, CircomVerifierProof } from './circom';
-import { ErrEntryIndexAlreadyExists, ErrInvalidNodeFound, ErrKeyNotFound, ErrNotFound, ErrNotWritable, ErrReachedMaxLevel } from '../errors';
-import { Proof } from './proof';
-import { checkEntryInField } from '../entry';
+import { Hash, ZERO_HASH, circomSiblingsFromSiblings } from '../hash/hash.js';
+import { NODE_TYPE_EMPTY, NODE_TYPE_LEAF, NODE_TYPE_MIDDLE } from '../../constants/index.js';
+import { NodeEmpty, NodeLeaf, NodeMiddle } from '../node/node.js';
+import { bytesEqual, getPath } from '../utils/index.js';
+import { checkBigIntInField } from '../utils/crypto.js';
+import { CircomProcessorProof, CircomVerifierProof } from './circom.js';
+import { ErrEntryIndexAlreadyExists, ErrInvalidNodeFound, ErrKeyNotFound, ErrNotFound, ErrNotWritable, ErrReachedMaxLevel } from '../errors/index.js';
+import { Proof } from './proof.js';
+import { checkEntryInField } from '../entry/index.js';
export class Merkletree {
constructor(_db, _writable, _maxLevels) {
_Merkletree_db.set(this, void 0);
diff --git a/dist/node/esm/lib/merkletree/proof.js b/dist/node/esm/lib/merkletree/proof.js
index 0d6005a29a1487a0d216d1edca1e820c03dc4c64..10a0dc32bde3201310b609df7a55a34ac13f01cb 100644
--- a/dist/node/esm/lib/merkletree/proof.js
+++ b/dist/node/esm/lib/merkletree/proof.js
@@ -1,9 +1,9 @@
-import { ELEM_BYTES_LEN, NOT_EMPTIES_LEN, PROOF_FLAG_LEN } from '../../constants';
-import { bytesEqual, getPath, setBitBigEndian, siblings2Bytes, testBitBigEndian } from '../utils';
-import { Hash, ZERO_HASH } from '../hash/hash';
-import { NodeMiddle } from '../node/node';
-import { leafKey } from '../utils/node';
-import { ErrNodeAuxNonExistAgainstHIndex } from '../errors/proof';
+import { ELEM_BYTES_LEN, NOT_EMPTIES_LEN, PROOF_FLAG_LEN } from '../../constants/index.js';
+import { bytesEqual, getPath, setBitBigEndian, siblings2Bytes, testBitBigEndian } from '../utils/index.js';
+import { Hash, ZERO_HASH } from '../hash/hash.js';
+import { NodeMiddle } from '../node/node.js';
+import { leafKey } from '../utils/node.js';
+import { ErrNodeAuxNonExistAgainstHIndex } from '../errors/proof.js';
export class Proof {
constructor(obj) {
this.existence = obj?.existence ?? false;
diff --git a/dist/node/esm/lib/node/node.js b/dist/node/esm/lib/node/node.js
index 02c7e0a551aa0a750955e5f7d75d1aad4dde0878..f5de2f354c4d292f32605683318801ab995c6424 100644
--- a/dist/node/esm/lib/node/node.js
+++ b/dist/node/esm/lib/node/node.js
@@ -10,9 +10,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _NodeLeaf_key, _NodeMiddle_key, _NodeEmpty_key;
-import { ZERO_HASH, hashElems } from '../hash/hash';
-import { EMPTY_NODE_STRING, EMPTY_NODE_VALUE, NODE_TYPE_EMPTY, NODE_TYPE_LEAF, NODE_TYPE_MIDDLE } from '../../constants';
-import { leafKey, nodeValue } from '../utils/node';
+import { ZERO_HASH, hashElems } from '../hash/hash.js';
+import { EMPTY_NODE_STRING, EMPTY_NODE_VALUE, NODE_TYPE_EMPTY, NODE_TYPE_LEAF, NODE_TYPE_MIDDLE } from '../../constants/index.js';
+import { leafKey, nodeValue } from '../utils/node.js';
export class NodeLeaf {
constructor(k, v) {
// cache used to avoid recalculating key
diff --git a/dist/node/esm/lib/utils/bigint.js b/dist/node/esm/lib/utils/bigint.js
index 996949bc0eba8ec94f41b327f141009c9a003ea1..7d1b39e75892f22f1851e3a679dafccb43bdf09a 100644
--- a/dist/node/esm/lib/utils/bigint.js
+++ b/dist/node/esm/lib/utils/bigint.js
@@ -1,4 +1,4 @@
-import { HASH_BYTES_LENGTH } from '../../constants';
+import { HASH_BYTES_LENGTH } from '../../constants/index.js';
export const bigint2Array = (bigNum, radix) => {
return bigNum
.toString(radix ? radix : 10)
diff --git a/dist/node/esm/lib/utils/bytes.js b/dist/node/esm/lib/utils/bytes.js
index 4bcd4676d9e108e980983e7cd6c7664b336bf08a..22b04e74c18005d2d9eeeb6a4e7e60026f346e5c 100644
--- a/dist/node/esm/lib/utils/bytes.js
+++ b/dist/node/esm/lib/utils/bytes.js
@@ -1,5 +1,5 @@
-import { HASH_BYTES_LENGTH } from '../../constants';
-import { checkBigIntInField } from './crypto';
+import { HASH_BYTES_LENGTH } from '../../constants/index.js';
+import { checkBigIntInField } from './crypto.js';
export const bytesEqual = (b1, b2) => {
return b1.every((ele, idx) => ele === b2[idx]);
};
diff --git a/dist/node/esm/lib/utils/crypto.js b/dist/node/esm/lib/utils/crypto.js
index 38eed0054ba596aaf0d8d73e2be30c2f39a61123..9079eadd33620530623523a5362ff5ea7713ac9e 100644
--- a/dist/node/esm/lib/utils/crypto.js
+++ b/dist/node/esm/lib/utils/crypto.js
@@ -1,4 +1,4 @@
-import { FIELD_SIZE } from '../../constants/field';
+import { FIELD_SIZE } from '../../constants/field.js';
export const checkBigIntInField = (bigNum) => {
return bigNum < FIELD_SIZE;
};
diff --git a/dist/node/esm/lib/utils/index.js b/dist/node/esm/lib/utils/index.js
index 1e7d7c57fb091b1ffa51ec9b758cec2912af8f79..8dc8ff91df9e75365140b62e8a0d2be51eaf6cbe 100644
--- a/dist/node/esm/lib/utils/index.js
+++ b/dist/node/esm/lib/utils/index.js
@@ -1,4 +1,4 @@
-export * from './bytes';
-export * from './merkletree';
-export * from './bigint';
-export * from './crypto';
+export * from './bytes.js';
+export * from './merkletree.js';
+export * from './bigint.js';
+export * from './crypto.js';
diff --git a/dist/node/esm/lib/utils/merkletree.js b/dist/node/esm/lib/utils/merkletree.js
index 09248c75891ad969b7262cc52c04dfc1688a7c27..9603cead526f26b1393091552c474404a25d1588 100644
--- a/dist/node/esm/lib/utils/merkletree.js
+++ b/dist/node/esm/lib/utils/merkletree.js
@@ -1,6 +1,6 @@
// const siblingBytes = bs.slice(this.notEmpties.length + PROOF_FLAG_LEN);
-import { HASH_BYTES_LENGTH } from '../../constants';
-import { testBit } from './bytes';
+import { HASH_BYTES_LENGTH } from '../../constants/index.js';
+import { testBit } from './bytes.js';
export const getPath = (numLevels, k) => {
const path = new Array(numLevels);
for (let idx = 0; idx < numLevels; idx += 1) {
diff --git a/dist/node/esm/lib/utils/node.js b/dist/node/esm/lib/utils/node.js
index 5d86d1ab22ee996b0319afd166a21085f9c3d872..dffc1cc3ba2012d469d022cc16c6eb95ca9c3cfe 100644
--- a/dist/node/esm/lib/utils/node.js
+++ b/dist/node/esm/lib/utils/node.js
@@ -1,8 +1,8 @@
// LeafKey computes the key of a leaf node given the hIndex and hValue of the
// entry of the leaf.
-import { hashElemsKey } from '../hash/hash';
-import { NODE_VALUE_BYTE_ARR_LENGTH } from '../../constants';
-import { bigIntToUINT8Array } from './bigint';
+import { hashElemsKey } from '../hash/hash.js';
+import { NODE_VALUE_BYTE_ARR_LENGTH } from '../../constants/index.js';
+import { bigIntToUINT8Array } from './bigint.js';
export const leafKey = async (k, v) => {
return hashElemsKey(BigInt(1), [k.bigInt(), v.bigInt()]);
};
diff --git a/dist/node/esm/types/index.js b/dist/node/esm/types/index.js
index a27fe01c48666116e12f80ab73788c5db4aa7476..6058b3af422e693ade1d7b60bed25b0f4cee94d4 100644
--- a/dist/node/esm/types/index.js
+++ b/dist/node/esm/types/index.js
@@ -1,5 +1,5 @@
-export * from './hash';
-export * from './node';
-export * from './bytes';
-export * from './storage';
-export * from './merkletree';
+export * from './hash.js';
+export * from './node.js';
+export * from './bytes.js';
+export * from './storage.js';
+export * from './merkletree.js';
diff --git a/package.json b/package.json
index 99e3520fd0146541de311685696afd9377d11423..81a18cc7e57b26f013cd70ac5a9d39f618517121 100644
--- a/package.json
+++ b/package.json
@@ -6,6 +6,7 @@
"main": "dist/node/cjs/index.js",
"module": "dist/node/esm/index.js",
"source": "./src/index.ts",
+ "type": "module",
"exports": {
".": {
"node": {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment