@agent-network-protocol/anp-identity 0.2.0-dsh-test.20260831.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/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@agent-network-protocol/anp-identity",
3
+ "version": "0.2.0-dsh-test.20260831.1",
4
+ "description": "Secure E1 DID identity custody and lifecycle management for ANP",
5
+ "license": "Apache-2.0",
6
+ "publishConfig": {
7
+ "access": "public",
8
+ "registry": "https://registry.npmjs.org"
9
+ },
10
+ "main": "index.js",
11
+ "types": "index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./index.d.ts",
15
+ "require": "./index.js",
16
+ "default": "./index.js"
17
+ },
18
+ "./provider": {
19
+ "types": "./provider.d.ts",
20
+ "require": "./provider.js",
21
+ "default": "./provider.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "index.js",
26
+ "index.d.ts",
27
+ "provider.js",
28
+ "provider.d.ts",
29
+ "native.cjs",
30
+ "README.md",
31
+ "LICENSE",
32
+ "NOTICE.md",
33
+ "SOURCE.md",
34
+ "checksums.json",
35
+ "provenance.json",
36
+ "sbom.cdx.json"
37
+ ],
38
+ "scripts": {
39
+ "build": "napi build --platform --release && node scripts/wrap.mjs",
40
+ "build:debug": "napi build --platform && node scripts/wrap.mjs",
41
+ "build:all": "napi build --release && node scripts/wrap.mjs",
42
+ "test": "node scripts/wrap.mjs && node --test test/*.test.cjs && node scripts/check-dts.mjs"
43
+ },
44
+ "napi": {
45
+ "binaryName": "anp-identity",
46
+ "targets": [
47
+ "x86_64-unknown-linux-gnu",
48
+ "aarch64-unknown-linux-gnu",
49
+ "x86_64-apple-darwin",
50
+ "aarch64-apple-darwin",
51
+ "x86_64-pc-windows-msvc",
52
+ "aarch64-pc-windows-msvc"
53
+ ]
54
+ },
55
+ "optionalDependencies": {
56
+ "@agent-network-protocol/anp-identity-darwin-arm64": "0.2.0-dsh-test.20260831.1",
57
+ "@agent-network-protocol/anp-identity-darwin-x64": "0.2.0-dsh-test.20260831.1",
58
+ "@agent-network-protocol/anp-identity-linux-arm64-gnu": "0.2.0-dsh-test.20260831.1",
59
+ "@agent-network-protocol/anp-identity-linux-x64-gnu": "0.2.0-dsh-test.20260831.1",
60
+ "@agent-network-protocol/anp-identity-win32-x64-msvc": "0.2.0-dsh-test.20260831.1"
61
+ },
62
+ "devDependencies": {
63
+ "@napi-rs/cli": "3.8.6",
64
+ "@types/node": "^22.0.0"
65
+ },
66
+ "engines": {
67
+ "node": ">=18"
68
+ }
69
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "package": {
4
+ "name": "@agent-network-protocol/anp-identity",
5
+ "version": "0.2.0-dsh-test.20260831.1"
6
+ },
7
+ "target": "platform-independent-wrapper",
8
+ "source": {
9
+ "repository": "https://github.com/agent-network-protocol/anp-identity",
10
+ "commit": "0865b2a37171391217e2aed7bb8757567c7022b1",
11
+ "committedAt": "2026-08-30T23:53:23+08:00",
12
+ "dirty": false
13
+ },
14
+ "toolchain": {
15
+ "rustc": "rustc 1.94.1 (e408947bf 2026-03-25)",
16
+ "node": "v24.19.0"
17
+ },
18
+ "channel": "dsh-test"
19
+ }
package/provider.d.ts ADDED
@@ -0,0 +1,384 @@
1
+ import type {
2
+ CreateIdentityRequest,
3
+ DocumentChangeOutcome,
4
+ DocumentChangeRequest,
5
+ IdentityDescriptor,
6
+ IdentityTransitionOutcome,
7
+ IdentityTransitionPublicationAttempt,
8
+ IdentityTransitionPublicationResult,
9
+ IdentityTransitionRemoteObservation,
10
+ IdentityTransitionRequest,
11
+ IdentityManagerConfig,
12
+ IdentityReference,
13
+ JsonValue,
14
+ OriginProofRequest,
15
+ PreparedDocumentChange,
16
+ PreparedIdentityTransition,
17
+ PublicIdentity,
18
+ PublicationAttempt,
19
+ PublicationResult,
20
+ SignRequest,
21
+ Signature,
22
+ SignedOriginProof,
23
+ StoreInfo,
24
+ VerifiedRemoteDocument,
25
+ VerifiedPublicationEvidence,
26
+ VerifyRequest,
27
+ RecoveryReport,
28
+ } from './index'
29
+
30
+ export type ProviderCapability =
31
+ | 'IDENTITY_READ'
32
+ | 'IDENTITY_CREATE'
33
+ | 'IDENTITY_IMPORT'
34
+ | 'IDENTITY_SIGN'
35
+ | 'IDENTITY_ECDH_SEALED'
36
+ | 'IDENTITY_DOCUMENT_UPDATE'
37
+ | 'IDENTITY_KEY_LIFECYCLE'
38
+ | 'IDENTITY_DELETE'
39
+ | 'IDENTITY_HTTP_SIGNATURE'
40
+ | 'AWIKI_LEGACY_ROOT_TRANSFER_V1'
41
+
42
+ export interface ProviderLeaseRequest {
43
+ consumer: string
44
+ capabilities: ProviderCapability[]
45
+ ttlSeconds: number
46
+ }
47
+
48
+ export interface HttpHeader {
49
+ name: string
50
+ value: string
51
+ }
52
+
53
+ export interface ExactHttpSigningRequest {
54
+ identity: IdentityReference
55
+ kid?: string
56
+ url: string
57
+ method: string
58
+ headers: HttpHeader[]
59
+ body?: Buffer
60
+ nonce?: string
61
+ created?: number
62
+ expires?: number
63
+ coveredComponents?: string[]
64
+ }
65
+
66
+ export interface PreparedHttpSignatureAttempt {
67
+ bindingDigest: string
68
+ kid: string
69
+ headerPatch: HttpHeader[]
70
+ }
71
+
72
+ export interface IdentityHostStatus {
73
+ rootCapability: 'absent' | 'pending' | 'active'
74
+ rootKeyFingerprint: string
75
+ checkpoint?: HostDocumentCheckpoint
76
+ }
77
+
78
+ export interface HostDocumentCheckpoint {
79
+ documentVersion: number
80
+ registryVersion: number
81
+ documentDigest: string
82
+ }
83
+
84
+ export interface ObjectProofRequest {
85
+ kid?: string
86
+ document: JsonValue
87
+ issuerDid: string
88
+ created?: string
89
+ }
90
+
91
+ export interface DocumentProofRequest {
92
+ kid?: string
93
+ document: JsonValue
94
+ options?: {
95
+ proofPurpose?: string
96
+ proofType?: string
97
+ cryptosuite?: string
98
+ created?: string
99
+ domain?: string
100
+ challenge?: string
101
+ }
102
+ }
103
+
104
+ export interface LegacyDidWbaRequest {
105
+ kid?: string
106
+ serviceDomain: string
107
+ version: string
108
+ }
109
+
110
+ export interface SealedSecretEnvelope {
111
+ protocol: 'anp-sealed-secret/1'
112
+ suite: 'hpke-base-x25519-hkdf-sha256-chacha20poly1305-v1'
113
+ encappedKey: string
114
+ ciphertext: string
115
+ }
116
+
117
+ export interface SealedSecretDelivery {
118
+ envelope: SealedSecretEnvelope
119
+ authorization: AuthorizationContext
120
+ aad: string
121
+ }
122
+
123
+ export interface SealedKeyAgreementRequest {
124
+ identity: IdentityReference
125
+ kid: string
126
+ peerPublic: Buffer
127
+ recipientPublicKey: Buffer
128
+ requestId: string
129
+ }
130
+
131
+ export interface SealedRootExportRequest {
132
+ identity: IdentityReference
133
+ kid: string
134
+ recipientPublicKey: Buffer
135
+ requestId: string
136
+ userPresenceConfirmed: boolean
137
+ }
138
+
139
+ export interface AuthorizationContext {
140
+ providerInstanceId: string
141
+ parentLeaseId: string
142
+ consumer: string
143
+ capability: ProviderCapability
144
+ storeId: string
145
+ expiresAt: number
146
+ }
147
+
148
+ export interface SealedImportOffer {
149
+ recipientPublicKey: Buffer
150
+ requestId: string
151
+ token: string
152
+ authorization: AuthorizationContext
153
+ aad: string
154
+ }
155
+
156
+ export interface LegacyRootImportEvidence {
157
+ transferId: string
158
+ sourceDid: string
159
+ targetDid: string
160
+ senderDeviceId: string
161
+ recipientDeviceId: string
162
+ recipientAgreementKid: string
163
+ rootKid: string
164
+ checkpoint: {
165
+ documentVersion: number
166
+ registryVersion: number
167
+ documentDigest: string
168
+ }
169
+ acceptedAt: string
170
+ }
171
+
172
+ export interface SealedRootImportPreparation {
173
+ identity: IdentityReference
174
+ evidence: LegacyRootImportEvidence
175
+ encoding: 'raw32' | 'pkcs8_der'
176
+ requestId: string
177
+ }
178
+
179
+ export type MigrationKeyPurpose =
180
+ | 'root_control'
181
+ | 'authentication'
182
+ | 'device_assertion'
183
+ | 'application_assertion'
184
+ | 'key_agreement'
185
+
186
+ export interface SealedIdentityMaterialKeySpec {
187
+ kid: string
188
+ purpose: MigrationKeyPurpose
189
+ encoding: 'raw32' | 'pkcs8_der'
190
+ }
191
+
192
+ export interface SealedIdentityImportPreparation {
193
+ remote: {
194
+ document: unknown
195
+ evidence: VerifiedPublicationEvidence
196
+ }
197
+ didWba: boolean
198
+ keys: SealedIdentityMaterialKeySpec[]
199
+ requestId: string
200
+ }
201
+
202
+ export interface SealedIdentityMaterialImportOffer extends SealedImportOffer {
203
+ target: IdentityReference
204
+ itemAad: string[]
205
+ }
206
+
207
+ export interface DeviceEnrollmentRequest {
208
+ remote: VerifiedRemoteDocument
209
+ deviceId: string
210
+ deviceSigningFragment: string
211
+ deviceAgreementFragment: string
212
+ profiles?: string[]
213
+ capabilities?: { didWba?: boolean }
214
+ }
215
+
216
+ export interface RequestSigningEnrollmentRequest {
217
+ remote: VerifiedRemoteDocument
218
+ fragment: string
219
+ capabilities?: { didWba?: boolean }
220
+ }
221
+
222
+ export interface EnrollmentPublicKey {
223
+ kid: string
224
+ publicKeyMultibase: string
225
+ }
226
+
227
+ export type EnrollmentProposalKind =
228
+ | {
229
+ kind: 'device'
230
+ deviceId: string
231
+ signingKey: EnrollmentPublicKey
232
+ agreementKey: EnrollmentPublicKey
233
+ profiles: string[]
234
+ }
235
+ | { kind: 'request_signing'; signingKey: EnrollmentPublicKey }
236
+
237
+ export interface EnrollmentProposal {
238
+ enrollmentId: string
239
+ identity: IdentityReference
240
+ kind: EnrollmentProposalKind
241
+ rootKeyFingerprint: string
242
+ checkpoint: HostDocumentCheckpoint
243
+ }
244
+
245
+ export interface SealedEnrollmentKeyAgreementRequest {
246
+ peerPublic: Buffer
247
+ recipientPublicKey: Buffer
248
+ requestId: string
249
+ }
250
+
251
+ export interface RootTransferContext {
252
+ sourceDid: string
253
+ targetDid: string
254
+ senderDeviceId: string
255
+ recipientDeviceId: string
256
+ recipientAgreementKid: string
257
+ rootKid: string
258
+ checkpoint: HostDocumentCheckpoint
259
+ createdAt: string
260
+ expiresAt: string
261
+ }
262
+
263
+ export interface WrappedRootEnvelope {
264
+ type: 'anp.identity.root-transfer.wrapped'
265
+ version: 1
266
+ context: RootTransferContext
267
+ ephemeralPublic: string
268
+ nonce: string
269
+ ciphertext: string
270
+ signature: string
271
+ }
272
+
273
+ export interface RootPromotionRequest {
274
+ remote: VerifiedRemoteDocument
275
+ }
276
+
277
+ export class IdentityProvider {
278
+ private constructor()
279
+ static initialize(config: IdentityManagerConfig): Promise<IdentityProvider>
280
+ static open(config: IdentityManagerConfig): Promise<IdentityProvider>
281
+ acquireLease(request: ProviderLeaseRequest): ProviderLease
282
+ }
283
+
284
+ export interface ProviderLease {
285
+ dispose(): void
286
+ info(): Promise<StoreInfo>
287
+ recover(): Promise<RecoveryReport>
288
+ list(): Promise<IdentityDescriptor[]>
289
+ publicIdentity(reference: IdentityReference): Promise<PublicIdentity>
290
+ hostStatus(reference: IdentityReference): Promise<IdentityHostStatus>
291
+ recoverIdentity(reference: IdentityReference): Promise<void>
292
+ create(request: CreateIdentityRequest): Promise<PublicIdentity>
293
+ delete(reference: IdentityReference): Promise<void>
294
+ sign(reference: IdentityReference, request: SignRequest): Promise<Signature>
295
+ verify(reference: IdentityReference, request: VerifyRequest): Promise<'valid' | 'invalid'>
296
+ signOriginProof(
297
+ reference: IdentityReference,
298
+ request: OriginProofRequest,
299
+ ): Promise<SignedOriginProof>
300
+ signObjectProof(reference: IdentityReference, request: ObjectProofRequest): Promise<JsonValue>
301
+ signDocumentProof(reference: IdentityReference, request: DocumentProofRequest): Promise<JsonValue>
302
+ prepareHttpSignature(request: ExactHttpSigningRequest): Promise<PreparedHttpSignatureAttempt>
303
+ prepareLegacyDidWba(reference: IdentityReference, request: LegacyDidWbaRequest): Promise<string>
304
+ prepareDocumentChange(
305
+ reference: IdentityReference,
306
+ request: DocumentChangeRequest,
307
+ ): Promise<ProviderDocumentChangeSession>
308
+ resumeDocumentChange(
309
+ reference: IdentityReference,
310
+ ): Promise<ProviderDocumentChangeSession | undefined>
311
+ prepareIdentityTransition(
312
+ request: IdentityTransitionRequest,
313
+ ): Promise<ProviderIdentityTransitionSession>
314
+ resumeIdentityTransition(
315
+ expectedCurrentDid: string,
316
+ ): Promise<ProviderIdentityTransitionSession | undefined>
317
+ adoptVerifiedDocument(
318
+ reference: IdentityReference,
319
+ remote: VerifiedRemoteDocument,
320
+ ): Promise<'activated' | 'updated' | 'unchanged' | 'revoked'>
321
+ beginDeviceEnrollment(request: DeviceEnrollmentRequest): Promise<ProviderEnrollmentSession>
322
+ beginRequestSigningEnrollment(
323
+ request: RequestSigningEnrollmentRequest,
324
+ ): Promise<ProviderEnrollmentSession>
325
+ resumeEnrollment(reference: IdentityReference): Promise<ProviderEnrollmentSession | undefined>
326
+ importWrappedRoot(
327
+ reference: IdentityReference,
328
+ envelope: WrappedRootEnvelope,
329
+ ): Promise<'pending' | 'active'>
330
+ confirmRootPromotion(reference: IdentityReference, request: RootPromotionRequest): Promise<void>
331
+ signPendingRootObjectProof(
332
+ reference: IdentityReference,
333
+ request: ObjectProofRequest,
334
+ ): Promise<JsonValue>
335
+ ecdhSealed(request: SealedKeyAgreementRequest): Promise<SealedSecretDelivery>
336
+ exportRootKeySealed(request: SealedRootExportRequest): Promise<SealedSecretDelivery>
337
+ prepareLegacyRootImport(request: SealedRootImportPreparation): Promise<PreparedRootImport>
338
+ prepareIdentityMaterialImport(
339
+ request: SealedIdentityImportPreparation,
340
+ ): Promise<PreparedIdentityMaterialImport>
341
+ }
342
+
343
+ export interface ProviderDocumentChangeSession {
344
+ candidate(): Promise<PreparedDocumentChange>
345
+ hostPhase(): Promise<'prepared' | 'publication_in_flight' | 'publication_uncertain' | 'published'>
346
+ beginPublication(): Promise<PublicationAttempt>
347
+ complete(
348
+ attempt: PublicationAttempt,
349
+ result: PublicationResult,
350
+ ): Promise<DocumentChangeOutcome>
351
+ reconcile(observation: VerifiedRemoteDocument): Promise<DocumentChangeOutcome>
352
+ }
353
+
354
+ export interface ProviderIdentityTransitionSession {
355
+ candidate(): Promise<PreparedIdentityTransition>
356
+ beginPublication(): Promise<IdentityTransitionPublicationAttempt>
357
+ complete(
358
+ attempt: IdentityTransitionPublicationAttempt,
359
+ result: IdentityTransitionPublicationResult,
360
+ ): Promise<IdentityTransitionOutcome>
361
+ reconcile(
362
+ observation: IdentityTransitionRemoteObservation,
363
+ ): Promise<IdentityTransitionOutcome>
364
+ }
365
+
366
+ export interface ProviderEnrollmentSession {
367
+ proposal(): Promise<EnrollmentProposal>
368
+ signDeviceAssertion(payload: Buffer): Promise<Buffer>
369
+ deriveDeviceSharedSecretSealed(
370
+ request: SealedEnrollmentKeyAgreementRequest,
371
+ ): Promise<SealedSecretDelivery>
372
+ activate(remote: VerifiedRemoteDocument): Promise<'activated'>
373
+ cancel(): Promise<void>
374
+ }
375
+
376
+ export interface PreparedRootImport {
377
+ offer(): SealedImportOffer
378
+ complete(token: string, envelope: SealedSecretEnvelope): Promise<'pending' | 'active'>
379
+ }
380
+
381
+ export interface PreparedIdentityMaterialImport {
382
+ offer(): SealedIdentityMaterialImportOffer
383
+ complete(token: string, envelopes: SealedSecretEnvelope[]): Promise<PublicIdentity>
384
+ }