@blocklet/meta 1.16.37-beta-20250104-120451-e4049aeb → 1.16.37-beta-20250106-134442-ea92021c

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2018-2020 ArcBlock
1
+ Copyright 2018-2025 ArcBlock
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
package/lib/index.d.ts CHANGED
@@ -84,7 +84,7 @@ declare const _default: {
84
84
  permanentWallet: import("@ocap/wallet").WalletObject;
85
85
  };
86
86
  getBlockletEngine: (meta: any) => import("./types").TEngine;
87
- verifyMultiSig: (blockletMeta: import("./types").TBlockletMeta) => boolean;
87
+ verifyMultiSig: (blockletMeta: import("./types").TBlockletMeta) => Promise<boolean>;
88
88
  getConnectedAccounts: typeof getConnectedAccounts;
89
89
  getConnectedDids: typeof getConnectedDids;
90
90
  getPermanentDid: typeof getPermanentDid;
package/lib/payment/v2.js CHANGED
@@ -419,7 +419,7 @@ const getStoreSignatures = async ({ meta, stores, factoryInput, contract, }) =>
419
419
  // verify sig
420
420
  const type = toTypeInfo(id);
421
421
  const wallet = (0, wallet_1.fromPublicKey)(pk, type);
422
- const verifyRes = wallet.verify(paymentIntegrity, res.signature);
422
+ const verifyRes = await wallet.verify(paymentIntegrity, res.signature);
423
423
  if (verifyRes !== true) {
424
424
  throw new Error('verify store signature failed');
425
425
  }
package/lib/security.d.ts CHANGED
@@ -4,4 +4,4 @@ export declare function signResponse<T extends Record<string, any>>(data: T, wal
4
4
  };
5
5
  export declare function verifyResponse<T extends Record<string, any>>(signed: T & {
6
6
  $signature?: string;
7
- }, wallet: WalletObject): boolean;
7
+ }, wallet: WalletObject): Promise<boolean>;
package/lib/security.js CHANGED
@@ -15,7 +15,7 @@ function signResponse(data, wallet) {
15
15
  }
16
16
  function verifyResponse(signed, wallet) {
17
17
  if (!signed.$signature) {
18
- return false;
18
+ return Promise.resolve(false);
19
19
  }
20
- return wallet.verify((0, json_stable_stringify_1.default)((0, omit_1.default)(signed, '$signature')), signed.$signature);
20
+ return Promise.resolve(wallet.verify((0, json_stable_stringify_1.default)((0, omit_1.default)(signed, '$signature')), signed.$signature));
21
21
  }
@@ -1,3 +1,3 @@
1
1
  import { TBlockletMeta } from './types';
2
- declare const verifyMultiSig: (blockletMeta: TBlockletMeta) => boolean;
2
+ declare const verifyMultiSig: (blockletMeta: TBlockletMeta) => Promise<boolean>;
3
3
  export = verifyMultiSig;
@@ -13,7 +13,7 @@ const jwt_1 = require("@arcblock/jwt");
13
13
  const util_1 = require("@ocap/util");
14
14
  const debug_1 = __importDefault(require("debug"));
15
15
  const debug = (0, debug_1.default)('@blocklet/meta:verifyMultiSig');
