@zkpassport/sdk 0.2.6 → 0.2.7

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
@@ -4,7 +4,7 @@ Privacy-preserving identity verification using passports and ID cards.
4
4
 
5
5
  _⚠️ Warning ⚠️_
6
6
 
7
- _This version of the SDK is only compatible with the version 0.5 and above of ZKPassport mobile app._
7
+ _This is experimental software that has not been audited yet. Use at your own risk._
8
8
 
9
9
  ## Installation
10
10
 
package/dist/cjs/index.js CHANGED
@@ -10,7 +10,7 @@ const websocket_1 = require("./websocket");
10
10
  const json_rpc_1 = require("./json-rpc");
11
11
  const encryption_1 = require("./encryption");
12
12
  const logger_1 = require("./logger");
13
- const node_gzip_1 = require("node-gzip");
13
+ const pako_1 = require("pako");
14
14
  //import initNoirC from '@noir-lang/noirc_abi'
15
15
  //import initACVM from '@noir-lang/acvm_js'
16
16
  const en_json_1 = tslib_1.__importDefault(require("i18n-iso-countries/langs/en.json"));
@@ -18,6 +18,9 @@ const buffer_1 = require("buffer/");
18
18
  // If Buffer is not defined, then we use the Buffer from the buffer package
19
19
  if (typeof globalThis.Buffer === "undefined") {
20
20
  globalThis.Buffer = buffer_1.Buffer;
21
+ if (typeof window !== "undefined") {
22
+ window.Buffer = buffer_1.Buffer;
23
+ }
21
24
  }
22
25
  (0, i18n_iso_countries_1.registerLocale)(en_json_1.default);
23
26
  function hasRequestedAccessToField(credentialsRequest, field) {
@@ -178,7 +181,7 @@ class ZKPassport {
178
181
  logger_1.noLogger.debug(`User generated proof`);
179
182
  // Uncompress the proof and convert it to a hex string
180
183
  const bytesProof = buffer_1.Buffer.from(request.params.proof, "base64");
181
- const uncompressedProof = await (0, node_gzip_1.ungzip)(bytesProof);
184
+ const uncompressedProof = (0, pako_1.inflate)(bytesProof);
182
185
  // The gzip lib in the app compress the proof as ASCII
183
186
  // and since the app passes the proof as a hex string, we can
184
187
  // just decode the bytes as hex characters using the TextDecoder
package/dist/esm/index.js CHANGED
@@ -6,7 +6,7 @@ import { getWebSocketClient } from "./websocket";
6
6
  import { createEncryptedJsonRpcRequest } from "./json-rpc";
7
7
  import { decrypt, generateECDHKeyPair, getSharedSecret } from "./encryption";
8
8
  import { noLogger as logger } from "./logger";
9
- import { ungzip } from "node-gzip";
9
+ import { inflate } from "pako";
10
10
  //import initNoirC from '@noir-lang/noirc_abi'
11
11
  //import initACVM from '@noir-lang/acvm_js'
12
12
  import i18en from "i18n-iso-countries/langs/en.json";
@@ -14,6 +14,9 @@ import { Buffer } from "buffer/";
14
14
  // If Buffer is not defined, then we use the Buffer from the buffer package
15
15
  if (typeof globalThis.Buffer === "undefined") {
16
16
  globalThis.Buffer = Buffer;
17
+ if (typeof window !== "undefined") {
18
+ window.Buffer = Buffer;
19
+ }
17
20
  }
18
21
  registerLocale(i18en);
19
22
  function hasRequestedAccessToField(credentialsRequest, field) {
@@ -168,7 +171,7 @@ export class ZKPassport {
168
171
  logger.debug(`User generated proof`);
169
172
  // Uncompress the proof and convert it to a hex string
170
173
  const bytesProof = Buffer.from(request.params.proof, "base64");
171
- const uncompressedProof = await ungzip(bytesProof);
174
+ const uncompressedProof = inflate(bytesProof);
172
175
  // The gzip lib in the app compress the proof as ASCII
173
176
  // and since the app passes the proof as a hex string, we can
174
177
  // just decode the bytes as hex characters using the TextDecoder
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zkpassport/sdk",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Privacy-preserving identity verification using passports and ID cards",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -31,7 +31,7 @@
31
31
  "@jest/globals": "^29.7.0",
32
32
  "@types/jest": "^29.5.14",
33
33
  "@types/node": "^22.10.9",
34
- "@types/node-gzip": "^1.1.3",
34
+ "@types/pako": "^2.0.3",
35
35
  "@types/ws": "^8.5.12",
36
36
  "jest": "^29.7.0",
37
37
  "ts-node": "^10.9.2",
@@ -44,7 +44,7 @@
44
44
  "@zkpassport/utils": "^0.2.16",
45
45
  "buffer": "^6.0.3",
46
46
  "i18n-iso-countries": "^7.12.0",
47
- "node-gzip": "^1.1.2",
47
+ "pako": "^2.1.0",
48
48
  "ws": "^8.18.0"
49
49
  },
50
50
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
package/src/index.ts CHANGED
@@ -37,7 +37,7 @@ import { getWebSocketClient, WebSocketClient } from "./websocket"
37
37
  import { createEncryptedJsonRpcRequest } from "./json-rpc"
38
38
  import { decrypt, generateECDHKeyPair, getSharedSecret } from "./encryption"
39
39
  import { noLogger as logger } from "./logger"
40
- import { ungzip } from "node-gzip"
40
+ import { inflate } from "pako"
41
41
  //import initNoirC from '@noir-lang/noirc_abi'
42
42
  //import initACVM from '@noir-lang/acvm_js'
43
43
  import i18en from "i18n-iso-countries/langs/en.json"
@@ -46,6 +46,9 @@ import { Buffer } from "buffer/"
46
46
  // If Buffer is not defined, then we use the Buffer from the buffer package
47
47
  if (typeof globalThis.Buffer === "undefined") {
48
48
  globalThis.Buffer = Buffer as any
49
+ if (typeof window !== "undefined") {
50
+ window.Buffer = Buffer as any
51
+ }
49
52
  }
50
53
 
51
54
  registerLocale(i18en)
@@ -395,7 +398,7 @@ export class ZKPassport {
395
398
  logger.debug(`User generated proof`)
396
399
  // Uncompress the proof and convert it to a hex string
397
400
  const bytesProof = Buffer.from(request.params.proof, "base64")
398
- const uncompressedProof = await ungzip(bytesProof)
401
+ const uncompressedProof = inflate(bytesProof)
399
402
  // The gzip lib in the app compress the proof as ASCII
400
403
  // and since the app passes the proof as a hex string, we can
401
404
  // just decode the bytes as hex characters using the TextDecoder