@vess-id/ai-identity 0.0.1 → 0.0.3
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 +33 -12
- package/dist/index.d.mts +3004 -0
- package/dist/index.d.ts +3004 -0
- package/dist/index.js +267 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +262 -55
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -10
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @vess-id/ai-identity
|
|
2
2
|
|
|
3
3
|
TypeScript SDK for AI Identity Layer - Secure delegation system for AI agents accessing external services.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @
|
|
8
|
+
npm install @vess-id/ai-identity
|
|
9
9
|
# or
|
|
10
|
-
pnpm add @
|
|
10
|
+
pnpm add @vess-id/ai-identity
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Quick Start
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
import { AIdentityClient } from '@
|
|
16
|
+
import { AIdentityClient } from '@vess-id/ai-identity'
|
|
17
17
|
|
|
18
18
|
// Initialize client
|
|
19
19
|
const client = new AIdentityClient({
|
|
20
20
|
proxyApi: {
|
|
21
|
-
baseUrl: 'http://localhost:3000' // Your Identity API endpoint
|
|
22
|
-
}
|
|
21
|
+
baseUrl: 'http://localhost:3000', // Your Identity API endpoint
|
|
22
|
+
},
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
// Create agent
|
|
@@ -29,30 +29,40 @@ const agent = await client.setup()
|
|
|
29
29
|
const vc = await client.issueToolPermission('slack', 'postMessage', {
|
|
30
30
|
subjectDid: agent.did,
|
|
31
31
|
resourceScope: { channel: 'C123456' },
|
|
32
|
-
expiresIn: '1h'
|
|
32
|
+
expiresIn: '1h',
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
// Use the permission
|
|
36
|
-
const result = await client.invokeTool(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
const result = await client.invokeTool(
|
|
37
|
+
'slack',
|
|
38
|
+
'postMessage',
|
|
39
|
+
{
|
|
40
|
+
channel: 'C123456',
|
|
41
|
+
text: 'Hello from AI Agent!',
|
|
42
|
+
},
|
|
43
|
+
[vc]
|
|
44
|
+
)
|
|
40
45
|
```
|
|
41
46
|
|
|
42
47
|
## Core Concepts
|
|
43
48
|
|
|
44
49
|
### Agents
|
|
50
|
+
|
|
45
51
|
Agents are autonomous entities with their own DID (Decentralized Identifier). Each agent has:
|
|
52
|
+
|
|
46
53
|
- A unique `did:jwk` identifier
|
|
47
54
|
- Public/private key pair for signing
|
|
48
55
|
- Local encrypted key storage
|
|
49
56
|
|
|
50
57
|
### Verifiable Credentials (VCs)
|
|
58
|
+
|
|
51
59
|
VCs represent permissions or capabilities:
|
|
60
|
+
|
|
52
61
|
- **ToolPermissionVC**: Permission to use a specific tool/action
|
|
53
62
|
- **DataAccessVC**: Permission to access data resources
|
|
54
63
|
|
|
55
64
|
### Verifiable Presentations (VPs)
|
|
65
|
+
|
|
56
66
|
VPs are signed presentations of VCs that agents use to prove their permissions when accessing services.
|
|
57
67
|
|
|
58
68
|
## API Reference
|
|
@@ -60,6 +70,7 @@ VPs are signed presentations of VCs that agents use to prove their permissions w
|
|
|
60
70
|
### AIdentityClient
|
|
61
71
|
|
|
62
72
|
#### Constructor
|
|
73
|
+
|
|
63
74
|
```typescript
|
|
64
75
|
new AIdentityClient(config?: AIdentityConfig, password?: string)
|
|
65
76
|
```
|
|
@@ -67,41 +78,51 @@ new AIdentityClient(config?: AIdentityConfig, password?: string)
|
|
|
67
78
|
#### Methods
|
|
68
79
|
|
|
69
80
|
##### `setup(did?: string): Promise<Agent>`
|
|
81
|
+
|
|
70
82
|
Create or load an agent.
|
|
71
83
|
|
|
72
84
|
##### `issueToolPermission(tool, action, options): Promise<string>`
|
|
85
|
+
|
|
73
86
|
Issue a VC for tool permission.
|
|
74
87
|
|
|
75
88
|
##### `issueDataAccess(resource, actions, options): Promise<string>`
|
|
89
|
+
|
|
76
90
|
Issue a VC for data access.
|
|
77
91
|
|
|
78
92
|
##### `invokeTool<T>(tool, action, params, vcs): Promise<ConnectorResponse<T>>`
|
|
93
|
+
|
|
79
94
|
Invoke a tool with VC authorization.
|
|
80
95
|
|
|
81
96
|
##### `writeMemory(content, namespace, vcs, metadata?)`
|
|
97
|
+
|
|
82
98
|
Write to memory with VC authorization.
|
|
83
99
|
|
|
84
100
|
##### `queryMemory(query, vcs, options?)`
|
|
101
|
+
|
|
85
102
|
Query memory with VC authorization.
|
|
86
103
|
|
|
87
104
|
### Supported Tools
|
|
88
105
|
|
|
89
106
|
#### Slack
|
|
107
|
+
|
|
90
108
|
- `postMessage`: Post messages to channels
|
|
91
109
|
- `getChannels`: List available channels
|
|
92
110
|
- `getUserInfo`: Get user information
|
|
93
111
|
|
|
94
112
|
#### GitHub
|
|
113
|
+
|
|
95
114
|
- `createIssue`: Create repository issues
|
|
96
115
|
- `listIssues`: List repository issues
|
|
97
116
|
- `getRepo`: Get repository information
|
|
98
117
|
|
|
99
118
|
#### Gmail
|
|
119
|
+
|
|
100
120
|
- `readMail`: Read email messages
|
|
101
121
|
- `listMails`: List email messages
|
|
102
122
|
- `getLabels`: Get available labels
|
|
103
123
|
|
|
104
124
|
#### Google Drive
|
|
125
|
+
|
|
105
126
|
- `readFile`: Read file content
|
|
106
127
|
- `listFiles`: List files in folder
|
|
107
128
|
- `getFolders`: List folders
|
|
@@ -150,4 +171,4 @@ See the `examples/` directory for complete usage examples:
|
|
|
150
171
|
|
|
151
172
|
## License
|
|
152
173
|
|
|
153
|
-
MIT
|
|
174
|
+
MIT
|