@aep-foundation/platform 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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +131 -0
- package/dist/index.cjs +849 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +432 -0
- package/dist/index.d.ts +432 -0
- package/dist/index.js +810 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @aep-foundation/platform
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1](https://github.com/aep-foundation/aep-node/pull/1) [`3d4713e`](https://github.com/aep-foundation/aep-node/commit/3d4713e2a9cf85478a415192c7c0abc90c374073) Thanks [@nkavian](https://github.com/nkavian)! - Add the initial AEP Node SDK packages, framework adapters, and conformance helpers.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`3d4713e`](https://github.com/aep-foundation/aep-node/commit/3d4713e2a9cf85478a415192c7c0abc90c374073)]:
|
|
12
|
+
- @aep-foundation/core@0.1.0
|
|
13
|
+
|
|
14
|
+
## 0.0.0
|
|
15
|
+
|
|
16
|
+
Initial development version.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AEP Foundation
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# @aep-foundation/platform
|
|
2
|
+
|
|
3
|
+
Platform-side helpers for managed Agent identity support.
|
|
4
|
+
|
|
5
|
+
For production storage, authorization, replay, and key-custody guidance, see
|
|
6
|
+
the repository [Integration Guide](../../INTEGRATION.md).
|
|
7
|
+
|
|
8
|
+
Current helpers cover the AEP Platform Hosted Identity Profile:
|
|
9
|
+
|
|
10
|
+
- create a Platform engine with pluggable persistence, key custody, replay
|
|
11
|
+
storage, authorization, lifecycle policy, and Service DID resolution
|
|
12
|
+
- build Platform discovery documents
|
|
13
|
+
- build Platform provisioning request and response bodies
|
|
14
|
+
- build Service-scoped Agent DIDs
|
|
15
|
+
- create managed Agent identity records
|
|
16
|
+
- store managed identities in an in-memory registry for tests and prototypes
|
|
17
|
+
- build platform-mediated Enroll request bodies
|
|
18
|
+
- build baseline AEP client assertion claims for delegated signing flows
|
|
19
|
+
- build managed Agent DID documents
|
|
20
|
+
- publish DID documents through caller-provided publishers
|
|
21
|
+
- sign delegated client assertions with `jose`-backed JWT keys
|
|
22
|
+
- verify hosted client assertions without requiring Services to resolve
|
|
23
|
+
Platform-managed Agent DID documents
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { createAepPlatform } from "@aep-foundation/platform";
|
|
29
|
+
|
|
30
|
+
const platform = createAepPlatform({
|
|
31
|
+
didHost: "platform.example.com",
|
|
32
|
+
didUrlTemplate: "https://platform.example.com/agents/{agent_did_id}/did.json",
|
|
33
|
+
discovery: {
|
|
34
|
+
endpointBase: "/v1/aep",
|
|
35
|
+
endpoints: {
|
|
36
|
+
hostedVerification: "/v1/aep/verifications",
|
|
37
|
+
lifecycle: "/v1/aep/agent-identities/{agent_identity_id}",
|
|
38
|
+
list: "/v1/aep/agent-identities",
|
|
39
|
+
provision: "/v1/aep/agent-identities",
|
|
40
|
+
sign: "/v1/aep/agent-identities/{agent_identity_id}/sign"
|
|
41
|
+
},
|
|
42
|
+
hostedVerification: true,
|
|
43
|
+
platformDid: "did:web:platform.example.com",
|
|
44
|
+
platformName: "Example Platform"
|
|
45
|
+
},
|
|
46
|
+
idGenerator: () => crypto.randomUUID().replaceAll("-", ""),
|
|
47
|
+
idempotencyStore,
|
|
48
|
+
identityStore,
|
|
49
|
+
keyStore,
|
|
50
|
+
replayStore,
|
|
51
|
+
serviceDidResolver,
|
|
52
|
+
signingAlgorithms: ["ES256"]
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const discovery = platform.discovery();
|
|
56
|
+
const provision = await platform.provision(
|
|
57
|
+
{
|
|
58
|
+
idempotency_key: "01J0AEPPLATFORM000000000001",
|
|
59
|
+
service_did: "did:web:api.service.example"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
authorization: "Bearer platform-api-token"
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const assertion = await platform.sign(
|
|
67
|
+
provision.body.agent_identity_id,
|
|
68
|
+
{
|
|
69
|
+
jti: crypto.randomUUID(),
|
|
70
|
+
lifetime_seconds: "300",
|
|
71
|
+
op: "enroll",
|
|
72
|
+
service_did: provision.body.service_did
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
authorization: "Bearer platform-api-token"
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const verification = await platform.verify({
|
|
80
|
+
client_assertion: assertion.body.client_assertion,
|
|
81
|
+
op: "enroll",
|
|
82
|
+
service_did: provision.body.service_did
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
console.log(discovery.body, provision.body, assertion.body, verification.body);
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The package does not implement databases, caches, HTTP routing, or key custody.
|
|
89
|
+
Callers provide those through `PlatformIdentityStore`,
|
|
90
|
+
`PlatformProvisionIdempotencyStore`, `PlatformReplayStore`, `PlatformKeyStore`,
|
|
91
|
+
`PlatformServiceDidResolver`, `PlatformAuthorizer`, and
|
|
92
|
+
`PlatformLifecyclePolicy`. The example Platform in this repository uses
|
|
93
|
+
in-memory implementations for those interfaces.
|
|
94
|
+
|
|
95
|
+
Low-level helpers remain available when an implementation needs to assemble
|
|
96
|
+
individual protocol objects:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import {
|
|
100
|
+
createManagedAgentDidDocument,
|
|
101
|
+
createManagedAgentIdentity,
|
|
102
|
+
createServiceScopedAgentDid
|
|
103
|
+
} from "@aep-foundation/platform";
|
|
104
|
+
|
|
105
|
+
const agentDid = createServiceScopedAgentDid({
|
|
106
|
+
agentDidId: "4Yf7p2xQd9",
|
|
107
|
+
host: "platform.example.com",
|
|
108
|
+
pathPrefix: "agents"
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const identity = createManagedAgentIdentity({
|
|
112
|
+
agentDid
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const didDocument = createManagedAgentDidDocument({
|
|
116
|
+
identity,
|
|
117
|
+
verificationMethods: [
|
|
118
|
+
{
|
|
119
|
+
id: identity.agentDid,
|
|
120
|
+
publicKeyJwk: {
|
|
121
|
+
crv: "P-256",
|
|
122
|
+
kty: "EC",
|
|
123
|
+
x: "...",
|
|
124
|
+
y: "..."
|
|
125
|
+
},
|
|
126
|
+
relationships: ["authentication", "assertionMethod", "capabilityInvocation"],
|
|
127
|
+
type: "JsonWebKey2020"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
```
|