16
- function verifyDelegationToken(signature) {
16
+ async function verifyDelegationToken(signature) {
17
17
  if (signature.delegation) {
18
18
  // @ts-ignore
19
19
  const payload = JSON.parse((0, util_1.fromBase64)(signature.delegation.split('.')[1]));
@@ -30,14 +30,14 @@ function verifyDelegationToken(signature) {
30
30
  return false;
31
31
  }
32
32
  // 验证一下delegation token
33
- if (!(0, jwt_1.verify)(signature.delegation, signature.pk)) {
33
+ if (!(await (0, jwt_1.verify)(signature.delegation, signature.pk))) {
34
34
  debug('verify delegation token failed', signature);
35
35
  return false;
36
36
  }
37
37
  }
38
38
  return true;
39
39
  }
40
- const verifyMultiSig = (blockletMeta) => {
40
+ const verifyMultiSig = async (blockletMeta) => {
41
41
  const { signatures: tmpSignatures, ...meta } = blockletMeta;
42
42
  const signatures = (0, cloneDeep_1.default)(tmpSignatures);
43
43
  if (!Array.isArray(signatures)) {
@@ -51,7 +51,8 @@ const verifyMultiSig = (blockletMeta) => {
51
51
  for (let i = 0; i < length; i++) {
52
52
  const signature = signatures.shift();
53
53
  // 验证delegation token
54
- if (!verifyDelegationToken(signature)) {
54
+ // eslint-disable-next-line no-await-in-loop
55
+ if (!(await verifyDelegationToken(signature))) {
55
56
  return false;
56
57
  }
57
58
  const { sig, signer, pk } = signature.delegation
@@ -78,7 +79,8 @@ const verifyMultiSig = (blockletMeta) => {
78
79
  }
79
80
  const type = (0, did_1.toTypeInfo)(signer);
80
81
  const wallet = (0, wallet_1.fromPublicKey)(pk, type);
81
- const verifyRes = wallet.verify((0, json_stable_stringify_1.default)({ ...toBeVerifiedMeta, signatures: [signature, ...signatures] }), sig);
82
+ // eslint-disable-next-line no-await-in-loop
83
+ const verifyRes = await wallet.verify((0, json_stable_stringify_1.default)({ ...toBeVerifiedMeta, signatures: [signature, ...signatures] }), sig);
82
84
  if (verifyRes !== true) {
83
85
  debug('verify failed', { signer });
84
86
  return verifyRes;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.37-beta-20250104-120451-e4049aeb",
6
+ "version": "1.16.37-beta-20250106-134442-ea92021c",
7
7
  "description": "Library to parse/validate/fix blocklet meta",
8
8
  "main": "./lib/index.js",
9
9
  "typings": "./lib/index.d.ts",
@@ -25,17 +25,17 @@
25
25
  "author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
26
26
  "license": "Apache-2.0",
27
27
  "dependencies": {
28
- "@abtnode/constant": "1.16.37-beta-20250104-120451-e4049aeb",
29
- "@arcblock/did": "1.18.166",
30
- "@arcblock/did-ext": "1.18.166",
31
- "@arcblock/did-util": "1.18.166",
32
- "@arcblock/jwt": "1.18.166",
33
- "@blocklet/constant": "1.16.37-beta-20250104-120451-e4049aeb",
34
- "@ocap/asset": "1.18.166",
35
- "@ocap/mcrypto": "1.18.166",
36
- "@ocap/types": "1.18.166",
37
- "@ocap/util": "1.18.166",
38
- "@ocap/wallet": "1.18.166",
28
+ "@abtnode/constant": "1.16.37-beta-20250106-134442-ea92021c",
29
+ "@arcblock/did": "1.19.1",
30
+ "@arcblock/did-ext": "1.19.1",
31
+ "@arcblock/did-util": "1.19.1",
32
+ "@arcblock/jwt": "1.19.1",
33
+ "@blocklet/constant": "1.16.37-beta-20250106-134442-ea92021c",
34
+ "@ocap/asset": "1.19.1",
35
+ "@ocap/mcrypto": "1.19.1",
36
+ "@ocap/types": "1.19.1",
37
+ "@ocap/util": "1.19.1",
38
+ "@ocap/wallet": "1.19.1",
39
39
  "ajv": "^8.11.0",
40
40
  "axios": "^1.7.9",
41
41
  "cjk-length": "^1.0.0",
@@ -79,5 +79,5 @@
79
79
  "ts-node": "^10.9.1",
80
80
  "typescript": "^5.6.3"
81
81
  },
82
- "gitHead": "b7b25187705d6a0ac07d3ff4ed3333bf7808120b"
82
+ "gitHead": "3ca08cceb016a318c7c00ec1f1bef4db19a3c723"
83
83
  }