@shiqianjiang/ceru-plugin-issuer 0.1.0
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 +21 -0
- package/README.md +22 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +600 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ceru Music contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Ceru Plugin Issuer
|
|
2
|
+
|
|
3
|
+
Node.js / TypeScript 静态验证、Ed25519 签名与缓存模板发放。
|
|
4
|
+
|
|
5
|
+
~~~ts
|
|
6
|
+
import { readFile } from 'node:fs/promises'
|
|
7
|
+
import { PreparedIssuer, readArtifact } from '@shiqianjiang/ceru-plugin-issuer'
|
|
8
|
+
|
|
9
|
+
const issuer = new PreparedIssuer(await readFile('template.js'), {
|
|
10
|
+
issuerPrivateKey: await readFile('issuer.private.pem', 'utf8'),
|
|
11
|
+
trustedPublicKeys: [await readFile('publisher.public.pem', 'utf8')],
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const bytes = issuer.issue({ display: { name: '我的音源' } })
|
|
15
|
+
console.log(readArtifact(bytes).signatureStatus)
|
|
16
|
+
~~~
|
|
17
|
+
|
|
18
|
+
准备一次后,重复 issue 不重新构建或扫描核心代码。writeTo 支持背压与共享主体流式输出,调用者负责结束流、下载鉴权和缓存策略。
|
|
19
|
+
|
|
20
|
+
签名有效不等于发布者已被信任;未提供可信公钥时结果为 verified-untrusted。静态校验不执行插件,也不替代生产沙箱。个性化文件不得提交到公开社区仓库。
|
|
21
|
+
|
|
22
|
+
[完整协议与命令](https://github.com/CeruMusic/CeruMusic-Plugin-Cli#readme)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type Writable } from 'node:stream';
|
|
2
|
+
import type { JsonObject, JsonValue, PluginManifest } from '@shiqianjiang/ceru-plugin-sdk/manifest';
|
|
3
|
+
export declare const FORMAT_VERSION = 2;
|
|
4
|
+
export declare const LIMITS: {
|
|
5
|
+
file: number;
|
|
6
|
+
header: number;
|
|
7
|
+
delivery: number;
|
|
8
|
+
resources: number;
|
|
9
|
+
nodes: number;
|
|
10
|
+
};
|
|
11
|
+
export type Resource = {
|
|
12
|
+
type: 'json';
|
|
13
|
+
value: JsonValue;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'text';
|
|
16
|
+
value: string;
|
|
17
|
+
mime?: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'base64';
|
|
20
|
+
value: string;
|
|
21
|
+
mime: string;
|
|
22
|
+
};
|
|
23
|
+
export interface Proof {
|
|
24
|
+
mode: 'single@1' | 'template@1' | 'delivery@1';
|
|
25
|
+
algorithm: 'ed25519';
|
|
26
|
+
keyId: string;
|
|
27
|
+
publicKey: string;
|
|
28
|
+
value: string;
|
|
29
|
+
}
|
|
30
|
+
export interface TemplateDeclaration {
|
|
31
|
+
codeDigest: string;
|
|
32
|
+
personalizationSchema: JsonObject;
|
|
33
|
+
issuerKeys: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface Delivery {
|
|
36
|
+
payload: JsonObject;
|
|
37
|
+
signature: Proof;
|
|
38
|
+
}
|
|
39
|
+
export interface ArtifactHeader {
|
|
40
|
+
formatVersion: 2;
|
|
41
|
+
syntax: 'js';
|
|
42
|
+
manifest: PluginManifest;
|
|
43
|
+
signature: Proof | null;
|
|
44
|
+
template?: TemplateDeclaration;
|
|
45
|
+
delivery?: Delivery;
|
|
46
|
+
}
|
|
47
|
+
export interface Artifact {
|
|
48
|
+
header: ArtifactHeader;
|
|
49
|
+
body: string;
|
|
50
|
+
modules: Record<string, string>;
|
|
51
|
+
resources: Record<string, Resource>;
|
|
52
|
+
codeDigest: string;
|
|
53
|
+
templateDigest?: string;
|
|
54
|
+
signatureStatus: 'unsigned' | 'verified-untrusted' | 'verified-trusted';
|
|
55
|
+
}
|
|
56
|
+
export interface ValidationOptions {
|
|
57
|
+
trustedPublicKeys?: string[];
|
|
58
|
+
now?: Date;
|
|
59
|
+
requireUnexpiredActivation?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export declare function canonical(value: unknown): string;
|
|
62
|
+
export declare function parseJsonStrict(text: string): any;
|
|
63
|
+
export declare const MANIFEST_SCHEMA: {
|
|
64
|
+
type: string;
|
|
65
|
+
properties: Record<string, unknown>;
|
|
66
|
+
required: string[];
|
|
67
|
+
additionalProperties: boolean;
|
|
68
|
+
};
|
|
69
|
+
export declare function validateManifest(value: unknown): asserts value is PluginManifest;
|
|
70
|
+
export declare function digest(input: string | Uint8Array): string;
|
|
71
|
+
export declare function generateSigningKeys(): {
|
|
72
|
+
publicKey: string;
|
|
73
|
+
privateKey: string;
|
|
74
|
+
};
|
|
75
|
+
export declare function encodeHeader(header: ArtifactHeader): Buffer;
|
|
76
|
+
export declare function encodeArtifact(header: ArtifactHeader, body: string): Buffer;
|
|
77
|
+
export declare const DEFAULT_PERSONALIZATION_SCHEMA: JsonObject;
|
|
78
|
+
export declare function readArtifact(input: Uint8Array | string, options?: ValidationOptions): Artifact;
|
|
79
|
+
export declare function signArtifact(input: Uint8Array, privateKey: string): Buffer;
|
|
80
|
+
export declare function createTemplate(input: Uint8Array, options: {
|
|
81
|
+
privateKey: string;
|
|
82
|
+
issuerPublicKeys: string[];
|
|
83
|
+
personalizationSchema?: JsonObject;
|
|
84
|
+
}): Buffer;
|
|
85
|
+
/** Prepare once per core/key; issue() copies a file, writeTo() streams the shared core without rehashing it. */
|
|
86
|
+
export declare class PreparedIssuer {
|
|
87
|
+
#private;
|
|
88
|
+
readonly templateDigest: string;
|
|
89
|
+
constructor(input: Uint8Array, options: {
|
|
90
|
+
issuerPrivateKey: string;
|
|
91
|
+
trustedPublicKeys?: string[];
|
|
92
|
+
});
|
|
93
|
+
issue(personalization: JsonObject, options?: {
|
|
94
|
+
deliveryId?: string;
|
|
95
|
+
now?: Date;
|
|
96
|
+
}): Buffer;
|
|
97
|
+
writeTo(destination: Writable, personalization: JsonObject, options?: {
|
|
98
|
+
deliveryId?: string;
|
|
99
|
+
now?: Date;
|
|
100
|
+
}): Promise<void>;
|
|
101
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, randomUUID, sign, verify, } from 'node:crypto';
|
|
2
|
+
import { Readable } from 'node:stream';
|
|
3
|
+
import { pipeline } from 'node:stream/promises';
|
|
4
|
+
import { parse, parseExpressionAt } from 'acorn';
|
|
5
|
+
import { Ajv } from 'ajv';
|
|
6
|
+
import { PERMISSION_NAMES } from '@shiqianjiang/ceru-plugin-sdk/catalog';
|
|
7
|
+
export const FORMAT_VERSION = 2;
|
|
8
|
+
export const LIMITS = {
|
|
9
|
+
file: 10 * 1024 * 1024,
|
|
10
|
+
header: 256 * 1024,
|
|
11
|
+
delivery: 16 * 1024,
|
|
12
|
+
resources: 32 * 1024 * 1024,
|
|
13
|
+
nodes: 500_000,
|
|
14
|
+
};
|
|
15
|
+
const START = '/* @ceru-plugin-v2\n';
|
|
16
|
+
const END = '\n@end-ceru-plugin */\n';
|
|
17
|
+
const ID = '^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$';
|
|
18
|
+
const forbidden = new Set(['__proto__', 'prototype', 'constructor']);
|
|
19
|
+
const ajv = new Ajv({ strict: false, allErrors: true, ownProperties: true });
|
|
20
|
+
function ensure(ok, message) {
|
|
21
|
+
if (!ok)
|
|
22
|
+
throw new Error(message);
|
|
23
|
+
}
|
|
24
|
+
function plain(value) {
|
|
25
|
+
return (!!value &&
|
|
26
|
+
typeof value === 'object' &&
|
|
27
|
+
!Array.isArray(value) &&
|
|
28
|
+
[Object.prototype, null].includes(Object.getPrototypeOf(value)));
|
|
29
|
+
}
|
|
30
|
+
function exactKeys(value, allowed, label) {
|
|
31
|
+
ensure(plain(value), label + ' must be an object');
|
|
32
|
+
for (const key of Object.keys(value))
|
|
33
|
+
ensure(allowed.includes(key), label + ': unknown field ' + key);
|
|
34
|
+
}
|
|
35
|
+
export function canonical(value) {
|
|
36
|
+
function visit(v, depth) {
|
|
37
|
+
ensure(depth <= 64, 'JSON nesting exceeds 64');
|
|
38
|
+
if (v === null || typeof v === 'string' || typeof v === 'boolean')
|
|
39
|
+
return JSON.stringify(v);
|
|
40
|
+
if (typeof v === 'number') {
|
|
41
|
+
ensure(Number.isFinite(v), 'JSON number must be finite');
|
|
42
|
+
return JSON.stringify(v);
|
|
43
|
+
}
|
|
44
|
+
if (Array.isArray(v))
|
|
45
|
+
return '[' + v.map((x) => visit(x, depth + 1)).join(',') + ']';
|
|
46
|
+
ensure(plain(v), 'Only JSON data is supported');
|
|
47
|
+
const descriptors = Object.getOwnPropertyDescriptors(v);
|
|
48
|
+
return ('{' +
|
|
49
|
+
Object.keys(descriptors)
|
|
50
|
+
.sort()
|
|
51
|
+
.map((key) => {
|
|
52
|
+
ensure(!forbidden.has(key), 'Unsafe JSON key: ' + key);
|
|
53
|
+
ensure('value' in descriptors[key], 'JSON getters are forbidden');
|
|
54
|
+
return JSON.stringify(key) + ':' + visit(descriptors[key].value, depth + 1);
|
|
55
|
+
})
|
|
56
|
+
.join(',') +
|
|
57
|
+
'}');
|
|
58
|
+
}
|
|
59
|
+
return visit(value, 0);
|
|
60
|
+
}
|
|
61
|
+
function astKey(property) {
|
|
62
|
+
ensure(property.type === 'Property' &&
|
|
63
|
+
property.kind === 'init' &&
|
|
64
|
+
!property.method &&
|
|
65
|
+
!property.computed, 'Only literal object properties are supported');
|
|
66
|
+
const key = property.key.type === 'Identifier' ? property.key.name : property.key.value;
|
|
67
|
+
ensure(typeof key === 'string' && !forbidden.has(key), 'Unsafe object key');
|
|
68
|
+
return key;
|
|
69
|
+
}
|
|
70
|
+
function astObject(node) {
|
|
71
|
+
ensure(node?.type === 'ObjectExpression', 'Expected literal object');
|
|
72
|
+
const entries = new Map();
|
|
73
|
+
for (const property of node.properties) {
|
|
74
|
+
const key = astKey(property);
|
|
75
|
+
ensure(!entries.has(key), 'Duplicate key: ' + key);
|
|
76
|
+
entries.set(key, property.value);
|
|
77
|
+
}
|
|
78
|
+
return entries;
|
|
79
|
+
}
|
|
80
|
+
function astJson(node, depth = 0) {
|
|
81
|
+
ensure(depth <= 64, 'Resource nesting exceeds 64');
|
|
82
|
+
if (node.type === 'Literal') {
|
|
83
|
+
ensure(!node.regex && !node.bigint, 'Only JSON literals are supported');
|
|
84
|
+
canonical(node.value);
|
|
85
|
+
return node.value;
|
|
86
|
+
}
|
|
87
|
+
if (node.type === 'UnaryExpression' &&
|
|
88
|
+
node.operator === '-' &&
|
|
89
|
+
node.argument.type === 'Literal' &&
|
|
90
|
+
typeof node.argument.value === 'number')
|
|
91
|
+
return -node.argument.value;
|
|
92
|
+
if (node.type === 'ArrayExpression')
|
|
93
|
+
return node.elements.map((x) => {
|
|
94
|
+
ensure(x, 'Array holes are forbidden');
|
|
95
|
+
return astJson(x, depth + 1);
|
|
96
|
+
});
|
|
97
|
+
const result = Object.create(null);
|
|
98
|
+
for (const [key, child] of astObject(node))
|
|
99
|
+
result[key] = astJson(child, depth + 1);
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
export function parseJsonStrict(text) {
|
|
103
|
+
ensure(Buffer.byteLength(text) <= LIMITS.header, 'JSON document too large');
|
|
104
|
+
const result = JSON.parse(text);
|
|
105
|
+
const expression = parseExpressionAt(text, 0, { ecmaVersion: 2022 });
|
|
106
|
+
astJson(expression);
|
|
107
|
+
canonical(result);
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
const string = { type: 'string', minLength: 1, maxLength: 4096 };
|
|
111
|
+
const id = { type: 'string', pattern: ID };
|
|
112
|
+
const strings = { type: 'array', items: string, maxItems: 128, uniqueItems: true };
|
|
113
|
+
const object = (properties, required = []) => ({
|
|
114
|
+
type: 'object',
|
|
115
|
+
properties,
|
|
116
|
+
required,
|
|
117
|
+
additionalProperties: false,
|
|
118
|
+
});
|
|
119
|
+
export const MANIFEST_SCHEMA = object({
|
|
120
|
+
manifestVersion: { const: 2 },
|
|
121
|
+
id: { type: 'string', pattern: '^[a-z0-9][a-z0-9._-]{2,127}$' },
|
|
122
|
+
name: { ...string, maxLength: 120 },
|
|
123
|
+
version: {
|
|
124
|
+
type: 'string',
|
|
125
|
+
pattern: '^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$',
|
|
126
|
+
},
|
|
127
|
+
description: string,
|
|
128
|
+
author: string,
|
|
129
|
+
publisher: string,
|
|
130
|
+
license: string,
|
|
131
|
+
engines: object({
|
|
132
|
+
hostApi: string,
|
|
133
|
+
logicRuntime: { const: 'ceru-js@1' },
|
|
134
|
+
uiSchema: string,
|
|
135
|
+
libraries: object({ vue: string, react: string, 'react-dom': string }),
|
|
136
|
+
}, ['hostApi', 'logicRuntime']),
|
|
137
|
+
modules: object({
|
|
138
|
+
logic: object({ entry: id, activation: strings }, ['entry']),
|
|
139
|
+
surfaces: {
|
|
140
|
+
type: 'array',
|
|
141
|
+
maxItems: 64,
|
|
142
|
+
items: object({ id, kind: { enum: ['schema', 'web'] }, entry: id }, [
|
|
143
|
+
'id',
|
|
144
|
+
'kind',
|
|
145
|
+
'entry',
|
|
146
|
+
]),
|
|
147
|
+
},
|
|
148
|
+
}),
|
|
149
|
+
contributes: object({
|
|
150
|
+
providers: {
|
|
151
|
+
type: 'array',
|
|
152
|
+
maxItems: 64,
|
|
153
|
+
items: object({
|
|
154
|
+
id,
|
|
155
|
+
name: string,
|
|
156
|
+
protocols: strings,
|
|
157
|
+
connectionMode: { enum: ['none', 'single', 'multiple'] },
|
|
158
|
+
icon: {
|
|
159
|
+
oneOf: [
|
|
160
|
+
object({ kind: { const: 'host' }, name: string }, ['kind', 'name']),
|
|
161
|
+
object({ kind: { const: 'asset' }, resource: id }, ['kind', 'resource']),
|
|
162
|
+
],
|
|
163
|
+
},
|
|
164
|
+
}, ['id', 'name', 'protocols']),
|
|
165
|
+
},
|
|
166
|
+
commands: {
|
|
167
|
+
type: 'array',
|
|
168
|
+
maxItems: 128,
|
|
169
|
+
items: object({ id, title: string, action: id, view: id }, ['id', 'title', 'action']),
|
|
170
|
+
},
|
|
171
|
+
sidebarItems: {
|
|
172
|
+
type: 'array',
|
|
173
|
+
maxItems: 64,
|
|
174
|
+
items: object({ id, group: id, title: string, view: id }, ['id', 'group', 'title', 'view']),
|
|
175
|
+
},
|
|
176
|
+
settingsPages: {
|
|
177
|
+
type: 'array',
|
|
178
|
+
maxItems: 64,
|
|
179
|
+
items: object({ id, title: string, view: id }, ['id', 'title', 'view']),
|
|
180
|
+
},
|
|
181
|
+
guestAdapters: {
|
|
182
|
+
type: 'array',
|
|
183
|
+
maxItems: 16,
|
|
184
|
+
items: object({
|
|
185
|
+
id,
|
|
186
|
+
format: string,
|
|
187
|
+
compatibilityProfile: string,
|
|
188
|
+
bootstrap: id,
|
|
189
|
+
runtime: { const: 'ceru-js@1' },
|
|
190
|
+
projectableProtocols: strings,
|
|
191
|
+
}, ['id', 'format', 'compatibilityProfile', 'bootstrap', 'runtime', 'projectableProtocols']),
|
|
192
|
+
},
|
|
193
|
+
}),
|
|
194
|
+
permissions: {
|
|
195
|
+
type: 'array',
|
|
196
|
+
maxItems: 64,
|
|
197
|
+
items: object({
|
|
198
|
+
key: id,
|
|
199
|
+
name: { enum: PERMISSION_NAMES },
|
|
200
|
+
scope: { type: 'object' },
|
|
201
|
+
reason: string,
|
|
202
|
+
optional: { type: 'boolean' },
|
|
203
|
+
requiredFor: strings,
|
|
204
|
+
}, ['key', 'name', 'reason']),
|
|
205
|
+
},
|
|
206
|
+
guestPolicy: object({
|
|
207
|
+
maxDepth: { const: 1 },
|
|
208
|
+
allowedCapabilities: strings,
|
|
209
|
+
networkScopeMode: { const: 'per-guest-user-approved' },
|
|
210
|
+
allowNativeCode: { const: false },
|
|
211
|
+
allowRemoteCodeExecution: { const: false },
|
|
212
|
+
}, [
|
|
213
|
+
'maxDepth',
|
|
214
|
+
'allowedCapabilities',
|
|
215
|
+
'networkScopeMode',
|
|
216
|
+
'allowNativeCode',
|
|
217
|
+
'allowRemoteCodeExecution',
|
|
218
|
+
]),
|
|
219
|
+
dataSchemas: object({ config: { type: 'integer', minimum: 1 }, state: { type: 'integer', minimum: 1 } }, ['config', 'state']),
|
|
220
|
+
}, ['manifestVersion', 'id', 'name', 'version', 'engines', 'modules']);
|
|
221
|
+
const checkManifest = ajv.compile(MANIFEST_SCHEMA);
|
|
222
|
+
export function validateManifest(value) {
|
|
223
|
+
canonical(value);
|
|
224
|
+
ensure(checkManifest(value), 'Invalid manifest: ' + ajv.errorsText(checkManifest.errors));
|
|
225
|
+
const manifest = value;
|
|
226
|
+
const unique = (values, label) => ensure(new Set(values).size === values.length, 'Duplicate ' + label);
|
|
227
|
+
unique(manifest.permissions?.map((p) => p.key) ?? [], 'permission key');
|
|
228
|
+
unique(manifest.modules.surfaces?.map((p) => p.id) ?? [], 'surface id');
|
|
229
|
+
for (const items of Object.values(manifest.contributes ?? {}))
|
|
230
|
+
unique(items.map((p) => p.id), 'contribution id');
|
|
231
|
+
const views = new Set(manifest.modules.surfaces?.map((p) => p.id));
|
|
232
|
+
for (const items of [
|
|
233
|
+
manifest.contributes?.commands,
|
|
234
|
+
manifest.contributes?.sidebarItems,
|
|
235
|
+
manifest.contributes?.settingsPages,
|
|
236
|
+
]) {
|
|
237
|
+
for (const item of items ?? [])
|
|
238
|
+
if (item.view)
|
|
239
|
+
ensure(views.has(item.view), 'Unknown view: ' + item.view);
|
|
240
|
+
}
|
|
241
|
+
if (manifest.contributes?.guestAdapters?.length)
|
|
242
|
+
ensure(manifest.guestPolicy, 'guestPolicy is required for a guest adapter');
|
|
243
|
+
}
|
|
244
|
+
export function digest(input) {
|
|
245
|
+
return 'sha256:' + createHash('sha256').update(input).digest('hex');
|
|
246
|
+
}
|
|
247
|
+
function publicDer(key) {
|
|
248
|
+
const pub = key.type === 'private' ? createPublicKey(key) : key;
|
|
249
|
+
ensure(pub.asymmetricKeyType === 'ed25519', 'Only Ed25519 keys are supported');
|
|
250
|
+
return pub.export({ type: 'spki', format: 'der' }).toString('base64');
|
|
251
|
+
}
|
|
252
|
+
function readPublic(der) {
|
|
253
|
+
ensure(typeof der === 'string' && der.length < 256, 'Invalid Ed25519 public key');
|
|
254
|
+
const key = createPublicKey({ key: Buffer.from(der, 'base64'), format: 'der', type: 'spki' });
|
|
255
|
+
ensure(publicDer(key) === der, 'Noncanonical public key');
|
|
256
|
+
return key;
|
|
257
|
+
}
|
|
258
|
+
export function generateSigningKeys() {
|
|
259
|
+
const { publicKey, privateKey } = generateKeyPairSync('ed25519');
|
|
260
|
+
return {
|
|
261
|
+
publicKey: publicKey.export({ type: 'spki', format: 'pem' }).toString(),
|
|
262
|
+
privateKey: privateKey.export({ type: 'pkcs8', format: 'pem' }).toString(),
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function newProof(mode, key) {
|
|
266
|
+
const publicKey = publicDer(key);
|
|
267
|
+
return {
|
|
268
|
+
mode,
|
|
269
|
+
algorithm: 'ed25519',
|
|
270
|
+
keyId: digest(Buffer.from(publicKey, 'base64')),
|
|
271
|
+
publicKey,
|
|
272
|
+
value: '',
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function signedBytes(domain, value) {
|
|
276
|
+
const data = Buffer.from(canonical(value));
|
|
277
|
+
const length = Buffer.alloc(8);
|
|
278
|
+
length.writeBigUInt64BE(BigInt(data.length));
|
|
279
|
+
return Buffer.concat([Buffer.from(domain + '\0'), length, data]);
|
|
280
|
+
}
|
|
281
|
+
function headerBytes(header, codeDigest) {
|
|
282
|
+
const { delivery: _delivery, signature, ...metadata } = header;
|
|
283
|
+
ensure(signature, 'Signature missing');
|
|
284
|
+
return signedBytes('ceru/' + signature.mode, {
|
|
285
|
+
...metadata,
|
|
286
|
+
signature: { ...signature, value: '' },
|
|
287
|
+
codeDigest,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function checkProof(proof, data) {
|
|
291
|
+
exactKeys(proof, ['mode', 'algorithm', 'keyId', 'publicKey', 'value'], 'signature');
|
|
292
|
+
ensure(proof.algorithm === 'ed25519', 'Unsupported signature algorithm');
|
|
293
|
+
ensure(typeof proof.value === 'string' && /^[A-Za-z0-9+/]{86}==$/.test(proof.value), 'Invalid signature encoding');
|
|
294
|
+
const key = readPublic(proof.publicKey);
|
|
295
|
+
ensure(proof.keyId === digest(Buffer.from(proof.publicKey, 'base64')), 'Incorrect keyId');
|
|
296
|
+
ensure(verify(null, data, key, Buffer.from(proof.value, 'base64')), 'Signature verification failed');
|
|
297
|
+
}
|
|
298
|
+
export function encodeHeader(header) {
|
|
299
|
+
const json = JSON.stringify(header, null, 2).replace(/\*/g, '\\u002a');
|
|
300
|
+
const head = Buffer.from(START + json + END);
|
|
301
|
+
ensure(head.length <= LIMITS.header, 'Artifact header is too large');
|
|
302
|
+
return head;
|
|
303
|
+
}
|
|
304
|
+
export function encodeArtifact(header, body) {
|
|
305
|
+
const result = Buffer.concat([encodeHeader(header), Buffer.from(body)]);
|
|
306
|
+
ensure(result.length <= LIMITS.file, 'Artifact exceeds size limit');
|
|
307
|
+
return result;
|
|
308
|
+
}
|
|
309
|
+
function checkPolicy(schema, depth = 0) {
|
|
310
|
+
ensure(depth <= 12, 'Personalization schema is too deep');
|
|
311
|
+
exactKeys(schema, [
|
|
312
|
+
'type',
|
|
313
|
+
'properties',
|
|
314
|
+
'required',
|
|
315
|
+
'additionalProperties',
|
|
316
|
+
'items',
|
|
317
|
+
'enum',
|
|
318
|
+
'minLength',
|
|
319
|
+
'maxLength',
|
|
320
|
+
'minimum',
|
|
321
|
+
'maximum',
|
|
322
|
+
'minItems',
|
|
323
|
+
'maxItems',
|
|
324
|
+
], 'personalization schema');
|
|
325
|
+
ensure(['object', 'array', 'string', 'number', 'integer', 'boolean', 'null'].includes(schema.type), 'Schema must declare a supported type');
|
|
326
|
+
if (schema.type === 'object') {
|
|
327
|
+
ensure(schema.additionalProperties === false && plain(schema.properties), 'Schema objects must close additionalProperties and declare properties');
|
|
328
|
+
for (const child of Object.values(schema.properties))
|
|
329
|
+
checkPolicy(child, depth + 1);
|
|
330
|
+
}
|
|
331
|
+
if (schema.type === 'array') {
|
|
332
|
+
ensure(Number.isInteger(schema.maxItems) && schema.maxItems <= 256, 'Schema arrays must have maxItems <= 256');
|
|
333
|
+
checkPolicy(schema.items, depth + 1);
|
|
334
|
+
}
|
|
335
|
+
if (schema.type === 'string')
|
|
336
|
+
ensure(Number.isInteger(schema.maxLength) && schema.maxLength <= 8192, 'Schema strings must have maxLength <= 8192');
|
|
337
|
+
canonical(schema);
|
|
338
|
+
}
|
|
339
|
+
export const DEFAULT_PERSONALIZATION_SCHEMA = {
|
|
340
|
+
type: 'object',
|
|
341
|
+
properties: {
|
|
342
|
+
display: {
|
|
343
|
+
type: 'object',
|
|
344
|
+
properties: {
|
|
345
|
+
name: { type: 'string', minLength: 1, maxLength: 120 },
|
|
346
|
+
description: { type: 'string', maxLength: 1024 },
|
|
347
|
+
},
|
|
348
|
+
additionalProperties: false,
|
|
349
|
+
},
|
|
350
|
+
config: { type: 'object', properties: {}, additionalProperties: false },
|
|
351
|
+
activation: {
|
|
352
|
+
type: 'object',
|
|
353
|
+
properties: {
|
|
354
|
+
mode: { type: 'string', enum: ['one-time-code', 'legacy-api-key'], maxLength: 32 },
|
|
355
|
+
code: { type: 'string', minLength: 1, maxLength: 2048 },
|
|
356
|
+
},
|
|
357
|
+
required: ['mode', 'code'],
|
|
358
|
+
additionalProperties: false,
|
|
359
|
+
},
|
|
360
|
+
activationExpiresAt: { type: 'string', maxLength: 40 },
|
|
361
|
+
},
|
|
362
|
+
additionalProperties: false,
|
|
363
|
+
};
|
|
364
|
+
function policyValidator(schema) {
|
|
365
|
+
checkPolicy(schema);
|
|
366
|
+
ensure(schema.type === 'object', 'Personalization root must be an object');
|
|
367
|
+
for (const key of Object.keys(schema.properties))
|
|
368
|
+
ensure(['display', 'config', 'activation', 'activationExpiresAt'].includes(key), 'Personalization cannot alter: ' + key);
|
|
369
|
+
return ajv.compile(schema);
|
|
370
|
+
}
|
|
371
|
+
function validatePersonalization(value, check, now, requireUnexpired = true) {
|
|
372
|
+
ensure(Buffer.byteLength(canonical(value)) <= LIMITS.delivery, 'Personalization is too large');
|
|
373
|
+
ensure(check(value), 'Invalid personalization: ' + ajv.errorsText(check.errors));
|
|
374
|
+
if (value.activationExpiresAt !== undefined) {
|
|
375
|
+
ensure(typeof value.activationExpiresAt === 'string' &&
|
|
376
|
+
Number.isFinite(Date.parse(value.activationExpiresAt)), 'Invalid activation expiry');
|
|
377
|
+
if (requireUnexpired)
|
|
378
|
+
ensure(Date.parse(value.activationExpiresAt) > now.getTime(), 'Activation delivery has expired');
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function inspectBody(body, manifest) {
|
|
382
|
+
const tree = parse(body, { ecmaVersion: 2022, sourceType: 'script' });
|
|
383
|
+
const pending = [tree];
|
|
384
|
+
let count = 0;
|
|
385
|
+
while (pending.length) {
|
|
386
|
+
const node = pending.pop();
|
|
387
|
+
ensure(++count <= LIMITS.nodes, 'Too many AST nodes');
|
|
388
|
+
ensure(node.type !== 'ImportExpression', 'External/dynamic import is not allowed in the final single-file artifact');
|
|
389
|
+
for (const value of Object.values(node)) {
|
|
390
|
+
if (Array.isArray(value))
|
|
391
|
+
for (const child of value) {
|
|
392
|
+
if (child && typeof child === 'object' && 'type' in child)
|
|
393
|
+
pending.push(child);
|
|
394
|
+
}
|
|
395
|
+
else if (value && typeof value === 'object' && 'type' in value)
|
|
396
|
+
pending.push(value);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
ensure(tree.body.length === 1 && tree.body[0].type === 'ExpressionStatement', 'Artifact must contain exactly one registration expression');
|
|
400
|
+
const call = tree.body[0].expression;
|
|
401
|
+
ensure(call.type === 'CallExpression' && !call.optional && call.arguments.length === 1, 'Invalid registration');
|
|
402
|
+
ensure(call.callee.type === 'MemberExpression' &&
|
|
403
|
+
!call.callee.computed &&
|
|
404
|
+
!call.callee.optional &&
|
|
405
|
+
call.callee.object.name === 'CeruPlugin' &&
|
|
406
|
+
call.callee.property.name === 'define', 'Expected CeruPlugin.define');
|
|
407
|
+
const registry = astObject(call.arguments[0]);
|
|
408
|
+
ensure(registry.size === 2 && registry.has('modules') && registry.has('resources'), 'Registration requires only modules and resources');
|
|
409
|
+
const modules = Object.create(null);
|
|
410
|
+
for (const [key, node] of astObject(registry.get('modules'))) {
|
|
411
|
+
ensure(new RegExp(ID).test(key), 'Invalid module id: ' + key);
|
|
412
|
+
ensure(node.type === 'FunctionExpression' &&
|
|
413
|
+
!node.generator &&
|
|
414
|
+
node.params.length === 1 &&
|
|
415
|
+
node.params[0].type === 'Identifier', 'Module must be a function with one context parameter');
|
|
416
|
+
modules[key] = body.slice(node.start, node.end);
|
|
417
|
+
}
|
|
418
|
+
ensure(Object.keys(modules).length <= 128, 'Too many modules');
|
|
419
|
+
const resources = astJson(registry.get('resources'));
|
|
420
|
+
ensure(plain(resources) && Object.keys(resources).length <= 512, 'Invalid resource table');
|
|
421
|
+
let resourceBytes = 0;
|
|
422
|
+
for (const [key, resource] of Object.entries(resources)) {
|
|
423
|
+
ensure(new RegExp(ID).test(key), 'Invalid resource id: ' + key);
|
|
424
|
+
exactKeys(resource, ['type', 'value', 'mime'], 'resource');
|
|
425
|
+
ensure(['json', 'text', 'base64'].includes(resource.type), 'Invalid resource type');
|
|
426
|
+
if ('mime' in resource && resource.mime !== undefined)
|
|
427
|
+
ensure(typeof resource.mime === 'string' && resource.mime.length <= 128, 'Invalid resource MIME type');
|
|
428
|
+
if (resource.type === 'json')
|
|
429
|
+
resourceBytes += Buffer.byteLength(canonical(resource.value));
|
|
430
|
+
else {
|
|
431
|
+
ensure(typeof resource.value === 'string', 'Text/binary resource must be a string');
|
|
432
|
+
if (resource.type === 'base64') {
|
|
433
|
+
ensure(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(resource.value), 'Invalid base64 resource');
|
|
434
|
+
resourceBytes += Buffer.from(resource.value, 'base64').length;
|
|
435
|
+
}
|
|
436
|
+
else
|
|
437
|
+
resourceBytes += Buffer.byteLength(resource.value);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
ensure(resourceBytes <= LIMITS.resources, 'Decoded resources exceed limit');
|
|
441
|
+
const declared = new Set();
|
|
442
|
+
const add = (entry) => {
|
|
443
|
+
ensure(Object.hasOwn(modules, entry), 'Missing module: ' + entry);
|
|
444
|
+
declared.add(entry);
|
|
445
|
+
};
|
|
446
|
+
if (manifest.modules.logic)
|
|
447
|
+
add(manifest.modules.logic.entry);
|
|
448
|
+
for (const surface of manifest.modules.surfaces ?? []) {
|
|
449
|
+
if (surface.kind === 'web')
|
|
450
|
+
add(surface.entry);
|
|
451
|
+
else
|
|
452
|
+
ensure(resources[surface.entry]?.type === 'json', 'Missing schema resource: ' + surface.entry);
|
|
453
|
+
}
|
|
454
|
+
for (const adapter of manifest.contributes?.guestAdapters ?? [])
|
|
455
|
+
add(adapter.bootstrap);
|
|
456
|
+
for (const provider of manifest.contributes?.providers ?? [])
|
|
457
|
+
if (provider.icon?.kind === 'asset')
|
|
458
|
+
ensure(Object.hasOwn(resources, provider.icon.resource), 'Missing icon resource');
|
|
459
|
+
for (const entry of Object.keys(modules))
|
|
460
|
+
ensure(declared.has(entry), 'Undeclared module: ' + entry);
|
|
461
|
+
return { modules, resources };
|
|
462
|
+
}
|
|
463
|
+
export function readArtifact(input, options = {}) {
|
|
464
|
+
const bytes = typeof input === 'string' ? Buffer.from(input) : input;
|
|
465
|
+
ensure(bytes.byteLength <= LIMITS.file, 'Artifact exceeds size limit');
|
|
466
|
+
const text = new TextDecoder('utf-8', { fatal: true }).decode(bytes);
|
|
467
|
+
ensure(text.startsWith(START), 'Missing Ceru v2 static header');
|
|
468
|
+
const end = text.indexOf(END, START.length);
|
|
469
|
+
ensure(end > 0 && Buffer.byteLength(text.slice(0, end)) <= LIMITS.header, 'Invalid static header boundary');
|
|
470
|
+
const header = parseJsonStrict(text.slice(START.length, end));
|
|
471
|
+
exactKeys(header, ['formatVersion', 'syntax', 'manifest', 'signature', 'template', 'delivery'], 'header');
|
|
472
|
+
ensure(header.formatVersion === 2 && header.syntax === 'js', 'Unsupported artifact format/syntax');
|
|
473
|
+
ensure(Object.hasOwn(header, 'signature'), 'Signature field is required');
|
|
474
|
+
validateManifest(header.manifest);
|
|
475
|
+
const body = text.slice(end + END.length);
|
|
476
|
+
const codeDigest = digest(body);
|
|
477
|
+
let signatureStatus = 'unsigned';
|
|
478
|
+
let templateDigest;
|
|
479
|
+
if (header.template) {
|
|
480
|
+
exactKeys(header.template, ['codeDigest', 'personalizationSchema', 'issuerKeys'], 'template');
|
|
481
|
+
ensure(header.signature?.mode === 'template@1', 'Template signature required');
|
|
482
|
+
ensure(header.template.codeDigest === codeDigest, 'Core code digest mismatch');
|
|
483
|
+
ensure(Array.isArray(header.template.issuerKeys) &&
|
|
484
|
+
header.template.issuerKeys.length > 0 &&
|
|
485
|
+
header.template.issuerKeys.length <= 16, 'Invalid issuer keys');
|
|
486
|
+
header.template.issuerKeys.forEach(readPublic);
|
|
487
|
+
const check = policyValidator(header.template.personalizationSchema);
|
|
488
|
+
const message = headerBytes(header, codeDigest);
|
|
489
|
+
checkProof(header.signature, message);
|
|
490
|
+
templateDigest = digest(message);
|
|
491
|
+
if (header.delivery) {
|
|
492
|
+
exactKeys(header.delivery, ['payload', 'signature'], 'delivery');
|
|
493
|
+
const { payload, signature } = header.delivery;
|
|
494
|
+
exactKeys(payload, ['deliveryVersion', 'templateDigest', 'deliveryId', 'issuedAt', 'personalization'], 'delivery payload');
|
|
495
|
+
ensure(payload.deliveryVersion === 1 && payload.templateDigest === templateDigest, 'Delivery belongs to a different template');
|
|
496
|
+
ensure(typeof payload.deliveryId === 'string' &&
|
|
497
|
+
payload.deliveryId.length > 0 &&
|
|
498
|
+
payload.deliveryId.length <= 128, 'Invalid deliveryId');
|
|
499
|
+
ensure(typeof payload.issuedAt === 'string' && Number.isFinite(Date.parse(payload.issuedAt)), 'Invalid issuedAt');
|
|
500
|
+
ensure(signature.mode === 'delivery@1' && header.template.issuerKeys.includes(signature.publicKey), 'Unauthorized issuer');
|
|
501
|
+
validatePersonalization(payload.personalization, check, options.now ?? new Date(), options.requireUnexpiredActivation ?? false);
|
|
502
|
+
checkProof(signature, signedBytes('ceru/delivery@1', { payload, signature: { ...signature, value: '' } }));
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
ensure(!header.delivery, 'Delivery requires a signed template');
|
|
507
|
+
if (header.signature) {
|
|
508
|
+
ensure(header.signature.mode === 'single@1', 'Invalid signature mode');
|
|
509
|
+
checkProof(header.signature, headerBytes(header, codeDigest));
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (header.signature) {
|
|
513
|
+
signatureStatus = 'verified-untrusted';
|
|
514
|
+
if (options.trustedPublicKeys?.some((pem) => publicDer(createPublicKey(pem)) === header.signature?.publicKey))
|
|
515
|
+
signatureStatus = 'verified-trusted';
|
|
516
|
+
}
|
|
517
|
+
if (options.trustedPublicKeys?.length)
|
|
518
|
+
ensure(signatureStatus === 'verified-trusted', 'Publisher is not in the supplied trust store');
|
|
519
|
+
return {
|
|
520
|
+
header,
|
|
521
|
+
body,
|
|
522
|
+
codeDigest,
|
|
523
|
+
templateDigest,
|
|
524
|
+
signatureStatus,
|
|
525
|
+
...inspectBody(body, header.manifest),
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
export function signArtifact(input, privateKey) {
|
|
529
|
+
const artifact = readArtifact(input);
|
|
530
|
+
ensure(!artifact.header.template, 'Use template issuance for a template artifact');
|
|
531
|
+
const key = createPrivateKey(privateKey);
|
|
532
|
+
const header = { ...artifact.header, signature: newProof('single@1', key) };
|
|
533
|
+
header.signature.value = sign(null, headerBytes(header, artifact.codeDigest), key).toString('base64');
|
|
534
|
+
return encodeArtifact(header, artifact.body);
|
|
535
|
+
}
|
|
536
|
+
export function createTemplate(input, options) {
|
|
537
|
+
const artifact = readArtifact(input);
|
|
538
|
+
ensure(!artifact.header.template, 'Input must be a normal plugin artifact');
|
|
539
|
+
const key = createPrivateKey(options.privateKey);
|
|
540
|
+
const policy = options.personalizationSchema ?? DEFAULT_PERSONALIZATION_SCHEMA;
|
|
541
|
+
policyValidator(policy);
|
|
542
|
+
ensure(options.issuerPublicKeys.length > 0 && options.issuerPublicKeys.length <= 16, 'Provide 1-16 issuer public keys');
|
|
543
|
+
const header = {
|
|
544
|
+
...artifact.header,
|
|
545
|
+
template: {
|
|
546
|
+
codeDigest: artifact.codeDigest,
|
|
547
|
+
personalizationSchema: policy,
|
|
548
|
+
issuerKeys: options.issuerPublicKeys.map((pem) => publicDer(createPublicKey(pem))),
|
|
549
|
+
},
|
|
550
|
+
signature: newProof('template@1', key),
|
|
551
|
+
};
|
|
552
|
+
header.signature.value = sign(null, headerBytes(header, artifact.codeDigest), key).toString('base64');
|
|
553
|
+
return encodeArtifact(header, artifact.body);
|
|
554
|
+
}
|
|
555
|
+
/** Prepare once per core/key; issue() copies a file, writeTo() streams the shared core without rehashing it. */
|
|
556
|
+
export class PreparedIssuer {
|
|
557
|
+
#header;
|
|
558
|
+
#core;
|
|
559
|
+
#key;
|
|
560
|
+
#check;
|
|
561
|
+
templateDigest;
|
|
562
|
+
constructor(input, options) {
|
|
563
|
+
const artifact = readArtifact(input, { trustedPublicKeys: options.trustedPublicKeys });
|
|
564
|
+
ensure(artifact.header.template && artifact.templateDigest && !artifact.header.delivery, 'Expected a template without a delivery');
|
|
565
|
+
this.#header = artifact.header;
|
|
566
|
+
this.#core = Buffer.from(artifact.body);
|
|
567
|
+
this.#key = createPrivateKey(options.issuerPrivateKey);
|
|
568
|
+
ensure(artifact.header.template.issuerKeys.includes(publicDer(this.#key)), 'Issuer key is not delegated by the template');
|
|
569
|
+
this.#check = policyValidator(artifact.header.template.personalizationSchema);
|
|
570
|
+
this.templateDigest = artifact.templateDigest;
|
|
571
|
+
}
|
|
572
|
+
#head(personalization, options = {}) {
|
|
573
|
+
const now = options.now ?? new Date();
|
|
574
|
+
const data = JSON.parse(canonical(personalization));
|
|
575
|
+
validatePersonalization(data, this.#check, now);
|
|
576
|
+
const payload = {
|
|
577
|
+
deliveryVersion: 1,
|
|
578
|
+
templateDigest: this.templateDigest,
|
|
579
|
+
deliveryId: options.deliveryId ?? randomUUID(),
|
|
580
|
+
issuedAt: now.toISOString(),
|
|
581
|
+
personalization: data,
|
|
582
|
+
};
|
|
583
|
+
ensure(typeof payload.deliveryId === 'string' &&
|
|
584
|
+
payload.deliveryId.length > 0 &&
|
|
585
|
+
payload.deliveryId.length <= 128, 'Invalid deliveryId');
|
|
586
|
+
const proof = newProof('delivery@1', this.#key);
|
|
587
|
+
proof.value = sign(null, signedBytes('ceru/delivery@1', { payload, signature: { ...proof, value: '' } }), this.#key).toString('base64');
|
|
588
|
+
const head = encodeHeader({ ...this.#header, delivery: { payload, signature: proof } });
|
|
589
|
+
ensure(head.length + this.#core.length <= LIMITS.file, 'Issued file exceeds limit');
|
|
590
|
+
return head;
|
|
591
|
+
}
|
|
592
|
+
issue(personalization, options) {
|
|
593
|
+
return Buffer.concat([this.#head(personalization, options), this.#core]);
|
|
594
|
+
}
|
|
595
|
+
async writeTo(destination, personalization, options) {
|
|
596
|
+
const head = this.#head(personalization, options);
|
|
597
|
+
await pipeline(Readable.from([head, this.#core]), destination, { end: false });
|
|
598
|
+
// Caller owns end(), HTTP policy and the writable. Do not expose this stream to untrusted code.
|
|
599
|
+
}
|
|
600
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shiqianjiang/ceru-plugin-issuer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Static verification, Ed25519 signing and cached personalized issuance of Ceru single-JS plugins",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "澜音团队",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=22.12.0"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@shiqianjiang/ceru-plugin-sdk": "0.1.0",
|
|
27
|
+
"acorn": "^8.18.0",
|
|
28
|
+
"ajv": "^8.20.0"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"registry": "https://registry.npmjs.org/"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/CeruMusic/CeruMusic-Plugin-Cli.git",
|
|
37
|
+
"directory": "packages/issuer"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/CeruMusic/CeruMusic-Plugin-Cli/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/CeruMusic/CeruMusic-Plugin-Cli#readme",
|
|
43
|
+
"keywords": [
|
|
44
|
+
"ceru-music",
|
|
45
|
+
"plugin",
|
|
46
|
+
"typescript",
|
|
47
|
+
"electron"
|
|
48
|
+
]
|
|
49
|
+
}
|