@binblink/wasmnest-plugin-sdk-desktop 0.0.1 → 0.0.2
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 +24 -4
- package/README_en.md +1 -1
- package/bin/cli.js +5 -5
- package/bin/manifest-gen.js +4 -0
- package/bin/manifest-validate.js +68 -6
- package/bin/permission-vocabulary.json +2 -2
- package/dev-shell/README.md +6 -5
- package/dev-shell/src/loader.ts +0 -5
- package/dev-shell/src/mock/commands.ts +1 -1
- package/dev-shell/src/mock/domain-context.ts +1 -1
- package/dev-shell/src/shell/types.ts +21 -32
- package/dev-shell/src/styles/shell.css +208 -2
- package/dev-shell/src/styles/style.css +72 -26
- package/dist/index.d.ts +44 -3
- package/dist/index.js +69 -1
- package/dist/types.d.ts +52 -5
- package/go/.gitignore +5 -0
- package/go/README.md +80 -0
- package/go/gen/wasmnest/api-call/host-api-call/empty.s +3 -0
- package/go/gen/wasmnest/api-call/host-api-call/host-api-call.wasm.go +13 -0
- package/go/gen/wasmnest/api-call/host-api-call/host-api-call.wit.go +34 -0
- package/go/gen/wasmnest/app/host-app/empty.s +3 -0
- package/go/gen/wasmnest/app/host-app/host-app.wasm.go +29 -0
- package/go/gen/wasmnest/app/host-app/host-app.wit.go +108 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/abi.go +14 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/empty.s +3 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/host-auth-center.wasm.go +49 -0
- package/go/gen/wasmnest/auth-center/host-auth-center/host-auth-center.wit.go +225 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/abi.go +14 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/empty.s +3 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/host-clipboard.wasm.go +17 -0
- package/go/gen/wasmnest/clipboard/host-clipboard/host-clipboard.wit.go +68 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/empty.s +3 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/host-connection-registry.wasm.go +13 -0
- package/go/gen/wasmnest/connection-registry/host-connection-registry/host-connection-registry.wit.go +50 -0
- package/go/gen/wasmnest/crypto/host-crypto/abi.go +18 -0
- package/go/gen/wasmnest/crypto/host-crypto/empty.s +3 -0
- package/go/gen/wasmnest/crypto/host-crypto/host-crypto.wasm.go +37 -0
- package/go/gen/wasmnest/crypto/host-crypto/host-crypto.wit.go +139 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/abi.go +14 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/empty.s +3 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/host-fs-desktop.wasm.go +21 -0
- package/go/gen/wasmnest/fs-desktop/host-fs-desktop/host-fs-desktop.wit.go +62 -0
- package/go/gen/wasmnest/http/host-http/abi.go +14 -0
- package/go/gen/wasmnest/http/host-http/empty.s +3 -0
- package/go/gen/wasmnest/http/host-http/host-http.wasm.go +13 -0
- package/go/gen/wasmnest/http/host-http/host-http.wit.go +40 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/empty.s +3 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/host-http-endpoint.wasm.go +17 -0
- package/go/gen/wasmnest/http-endpoint/host-http-endpoint/host-http-endpoint.wit.go +69 -0
- package/go/gen/wasmnest/mdns/host-mdns/empty.s +3 -0
- package/go/gen/wasmnest/mdns/host-mdns/host-mdns.wasm.go +29 -0
- package/go/gen/wasmnest/mdns/host-mdns/host-mdns.wit.go +101 -0
- package/go/gen/wasmnest/notify/host-notify/empty.s +3 -0
- package/go/gen/wasmnest/notify/host-notify/host-notify.wasm.go +13 -0
- package/go/gen/wasmnest/notify/host-notify/host-notify.wit.go +64 -0
- package/go/gen/wasmnest/peer/host-peer/abi.go +14 -0
- package/go/gen/wasmnest/peer/host-peer/empty.s +3 -0
- package/go/gen/wasmnest/peer/host-peer/host-peer.wasm.go +85 -0
- package/go/gen/wasmnest/peer/host-peer/host-peer.wit.go +357 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/empty.s +3 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/host-platform-desktop.wasm.go +21 -0
- package/go/gen/wasmnest/platform-desktop/host-platform-desktop/host-platform-desktop.wit.go +70 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.exports.go +11 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/abi-form/abi-form.wit.go +7 -0
- package/go/gen/wasmnest/plugin/abi-form/empty.s +3 -0
- package/go/gen/wasmnest/plugin/command/command.exports.go +11 -0
- package/go/gen/wasmnest/plugin/command/command.wasm.go +19 -0
- package/go/gen/wasmnest/plugin/command/command.wit.go +6 -0
- package/go/gen/wasmnest/plugin/command/empty.s +3 -0
- package/go/gen/wasmnest/plugin/events/empty.s +3 -0
- package/go/gen/wasmnest/plugin/events/events.exports.go +52 -0
- package/go/gen/wasmnest/plugin/events/events.wasm.go +74 -0
- package/go/gen/wasmnest/plugin/events/events.wit.go +195 -0
- package/go/gen/wasmnest/plugin/host-bus/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-bus/host-bus.wasm.go +29 -0
- package/go/gen/wasmnest/plugin/host-bus/host-bus.wit.go +94 -0
- package/go/gen/wasmnest/plugin/host-config/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-config/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-config/host-config.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/host-config/host-config.wit.go +21 -0
- package/go/gen/wasmnest/plugin/host-events/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-events/host-events.wasm.go +9 -0
- package/go/gen/wasmnest/plugin/host-events/host-events.wit.go +27 -0
- package/go/gen/wasmnest/plugin/host-fs/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-fs/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-fs/host-fs.wasm.go +33 -0
- package/go/gen/wasmnest/plugin/host-fs/host-fs.wit.go +86 -0
- package/go/gen/wasmnest/plugin/host-log/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-log/host-log.wasm.go +25 -0
- package/go/gen/wasmnest/plugin/host-log/host-log.wit.go +65 -0
- package/go/gen/wasmnest/plugin/host-metrics/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-metrics/host-metrics.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/host-metrics/host-metrics.wit.go +34 -0
- package/go/gen/wasmnest/plugin/host-platform/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-platform/host-platform.wasm.go +21 -0
- package/go/gen/wasmnest/plugin/host-platform/host-platform.wit.go +85 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/host-plugin-database.wasm.go +29 -0
- package/go/gen/wasmnest/plugin/host-plugin-database/host-plugin-database.wit.go +70 -0
- package/go/gen/wasmnest/plugin/host-storage/abi.go +14 -0
- package/go/gen/wasmnest/plugin/host-storage/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-storage/host-storage.wasm.go +21 -0
- package/go/gen/wasmnest/plugin/host-storage/host-storage.wit.go +44 -0
- package/go/gen/wasmnest/plugin/host-worker/empty.s +3 -0
- package/go/gen/wasmnest/plugin/host-worker/host-worker.wasm.go +17 -0
- package/go/gen/wasmnest/plugin/host-worker/host-worker.wit.go +50 -0
- package/go/gen/wasmnest/plugin/lifecycle/empty.s +3 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.exports.go +32 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.wasm.go +41 -0
- package/go/gen/wasmnest/plugin/lifecycle/lifecycle.wit.go +9 -0
- package/go/gen/wasmnest/plugin/manifest/empty.s +3 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.exports.go +11 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.wasm.go +13 -0
- package/go/gen/wasmnest/plugin/manifest/manifest.wit.go +6 -0
- package/go/gen/wasmnest/plugin/plugin/plugin.wit.go +4 -0
- package/go/gen/wasmnest/process/host-process/empty.s +3 -0
- package/go/gen/wasmnest/process/host-process/host-process.wasm.go +21 -0
- package/go/gen/wasmnest/process/host-process/host-process.wit.go +56 -0
- package/go/gen/wasmnest/pty/host-pty/abi.go +14 -0
- package/go/gen/wasmnest/pty/host-pty/empty.s +3 -0
- package/go/gen/wasmnest/pty/host-pty/host-pty.wasm.go +33 -0
- package/go/gen/wasmnest/pty/host-pty/host-pty.wit.go +164 -0
- package/go/gen/wasmnest/task/host-task/abi.go +14 -0
- package/go/gen/wasmnest/task/host-task/empty.s +3 -0
- package/go/gen/wasmnest/task/host-task/host-task.wasm.go +29 -0
- package/go/gen/wasmnest/task/host-task/host-task.wit.go +110 -0
- package/go/gen/wasmnest/timer/host-timer/empty.s +3 -0
- package/go/gen/wasmnest/timer/host-timer/host-timer.wasm.go +13 -0
- package/go/gen/wasmnest/timer/host-timer/host-timer.wit.go +25 -0
- package/go/gen/wasmnest/ws/host-websocket/empty.s +3 -0
- package/go/gen/wasmnest/ws/host-websocket/host-websocket.wasm.go +29 -0
- package/go/gen/wasmnest/ws/host-websocket/host-websocket.wit.go +109 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/empty.s +3 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/host-websocket-server.wasm.go +49 -0
- package/go/gen/wasmnest/ws-server/host-websocket-server/host-websocket-server.wit.go +220 -0
- package/go/go.mod +14 -0
- package/go/go.sum +2 -0
- package/go/sdk/dispatch.go +49 -0
- package/go/sdk/dispatch_test.go +81 -0
- package/go/sdk/entry_native.go +13 -0
- package/go/sdk/entry_wasip2.go +188 -0
- package/go/sdk/host_http_wasip2.go +42 -0
- package/go/sdk/host_wasip2.go +251 -0
- package/go/sdk/plugin.go +103 -0
- package/go/testplugin/index.js +1 -0
- package/go/testplugin/main.go +67 -0
- package/go/testplugin/plugin.json +24 -0
- package/go/tools/assemble-wit.mjs +152 -0
- package/go/tools/gen-bindings.mjs +51 -0
- package/go/wit/core.wit +273 -0
- package/go/wit/deps/api-call/cap-api-call.wit +20 -0
- package/go/wit/deps/app/cap-app.wit +54 -0
- package/go/wit/deps/auth-center/cap-auth-center.wit +124 -0
- package/go/wit/deps/clipboard/clipboard.wit +48 -0
- package/go/wit/deps/clocks/monotonic-clock.wit +45 -0
- package/go/wit/deps/clocks/wall-clock.wit +42 -0
- package/go/wit/deps/clocks/world.wit +6 -0
- package/go/wit/deps/connection-registry/cap-connection-registry.wit +40 -0
- package/go/wit/deps/crypto/cap-crypto.wit +68 -0
- package/go/wit/deps/filesystem/preopens.wit +8 -0
- package/go/wit/deps/filesystem/types.wit +634 -0
- package/go/wit/deps/filesystem/world.wit +6 -0
- package/go/wit/deps/fs-desktop/cap-fs-desktop.wit +29 -0
- package/go/wit/deps/http/http.wit +28 -0
- package/go/wit/deps/http-endpoint/cap-http.wit +44 -0
- package/go/wit/deps/io/error.wit +34 -0
- package/go/wit/deps/io/poll.wit +41 -0
- package/go/wit/deps/io/streams.wit +262 -0
- package/go/wit/deps/io/world.wit +6 -0
- package/go/wit/deps/mdns/mdns.wit +45 -0
- package/go/wit/deps/notify/notify.wit +51 -0
- package/go/wit/deps/peer/peer.wit +126 -0
- package/go/wit/deps/platform-desktop/cap-platform-desktop.wit +38 -0
- package/go/wit/deps/process/cap-process.wit +25 -0
- package/go/wit/deps/pty/pty.wit +80 -0
- package/go/wit/deps/random/insecure-seed.wit +25 -0
- package/go/wit/deps/random/insecure.wit +22 -0
- package/go/wit/deps/random/random.wit +26 -0
- package/go/wit/deps/random/world.wit +7 -0
- package/go/wit/deps/sockets/instance-network.wit +9 -0
- package/go/wit/deps/sockets/ip-name-lookup.wit +51 -0
- package/go/wit/deps/sockets/network.wit +145 -0
- package/go/wit/deps/sockets/tcp-create-socket.wit +27 -0
- package/go/wit/deps/sockets/tcp.wit +353 -0
- package/go/wit/deps/sockets/udp-create-socket.wit +27 -0
- package/go/wit/deps/sockets/udp.wit +266 -0
- package/go/wit/deps/sockets/world.wit +11 -0
- package/go/wit/deps/task/cap-task.wit +56 -0
- package/go/wit/deps/timer/cap-timer.wit +14 -0
- package/go/wit/deps/wasi-cli/command.wit +7 -0
- package/go/wit/deps/wasi-cli/environment.wit +18 -0
- package/go/wit/deps/wasi-cli/exit.wit +4 -0
- package/go/wit/deps/wasi-cli/imports.wit +20 -0
- package/go/wit/deps/wasi-cli/run.wit +4 -0
- package/go/wit/deps/wasi-cli/stdio.wit +17 -0
- package/go/wit/deps/wasi-cli/terminal.wit +49 -0
- package/go/wit/deps/ws/ws.wit +50 -0
- package/go/wit/deps/ws-server/cap-ws.wit +99 -0
- package/go/wit/go-plugin.wit +28 -0
- package/go/wit/plugin-face.wit +355 -0
- package/go/wit/wasmnest.wit +25 -0
- package/package.json +12 -1
- package/src/index.ts +8 -0
- package/src/types.ts +681 -630
- package/src/ui/AppUpdateSection.d.ts +44 -0
- package/src/ui/AppUpdateSection.vue +253 -0
- package/src/ui/NumberField.d.ts +49 -0
- package/src/ui/NumberField.vue +390 -0
- package/src/ui/Select.vue +4 -4
- package/src/update.ts +123 -0
- package/template/README.md +39 -39
- package/tools/componentize/Cargo.lock +30 -1
- package/tools/componentize/Cargo.toml +3 -0
- package/tools/componentize/src/main.rs +197 -94
- package/dev-shell/src/mock/agent-hub-commands.ts +0 -1065
- package/dev-shell/src/mock/agent-hub.ts +0 -42
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
package wasmnest:auth-center@0.0.1;
|
|
2
|
+
|
|
3
|
+
// 桌面端能力域分片(WIT 按包拆分,ADR 0061):一个能力域 = 一个独立包,
|
|
4
|
+
// 版本独立演进——本包 WIT 变更只 bump 本包,不波及未 import 它的应用。
|
|
5
|
+
// 端 `plugin` world 经 `include wasmnest:auth-center/cap-auth-center@0.0.1;` 并入本接口。
|
|
6
|
+
|
|
7
|
+
/// 密钥托管(secret-store,v15)+ 认证编排桥接面(v17 起,desktop 独有)
|
|
8
|
+
///
|
|
9
|
+
/// **本 interface 是编排桥接面,不是记录面**:宿主不持有任何认证记录或设备入场
|
|
10
|
+
/// 密码学。真源归属(逐条对应本 interface 现有 10 条原语):
|
|
11
|
+
/// - `secret-get/set/delete/keys`(4 条,secret-store):属主密钥托管。约定与红线:
|
|
12
|
+
/// * **属主隔离**:属主 = 调用方插件实例的 plugin_id(宿主自 store state 派生,
|
|
13
|
+
/// guest 无法伪造/旁路);A 不能读/改/删 B 命名空间的密钥,越权由命名空间
|
|
14
|
+
/// 隔离天然拒绝(权限门之外的第二道闸)
|
|
15
|
+
/// * **明文不落日志**:宿主日志/告警只记密钥长度(`value.len()` 模式),
|
|
16
|
+
/// 禁止打印值本身
|
|
17
|
+
/// * 持久化:真源 = 宿主主库 `plugin_secrets` 表(schema.sql);set 覆盖写、
|
|
18
|
+
/// delete 幂等,重启后密钥稳定
|
|
19
|
+
/// - `auth-setting-set`(1 条):认证域设置项写入(键白名单 `pairing_code_ttl` /
|
|
20
|
+
/// `qr_token_ttl`,十进制秒数)。真源 = 宿主主库 `settings` 表;读取走 `host-config`
|
|
21
|
+
/// / 宿主命令面,白名单外键一律拒绝
|
|
22
|
+
/// - `link-identity-parts`(1 条):链路身份 Kd 公钥材料(只含公开材料),
|
|
23
|
+
/// 来自 `link_crypto::identity_parts`
|
|
24
|
+
/// - `auth-center-register` / `auth-center-unregister`(2 条):认证中心显式注册与
|
|
25
|
+
/// 注销(ADR 0031)。真实认证执行在认证中心插件(`com.wasmnest.bedcode`),
|
|
26
|
+
/// 本组只是宿主进程内的发现协议与唯一性仲裁
|
|
27
|
+
/// - `auth-methods-list` / `auth-method-invoke`(2 条):组合式认证方法(ADR 0031)
|
|
28
|
+
///
|
|
29
|
+
/// **已退役、不得回接**(历史注释见下方 v24 / v33 / v34 条目):v18/v19 的记录面
|
|
30
|
+
/// 七函数(`trusted-devices-*` / `connection-history-*`)、v33 的设备入场 JWT
|
|
31
|
+
/// 签发验签两函数、v34 的生物凭证面三函数。旧产物仍 import 它们时在实例化期被拒,
|
|
32
|
+
/// 由 `stale_artifact_rebuild_hint` 点名「按对应 ABI 重建」。
|
|
33
|
+
/// **为什么叫 center**:移动分片曾声明同名 `host-auth`,但两者函数集**零交集**——
|
|
34
|
+
/// 移动侧是「设备入场客户端」(配对 / QR / 生物凭证 / 凭据事实),本 interface 是
|
|
35
|
+
/// 「认证中心角色」(密钥托管 + 中心注册 + 组合式认证发现)。同名不同角色会在统一
|
|
36
|
+
/// 契约(并集 world)里撞 duplicate definition,故按角色定名:本侧 `-center`,
|
|
37
|
+
/// 移动那侧 `host-auth-client`;两端各自注册自己承担的角色,Core 不做端点判定。
|
|
38
|
+
interface host-auth-center {
|
|
39
|
+
/// 读取属主密钥;键不存在返回 `ok(none)`
|
|
40
|
+
secret-get: func(key: string) -> result<option<string>, string>;
|
|
41
|
+
/// 写入/覆盖属主密钥
|
|
42
|
+
secret-set: func(key: string, value: string) -> result<_, string>;
|
|
43
|
+
/// 删除属主密钥(键不存在也视为成功)
|
|
44
|
+
secret-delete: func(key: string) -> result<_, string>;
|
|
45
|
+
/// 列举属主密钥名(供诊断/清理;不返回值本身)
|
|
46
|
+
secret-keys: func() -> result<list<string>, string>;
|
|
47
|
+
|
|
48
|
+
// ==================== v18:认证域设置写入 ====================
|
|
49
|
+
|
|
50
|
+
/// 认证域设置项写入(内核 `settings` 表,键白名单:`pairing_code_ttl` /
|
|
51
|
+
/// `qr_token_ttl`,值为十进制秒数)。读取走宿主配置面(`host-config` / 宿主命令面);
|
|
52
|
+
/// 白名单外键一律拒绝——设置表是宿主真源,不接受插件写入任意键。
|
|
53
|
+
auth-setting-set: func(key: string, value: string) -> result<_, string>;
|
|
54
|
+
|
|
55
|
+
// ==================== v24:认证记录下沉(2026-09-22 用户裁定) ====================
|
|
56
|
+
// 用户裁定:`pairings` / `connection_history` 不再留宿主主库(§8「留宿主」
|
|
57
|
+
// 口径撤销),认证记录归认证中心(`com.wasmnest.bedcode`)私有库,
|
|
58
|
+
// 经其互调 api(`auth-records-import` / `devices-list` / `history-list`)服务。
|
|
59
|
+
// 宿主 host-auth 记录面原语(v18/v19 七函数:trusted-devices-list /
|
|
60
|
+
// trusted-device-revoke / connection-history-list / connection-history-clear /
|
|
61
|
+
// trusted-device-upsert / trusted-device-touch / connection-history-record)
|
|
62
|
+
// 随之**退役删除**。旧产物(v23 SDK 构建)在 activate 期拿到点明新形态的
|
|
63
|
+
// 错误,须按 v24 SDK 重建。
|
|
64
|
+
//
|
|
65
|
+
// 保留面(凭据与密码学归属见 **v33 / v34 条目**,ADR 0033):secret-store 密钥托管、
|
|
66
|
+
// 链路身份(link-identity-parts)。**设备入场 JWT 签发/验签已于 v33 从本 interface 退役**
|
|
67
|
+
// (原先的 `device-token-issue` / `device-token-verify`);**生物凭证面(原先的
|
|
68
|
+
// `biometric-credential-bound` / `biometric-verify-signature` /
|
|
69
|
+
// `biometric-credential-bind`)已于 v34 退役**——公钥托管与验签执行下沉认证中心
|
|
70
|
+
// 插件私有库(B-downsink),宿主不再持有任何设备侧凭证材料。
|
|
71
|
+
|
|
72
|
+
/// 链路身份 Kd 公钥材料读取(`link_crypto::identity_parts` 语义):
|
|
73
|
+
/// `ok(none)` = 身份未就绪。JSON:`{ publicB64, fingerprint }`。
|
|
74
|
+
/// 响应字段 `kdPublicB64` / `kdFingerprint` 的数据源;只含公开材料。
|
|
75
|
+
link-identity-parts: func() -> result<option<string>, string>;
|
|
76
|
+
|
|
77
|
+
// ==================== v34:生物凭证面退役(B-downsink,2026-09-30) ====================
|
|
78
|
+
// 原 `biometric-credential-bound` / `biometric-verify-signature` /
|
|
79
|
+
// `biometric-credential-bind` 三函数**删除**(破坏性):认证中心
|
|
80
|
+
// (`com.wasmnest.bedcode`)自持生物公钥(本插件私有库 `auth_biometric_keys`)
|
|
81
|
+
// 并在 WASM 内用 p256 验签,宿主不再托管任何生物凭证材料(宿主
|
|
82
|
+
// `utils/auth/biometric.rs` 与 `host_secrets` 的生物键同批退役)。旧产物
|
|
83
|
+
// (v33 SDK 构建)仍 import 这三函数 → **实例化期**即被拒,
|
|
84
|
+
// `stale_artifact_rebuild_hint` 点名「按 v34 SDK 重建」,不是 trap 也不是静默降级。
|
|
85
|
+
// wire 格式与挑战-应答流程逐字节不变(移动端仍走 HTTP /api/auth/biometric-*,零改动)。
|
|
86
|
+
|
|
87
|
+
// ==================== v33:设备入场 JWT 签发/验签退役(ADR 0033) ====================
|
|
88
|
+
// 原 `device-token-issue` / `device-token-verify` 两函数**删除**(破坏性):
|
|
89
|
+
// 认证中心(`com.wasmnest.bedcode`)自持入场密钥并自签自验,宿主不再
|
|
90
|
+
// 持有任何设备 JWT 密码学,`utils/auth/jwt.rs` 整个退役。旧产物(v32 SDK
|
|
91
|
+
// 构建)仍 import 这两个函数 → **实例化期**即被拒,`stale_artifact_rebuild_hint`
|
|
92
|
+
// 点名「按 v33 SDK 重建」,不是 trap 也不是静默降级。
|
|
93
|
+
// token wire 格式逐字节不变(移动端把 token 当不透明串,零改动)。
|
|
94
|
+
|
|
95
|
+
// ==================== v32:认证中心显式注册 + 组合式认证原语(ADR 0031) ====================
|
|
96
|
+
// 用户裁定 2026-09-29:认证中心与微服务 auth server 概念一致,只不过这里没有也
|
|
97
|
+
// 不需要服务发现——注册表就是宿主进程内的发现协议(激活时注册 + 唯一性仲裁)。
|
|
98
|
+
// 本组 4 函数为**桌面独有**(双端偏离,ADR 0022):移动端是客户端,不承载服务端
|
|
99
|
+
// 网关与认证中心角色,不跟演不投影,mobile ABI 保持 11。
|
|
100
|
+
//
|
|
101
|
+
// 权限门:4 函数全部 `auth`(复用既有 PERMISSION_AUTH,不新增词汇位)。
|
|
102
|
+
|
|
103
|
+
/// 注册本插件为**认证中心**(单中心角色,K4)。入参 = 本中心提供的认证方式标识
|
|
104
|
+
/// 列表(**声明式**,宿主不解释每个 method 的业务语义);成功返回中心句柄
|
|
105
|
+
/// `authc-<uuid>`。已有中心在册 → `err`(点名在册属主);无 `auth` 权限位 →
|
|
106
|
+
/// `err("permission denied")`。停用后宿主 `purge_for_plugin` 兜底回收。
|
|
107
|
+
auth-center-register: func(methods: list<string>) -> result<string, string>;
|
|
108
|
+
/// 注销本插件的认证中心角色(仅属主本人可调;非属主 → `err`)。无中心在册也
|
|
109
|
+
/// 视为成功(幂等)。
|
|
110
|
+
auth-center-unregister: func() -> result<_, string>;
|
|
111
|
+
/// 列取当前认证中心注册时声明的认证方式(无中心在册 → `err`)。其他插件据此
|
|
112
|
+
/// 发现可用的认证方式(组合式认证的发现端,K6)。权限 `auth`。
|
|
113
|
+
auth-methods-list: func() -> result<list<string>, string>;
|
|
114
|
+
/// 经认证中心执行一次认证方式调用(**零解析窄转发**:`params` 原样透传给中心,
|
|
115
|
+
/// 返回值原样透回)。`method` 必须在中心注册的 methods 内(安全闸门判据,非
|
|
116
|
+
/// 语义解释),否则 `err`(点名 method 与在册列表)。无中心 → `err(no auth center
|
|
117
|
+
/// registered)`(fail-closed);中心调用失败 → `err(auth center unavailable: …)`;
|
|
118
|
+
/// 中心返回业务错误 → 原样透传(不吞成宿主错误)。权限 `auth`。
|
|
119
|
+
auth-method-invoke: func(method: string, params: string) -> result<string, string>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
world cap-auth-center {
|
|
123
|
+
import host-auth-center;
|
|
124
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
package wasmnest:clipboard@0.0.1;
|
|
2
|
+
// ======================================================================
|
|
3
|
+
// 剪贴板域共享契约(唯一真源;ADR 0052 D2/D3 · domain-owned-contracts 票 04)
|
|
4
|
+
//
|
|
5
|
+
// 本文件是 `host-clipboard` 的单一事实源:
|
|
6
|
+
// - 双端 `compose.json` 的 caps.clipboard 直接指向本文件(pty 先例推广);
|
|
7
|
+
// - 有实现两端底层机制不同、且都只有几行宿主代码,故本域没有共享引擎,
|
|
8
|
+
// 按 ADR 0052 D2/D4 用**轻量契约房**(`wasmnest-clipboard-engine`)承载;
|
|
9
|
+
// 实现按端住宿主(桌面 / 移动各自 `src-tauri/src/plugin/clipboard.rs`)。
|
|
10
|
+
//
|
|
11
|
+
// ## 功能级口径(票 04 统一)
|
|
12
|
+
//
|
|
13
|
+
// - 桌面与移动共享同一 `host-clipboard` 接口:`read-text` 读系统剪贴板文本、
|
|
14
|
+
// `write-text` 写文本到系统剪贴板;
|
|
15
|
+
// - 读操作返回 `option<string>`(剪贴板为空或含非文本内容时返回 `none`);
|
|
16
|
+
// - 写操作返回空结果(成功即 `ok`,失败经 `err` 传宿主侧可读消息)。
|
|
17
|
+
//
|
|
18
|
+
// ## 权限(各端自持,契约不规定门)
|
|
19
|
+
//
|
|
20
|
+
// - 桌面:`clipboard:read` / `clipboard:write`(fail-closed,未声明即拒——
|
|
21
|
+
// 剪贴板是用户隐私面,跨应用数据泄露风险高);
|
|
22
|
+
// - 移动:同桌面(双端同一口径,与 `host-clipboard` 共享契约对齐)。
|
|
23
|
+
//
|
|
24
|
+
// 门在各端函数实现内(正确性由 Rust 端仲裁),契约面只描述签名。
|
|
25
|
+
// ======================================================================
|
|
26
|
+
|
|
27
|
+
/// 系统剪贴板读写(功能级交集;实现按端住宿主)
|
|
28
|
+
interface host-clipboard {
|
|
29
|
+
/// 读取系统剪贴板文本内容。
|
|
30
|
+
///
|
|
31
|
+
/// 返回 `ok(option<string>)`:剪贴板有文本时返回 `some(text)`,剪贴板为空
|
|
32
|
+
/// 或含非文本内容(图片、文件等)时返回 `none`。失败返回 `err(message)`。
|
|
33
|
+
///
|
|
34
|
+
/// **权限 `clipboard:read`(manifest 必须单独声明)**:未声明即 `Err`。
|
|
35
|
+
read-text: func() -> result<option<string>, string>;
|
|
36
|
+
|
|
37
|
+
/// 写入文本到系统剪贴板。
|
|
38
|
+
///
|
|
39
|
+
/// 成功返回 `ok`,失败返回 `err(message)`(如剪贴板被其他进程锁定)。
|
|
40
|
+
///
|
|
41
|
+
/// **权限 `clipboard:write`(manifest 必须单独声明)**:未声明即 `Err`。
|
|
42
|
+
write-text: func(text: string) -> result<_, string>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// 剪贴板域端组合 world(双端 compose.json 的 `caps.clipboard` 指向本文件)
|
|
46
|
+
world cap-clipboard {
|
|
47
|
+
import host-clipboard;
|
|
48
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
package wasi:clocks@0.2.0;
|
|
2
|
+
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
|
|
3
|
+
/// time.
|
|
4
|
+
///
|
|
5
|
+
/// It is intended to be portable at least between Unix-family platforms and
|
|
6
|
+
/// Windows.
|
|
7
|
+
///
|
|
8
|
+
/// A monotonic clock is a clock which has an unspecified initial value, and
|
|
9
|
+
/// successive reads of the clock will produce non-decreasing values.
|
|
10
|
+
///
|
|
11
|
+
/// It is intended for measuring elapsed time.
|
|
12
|
+
interface monotonic-clock {
|
|
13
|
+
use wasi:io/poll@0.2.0.{pollable};
|
|
14
|
+
|
|
15
|
+
/// An instant in time, in nanoseconds. An instant is relative to an
|
|
16
|
+
/// unspecified initial value, and can only be compared to instances from
|
|
17
|
+
/// the same monotonic-clock.
|
|
18
|
+
type instant = u64;
|
|
19
|
+
|
|
20
|
+
/// A duration of time, in nanoseconds.
|
|
21
|
+
type duration = u64;
|
|
22
|
+
|
|
23
|
+
/// Read the current value of the clock.
|
|
24
|
+
///
|
|
25
|
+
/// The clock is monotonic, therefore calling this function repeatedly will
|
|
26
|
+
/// produce a sequence of non-decreasing values.
|
|
27
|
+
now: func() -> instant;
|
|
28
|
+
|
|
29
|
+
/// Query the resolution of the clock. Returns the duration of time
|
|
30
|
+
/// corresponding to a clock tick.
|
|
31
|
+
resolution: func() -> duration;
|
|
32
|
+
|
|
33
|
+
/// Create a `pollable` which will resolve once the specified instant
|
|
34
|
+
/// occured.
|
|
35
|
+
subscribe-instant: func(
|
|
36
|
+
when: instant,
|
|
37
|
+
) -> pollable;
|
|
38
|
+
|
|
39
|
+
/// Create a `pollable` which will resolve once the given duration has
|
|
40
|
+
/// elapsed, starting at the time at which this function was called.
|
|
41
|
+
/// occured.
|
|
42
|
+
subscribe-duration: func(
|
|
43
|
+
when: duration,
|
|
44
|
+
) -> pollable;
|
|
45
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
package wasi:clocks@0.2.0;
|
|
2
|
+
/// WASI Wall Clock is a clock API intended to let users query the current
|
|
3
|
+
/// time. The name "wall" makes an analogy to a "clock on the wall", which
|
|
4
|
+
/// is not necessarily monotonic as it may be reset.
|
|
5
|
+
///
|
|
6
|
+
/// It is intended to be portable at least between Unix-family platforms and
|
|
7
|
+
/// Windows.
|
|
8
|
+
///
|
|
9
|
+
/// A wall clock is a clock which measures the date and time according to
|
|
10
|
+
/// some external reference.
|
|
11
|
+
///
|
|
12
|
+
/// External references may be reset, so this clock is not necessarily
|
|
13
|
+
/// monotonic, making it unsuitable for measuring elapsed time.
|
|
14
|
+
///
|
|
15
|
+
/// It is intended for reporting the current date and time for humans.
|
|
16
|
+
interface wall-clock {
|
|
17
|
+
/// A time and date in seconds plus nanoseconds.
|
|
18
|
+
record datetime {
|
|
19
|
+
seconds: u64,
|
|
20
|
+
nanoseconds: u32,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/// Read the current value of the clock.
|
|
24
|
+
///
|
|
25
|
+
/// This clock is not monotonic, therefore calling this function repeatedly
|
|
26
|
+
/// will not necessarily produce a sequence of non-decreasing values.
|
|
27
|
+
///
|
|
28
|
+
/// The returned timestamps represent the number of seconds since
|
|
29
|
+
/// 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch],
|
|
30
|
+
/// also known as [Unix Time].
|
|
31
|
+
///
|
|
32
|
+
/// The nanoseconds field of the output is always less than 1000000000.
|
|
33
|
+
///
|
|
34
|
+
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
|
|
35
|
+
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
|
|
36
|
+
now: func() -> datetime;
|
|
37
|
+
|
|
38
|
+
/// Query the resolution of the clock.
|
|
39
|
+
///
|
|
40
|
+
/// The nanoseconds field of the output is always less than 1000000000.
|
|
41
|
+
resolution: func() -> datetime;
|
|
42
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
package wasmnest:connection-registry@0.0.1;
|
|
2
|
+
|
|
3
|
+
// 桌面端能力域分片(WIT 按包拆分,ADR 0061):一个能力域 = 一个独立包,
|
|
4
|
+
// 版本独立演进——本包 WIT 变更只 bump 本包,不波及未 import 它的应用。
|
|
5
|
+
// 端 `plugin` world 经 `include wasmnest:connection-registry/cap-connection-registry@0.0.1;` 并入本接口。
|
|
6
|
+
|
|
7
|
+
/// 宿主 server 的在册连接清单(自 `host-session.connections-list` 迁出)
|
|
8
|
+
///
|
|
9
|
+
/// **为什么单独成 interface**:这份事实的主语是宿主 WS 服务的连接注册表
|
|
10
|
+
/// (`WsSessionRegistry`),不是插件自己开的 socket(那是 `host-websocket` 的
|
|
11
|
+
/// `ws:client` / `ws:server`),也不是会话(会话真源已在 `com.wasmnest.bedcode`
|
|
12
|
+
/// 登记域)。它历史上住进 `host-session` 只是当时顺手——而 `host-session` 整 interface
|
|
13
|
+
/// 已在 v27 退役,这份**只有宿主机进程知道、且零会话语义**的事实因此必须
|
|
14
|
+
/// 换个家活下来(ADR 0022 v12 裁决 5「迁独立原语」);**迁出后唯一的调用入口就是本
|
|
15
|
+
/// interface**(旧别名随 `host-session` 一起删除,不留第二把钥匙)。
|
|
16
|
+
///
|
|
17
|
+
/// 权限 `connection:read`(新位,替代原 `session:read`;迁移期两条入口共用
|
|
18
|
+
/// 这一判据,`host-session` 侧那一条已随 v27 删除)。
|
|
19
|
+
///
|
|
20
|
+
/// **无排序无解读**:返回内核 WS 连接注册表的全部原始条目,按注册表存储序
|
|
21
|
+
/// (HashMap 迭代序,不保证稳定),不做过滤(含未认证连接)、不做合并(不关联配对记录)、
|
|
22
|
+
/// 不加派生字段(无会话数 / 在线判定——那些是插件侧派生视图的职责)。
|
|
23
|
+
/// JSON 数组,元素(原始字段名,camelCase):
|
|
24
|
+
/// `{ clientId, deviceName?, fingerprint?, addr, authenticated, connectedAt }`
|
|
25
|
+
/// (`clientId` = 注册表键 = 连接地址串;`deviceName` / `fingerprint` 来自 JWT claims,
|
|
26
|
+
/// 认证前为 null;`connectedAt` 为 epoch 毫秒)。
|
|
27
|
+
///
|
|
28
|
+
/// 注:WIT 中 `list` 是关键字,故函数名沿用 `connections-list`。
|
|
29
|
+
///
|
|
30
|
+
/// **为什么叫 registry**:移动分片曾声明同名 `host-connection`,两者函数集**零交集**
|
|
31
|
+
/// ——本 interface 是「在册连接清单」角色,移动侧是「主连接目标」角色
|
|
32
|
+
/// (`host-connection-target`)。统一契约(并集 world)下同名会撞 duplicate
|
|
33
|
+
/// definition,故按角色定名。
|
|
34
|
+
interface host-connection-registry {
|
|
35
|
+
connections-list: func() -> result<string, string>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
world cap-connection-registry {
|
|
39
|
+
import host-connection-registry;
|
|
40
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
package wasmnest:crypto@0.0.1;
|
|
2
|
+
|
|
3
|
+
// 桌面端能力域分片(WIT 按包拆分,ADR 0061):一个能力域 = 一个独立包,
|
|
4
|
+
// 版本独立演进——本包 WIT 变更只 bump 本包,不波及未 import 它的应用。
|
|
5
|
+
// 端 `plugin` world 经 `include wasmnest:crypto/cap-crypto@0.0.1;` 并入本接口。
|
|
6
|
+
|
|
7
|
+
/// 宿主加密引擎(host-crypto,v26,**desktop 独有,双端偏离**——同 host-pty /
|
|
8
|
+
/// host-auth 先例,ADR 0022「双端偏离」节)。
|
|
9
|
+
///
|
|
10
|
+
/// 宿主加密引擎(`crypto/`)的按名寻址原语面:插件经算法名调用宿主聚合的
|
|
11
|
+
/// 「全局加密方法大全」,引擎只提供**无业务语义的中性算法原语**(ADR 0022
|
|
12
|
+
/// 裁剪线)——绝不做认证编排/协商流程/密钥策略,密钥材料一律由调用方传入,
|
|
13
|
+
/// 宿主身份密钥(Kd / JWT keystore)不出口(仅内部 filter 链使用)。
|
|
14
|
+
///
|
|
15
|
+
/// 算法名白名单在宿主注册表(`crypto/registry`),未知名返回错误(fail-visible);
|
|
16
|
+
/// 首版最小子集:aead(aes-256-gcm / chacha20-poly1305)、kdf(hkdf-sha256)、
|
|
17
|
+
/// key-exchange(x25519)。rsa / hybrid 按需扩展。
|
|
18
|
+
/// 权限三域(风险拆分,对齐 ws:client/ws:server 先例):`crypto:aead` /
|
|
19
|
+
/// `crypto:asym` / `crypto:kdf`(各自域入口门禁)。
|
|
20
|
+
interface host-crypto {
|
|
21
|
+
/// AEAD 加密:算法名 + 密钥/nonce/明文/aad(全部字节由调用方提供)
|
|
22
|
+
/// name:aes-256-gcm | chacha20-poly1305;key/nonce 长度由算法定(32/12),
|
|
23
|
+
/// 超长/不足 → `Err`(长度校验,不做截断)。返回 密文 + 认证标签。
|
|
24
|
+
aead-encrypt: func(
|
|
25
|
+
algorithm: string,
|
|
26
|
+
key: list<u8>,
|
|
27
|
+
nonce: list<u8>,
|
|
28
|
+
plaintext: list<u8>,
|
|
29
|
+
aad: option<list<u8>>,
|
|
30
|
+
) -> result<list<u8>, string>;
|
|
31
|
+
/// AEAD 解密;完整性校验失败返回 `Err`(不可与「不存在」混淆—— AEAD 认证失败
|
|
32
|
+
/// 是明显的完整性错误,非存在性)
|
|
33
|
+
aead-decrypt: func(
|
|
34
|
+
algorithm: string,
|
|
35
|
+
key: list<u8>,
|
|
36
|
+
nonce: list<u8>,
|
|
37
|
+
ciphertext: list<u8>,
|
|
38
|
+
aad: option<list<u8>>,
|
|
39
|
+
) -> result<list<u8>, string>;
|
|
40
|
+
/// 生成指定 AEAD 算法的随机密钥;算法名非法 → `Err`
|
|
41
|
+
aead-generate-key: func(algorithm: string) -> result<list<u8>, string>;
|
|
42
|
+
/// 生成随机 nonce;算法名非法 → `Err`
|
|
43
|
+
aead-generate-nonce: func(algorithm: string) -> result<list<u8>, string>;
|
|
44
|
+
|
|
45
|
+
/// KDF 密钥派生(hkdf-sha256):salt(可选)/ ikm / info → 指定长度密钥
|
|
46
|
+
kdf-derive: func(
|
|
47
|
+
algorithm: string,
|
|
48
|
+
salt: option<list<u8>>,
|
|
49
|
+
ikm: list<u8>,
|
|
50
|
+
info: list<u8>,
|
|
51
|
+
length: u32,
|
|
52
|
+
) -> result<list<u8>, string>;
|
|
53
|
+
|
|
54
|
+
/// 随机密钥交换(x25519)——生成临时密钥对,返回 `private ‖ public`
|
|
55
|
+
/// 裸字节(定长:x25519 各 32 字节,前 32 为私钥、后 32 为公钥)。
|
|
56
|
+
/// 私钥仅宿主内传、不入日志;定长拼接避免 base64 编解码与长度歧义。
|
|
57
|
+
keyagreement-generate: func(algorithm: string) -> result<list<u8>, string>;
|
|
58
|
+
/// 用本端私钥 + 对端公钥求共享密钥(字节,可直接进 kdf-derive)
|
|
59
|
+
keyagreement-shared: func(
|
|
60
|
+
algorithm: string,
|
|
61
|
+
local-private: list<u8>,
|
|
62
|
+
peer-public: list<u8>,
|
|
63
|
+
) -> result<list<u8>, string>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
world cap-crypto {
|
|
67
|
+
import host-crypto;
|
|
68
|
+
}
|