@arcblock/vc 1.30.3 → 1.30.5

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/esm/index.mjs CHANGED
@@ -6,7 +6,6 @@ import { fromPublicKey } from "@ocap/wallet";
6
6
  import Debug from "debug";
7
7
  import stringify from "fast-json-stable-stringify";
8
8
  import isAbsoluteUrl from "is-absolute-url";
9
- import cloneDeep from "lodash/cloneDeep.js";
10
9
 
11
10
  //#region src/index.ts
12
11
  /**
@@ -126,7 +125,7 @@ async function verify({ vc, ownerDid, trustedIssuers, ignoreExpired = false }) {
126
125
  const proofSigner = proof.signer || vc.issuer.id;
127
126
  if (!issuers.includes(proofSigner)) throw new Error("Proof signer not in trusted issuers");
128
127
  if (proof.signer && proof.pk && !isFromPublicKey(proof.signer, proof.pk)) throw new Error("Proof pk does not match signer");
129
- const clone = cloneDeep(vc);
128
+ const clone = structuredClone(vc);
130
129
  delete clone.signature;
131
130
  const prevProofRefs = proof.previousProof;
132
131
  if (prevProofRefs && (typeof prevProofRefs === "string" || Array.isArray(prevProofRefs) && prevProofRefs.length > 0)) {
@@ -162,7 +161,7 @@ async function counterSign({ vc, wallet, mode = "set" }) {
162
161
  ...p,
163
162
  id: crypto.randomUUID()
164
163
  });
165
- const clone = cloneDeep(vc);
164
+ const clone = structuredClone(vc);
166
165
  delete clone.signature;
167
166
  const newProof = {
168
167
  type: proofTypes[pkType],
@@ -202,7 +201,7 @@ async function verifyPresentation({ presentation, trustedIssuers, challenge, ign
202
201
  if (!presentation.challenge || challenge !== presentation.challenge) throw Error("Invalid challenge included on vc presentation");
203
202
  const vcList = Array.isArray(presentation.verifiableCredential) ? presentation.verifiableCredential : [presentation.verifiableCredential];
204
203
  const proofList = Array.isArray(presentation.proof) ? presentation.proof : [presentation.proof];
205
- const clone = cloneDeep(presentation);
204
+ const clone = structuredClone(presentation);
206
205
  delete clone.proof;
207
206
  await Promise.all(vcList.map(async (vcStr) => {
208
207
  const vcObj = JSON.parse(vcStr);
@@ -264,7 +263,7 @@ async function verifyCredentialList({ credentials, trustedIssuers }) {
264
263
  if (!isFromPublicKey(issuerDid, x.issuer.pk)) throw new Error("Credential not issuer pk not match with issuer did");
265
264
  const proofList = Array.isArray(x.proof) ? x.proof : x.proof ? [x.proof] : [];
266
265
  if (proofList.length === 0 || proofList.some((p) => !p || !p.jws)) throw new Error("Invalid credential proof");
267
- const clone = cloneDeep(x);
266
+ const clone = structuredClone(x);
268
267
  delete clone.proof;
269
268
  const signedContent = stringify(clone);
270
269
  for (const proof of proofList) {
package/lib/index.cjs CHANGED
@@ -10,8 +10,6 @@ let fast_json_stable_stringify = require("fast-json-stable-stringify");
10
10
  fast_json_stable_stringify = require_rolldown_runtime.__toESM(fast_json_stable_stringify);
11
11
  let is_absolute_url = require("is-absolute-url");
12
12
  is_absolute_url = require_rolldown_runtime.__toESM(is_absolute_url);
13
- let lodash_cloneDeep = require("lodash/cloneDeep");
14
- lodash_cloneDeep = require_rolldown_runtime.__toESM(lodash_cloneDeep);
15
13
 
16
14
  //#region src/index.ts
17
15
  /**
@@ -131,7 +129,7 @@ async function verify({ vc, ownerDid, trustedIssuers, ignoreExpired = false }) {
131
129
  const proofSigner = proof.signer || vc.issuer.id;
132
130
  if (!issuers.includes(proofSigner)) throw new Error("Proof signer not in trusted issuers");
133
131
  if (proof.signer && proof.pk && !(0, _arcblock_did.isFromPublicKey)(proof.signer, proof.pk)) throw new Error("Proof pk does not match signer");
134
- const clone = (0, lodash_cloneDeep.default)(vc);
132
+ const clone = structuredClone(vc);
135
133
  delete clone.signature;
136
134
  const prevProofRefs = proof.previousProof;
137
135
  if (prevProofRefs && (typeof prevProofRefs === "string" || Array.isArray(prevProofRefs) && prevProofRefs.length > 0)) {
@@ -167,7 +165,7 @@ async function counterSign({ vc, wallet, mode = "set" }) {
167
165
  ...p,
168
166
  id: crypto.randomUUID()
169
167
  });
170
- const clone = (0, lodash_cloneDeep.default)(vc);
168
+ const clone = structuredClone(vc);
171
169
  delete clone.signature;
172
170
  const newProof = {
173
171
  type: proofTypes[pkType],
@@ -207,7 +205,7 @@ async function verifyPresentation({ presentation, trustedIssuers, challenge, ign
207
205
  if (!presentation.challenge || challenge !== presentation.challenge) throw Error("Invalid challenge included on vc presentation");
208
206
  const vcList = Array.isArray(presentation.verifiableCredential) ? presentation.verifiableCredential : [presentation.verifiableCredential];
209
207
  const proofList = Array.isArray(presentation.proof) ? presentation.proof : [presentation.proof];
210
- const clone = (0, lodash_cloneDeep.default)(presentation);
208
+ const clone = structuredClone(presentation);
211
209
  delete clone.proof;
212
210
  await Promise.all(vcList.map(async (vcStr) => {
213
211
  const vcObj = JSON.parse(vcStr);
@@ -269,7 +267,7 @@ async function verifyCredentialList({ credentials, trustedIssuers }) {
269
267
  if (!(0, _arcblock_did.isFromPublicKey)(issuerDid, x.issuer.pk)) throw new Error("Credential not issuer pk not match with issuer did");
270
268
  const proofList = Array.isArray(x.proof) ? x.proof : x.proof ? [x.proof] : [];
271
269
  if (proofList.length === 0 || proofList.some((p) => !p || !p.jws)) throw new Error("Invalid credential proof");
272
- const clone = (0, lodash_cloneDeep.default)(x);
270
+ const clone = structuredClone(x);
273
271
  delete clone.proof;
274
272
  const signedContent = (0, fast_json_stable_stringify.default)(clone);
275
273
  for (const proof of proofList) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/vc",
3
- "version": "1.30.3",
3
+ "version": "1.30.5",
4
4
  "description": "TypeScript lib to work with ArcBlock Verifiable Credentials",
5
5
  "keywords": [
6
6
  "arcblock",
@@ -71,10 +71,10 @@
71
71
  "url": "https://github.com/ArcBlock/blockchain/issues"
72
72
  },
73
73
  "dependencies": {
74
- "@arcblock/did": "1.30.3",
75
- "@ocap/mcrypto": "1.30.3",
76
- "@ocap/util": "1.30.3",
77
- "@ocap/wallet": "1.30.3",
74
+ "@arcblock/did": "1.30.5",
75
+ "@ocap/mcrypto": "1.30.5",
76
+ "@ocap/util": "1.30.5",
77
+ "@ocap/wallet": "1.30.5",
78
78
  "debug": "^4.4.3",
79
79
  "is-absolute-url": "^3.0.3",
80
80
  "fast-json-stable-stringify": "^2.1.0",