@agent-network-protocol/dsh-anp-identity 0.1.2 → 0.1.3-rc.1
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/BOUNDARY.md +14 -2
- package/README.md +37 -4
- package/README.zh.md +10 -2
- package/V7-MANAGEMENT.md +90 -0
- package/cordis.patch.yml +4 -0
- package/lib/authorization-types.d.ts +150 -0
- package/lib/authorization-types.d.ts.map +1 -0
- package/lib/authorization-types.js +2 -0
- package/lib/authorization-types.js.map +1 -0
- package/lib/authorization.d.ts +45 -0
- package/lib/authorization.d.ts.map +1 -0
- package/lib/authorization.js +718 -0
- package/lib/authorization.js.map +1 -0
- package/lib/catalog.d.ts +7 -2
- package/lib/catalog.d.ts.map +1 -1
- package/lib/catalog.js +45 -23
- package/lib/catalog.js.map +1 -1
- package/lib/client/controller.d.ts +78 -0
- package/lib/client/controller.d.ts.map +1 -0
- package/lib/client/controller.js +365 -0
- package/lib/client/controller.js.map +1 -0
- package/lib/client/identity-icon.d.ts +3 -0
- package/lib/client/identity-icon.d.ts.map +1 -0
- package/lib/client/identity-icon.js +6 -0
- package/lib/client/identity-icon.js.map +1 -0
- package/lib/client/index.d.ts +7 -0
- package/lib/client/index.d.ts.map +1 -0
- package/lib/client/index.js +51 -0
- package/lib/client/index.js.map +1 -0
- package/lib/client/settings-icon-slot.d.ts +13 -0
- package/lib/client/settings-icon-slot.d.ts.map +1 -0
- package/lib/client/settings-icon-slot.js +2 -0
- package/lib/client/settings-icon-slot.js.map +1 -0
- package/lib/client/styles.d.ts +4 -0
- package/lib/client/styles.d.ts.map +1 -0
- package/lib/client/styles.js +39 -0
- package/lib/client/styles.js.map +1 -0
- package/lib/client/views.d.ts +11 -0
- package/lib/client/views.d.ts.map +1 -0
- package/lib/client/views.js +287 -0
- package/lib/client/views.js.map +1 -0
- package/lib/client.js +21008 -0
- package/lib/client.js.map +7 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +413 -58
- package/lib/index.js.map +1 -1
- package/lib/management-remote.d.ts +23 -0
- package/lib/management-remote.d.ts.map +1 -0
- package/lib/management-remote.js +126 -0
- package/lib/management-remote.js.map +1 -0
- package/lib/management-types.d.ts +50 -0
- package/lib/management-types.d.ts.map +1 -0
- package/lib/management-types.js +2 -0
- package/lib/management-types.js.map +1 -0
- package/lib/provider-api.d.ts +3 -0
- package/lib/provider-api.d.ts.map +1 -1
- package/lib/provider-api.js.map +1 -1
- package/lib/remote.d.ts +4 -0
- package/lib/remote.d.ts.map +1 -0
- package/lib/remote.js +86 -0
- package/lib/remote.js.map +1 -0
- package/lib/user-client.d.ts +41 -0
- package/lib/user-client.d.ts.map +1 -0
- package/lib/user-client.js +6 -0
- package/lib/user-client.js.map +1 -0
- package/lib/user-operation.d.ts +7 -0
- package/lib/user-operation.d.ts.map +1 -0
- package/lib/user-operation.js +87 -0
- package/lib/user-operation.js.map +1 -0
- package/lib/user-service.d.ts +26 -0
- package/lib/user-service.d.ts.map +1 -0
- package/lib/user-service.js +140 -0
- package/lib/user-service.js.map +1 -0
- package/package.json +113 -10
package/BOUNDARY.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
The DSH package is a policy and lifecycle layer around ANP Identity. It does not replace the native custody boundary.
|
|
4
4
|
|
|
5
|
+
The v7 ordinary-plugin creation/authorization UI and Host-bound `UserIdentityClient`
|
|
6
|
+
are documented in [V7-MANAGEMENT.md](./V7-MANAGEMENT.md). The legacy
|
|
7
|
+
`IdentityClientLease` below remains a separate compatibility contract. Ordinary
|
|
8
|
+
user consumers cannot acquire it or supply an HTTP transport callback; their
|
|
9
|
+
approved dispatch uses Host-owned transport.
|
|
10
|
+
|
|
5
11
|
## Trust zones
|
|
6
12
|
|
|
7
13
|
- ANP Identity Rust and its Node binding hold Store Root Keys, managed private keys, and decrypted signing material.
|
|
@@ -11,6 +17,12 @@ The DSH package is a policy and lifecycle layer around ANP Identity. It does not
|
|
|
11
17
|
|
|
12
18
|
Consumer identifiers are soft same-process identities. The allowlists prevent accidental cross-plugin use and provide an auditable policy, but JavaScript in the same process is not a sandbox.
|
|
13
19
|
|
|
20
|
+
Known unresolved limitation: ordinary facades omit management methods, but the
|
|
21
|
+
shared root service and Host gateway still allow same-process code to reach the
|
|
22
|
+
manager without the approval UI (review F2). Host-side call authentication is not
|
|
23
|
+
part of the current scoped fix. Excluding Host-associated identities from ordinary
|
|
24
|
+
grants does not resolve this manager-entry vulnerability.
|
|
25
|
+
|
|
14
26
|
## Secret rules
|
|
15
27
|
|
|
16
28
|
- The default client surface has no raw ECDH, private-key import, Root Key export, sealed envelope, or Header patch method.
|
|
@@ -31,7 +43,7 @@ Consumer identifiers are soft same-process identities. The allowlists prevent ac
|
|
|
31
43
|
|
|
32
44
|
## HTTP dispatcher
|
|
33
45
|
|
|
34
|
-
The
|
|
46
|
+
The legacy client API exposes `dispatch(Request, transport)`:
|
|
35
47
|
|
|
36
48
|
- exact HTTPS origins must be authorized by Host configuration and requested by the lease;
|
|
37
49
|
- caller-supplied `Authorization`, `Signature-Input`, `Signature`, and `Content-Digest` are rejected;
|
|
@@ -44,4 +56,4 @@ AWiki's Bearer Token cache, challenge processing, and retry policy remain in `ds
|
|
|
44
56
|
|
|
45
57
|
## Out of scope
|
|
46
58
|
|
|
47
|
-
This package does not provide OS sandboxing, malicious-plugin isolation, DID resolution or publication, remote backup, Store rekey, Root Key rotation
|
|
59
|
+
This package does not provide OS sandboxing, malicious-plugin isolation, DID resolution or publication, remote backup, Store rekey, or Root Key rotation. Its ordinary-plugin approval UI does not replace Root Transfer user-presence confirmation, which remains an AWiki workflow above the Host Provider lease.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`@agent-network-protocol/dsh-anp-identity` gives DSH applications one shared, multi-DID identity store without making each application implement key custody, DID document lifecycle, crash recovery, or request signing.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Ordinary plugins use `bindIdentityClient(ctx)` to request user-approved identity creation and use. Trusted Host integrations retain a separate facade through `ctx.anpIdentity`. The plugin delegates private-key operations to the ANP Identity native module, keeps private keys encrypted at rest, and stores only non-secret DSH metadata—labels, handles, and consumer grants—in its catalog.
|
|
6
6
|
|
|
7
7
|
## What problem it solves
|
|
8
8
|
|
|
@@ -14,10 +14,11 @@ A DSH installation may host several plugins and several independent DIDs. Those
|
|
|
14
14
|
- How can a request be authenticated without exposing a reusable signature header patch?
|
|
15
15
|
- How can a Store contain several DIDs while handles and deletion grants remain consistent?
|
|
16
16
|
|
|
17
|
-
This package supplies that coordination layer. ANP Identity remains the source of truth for identities and encrypted keys. A transactional
|
|
17
|
+
This package supplies that coordination layer. ANP Identity remains the source of truth for identities and encrypted keys. A transactional catalog adds DSH-specific ownership metadata. Creation uses a recoverable intent; deletion writes a tombstone before touching the native Store; cross-process mutations use a file lock, generation checks, and atomic rename. Management upgrades the catalog to schema v2; see the coordinated upgrade and rollback instructions in [V7-MANAGEMENT.md](./V7-MANAGEMENT.md).
|
|
18
18
|
|
|
19
19
|
## What it provides
|
|
20
20
|
|
|
21
|
+
- An optional settings page with Handle/DID details, creation confirmations, an authorization inbox, once or persistent revocable grants, permission details and guarded deletion.
|
|
21
22
|
- Multi-DID create, list, open, delete, and recovery operations.
|
|
22
23
|
- Purpose-based Ed25519 signing and verification.
|
|
23
24
|
- Origin Proof signing.
|
|
@@ -78,7 +79,27 @@ those defaults for a different deployment.
|
|
|
78
79
|
|
|
79
80
|
## Use it from another DSH plugin
|
|
80
81
|
|
|
81
|
-
|
|
82
|
+
Ordinary plugins must be configured in `userConsumers` by the Host. They use the loader-bound client below, not a self-declared consumer name or a legacy lease:
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import { bindIdentityClient } from '@agent-network-protocol/dsh-anp-identity/user-client'
|
|
86
|
+
|
|
87
|
+
export const inject = ['anpIdentity']
|
|
88
|
+
// Call from the installed plugin's Context after its Loader entry is ready.
|
|
89
|
+
const client = bindIdentityClient(ctx)
|
|
90
|
+
const request = await client.requestCreateIdentity({
|
|
91
|
+
requestId: 'stable-create-id',
|
|
92
|
+
purpose: 'Create an identity for this integration',
|
|
93
|
+
parameters: { label: 'Work', domain: 'example.com', path: '/agents/work' },
|
|
94
|
+
})
|
|
95
|
+
// Query request.id after user confirmation, then request separate use authorization.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Creation does not publish the document, register a Handle, or grant use. Once authorization binds one operation; permanent authorization lasts until revoked. The current MVP grants the full ordinary capability bundle, not individually selected permissions. See [the complete management contract](./V7-MANAGEMENT.md) and the [runnable signed HTTP demo](../../demo/dsh-http/README.md).
|
|
99
|
+
|
|
100
|
+
### Existing trusted Host consumers
|
|
101
|
+
|
|
102
|
+
The following legacy facade is for explicitly configured **trusted Host integrations**, not ordinary user-mode plugins. Declare the Cordis dependency, acquire only the capabilities you need, and dispose the lease with the calling plugin's fiber:
|
|
82
103
|
|
|
83
104
|
```ts
|
|
84
105
|
import type { Context } from '@deepseek-ai/cordis'
|
|
@@ -153,7 +174,7 @@ identity namespace; it does not revoke or modify the remote DID.
|
|
|
153
174
|
## Development
|
|
154
175
|
|
|
155
176
|
```bash
|
|
156
|
-
npm
|
|
177
|
+
npm ci --legacy-peer-deps
|
|
157
178
|
npm run verify
|
|
158
179
|
```
|
|
159
180
|
|
|
@@ -167,6 +188,10 @@ expected by the workspace:
|
|
|
167
188
|
npm run test:functional
|
|
168
189
|
```
|
|
169
190
|
|
|
191
|
+
After publishing, run `npm run test:functional -- --published` to repeat the
|
|
192
|
+
same real DSH/HTTPS acceptance using the exact plugin version from npm instead
|
|
193
|
+
of a locally packed candidate.
|
|
194
|
+
|
|
170
195
|
It downloads the exact published native wrapper and host platform package
|
|
171
196
|
pinned by this plugin, packs the DSH plugin from source, and installs them
|
|
172
197
|
into a temporary real DSH profile, then sends signed GET and POST
|
|
@@ -174,4 +199,12 @@ requests to an independent HTTPS process backed by the ANP Python verifier. A
|
|
|
174
199
|
tampered POST must be rejected. The temporary DSH profile, Store, certificate,
|
|
175
200
|
and tarballs are removed after the run.
|
|
176
201
|
|
|
202
|
+
The management UI tests render the real DSH primitives. Version `0.1.5-rc.1` of
|
|
203
|
+
`@deepseek-ai/dsh-client-ui-primitives` imports syntax-highlighting, Markdown,
|
|
204
|
+
terminal, and styling packages from its entry point but lists them only as its
|
|
205
|
+
own development dependencies. We explicitly include those imports as development
|
|
206
|
+
dependencies here so a clean `npm ci` can load the same components without
|
|
207
|
+
relying on a parent workspace's `node_modules`. They are test-environment
|
|
208
|
+
dependencies; the browser build continues to use the host-provided UI primitives.
|
|
209
|
+
|
|
177
210
|
Licensed under Apache-2.0.
|
package/README.zh.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`@agent-network-protocol/dsh-anp-identity` 为 DSH 应用提供共享的多 DID 身份 Store。应用不需要各自实现私钥托管、DID Document 生命周期、崩溃恢复和请求签名。
|
|
4
4
|
|
|
5
|
-
普通插件通过 `ctx.anpIdentity`
|
|
5
|
+
普通插件通过 `bindIdentityClient(ctx)` 申请创建身份和使用授权;`ctx.anpIdentity` 的旧 lease 接口保留给可信 Host 集成。私钥操作由 ANP Identity 原生模块完成;私钥在磁盘上加密保存。DSH catalog 只记录 label、handle 和 consumer grant 等非秘密元数据。
|
|
6
6
|
|
|
7
7
|
## 它解决什么问题
|
|
8
8
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
- HTTP 请求如何完成身份认证,同时不把可复用 Header patch 交给调用方;
|
|
15
15
|
- 多 DID、通用 handle、consumer grant 和删除保护如何保持一致。
|
|
16
16
|
|
|
17
|
-
ANP Identity Store 是身份与加密密钥的真值。插件增加事务化的
|
|
17
|
+
ANP Identity Store 是身份与加密密钥的真值。插件增加事务化的 catalog:创建前写 intent,删除前写 tombstone;跨进程修改使用文件锁、generation 检查和原子 rename。异常重启后流程会继续完成,未知身份只会成为无授权的 `Unclaimed`,不会猜测所有者。管理功能将 catalog 升级为 v2,升级和回滚必须遵循 [V7-MANAGEMENT.md](./V7-MANAGEMENT.md) 的停写与一致性要求。
|
|
18
18
|
|
|
19
19
|
## 主要能力
|
|
20
20
|
|
|
@@ -72,6 +72,14 @@ keyring 的 `rootKeyProviderId` 格式为 `service/account`;env 模式填写
|
|
|
72
72
|
|
|
73
73
|
## 其他 DSH 插件如何使用
|
|
74
74
|
|
|
75
|
+
普通插件由 Host 加入 `userConsumers`,通过 `bindIdentityClient(ctx)` 提交请求,等待创建确认,再单独申请使用授权。创建不会发布 DID 文档、注册 Handle 或自动授予使用权。支持单次授权和持续到撤销的永久授权;当前默认授予全部普通使用权限,暂不支持逐项选择。
|
|
76
|
+
|
|
77
|
+
完整 API 与边界见 [管理说明](./V7-MANAGEMENT.md);可运行示例见 [HTTP 签名 demo](../../demo/dsh-http/README.md)。设置页包含 Handle/DID、授权请求、权限详情和撤销入口。
|
|
78
|
+
|
|
79
|
+
### 既有可信 Host 集成
|
|
80
|
+
|
|
81
|
+
以下旧 lease 示例仅适用于明确配置的可信 Host 集成,不适用于普通 user-mode 插件。
|
|
82
|
+
|
|
75
83
|
调用插件声明 `inject = ['anpIdentity']`,申请最小 capability,并让 lease 随自己的 Cordis fiber 释放:
|
|
76
84
|
|
|
77
85
|
```ts
|
package/V7-MANAGEMENT.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Identity management and ordinary plugin authorization
|
|
2
|
+
|
|
3
|
+
This implementation adds an optional DSH settings section, a shared approval overlay and a Host-owned persistent authorization boundary. It does not change the ANP identity, signature or HTTP wire protocols. Real native Desktop acceptance is a separate integration gate; package tests are not that evidence.
|
|
4
|
+
|
|
5
|
+
## Installation and authority
|
|
6
|
+
|
|
7
|
+
Load the existing service/provider patch. Configure `allowConsumers` with exact installed loader package identifiers and put ordinary plugins in `userConsumers`. Provider consumers cannot also be user consumers. Configure each plugin's exact HTTPS `httpAllowedOrigins`; the full ordinary capability bundle contains public identity reads, non-management signing, and Host-controlled authenticated HTTP.
|
|
8
|
+
|
|
9
|
+
Load the optional `./management-remote` Host plugin and `./client` browser contribution through the DSH loader. The browser uses `settings.section` and `shell.overlay`; it never imports the native provider. `./remote` describes only manager queries and decisions, not signing or transport APIs.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// Host configuration, not a value supplied by an ordinary request.
|
|
13
|
+
{
|
|
14
|
+
allowConsumers: ['example-consumer', 'trusted-provider'],
|
|
15
|
+
userConsumers: ['example-consumer'],
|
|
16
|
+
allowProviderConsumers: ['trusted-provider'],
|
|
17
|
+
httpAllowedOrigins: { 'example-consumer': ['https://api.example.com'] },
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The Host resolves ordinary callers by the actual installed Cordis fiber and loader entry. Unknown, disabled and mismatched contexts fail closed. Normal user-mode proxies cannot acquire legacy or Provider leases by claiming a different allowed consumer string. Ordinary facades do not contain manager methods. This is cooperative same-process policy, not a sandbox.
|
|
22
|
+
|
|
23
|
+
**Unresolved security limitation (review F2):** the proxy check does not authenticate
|
|
24
|
+
the origin of a call made through `ctx.root.get('anpIdentity')`. Same-process plugins
|
|
25
|
+
can also reach the shared management Remote through the Host gateway. The approval
|
|
26
|
+
UI is therefore not an enforced isolation boundary against such plugins. Host-side
|
|
27
|
+
management-call authentication is explicitly outside this fix's scope; do not report
|
|
28
|
+
F2 as resolved or these changes as complete malicious-plugin isolation.
|
|
29
|
+
|
|
30
|
+
## Ordinary consumer flow
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { bindIdentityClient } from '@agent-network-protocol/dsh-anp-identity/user-client'
|
|
34
|
+
|
|
35
|
+
const identity = bindIdentityClient(ctx)
|
|
36
|
+
const creation = await identity.requestCreateIdentity({
|
|
37
|
+
requestId: 'stable-create-id',
|
|
38
|
+
purpose: 'Create the identity used by this integration',
|
|
39
|
+
parameters: { label: 'Work', handle: 'work.example', domain: 'example.com', path: '/agents/work' },
|
|
40
|
+
})
|
|
41
|
+
// Return immediately to the plugin's caller. Query this ID after notification.
|
|
42
|
+
const result = await identity.getCreateRequest(creation.id)
|
|
43
|
+
if (result.kind === 'create' && result.executionStatus === 'succeeded') {
|
|
44
|
+
const access = await identity.requestAccess({
|
|
45
|
+
requestId: 'stable-operation-id',
|
|
46
|
+
purpose: 'Read my remote profile',
|
|
47
|
+
identity: result.result!.reference,
|
|
48
|
+
operation: { action: 'http', request: new Request('https://api.example.com/profile') },
|
|
49
|
+
})
|
|
50
|
+
// After the user approves, query the authoritative request again.
|
|
51
|
+
const approved = await identity.getAccessRequest(access.id)
|
|
52
|
+
if (approved.kind === 'access' && approved.status === 'approved' && approved.grantId) {
|
|
53
|
+
const client = await identity.openAuthorizedIdentity(approved.grantId)
|
|
54
|
+
await client.authenticatedHttp.dispatch(new Request('https://api.example.com/profile'), 'execution-id')
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Creation and use are separate decisions. Creation does not grant use, publish a document, register a Handle, or disclose keys. The optional `parameters.handle` is supplied by the requesting plugin, normalized using the existing catalog rules, frozen with the other creation parameters, and displayed read-only for confirmation. Approval reserves and persists it through the existing create intent and local uniqueness checks, including crash reconciliation. Omission remains compatible with older plugins; existing identities are not backfilled. The saved Handle is local metadata, not proof of registration or ownership on an external service. A request's purpose is plugin-declared text, not verified business intent.
|
|
60
|
+
|
|
61
|
+
The ordinary HTTP API does **not** accept a consumer transport callback: the Host dispatches exactly one attempt with manual redirects, validates the fixed operation, signs internally, and does not return signed outbound headers. The confirmation summary explicitly marks a query-bearing URL without storing query names or values; the fingerprint still binds the full URL and body. Permanent mode leads with the persistent full-use scope rather than a single-operation summary. Legacy Host APIs keep their previous transport contract. Raw non-management signatures can still be used outside the website list, as stated in the confirmation UI.
|
|
62
|
+
|
|
63
|
+
## Persistence and revocation
|
|
64
|
+
|
|
65
|
+
- Once is the default user choice and binds one immutable operation. The Host fingerprints actual normalized bytes; a consumer cannot supply the fingerprint. The ledger atomically consumes once admission before execution. Multiple objects/processes cannot create extra admissions. Native-key/parameter preflight failures do not consume; admitted failures or uncertain results never refund. An execution ID is a status-query key, not a replay instruction.
|
|
66
|
+
- Once expires unused after five minutes. A permanent grant lasts until revoked, but each opened object lasts five minutes. Permanent execution uses the approved capability/purpose/Origin snapshot intersected with current Host policy. Upgrades do not expand approval.
|
|
67
|
+
- The manager must echo the displayed `reviewedSnapshot` on access approval. A changed Host policy rejects that decision and requires a refreshed review; it cannot silently broaden a pending confirmation after restart.
|
|
68
|
+
- Revocation requires a confirmation showing the plugin and identity before the versioned manager call. A cancelled dialog makes no mutation, and externally invalidated grants close a stale confirmation. Revocation is persisted and checked on every operation and before HTTP transport. In-flight operations may already have executed; neither revocation nor identity deletion logs out external servers.
|
|
69
|
+
- Creation results keep stable operation provenance and deletion tombstones. Uncertain creation is reconciled with the native journal, never blindly recreated. Concurrent creation/recovery uses the same native-create lock.
|
|
70
|
+
- Processed creation records provide a read-only result/reconciliation action, not another creation approval. Startup completes previously fenced deletion tombstones only after confirming absence from both the native Store and catalog. Ordinary requests wait for Provider readiness before taking an authorization transaction, avoiding a startup lock inversion.
|
|
71
|
+
- Denial/revocation suppresses automatic re-prompting even with changed request IDs or wording. The manager's explicit history re-request creates a new record. Disable/uninstall events cancel pending requests; a transient frontend disconnect or ordinary Host restart does not.
|
|
72
|
+
- Public JSON inspection never fetches a remote document. Deletion is forbidden while effective ordinary grants or legacy/Host associations remain; unknown old Provider ownership fails conservatively.
|
|
73
|
+
- Ordinary access uses the same conservative Host-association exclusion. It is enforced during request validation, approval, opening and execution, not just in the identity selector. The selector omits incompatible identities; the management inventory still shows them. User-created ordinary identities remain shareable across plugins through separate user grants.
|
|
74
|
+
- Native policy reads and deletion reconciliation run outside the shared authorization lock. Their ledger changes commit under a generation CAS; conflicts re-read and revalidate, and sustained contention fails closed with `authorization_conflict`. Host association changes advance the same epoch so stale ordinary snapshots cannot commit across them. The transaction callback must not perform external mutations because it may be retried.
|
|
75
|
+
- Deletion persists its fence before releasing the ledger lock for native I/O, then finalizes against fresh ledger state. A separate per-identity cross-process lock serializes duplicate delete executions. Uncertain failures retain the fence for reconciliation; unrelated ledger work is not blocked by native deletion. The short catalog preparation still runs under the shared ledger lock.
|
|
76
|
+
|
|
77
|
+
## Upgrade and rollback
|
|
78
|
+
|
|
79
|
+
Stop old writers before upgrade. The existing catalog file is migrated in-place to schema `anp-identity-catalog/2`, with a synced `.before-v2` backup and preserved legacy associations. Backup publication uses temp-file sync, atomic rename and directory sync before the live catalog upgrade. Under the catalog lock, a validated live v1 catalog repairs partial/mismatched backups left by an interrupted older writer; corrupt live catalogs and already-v2 catalogs never replace that backup. Legacy associations do not become user grants. A separate non-secret authorization ledger contains requests, snapshots, operation fingerprints and execution status, never signature payloads, HTTP bodies, private keys or login tokens.
|
|
80
|
+
|
|
81
|
+
Old processes cannot parse the v2 catalog; mixed-version writes are unsupported. Rollback requires coordinated stopped writers and restoration of matching catalog, authorization and native state, not deletion of just one metadata file. Do not use corrupt-catalog recovery to downgrade a newer schema.
|
|
82
|
+
|
|
83
|
+
## Verification
|
|
84
|
+
|
|
85
|
+
Run `npm run verify` after building the matching native Node binding. Tests cover real native Store creation/signatures, caller context, Host HTTP, restart and deletion, plus cross-process ledger contention and UI component/controller behavior. The native binding requires the declared compatible sibling ANP Rust dependency; an older unrelated checkout is not an equivalent build baseline.
|
|
86
|
+
|
|
87
|
+
DSH native-window, live ordinary-consumer product integration, and real-service checks must be reported separately. No publication, Handle registration, key lifecycle or recovery controls are added to this MVP.
|
|
88
|
+
# Local presentation integration
|
|
89
|
+
|
|
90
|
+
The optional `settings.nav.icon` contribution provides a contact-card glyph only for the settings menu. Identity list entries remain text-only. The shell owns that root-scoped list slot; ANP registers the glyph under `anp-identity`, matching its settings-section id. Older shells without the slot continue to render the page with their default navigation glyph. This presentation extension does not grant identity access or alter protocol behavior.
|
package/cordis.patch.yml
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
config:
|
|
9
9
|
stateRoot: !!js process.env.DSH_ANP_IDENTITY_STATE_ROOT
|
|
10
10
|
allowConsumers: !!js JSON.parse(process.env.DSH_ANP_IDENTITY_ALLOW_CONSUMERS ?? '["@awiki/dsh-plugin"]')
|
|
11
|
+
userConsumers: !!js JSON.parse(process.env.DSH_ANP_IDENTITY_USER_CONSUMERS ?? '[]')
|
|
11
12
|
allowProviderConsumers: !!js JSON.parse(process.env.DSH_ANP_IDENTITY_ALLOW_PROVIDER_CONSUMERS ?? '["@awiki/dsh-plugin"]')
|
|
12
13
|
httpAllowedOrigins: !!js JSON.parse(process.env.DSH_ANP_IDENTITY_HTTP_ALLOWED_ORIGINS ?? '{}')
|
|
13
14
|
recoveryOnOpen: true
|
|
@@ -19,3 +20,6 @@
|
|
|
19
20
|
rootKeyProvider: !!js process.env.DSH_ANP_IDENTITY_ROOT_KEY_PROVIDER ?? 'keyring'
|
|
20
21
|
rootKeyProviderId: !!js process.env.DSH_ANP_IDENTITY_ROOT_KEY_PROVIDER_ID ?? 'anp-identity/dsh'
|
|
21
22
|
keyringFallbackToLocalFile: false
|
|
23
|
+
|
|
24
|
+
- id: anp-identity-manager
|
|
25
|
+
name: '@agent-network-protocol/dsh-anp-identity/management-remote'
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { IdentityReference } from '@agent-network-protocol/anp-identity';
|
|
2
|
+
/** Only the Host may construct this from the installed plugin context. */
|
|
3
|
+
export interface VerifiedCaller {
|
|
4
|
+
readonly consumer: string;
|
|
5
|
+
readonly displayName: string;
|
|
6
|
+
}
|
|
7
|
+
export type OrdinaryCapability = 'identity:read' | 'identity:sign' | 'identity:http-auth';
|
|
8
|
+
export interface CapabilitySnapshot {
|
|
9
|
+
readonly version: string;
|
|
10
|
+
readonly capabilities: readonly OrdinaryCapability[];
|
|
11
|
+
readonly signingPurposes: readonly string[];
|
|
12
|
+
readonly httpOrigins: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
export type AuthorizationMode = 'once' | 'permanent';
|
|
15
|
+
export type RequestStatus = 'pending' | 'approved' | 'denied' | 'cancelled' | 'expired';
|
|
16
|
+
export interface ControlledOperation {
|
|
17
|
+
readonly capability: OrdinaryCapability;
|
|
18
|
+
readonly fingerprint: string;
|
|
19
|
+
/** Host-produced safe summary, never a signature payload or HTTP body. */
|
|
20
|
+
readonly summary: string;
|
|
21
|
+
readonly signingPurpose?: string;
|
|
22
|
+
readonly httpOrigin?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CreateParameters {
|
|
25
|
+
readonly label: string;
|
|
26
|
+
readonly domain: string;
|
|
27
|
+
readonly path: string;
|
|
28
|
+
readonly handle?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface CreateResult {
|
|
31
|
+
readonly reference: IdentityReference;
|
|
32
|
+
readonly label: string;
|
|
33
|
+
}
|
|
34
|
+
interface RequestBase {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly caller: VerifiedCaller;
|
|
37
|
+
readonly purpose: string;
|
|
38
|
+
readonly version: number;
|
|
39
|
+
readonly status: RequestStatus;
|
|
40
|
+
readonly createdAt: number;
|
|
41
|
+
readonly expiresAt: number;
|
|
42
|
+
readonly fingerprint: string;
|
|
43
|
+
readonly prompted: boolean;
|
|
44
|
+
readonly decidedAt?: number;
|
|
45
|
+
readonly retryOf?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface CreateAuthorizationRequest extends RequestBase {
|
|
48
|
+
readonly kind: 'create';
|
|
49
|
+
readonly parameters: CreateParameters;
|
|
50
|
+
readonly operationId?: string;
|
|
51
|
+
readonly executionStatus?: 'running' | 'succeeded' | 'unknown' | 'deleted';
|
|
52
|
+
readonly result?: CreateResult;
|
|
53
|
+
}
|
|
54
|
+
export interface AccessAuthorizationRequest extends RequestBase {
|
|
55
|
+
readonly kind: 'access';
|
|
56
|
+
readonly identity?: IdentityReference;
|
|
57
|
+
readonly operation?: ControlledOperation;
|
|
58
|
+
readonly mode?: AuthorizationMode;
|
|
59
|
+
readonly grantId?: string;
|
|
60
|
+
}
|
|
61
|
+
export type AuthorizationRequest = CreateAuthorizationRequest | AccessAuthorizationRequest;
|
|
62
|
+
export interface AuthorizationGrant {
|
|
63
|
+
readonly id: string;
|
|
64
|
+
readonly requestId: string;
|
|
65
|
+
readonly caller: VerifiedCaller;
|
|
66
|
+
readonly identity: IdentityReference;
|
|
67
|
+
readonly snapshot: CapabilitySnapshot;
|
|
68
|
+
readonly mode: AuthorizationMode;
|
|
69
|
+
readonly version: number;
|
|
70
|
+
readonly approvedAt: number;
|
|
71
|
+
readonly status: 'active' | 'consumed' | 'revoked' | 'expired';
|
|
72
|
+
readonly expiresAt?: number;
|
|
73
|
+
readonly operation?: ControlledOperation;
|
|
74
|
+
readonly executionId?: string;
|
|
75
|
+
readonly revokedAt?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface AuthorizedLease {
|
|
78
|
+
readonly grantId: string;
|
|
79
|
+
readonly consumer: string;
|
|
80
|
+
readonly identity: IdentityReference;
|
|
81
|
+
readonly grantVersion: number;
|
|
82
|
+
readonly expiresAt: number;
|
|
83
|
+
}
|
|
84
|
+
export interface AuthorizationExecution {
|
|
85
|
+
readonly id: string;
|
|
86
|
+
readonly grantId: string;
|
|
87
|
+
readonly consumer: string;
|
|
88
|
+
readonly fingerprint: string;
|
|
89
|
+
readonly admittedAt: number;
|
|
90
|
+
readonly grantVersion: number;
|
|
91
|
+
readonly operation: ControlledOperation;
|
|
92
|
+
readonly status: 'admitted' | 'succeeded' | 'failed' | 'unknown';
|
|
93
|
+
readonly finishedAt?: number;
|
|
94
|
+
}
|
|
95
|
+
export interface AuthorizationState {
|
|
96
|
+
readonly schema: 'anp-identity-authorization/1';
|
|
97
|
+
generation: number;
|
|
98
|
+
requests: AuthorizationRequest[];
|
|
99
|
+
grants: AuthorizationGrant[];
|
|
100
|
+
executions: AuthorizationExecution[];
|
|
101
|
+
deletedIdentities: IdentityReference[];
|
|
102
|
+
deletingIdentities: IdentityReference[];
|
|
103
|
+
suppressions: {
|
|
104
|
+
consumer: string;
|
|
105
|
+
kind: 'create' | 'access';
|
|
106
|
+
identity?: IdentityReference;
|
|
107
|
+
requestId: string;
|
|
108
|
+
}[];
|
|
109
|
+
}
|
|
110
|
+
export interface RequestCreateInput {
|
|
111
|
+
readonly requestId: string;
|
|
112
|
+
readonly purpose: string;
|
|
113
|
+
readonly parameters: CreateParameters;
|
|
114
|
+
}
|
|
115
|
+
export interface RequestAccessInput {
|
|
116
|
+
readonly requestId: string;
|
|
117
|
+
readonly purpose: string;
|
|
118
|
+
readonly identity?: IdentityReference;
|
|
119
|
+
readonly operation?: ControlledOperation;
|
|
120
|
+
}
|
|
121
|
+
export interface AuthorizationDecision {
|
|
122
|
+
readonly requestId: string;
|
|
123
|
+
readonly expectedVersion: number;
|
|
124
|
+
readonly decision: 'approve' | 'deny';
|
|
125
|
+
readonly identity?: IdentityReference;
|
|
126
|
+
readonly mode?: AuthorizationMode;
|
|
127
|
+
/** Exact scope shown for the selected identity; access approvals must echo it. */
|
|
128
|
+
readonly reviewedSnapshot?: CapabilitySnapshot;
|
|
129
|
+
}
|
|
130
|
+
export interface DeletionReconciliation {
|
|
131
|
+
/** Host-sourced durable catalog deletion fences, never arbitrary missing identities. */
|
|
132
|
+
readonly catalogFences: readonly IdentityReference[];
|
|
133
|
+
/** Must positively verify this exact reference is absent from both native storage and catalog. */
|
|
134
|
+
readonly isAbsent: (reference: IdentityReference) => Promise<boolean>;
|
|
135
|
+
}
|
|
136
|
+
export interface AuthorizationOptions {
|
|
137
|
+
readonly validateCaller: (caller: VerifiedCaller) => Promise<void>;
|
|
138
|
+
readonly resolveSnapshot: (caller: VerifiedCaller, identity: IdentityReference) => Promise<CapabilitySnapshot>;
|
|
139
|
+
/** Must use the native durable create journal and never implicitly grant use. */
|
|
140
|
+
readonly createIdentity: (operationId: string, caller: VerifiedCaller, parameters: CreateParameters) => Promise<CreateResult>;
|
|
141
|
+
/** Only recover an existing operation; undefined must not trigger creation. */
|
|
142
|
+
readonly reconcileCreation?: (operationId: string, caller: VerifiedCaller, parameters: CreateParameters) => Promise<CreateResult | undefined>;
|
|
143
|
+
readonly now?: () => number;
|
|
144
|
+
readonly requestTtlMs?: number;
|
|
145
|
+
readonly onceTtlMs?: number;
|
|
146
|
+
readonly leaseTtlMs?: number;
|
|
147
|
+
readonly fault?: (point: 'before_rename' | 'after_rename') => void;
|
|
148
|
+
}
|
|
149
|
+
export {};
|
|
150
|
+
//# sourceMappingURL=authorization-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-types.d.ts","sourceRoot":"","sources":["../src/authorization-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAE7E,0EAA0E;AAC1E,MAAM,WAAW,cAAc;IAAG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE;AAC3F,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,eAAe,GAAG,oBAAoB,CAAA;AACzF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,YAAY,EAAE,SAAS,kBAAkB,EAAE,CAAA;IACpD,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;CACxC;AACD,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,WAAW,CAAA;AACpD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAA;AACvF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAA;IACvC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,0EAA0E;IAC1E,QAAQ,C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;IAC/E,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,KAAK,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAAA;IAC7I,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,GAAG,cAAc,KAAK,IAAI,CAAA;CACnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-types.js","sourceRoot":"","sources":["../src/authorization-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { IdentityReference } from '@agent-network-protocol/anp-identity';
|
|
2
|
+
import type { AccessAuthorizationRequest, AuthorizationDecision, AuthorizationExecution, AuthorizationGrant, AuthorizationOptions, AuthorizationRequest, AuthorizedLease, ControlledOperation, CreateAuthorizationRequest, DeletionReconciliation, RequestAccessInput, RequestCreateInput, VerifiedCaller } from './authorization-types.js';
|
|
3
|
+
export * from './authorization-types.js';
|
|
4
|
+
export declare class AuthorizationError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
constructor(code: string);
|
|
7
|
+
}
|
|
8
|
+
/** Compute at the Host boundary from the actual immutable operation, not a plugin-provided digest. */
|
|
9
|
+
export declare function freezeOperation(descriptor: Omit<ControlledOperation, 'fingerprint'>, canonicalPayload: unknown): ControlledOperation;
|
|
10
|
+
/** Persistent non-secret authorization ledger. Caller authentication belongs to the Host. */
|
|
11
|
+
export declare class AuthorizationEngine {
|
|
12
|
+
#private;
|
|
13
|
+
readonly stateRoot: string;
|
|
14
|
+
readonly options: AuthorizationOptions;
|
|
15
|
+
readonly statePath: string;
|
|
16
|
+
constructor(stateRoot: string, options: AuthorizationOptions);
|
|
17
|
+
initialize(): Promise<void>;
|
|
18
|
+
subscribeRequestChanges(listener: () => void): () => void;
|
|
19
|
+
requestCreate(verifiedCaller: VerifiedCaller, input: RequestCreateInput): Promise<CreateAuthorizationRequest>;
|
|
20
|
+
requestAccess(verifiedCaller: VerifiedCaller, input: RequestAccessInput): Promise<AccessAuthorizationRequest>;
|
|
21
|
+
getRequest(verifiedCaller: VerifiedCaller, requestId: string): Promise<AuthorizationRequest>;
|
|
22
|
+
listRequests(): Promise<AuthorizationRequest[]>;
|
|
23
|
+
markPrompted(requestId: string, expectedVersion?: number): Promise<void>;
|
|
24
|
+
cancel(verifiedCaller: VerifiedCaller, requestId: string, expectedVersion: number): Promise<AuthorizationRequest>;
|
|
25
|
+
decide(input: AuthorizationDecision): Promise<AuthorizationRequest>;
|
|
26
|
+
reconcileCreation(requestId: string): Promise<CreateAuthorizationRequest>;
|
|
27
|
+
listGrants(identity?: IdentityReference): Promise<AuthorizationGrant[]>;
|
|
28
|
+
revoke(grantId: string, expectedVersion: number): Promise<AuthorizationGrant>;
|
|
29
|
+
/** Manager-only explicit user retry. The old request and decision remain immutable history. */
|
|
30
|
+
reauthorize(requestId: string, expectedVersion: number): Promise<AuthorizationRequest>;
|
|
31
|
+
/** Call only for an authoritative disable/uninstall, never for a transient connection loss. */
|
|
32
|
+
cancelPendingForConsumer(consumer: string): Promise<void>;
|
|
33
|
+
/** Host-only bridge for legacy catalog grants, serialized against deletion and ordinary approvals. */
|
|
34
|
+
withIdentityAccess<T>(identity: IdentityReference, callback: () => Promise<T>): Promise<T>;
|
|
35
|
+
open(verifiedCaller: VerifiedCaller, grantId: string): Promise<AuthorizedLease>;
|
|
36
|
+
admit(verifiedCaller: VerifiedCaller, lease: AuthorizedLease, requestedOperation: ControlledOperation, executionId: string): Promise<AuthorizationExecution>;
|
|
37
|
+
assertExecutionActive(verifiedCaller: VerifiedCaller, lease: AuthorizedLease, executionId: string): Promise<void>;
|
|
38
|
+
recordExecution(verifiedCaller: VerifiedCaller, executionId: string, status: 'succeeded' | 'failed' | 'unknown'): Promise<AuthorizationExecution>;
|
|
39
|
+
getExecution(verifiedCaller: VerifiedCaller, executionId: string): Promise<AuthorizationExecution>;
|
|
40
|
+
/** Prepare checks associations and may set the catalog deletion fence before native execution. */
|
|
41
|
+
withIdentityDeletion(identity: IdentityReference, prepare: () => Promise<void>, execute: () => Promise<void>): Promise<void>;
|
|
42
|
+
/** Host-only recovery of previously fenced deletions; absence alone never authorizes deletion. */
|
|
43
|
+
reconcileDeletions(input: DeletionReconciliation): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../src/authorization.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,KAAK,EACV,0BAA0B,EAAE,qBAAqB,EAAE,sBAAsB,EACzE,kBAAkB,EAAE,oBAAoB,EAAE,oBAAoB,EAC9D,eAAe,EAAsB,mBAAmB,EAAE,0BAA0B,EACpD,sBAAsB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,EAC/G,MAAM,0BAA0B,CAAA;AAEjC,cAAc,0BAA0B,CAAA;AAMxC,qBAAa,kBAAmB,SAAQ,KAAK;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;CAClC;AA0DD,sGAAsG;AACtG,wBAAgB,eAAe,CAC7B,UAAU,EAAE,IAAI,CAAC,mBAAmB,EAAE,aAAa,CAAC,EACpD,gBAAgB,EAAE,OAAO,GACxB,mBAAmB,CAErB;AAED,6FAA6F;AAC7F,qBAAa,mBAAmB;;IAKlB,QAAQ,CAAC,SAAS,EAAE,MAAM;IA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