@blocklet/meta 1.16.54-beta-20251016-050817-2fc632b8 → 1.16.54-beta-20251021-070951-25e3083c
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/lib/did.d.ts +1 -1
- package/lib/did.js +3 -1
- package/lib/entry.d.ts +1 -1
- package/lib/entry.js +3 -1
- package/lib/get-component-process-id.d.ts +1 -1
- package/lib/get-component-process-id.js +3 -1
- package/lib/has-reserved-key.d.ts +1 -1
- package/lib/has-reserved-key.js +3 -1
- package/lib/index.d.ts +5 -5
- package/lib/index.js +15 -18
- package/lib/info.d.ts +1 -1
- package/lib/info.js +9 -7
- package/lib/parse-navigation.d.ts +1 -1
- package/lib/parse-navigation.js +3 -1
- package/lib/parse.d.ts +1 -1
- package/lib/parse.js +3 -1
- package/lib/payment/v2.js +1 -1
- package/lib/schema.js +4 -37
- package/lib/security.d.ts +2 -2
- package/lib/security.js +3 -3
- package/lib/url-path-friendly.d.ts +1 -2
- package/lib/url-path-friendly.js +2 -2
- package/lib/util-meta.js +2 -2
- package/lib/verify-multi-sig.d.ts +3 -1
- package/lib/verify-multi-sig.js +4 -1
- package/lib/wallet.d.ts +1 -1
- package/lib/wallet.js +3 -1
- package/lib/with-cache.js +3 -1
- package/package.json +18 -17
package/lib/did.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
declare const toBlockletDid: (name: string | Buffer) => string;
|
|
2
|
-
export
|
|
2
|
+
export { toBlockletDid };
|
package/lib/did.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toBlockletDid = void 0;
|
|
2
4
|
const mcrypto_1 = require("@ocap/mcrypto");
|
|
3
5
|
const util_1 = require("@ocap/util");
|
|
4
6
|
const did_1 = require("@arcblock/did");
|
|
@@ -10,4 +12,4 @@ const toBlockletDid = (name) => {
|
|
|
10
12
|
const pk = (0, util_1.toHex)(Buffer.from(typeof name === 'string' ? name.trim() : name));
|
|
11
13
|
return (0, did_1.fromPublicKey)(pk, { role: mcrypto_1.types.RoleType.ROLE_ANY });
|
|
12
14
|
};
|
|
13
|
-
|
|
15
|
+
exports.toBlockletDid = toBlockletDid;
|
package/lib/entry.d.ts
CHANGED
package/lib/entry.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.validateBlockletEntry = void 0;
|
|
5
7
|
const fs_1 = __importDefault(require("fs"));
|
|
6
8
|
const path_1 = __importDefault(require("path"));
|
|
7
9
|
const os_1 = __importDefault(require("os"));
|
|
@@ -49,4 +51,4 @@ const validateBlockletEntry = (dir, meta) => {
|
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
};
|
|
52
|
-
|
|
54
|
+
exports.validateBlockletEntry = validateBlockletEntry;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getComponentProcessId = void 0;
|
|
5
7
|
const crypto_1 = __importDefault(require("crypto"));
|
|
6
8
|
const md5 = (str) => crypto_1.default.createHash('md5').update(str).digest('hex');
|
|
7
9
|
const getComponentProcessId = (component, ancestors = []) => {
|
|
@@ -14,4 +16,4 @@ const getComponentProcessId = (component, ancestors = []) => {
|
|
|
14
16
|
}
|
|
15
17
|
return md5(name);
|
|
16
18
|
};
|
|
17
|
-
|
|
19
|
+
exports.getComponentProcessId = getComponentProcessId;
|
package/lib/has-reserved-key.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasReservedKey = void 0;
|
|
2
4
|
const constant_1 = require("@blocklet/constant");
|
|
3
5
|
const hasReservedKey = (environments) => (environments || []).some((x) => {
|
|
4
6
|
// @ts-ignore
|
|
@@ -8,4 +10,4 @@ const hasReservedKey = (environments) => (environments || []).some((x) => {
|
|
|
8
10
|
}
|
|
9
11
|
return !!(key.startsWith('BLOCKLET_') && !constant_1.BLOCKLET_CONFIGURABLE_KEY[key]);
|
|
10
12
|
});
|
|
11
|
-
|
|
13
|
+
exports.hasReservedKey = hasReservedKey;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as constants from './constants';
|
|
2
|
-
import parse from './parse';
|
|
3
|
-
import toBlockletDid from './did';
|
|
4
|
-
import getBlockletWallet from './wallet';
|
|
5
|
-
import getBlockletInfo from './info';
|
|
2
|
+
import { parse } from './parse';
|
|
3
|
+
import { toBlockletDid } from './did';
|
|
4
|
+
import { getApplicationWallet as getBlockletWallet } from './wallet';
|
|
5
|
+
import { getBlockletInfo } from './info';
|
|
6
6
|
import { getBlockletEngine, hasStartEngine } from './engine';
|
|
7
7
|
import { validateMeta, fixAndValidateService } from './validate';
|
|
8
8
|
import { formatPerson, parsePerson, fixPerson, fixInterfaces, fixService, fixName } from './fix';
|
|
9
9
|
import { list, select, update, read } from './file';
|
|
10
10
|
import { signResponse, verifyResponse } from './security';
|
|
11
|
-
import verifyMultiSig from './verify-multi-sig';
|
|
11
|
+
import { verifyMultiSig } from './verify-multi-sig';
|
|
12
12
|
import { getConnectedAccounts, getConnectedDids, getPermanentDid, getWallet, getWalletDid } from './did-utils';
|
|
13
13
|
export { constants };
|
|
14
14
|
export { list };
|
package/lib/index.js
CHANGED
|
@@ -32,21 +32,18 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.verifyResponse = exports.signResponse = exports.getWalletDid = exports.getWallet = exports.getPermanentDid = exports.getConnectedDids = exports.getConnectedAccounts = exports.verifyMultiSig = exports.hasStartEngine = exports.getBlockletEngine = exports.getBlockletInfo = exports.getBlockletWallet = exports.toBlockletDid = exports.fixName = exports.fixService = exports.fixInterfaces = exports.fixPerson = exports.parsePerson = exports.formatPerson = exports.fixAndValidateService = exports.validateMeta = exports.parse = exports.read = exports.update = exports.select = exports.list = exports.constants = void 0;
|
|
40
37
|
const constants = __importStar(require("./constants"));
|
|
41
38
|
exports.constants = constants;
|
|
42
|
-
const parse_1 =
|
|
43
|
-
exports
|
|
44
|
-
const did_1 =
|
|
45
|
-
exports
|
|
46
|
-
const wallet_1 =
|
|
47
|
-
exports
|
|
48
|
-
const info_1 =
|
|
49
|
-
exports
|
|
39
|
+
const parse_1 = require("./parse");
|
|
40
|
+
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_1.parse; } });
|
|
41
|
+
const did_1 = require("./did");
|
|
42
|
+
Object.defineProperty(exports, "toBlockletDid", { enumerable: true, get: function () { return did_1.toBlockletDid; } });
|
|
43
|
+
const wallet_1 = require("./wallet");
|
|
44
|
+
Object.defineProperty(exports, "getBlockletWallet", { enumerable: true, get: function () { return wallet_1.getApplicationWallet; } });
|
|
45
|
+
const info_1 = require("./info");
|
|
46
|
+
Object.defineProperty(exports, "getBlockletInfo", { enumerable: true, get: function () { return info_1.getBlockletInfo; } });
|
|
50
47
|
const engine_1 = require("./engine");
|
|
51
48
|
Object.defineProperty(exports, "getBlockletEngine", { enumerable: true, get: function () { return engine_1.getBlockletEngine; } });
|
|
52
49
|
Object.defineProperty(exports, "hasStartEngine", { enumerable: true, get: function () { return engine_1.hasStartEngine; } });
|
|
@@ -68,8 +65,8 @@ Object.defineProperty(exports, "read", { enumerable: true, get: function () { re
|
|
|
68
65
|
const security_1 = require("./security");
|
|
69
66
|
Object.defineProperty(exports, "signResponse", { enumerable: true, get: function () { return security_1.signResponse; } });
|
|
70
67
|
Object.defineProperty(exports, "verifyResponse", { enumerable: true, get: function () { return security_1.verifyResponse; } });
|
|
71
|
-
const verify_multi_sig_1 =
|
|
72
|
-
exports
|
|
68
|
+
const verify_multi_sig_1 = require("./verify-multi-sig");
|
|
69
|
+
Object.defineProperty(exports, "verifyMultiSig", { enumerable: true, get: function () { return verify_multi_sig_1.verifyMultiSig; } });
|
|
73
70
|
const did_utils_1 = require("./did-utils");
|
|
74
71
|
Object.defineProperty(exports, "getConnectedAccounts", { enumerable: true, get: function () { return did_utils_1.getConnectedAccounts; } });
|
|
75
72
|
Object.defineProperty(exports, "getConnectedDids", { enumerable: true, get: function () { return did_utils_1.getConnectedDids; } });
|
|
@@ -82,7 +79,7 @@ exports.default = {
|
|
|
82
79
|
select: file_1.select,
|
|
83
80
|
update: file_1.update,
|
|
84
81
|
read: file_1.read,
|
|
85
|
-
parse: parse_1.
|
|
82
|
+
parse: parse_1.parse,
|
|
86
83
|
validateMeta: validate_1.validateMeta,
|
|
87
84
|
fixAndValidateService: validate_1.fixAndValidateService,
|
|
88
85
|
formatPerson: fix_1.formatPerson,
|
|
@@ -91,11 +88,11 @@ exports.default = {
|
|
|
91
88
|
fixInterfaces: fix_1.fixInterfaces,
|
|
92
89
|
fixName: fix_1.fixName,
|
|
93
90
|
fixService: fix_1.fixService,
|
|
94
|
-
toBlockletDid: did_1.
|
|
95
|
-
getBlockletWallet: wallet_1.
|
|
96
|
-
getBlockletInfo: info_1.
|
|
91
|
+
toBlockletDid: did_1.toBlockletDid,
|
|
92
|
+
getBlockletWallet: wallet_1.getApplicationWallet,
|
|
93
|
+
getBlockletInfo: info_1.getBlockletInfo,
|
|
97
94
|
getBlockletEngine: engine_1.getBlockletEngine,
|
|
98
|
-
verifyMultiSig: verify_multi_sig_1.
|
|
95
|
+
verifyMultiSig: verify_multi_sig_1.verifyMultiSig,
|
|
99
96
|
getConnectedAccounts: did_utils_1.getConnectedAccounts,
|
|
100
97
|
getConnectedDids: did_utils_1.getConnectedDids,
|
|
101
98
|
getPermanentDid: did_utils_1.getPermanentDid,
|
package/lib/info.d.ts
CHANGED
package/lib/info.js
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getBlockletInfo = void 0;
|
|
5
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
6
8
|
const mcrypto_1 = require("@ocap/mcrypto");
|
|
7
|
-
const wallet_1 =
|
|
9
|
+
const wallet_1 = require("./wallet");
|
|
8
10
|
const util_1 = require("./util");
|
|
9
11
|
const getBlockletInfo = (state, nodeSk, { returnWallet = true } = {}) => {
|
|
10
12
|
if (!state || typeof state !== 'object' || !Array.isArray(state.environments) || !(0, get_1.default)(state, 'meta.did')) {
|
|
11
13
|
throw new Error('Blocklet state must be an object');
|
|
12
14
|
}
|
|
13
|
-
const { environments, configs = [] } = state;
|
|
15
|
+
const { environments = [], configs = [] } = state;
|
|
14
16
|
const envs = [...configs, ...environments];
|
|
15
17
|
const customDescription = envs.find((x) => x.key === 'BLOCKLET_APP_DESCRIPTION');
|
|
16
18
|
const customPassportColor = envs.find((x) => x.key === 'BLOCKLET_PASSPORT_COLOR');
|
|
@@ -46,9 +48,9 @@ const getBlockletInfo = (state, nodeSk, { returnWallet = true } = {}) => {
|
|
|
46
48
|
let wallet = null;
|
|
47
49
|
let permanentWallet = null;
|
|
48
50
|
if (customSk && customSk.value) {
|
|
49
|
-
wallet = (0, wallet_1.
|
|
51
|
+
wallet = (0, wallet_1.getApplicationWallet)(customSk.value, undefined, type);
|
|
50
52
|
if (permanentSk && permanentSk.value && permanentSk.value !== customSk.value) {
|
|
51
|
-
permanentWallet = (0, wallet_1.
|
|
53
|
+
permanentWallet = (0, wallet_1.getApplicationWallet)(permanentSk.value, undefined, type);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
else {
|
|
@@ -56,10 +58,10 @@ const getBlockletInfo = (state, nodeSk, { returnWallet = true } = {}) => {
|
|
|
56
58
|
throw new Error('Node secret key must be a string');
|
|
57
59
|
}
|
|
58
60
|
if (customType) {
|
|
59
|
-
wallet = (0, wallet_1.
|
|
61
|
+
wallet = (0, wallet_1.getApplicationWallet)(state.meta.did, nodeSk, type);
|
|
60
62
|
}
|
|
61
63
|
else {
|
|
62
|
-
wallet = (0, wallet_1.
|
|
64
|
+
wallet = (0, wallet_1.getApplicationWallet)(state.meta.did, nodeSk);
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
const salt = state.settings?.session?.salt || '';
|
|
@@ -77,4 +79,4 @@ const getBlockletInfo = (state, nodeSk, { returnWallet = true } = {}) => {
|
|
|
77
79
|
tenantMode,
|
|
78
80
|
};
|
|
79
81
|
};
|
|
80
|
-
|
|
82
|
+
exports.getBlockletInfo = getBlockletInfo;
|
package/lib/parse-navigation.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseNavigation = void 0;
|
|
5
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
6
8
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
7
9
|
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
@@ -197,4 +199,4 @@ const parseNavigation = (...args) => {
|
|
|
197
199
|
const res = doParseNavigation(...args);
|
|
198
200
|
return uniq(res).filter((x) => x.link || (x.items && x.items.length));
|
|
199
201
|
};
|
|
200
|
-
|
|
202
|
+
exports.parseNavigation = parseNavigation;
|
package/lib/parse.d.ts
CHANGED
package/lib/parse.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parse = void 0;
|
|
5
7
|
const fs_1 = __importDefault(require("fs"));
|
|
6
8
|
const path_1 = __importDefault(require("path"));
|
|
7
9
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
@@ -105,4 +107,4 @@ const parse = (dir, { ensureFiles = false, ensureDist = false, ensureComponentSt
|
|
|
105
107
|
}
|
|
106
108
|
return value;
|
|
107
109
|
};
|
|
108
|
-
|
|
110
|
+
exports.parse = parse;
|
package/lib/payment/v2.js
CHANGED
|
@@ -532,7 +532,7 @@ const verifyNftFactory = async ({ factoryState, signerWallet, }) => {
|
|
|
532
532
|
factoryInput,
|
|
533
533
|
storeComponents: components,
|
|
534
534
|
});
|
|
535
|
-
if (signerWallet.sign(integrity) !== store.signature) {
|
|
535
|
+
if ((await signerWallet.sign(integrity)) !== store.signature) {
|
|
536
536
|
debug(store, factoryInput, integrity, components, c.hook);
|
|
537
537
|
throw new Error(`verify nft factory failed: ${factoryState.address}`);
|
|
538
538
|
}
|
package/lib/schema.js
CHANGED
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
@@ -47,10 +14,10 @@ const constant_1 = require("@abtnode/constant");
|
|
|
47
14
|
const did_1 = require("@arcblock/did");
|
|
48
15
|
const docker_utils_1 = require("@abtnode/docker-utils");
|
|
49
16
|
const constant_2 = require("@blocklet/constant");
|
|
50
|
-
const did_2 =
|
|
17
|
+
const did_2 = require("./did");
|
|
51
18
|
const extension_1 = require("./extension");
|
|
52
19
|
const name_1 = require("./name");
|
|
53
|
-
const url_path_friendly_1 =
|
|
20
|
+
const url_path_friendly_1 = require("./url-path-friendly");
|
|
54
21
|
const cjkLength = cjk_length_1.default.default;
|
|
55
22
|
const WELLKNOWN_PATH_PREFIX = '/.well-known';
|
|
56
23
|
const Joi = joi_1.default.extend(joi_extension_semver_1.semver)
|
|
@@ -138,7 +105,7 @@ const mountPointSchema = baseMountPointSchema
|
|
|
138
105
|
exports.mountPointSchema = mountPointSchema;
|
|
139
106
|
const updateMountPointSchema = baseMountPointSchema
|
|
140
107
|
.meta({ className: 'TUpdateMountPoint' })
|
|
141
|
-
.custom((value) => (0, url_path_friendly_1.
|
|
108
|
+
.custom((value) => (0, url_path_friendly_1.urlPathFriendly)(value));
|
|
142
109
|
exports.updateMountPointSchema = updateMountPointSchema;
|
|
143
110
|
const blockletNameSchema = Joi.string()
|
|
144
111
|
.custom((value) => {
|
|
@@ -805,7 +772,7 @@ const createBlockletSchema = (baseDir, { ensureFiles = false, ensureDist = false
|
|
|
805
772
|
// 此时 name 必须存在
|
|
806
773
|
if (name) {
|
|
807
774
|
(0, name_1.validateName)(name, { checkDid: !skipValidateDidName });
|
|
808
|
-
const expectDid = (0, did_2.
|
|
775
|
+
const expectDid = (0, did_2.toBlockletDid)(name);
|
|
809
776
|
if (expectDid !== did) {
|
|
810
777
|
// @ts-ignore
|
|
811
778
|
return helper.message(`The did of name "${name}" should be "${expectDid}"`);
|
package/lib/security.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WalletObject } from '@ocap/wallet';
|
|
2
|
-
export declare function signResponse<T extends Record<string, any>>(data: T, wallet: WalletObject): T & {
|
|
2
|
+
export declare function signResponse<T extends Record<string, any>>(data: T, wallet: WalletObject): Promise<T & {
|
|
3
3
|
$signature: string;
|
|
4
|
-
}
|
|
4
|
+
}>;
|
|
5
5
|
export declare function verifyResponse<T extends Record<string, any>>(signed: T & {
|
|
6
6
|
$signature?: string;
|
|
7
7
|
}, wallet: WalletObject): Promise<boolean>;
|
package/lib/security.js
CHANGED
|
@@ -10,9 +10,9 @@ const omit_1 = __importDefault(require("lodash/omit"));
|
|
|
10
10
|
const json_stable_stringify_1 = __importDefault(require("json-stable-stringify"));
|
|
11
11
|
const wallet_1 = require("@ocap/wallet");
|
|
12
12
|
const did_1 = require("@arcblock/did");
|
|
13
|
-
function signResponse(data, wallet) {
|
|
13
|
+
async function signResponse(data, wallet) {
|
|
14
14
|
const payload = (0, json_stable_stringify_1.default)(data);
|
|
15
|
-
const signature = wallet.sign(payload);
|
|
15
|
+
const signature = await wallet.sign(payload);
|
|
16
16
|
const signed = { ...data, $signature: signature };
|
|
17
17
|
return signed;
|
|
18
18
|
}
|
|
@@ -20,7 +20,7 @@ function verifyResponse(signed, wallet) {
|
|
|
20
20
|
if (!signed.$signature) {
|
|
21
21
|
return Promise.resolve(false);
|
|
22
22
|
}
|
|
23
|
-
return
|
|
23
|
+
return wallet.verify((0, json_stable_stringify_1.default)((0, omit_1.default)(signed, '$signature')), signed.$signature);
|
|
24
24
|
}
|
|
25
25
|
async function verifyVault(vaults, appPid, throwOnError = false) {
|
|
26
26
|
// return empty string if the vaults list is empty
|
|
@@ -3,5 +3,4 @@ declare const urlPathFriendly: (name: any, { keepSlash }?: {
|
|
|
3
3
|
keepSlash?: boolean;
|
|
4
4
|
}) => any;
|
|
5
5
|
declare const checkLink: (value: string) => boolean;
|
|
6
|
-
export { isValidUrlPath, checkLink };
|
|
7
|
-
export default urlPathFriendly;
|
|
6
|
+
export { isValidUrlPath, checkLink, urlPathFriendly };
|
package/lib/url-path-friendly.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.checkLink = exports.isValidUrlPath = void 0;
|
|
6
|
+
exports.urlPathFriendly = exports.checkLink = exports.isValidUrlPath = void 0;
|
|
7
7
|
const is_absolute_url_1 = __importDefault(require("is-absolute-url"));
|
|
8
8
|
const isValidUrlPath = (name) => {
|
|
9
9
|
// Check if the path contains any non-ASCII characters
|
|
@@ -33,6 +33,7 @@ const urlPathFriendly = (name, { keepSlash = true } = {}) => {
|
|
|
33
33
|
}
|
|
34
34
|
return noConsecutiveSlashes;
|
|
35
35
|
};
|
|
36
|
+
exports.urlPathFriendly = urlPathFriendly;
|
|
36
37
|
/**
|
|
37
38
|
* 判断一个 url 是否为合法的 url 拼接路径
|
|
38
39
|
* /abc, /abc/bcd valid
|
|
@@ -50,4 +51,3 @@ const checkLink = (value) => {
|
|
|
50
51
|
return false;
|
|
51
52
|
};
|
|
52
53
|
exports.checkLink = checkLink;
|
|
53
|
-
exports.default = urlPathFriendly;
|
package/lib/util-meta.js
CHANGED
|
@@ -10,7 +10,7 @@ const promise_any_1 = __importDefault(require("promise.any"));
|
|
|
10
10
|
const ufo_1 = require("ufo");
|
|
11
11
|
const constant_1 = __importDefault(require("@abtnode/constant"));
|
|
12
12
|
const axios_1 = __importDefault(require("./axios"));
|
|
13
|
-
const did_1 =
|
|
13
|
+
const did_1 = require("./did");
|
|
14
14
|
const validate_1 = require("./validate");
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
const package_json_1 = require("../package.json");
|
|
@@ -142,7 +142,7 @@ const getSourceUrlsFromConfig = (config) => {
|
|
|
142
142
|
// FIXME: @linchen the format or version is semverRange, blocklet store should support it
|
|
143
143
|
return [store]
|
|
144
144
|
.flat()
|
|
145
|
-
.map((x) => (0, ufo_1.joinURL)(x, BLOCKLET_STORE_API_BLOCKLET_PREFIX, (0, did_1.
|
|
145
|
+
.map((x) => (0, ufo_1.joinURL)(x, BLOCKLET_STORE_API_BLOCKLET_PREFIX, (0, did_1.toBlockletDid)(name), !version || version === 'latest' ? '' : version, 'blocklet.json'));
|
|
146
146
|
}
|
|
147
147
|
if (config.resolved) {
|
|
148
148
|
return [config.resolved];
|
package/lib/verify-multi-sig.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.debug = exports.verifyMultiSig = void 0;
|
|
5
7
|
/* eslint-disable @typescript-eslint/indent */
|
|
6
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
7
9
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
@@ -13,6 +15,7 @@ const jwt_1 = require("@arcblock/jwt");
|
|
|
13
15
|
const util_1 = require("@ocap/util");
|
|
14
16
|
const debug_1 = __importDefault(require("debug"));
|
|
15
17
|
const debug = (0, debug_1.default)('@blocklet/meta:verifyMultiSig');
|
|
18
|
+
exports.debug = debug;
|
|
16
19
|
async function verifyDelegationToken(signature) {
|
|
17
20
|
if (signature.delegation) {
|
|
18
21
|
// @ts-ignore
|
|
@@ -89,4 +92,4 @@ const verifyMultiSig = async (blockletMeta) => {
|
|
|
89
92
|
}
|
|
90
93
|
return true;
|
|
91
94
|
};
|
|
92
|
-
|
|
95
|
+
exports.verifyMultiSig = verifyMultiSig;
|
package/lib/wallet.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ import { DIDType } from '@arcblock/did';
|
|
|
6
6
|
* Spec: https://github.com/ArcBlock/ABT-DID-Protocol#request-did-authentication
|
|
7
7
|
*/
|
|
8
8
|
declare const getApplicationWallet: (didOrSk: string, nodeSk?: string, type?: DIDType | "default" | "eth" | "ethereum", index?: number) => WalletObject;
|
|
9
|
-
export
|
|
9
|
+
export { getApplicationWallet };
|
package/lib/wallet.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getApplicationWallet = void 0;
|
|
2
4
|
const mcrypto_1 = require("@ocap/mcrypto");
|
|
3
5
|
const wallet_1 = require("@ocap/wallet");
|
|
4
6
|
const did_1 = require("@arcblock/did");
|
|
@@ -38,4 +40,4 @@ const getApplicationWallet = (didOrSk, nodeSk, type, index) => {
|
|
|
38
40
|
}
|
|
39
41
|
return (0, did_ext_1.fromAppDid)(didOrSk, nodeSk, t, index || 0);
|
|
40
42
|
};
|
|
41
|
-
|
|
43
|
+
exports.getApplicationWallet = getApplicationWallet;
|
package/lib/with-cache.js
CHANGED
|
@@ -18,7 +18,9 @@ function withCache(fn, // The function to wrap
|
|
|
18
18
|
return result;
|
|
19
19
|
}
|
|
20
20
|
catch (error) {
|
|
21
|
-
|
|
21
|
+
if (process.env.NODE_ENV !== 'test') {
|
|
22
|
+
console.error(`[Cache Wrapper] Error during function execution for key ${key}:`, error);
|
|
23
|
+
}
|
|
22
24
|
throw error;
|
|
23
25
|
}
|
|
24
26
|
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.54-beta-
|
|
6
|
+
"version": "1.16.54-beta-20251021-070951-25e3083c",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"homepage": "https://www.arcblock.io/docs/blocklet-spec",
|
|
9
9
|
"main": "./lib/index.js",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"verify": "npm run lint:fix && npm run coverage && npm run build",
|
|
16
16
|
"lint": "eslint src tests",
|
|
17
17
|
"lint:fix": "npm run lint -- --fix",
|
|
18
|
-
"test": "
|
|
19
|
-
"coverage": "
|
|
18
|
+
"test": "bun test",
|
|
19
|
+
"coverage": "bun test --coverage",
|
|
20
20
|
"clean": "rm -fr lib",
|
|
21
21
|
"types": "ts-node tools/types.js && sed -i.bak 's/unknown/string/g' ./src/types/schema.ts && rm ./src/types/schema.ts.bak && prettier --write ./src/types/*.ts",
|
|
22
22
|
"prebuild": "npm run clean && npm run types",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@abtnode/constant": "1.16.54-beta-
|
|
30
|
-
"@abtnode/db-cache": "1.16.54-beta-
|
|
31
|
-
"@abtnode/docker-utils": "1.16.54-beta-
|
|
32
|
-
"@arcblock/did": "1.
|
|
33
|
-
"@arcblock/did-ext": "1.
|
|
34
|
-
"@arcblock/did-util": "1.
|
|
35
|
-
"@arcblock/jwt": "1.
|
|
36
|
-
"@blocklet/constant": "1.16.54-beta-
|
|
37
|
-
"@ocap/asset": "1.
|
|
38
|
-
"@ocap/mcrypto": "1.
|
|
39
|
-
"@ocap/types": "1.
|
|
40
|
-
"@ocap/util": "1.
|
|
41
|
-
"@ocap/wallet": "1.
|
|
29
|
+
"@abtnode/constant": "1.16.54-beta-20251021-070951-25e3083c",
|
|
30
|
+
"@abtnode/db-cache": "1.16.54-beta-20251021-070951-25e3083c",
|
|
31
|
+
"@abtnode/docker-utils": "1.16.54-beta-20251021-070951-25e3083c",
|
|
32
|
+
"@arcblock/did": "^1.26.2",
|
|
33
|
+
"@arcblock/did-ext": "^1.26.2",
|
|
34
|
+
"@arcblock/did-util": "^1.26.2",
|
|
35
|
+
"@arcblock/jwt": "^1.26.2",
|
|
36
|
+
"@blocklet/constant": "1.16.54-beta-20251021-070951-25e3083c",
|
|
37
|
+
"@ocap/asset": "^1.26.2",
|
|
38
|
+
"@ocap/mcrypto": "^1.26.2",
|
|
39
|
+
"@ocap/types": "^1.26.2",
|
|
40
|
+
"@ocap/util": "^1.26.2",
|
|
41
|
+
"@ocap/wallet": "^1.26.2",
|
|
42
42
|
"ajv": "^8.11.0",
|
|
43
43
|
"axios": "^1.7.9",
|
|
44
44
|
"cjk-length": "^1.0.0",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"@typescript-eslint/eslint-plugin": "^5.42.0",
|
|
73
73
|
"@typescript-eslint/parser": "^5.42.0",
|
|
74
74
|
"body-parser": "^2.2.0",
|
|
75
|
+
"cors": "^2.8.5",
|
|
75
76
|
"detect-port": "^1.5.1",
|
|
76
77
|
"eslint": "^8.27.0",
|
|
77
78
|
"expand-tilde": "^2.0.2",
|
|
@@ -83,5 +84,5 @@
|
|
|
83
84
|
"ts-node": "^10.9.1",
|
|
84
85
|
"typescript": "^5.6.3"
|
|
85
86
|
},
|
|
86
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "db517e9013dbad744e38883f56e4eba1fa1615c1"
|
|
87
88
|
}
|