@zkpassport/sdk 0.5.6 → 0.5.7-beta.1

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.
@@ -1,10 +1,13 @@
1
- import { type DisclosableIDCredential, type IDCredential, type IDCredentialValue, type NumericalIDCredential, type ProofResult, type QueryResult, ProofMode, BoundData } from "@zkpassport/utils";
2
- export type QueryResultError<T> = {
1
+ import { IDCredential, ProofResult, QueryResult, IDCredentialValue, NumericalIDCredential, DisclosableIDCredential, BoundData, ProofMode } from '@zkpassport/utils';
2
+ export * from '@zkpassport/utils';
3
+ export { ASEAN_COUNTRIES, EEA_COUNTRIES, EU_COUNTRIES, MERCOSUR_COUNTRIES, SANCTIONED_COUNTRIES, SCHENGEN_COUNTRIES } from '@zkpassport/utils';
4
+
5
+ type QueryResultError<T> = {
3
6
  expected?: T;
4
7
  received?: T;
5
8
  message: string;
6
9
  };
7
- export type QueryResultErrors = {
10
+ type QueryResultErrors = {
8
11
  [key in IDCredential | "sig_check_dsc" | "sig_check_id_data" | "data_check_integrity" | "outer" | "disclose" | "bind"]: {
9
12
  disclose?: QueryResultError<string | number | Date>;
10
13
  gte?: QueryResultError<number | Date>;
@@ -20,7 +23,7 @@ export type QueryResultErrors = {
20
23
  scope?: QueryResultError<string>;
21
24
  };
22
25
  };
23
- export type SolidityVerifierParameters = {
26
+ type SolidityVerifierParameters = {
24
27
  vkeyHash: string;
25
28
  proof: string;
26
29
  publicInputs: string[];
@@ -31,10 +34,9 @@ export type SolidityVerifierParameters = {
31
34
  scope: string;
32
35
  devMode: boolean;
33
36
  };
34
- export type EVMChain = "ethereum_sepolia" | "local_anvil";
35
- export type * from "@zkpassport/utils";
36
- export { SANCTIONED_COUNTRIES, EU_COUNTRIES, EEA_COUNTRIES, SCHENGEN_COUNTRIES, ASEAN_COUNTRIES, MERCOSUR_COUNTRIES, } from "@zkpassport/utils";
37
- export type QueryBuilderResult = {
37
+ type EVMChain = "ethereum_sepolia" | "local_anvil";
38
+
39
+ type QueryBuilderResult = {
38
40
  /**
39
41
  * The URL of the request.
40
42
  *
@@ -101,7 +103,7 @@ export type QueryBuilderResult = {
101
103
  */
102
104
  requestReceived: () => boolean;
103
105
  };
104
- export type QueryBuilder = {
106
+ type QueryBuilder = {
105
107
  /**
106
108
  * Requires this attribute to be equal to the provided value.
107
109
  * @param key The attribute to compare.
@@ -165,7 +167,7 @@ export type QueryBuilder = {
165
167
  */
166
168
  done: () => QueryBuilderResult;
167
169
  };
168
- export declare class ZKPassport {
170
+ declare class ZKPassport {
169
171
  private domain;
170
172
  private topicToConfig;
171
173
  private topicToLocalConfig;
@@ -303,3 +305,5 @@ export declare class ZKPassport {
303
305
  */
304
306
  clearAllRequests(): void;
305
307
  }
308
+
309
+ export { type EVMChain, type QueryBuilder, type QueryBuilderResult, type QueryResultError, type QueryResultErrors, type SolidityVerifierParameters, ZKPassport };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/logger.ts
21
+ var logger_exports = {};
22
+ __export(logger_exports, {
23
+ customLogger: () => customLogger,
24
+ noLogger: () => noLogger
25
+ });
26
+ module.exports = __toCommonJS(logger_exports);
27
+ var customLogger = {
28
+ debug: (message, ...args) => console.debug(message, ...args),
29
+ info: (message, ...args) => console.info(message, ...args),
30
+ warn: (message, ...args) => console.warn(message, ...args),
31
+ error: (message, ...args) => console.error(message, ...args)
32
+ };
33
+ var noLogger = {
34
+ debug: (..._) => {
35
+ },
36
+ info: (..._) => {
37
+ },
38
+ warn: (..._) => {
39
+ },
40
+ error: (..._) => {
41
+ }
42
+ };
43
+ // Annotate the CommonJS export names for ESM import in node:
44
+ 0 && (module.exports = {
45
+ customLogger,
46
+ noLogger
47
+ });
@@ -1,12 +1,14 @@
1
- export declare const customLogger: {
1
+ declare const customLogger: {
2
2
  debug: (message: string, ...args: any[]) => void;
3
3
  info: (message: string, ...args: any[]) => void;
4
4
  warn: (message: string, ...args: any[]) => void;
5
5
  error: (message: string, ...args: any[]) => void;
6
6
  };
7
- export declare const noLogger: {
7
+ declare const noLogger: {
8
8
  debug: (..._: any[]) => void;
9
9
  info: (..._: any[]) => void;
10
10
  warn: (..._: any[]) => void;
11
11
  error: (..._: any[]) => void;
12
12
  };
13
+
14
+ export { customLogger, noLogger };
package/dist/esm/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { getAlpha3Code, registerLocale } from "i18n-iso-countries";
2
2
  import { getProofData, getCommitmentFromDSCProof, getCommitmentInFromIDDataProof, getCommitmentOutFromIDDataProof, getNullifierFromDisclosureProof, getCommitmentInFromIntegrityProof, getCommitmentOutFromIntegrityProof, getCommitmentInFromDisclosureProof, getMerkleRootFromDSCProof, getCurrentDateFromIntegrityProof, DisclosedData, formatName, getNumberOfPublicInputs, getParameterCommitmentFromDisclosureProof, getCountryParameterCommitment, getDiscloseParameterCommitment, getDateParameterCommitment, getCertificateRegistryRootFromOuterProof, getParamCommitmentsFromOuterProof, getCurrentDateFromCommittedInputs, getMinAgeFromCommittedInputs, getMaxAgeFromCommittedInputs, getAgeParameterCommitment, getMinDateFromCommittedInputs, getMaxDateFromCommittedInputs, getCurrentDateFromOuterProof, getNullifierFromOuterProof, getAgeEVMParameterCommitment, getDateEVMParameterCommitment, getDiscloseEVMParameterCommitment, getCountryEVMParameterCommitment, rightPadArrayWithZeros, getCommittedInputCount, ProofType, getScopeHash, getScopeFromOuterProof, getSubscopeFromOuterProof, getServiceScopeHash, getBindEVMParameterCommitment, getBindParameterCommitment, formatBoundData, getCircuitRegistryRootFromOuterProof, } from "@zkpassport/utils";
3
3
  import { bytesToHex } from "@noble/ciphers/utils";
4
- import { noLogger as logger } from "./logger";
4
+ import { noLogger as logger } from "./logger.js";
5
5
  import i18en from "i18n-iso-countries/langs/en.json";
6
- import { Buffer } from "buffer/";
6
+ import { Buffer } from "buffer";
7
7
  import { sha256 } from "@noble/hashes/sha2";
8
8
  import { hexToBytes } from "@noble/hashes/utils";
9
9
  import ZKPassportVerifierAbi from "./assets/abi/ZKPassportVerifier.json";
package/package.json CHANGED
@@ -1,55 +1,52 @@
1
1
  {
2
2
  "name": "@zkpassport/sdk",
3
- "version": "0.5.6",
3
+ "version": "0.5.7-beta.1",
4
4
  "description": "Privacy-preserving identity verification using passports and ID cards",
5
- "main": "./dist/cjs/index.js",
6
- "module": "./dist/esm/index.js",
7
- "types": "./dist/esm/index.d.ts",
5
+ "author": "ZKPassport",
6
+ "license": "Apache-2.0",
8
7
  "type": "module",
9
- "files": [
10
- "src/",
11
- "dist/**",
12
- "tsconfig.json",
13
- "README.md"
14
- ],
15
- "scripts": {
16
- "prepublishOnly": "npm run test && npm run build",
17
- "build": "npm run build:esm && npm run build:cjs",
18
- "build:esm": "tsc -p tsconfig.json",
19
- "build:cjs": "tsc -p tsconfig.cjs.json",
20
- "test": "NODE_OPTIONS='--require ts-node/register' NODE_NO_WARNINGS=1 node node_modules/.bin/jest --no-cache --passWithNoTests --runInBand **/*.test.ts",
21
- "test:debug": "NODE_OPTIONS='--require ts-node/register' NODE_NO_WARNINGS=1 node --inspect-brk=0.0.0.0 node_modules/.bin/jest --no-cache --passWithNoTests --runInBand **/*.test.ts",
22
- "deploy": "npm publish --access public"
8
+ "main": "./dist/esm/index.js",
9
+ "types": "./dist/esm/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/esm/index.js",
13
+ "require": "./dist/cjs/index.cjs"
14
+ }
23
15
  },
24
- "keywords": [],
25
- "author": "",
26
- "license": "Apache-2.0",
27
- "devDependencies": {
28
- "@babel/plugin-proposal-decorators": "^7.25.9",
29
- "@babel/preset-env": "^7.26.0",
30
- "@babel/preset-typescript": "^7.26.0",
31
- "@jest/globals": "^29.7.0",
32
- "@types/jest": "^29.5.14",
33
- "@types/node": "^22.10.9",
34
- "@types/pako": "^2.0.3",
35
- "@types/ws": "^8.5.12",
36
- "jest": "^29.7.0",
37
- "ts-node": "^10.9.2",
38
- "typescript": "^5.6.2"
16
+ "scripts": {
17
+ "test": "bun test",
18
+ "coverage": "bun test --coverage",
19
+ "check": "tsc --noEmit && prettier -c src tests",
20
+ "format": "prettier -c -w src tests",
21
+ "build": "rimraf dist && tsc && bun run scripts/fix-aliases.mjs && tsup",
22
+ "prepublishOnly": "./scripts/prepublish.sh"
39
23
  },
24
+ "files": [
25
+ "dist/esm",
26
+ "dist/cjs"
27
+ ],
28
+ "keywords": [
29
+ "zkpassport",
30
+ "zkpassport-sdk",
31
+ "sdk"
32
+ ],
40
33
  "dependencies": {
41
34
  "@aztec/bb.js": "^0.82.2",
42
35
  "@noble/ciphers": "^1.2.1",
43
36
  "@noble/hashes": "^1.7.2",
44
37
  "@noble/secp256k1": "^2.2.3",
45
38
  "@obsidion/bridge": "^0.10.2",
46
- "@zkpassport/registry": "^0.5.2",
47
- "@zkpassport/utils": "^0.15.3",
39
+ "@zkpassport/registry": "0.5.2",
40
+ "@zkpassport/utils": "0.16.2",
48
41
  "buffer": "^6.0.3",
49
42
  "i18n-iso-countries": "^7.12.0",
50
43
  "pako": "^2.1.0",
51
44
  "viem": "^2.27.2",
52
45
  "ws": "^8.18.0"
53
46
  },
54
- "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
47
+ "devDependencies": {
48
+ "@types/pako": "^2.0.3",
49
+ "@types/ws": "^8.5.12"
50
+ },
51
+ "packageManager": "bun@1.2.13"
55
52
  }