@id-wispera/core 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/README.md +268 -0
- package/dist/audit.d.ts +68 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +252 -0
- package/dist/audit.js.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +8 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/keychainProvider.d.ts +40 -0
- package/dist/auth/keychainProvider.d.ts.map +1 -0
- package/dist/auth/keychainProvider.js +98 -0
- package/dist/auth/keychainProvider.js.map +1 -0
- package/dist/auth/passphraseProvider.d.ts +80 -0
- package/dist/auth/passphraseProvider.d.ts.map +1 -0
- package/dist/auth/passphraseProvider.js +188 -0
- package/dist/auth/passphraseProvider.js.map +1 -0
- package/dist/auth/sessionTokenManager.d.ts +106 -0
- package/dist/auth/sessionTokenManager.d.ts.map +1 -0
- package/dist/auth/sessionTokenManager.js +263 -0
- package/dist/auth/sessionTokenManager.js.map +1 -0
- package/dist/delegation.d.ts +81 -0
- package/dist/delegation.d.ts.map +1 -0
- package/dist/delegation.js +299 -0
- package/dist/delegation.js.map +1 -0
- package/dist/detection.d.ts +35 -0
- package/dist/detection.d.ts.map +1 -0
- package/dist/detection.js +474 -0
- package/dist/detection.js.map +1 -0
- package/dist/exec/execManager.d.ts +60 -0
- package/dist/exec/execManager.d.ts.map +1 -0
- package/dist/exec/execManager.js +226 -0
- package/dist/exec/execManager.js.map +1 -0
- package/dist/exec/index.d.ts +6 -0
- package/dist/exec/index.d.ts.map +1 -0
- package/dist/exec/index.js +5 -0
- package/dist/exec/index.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +98 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/base.d.ts +64 -0
- package/dist/integrations/base.d.ts.map +1 -0
- package/dist/integrations/base.js +173 -0
- package/dist/integrations/base.js.map +1 -0
- package/dist/integrations/envMapping.d.ts +47 -0
- package/dist/integrations/envMapping.d.ts.map +1 -0
- package/dist/integrations/envMapping.js +174 -0
- package/dist/integrations/envMapping.js.map +1 -0
- package/dist/integrations/google-a2a.d.ts +48 -0
- package/dist/integrations/google-a2a.d.ts.map +1 -0
- package/dist/integrations/google-a2a.js +108 -0
- package/dist/integrations/google-a2a.js.map +1 -0
- package/dist/integrations/index.d.ts +14 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +14 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/integrations/langchain.d.ts +38 -0
- package/dist/integrations/langchain.d.ts.map +1 -0
- package/dist/integrations/langchain.js +45 -0
- package/dist/integrations/langchain.js.map +1 -0
- package/dist/integrations/openai-agents.d.ts +76 -0
- package/dist/integrations/openai-agents.d.ts.map +1 -0
- package/dist/integrations/openai-agents.js +95 -0
- package/dist/integrations/openai-agents.js.map +1 -0
- package/dist/integrations/slack.d.ts +59 -0
- package/dist/integrations/slack.d.ts.map +1 -0
- package/dist/integrations/slack.js +113 -0
- package/dist/integrations/slack.js.map +1 -0
- package/dist/integrations/types.d.ts +107 -0
- package/dist/integrations/types.d.ts.map +1 -0
- package/dist/integrations/types.js +6 -0
- package/dist/integrations/types.js.map +1 -0
- package/dist/locations.d.ts +157 -0
- package/dist/locations.d.ts.map +1 -0
- package/dist/locations.js +733 -0
- package/dist/locations.js.map +1 -0
- package/dist/passport.d.ts +70 -0
- package/dist/passport.d.ts.map +1 -0
- package/dist/passport.js +429 -0
- package/dist/passport.js.map +1 -0
- package/dist/policy.d.ts +80 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +392 -0
- package/dist/policy.js.map +1 -0
- package/dist/providers/openclaw.d.ts +80 -0
- package/dist/providers/openclaw.d.ts.map +1 -0
- package/dist/providers/openclaw.js +712 -0
- package/dist/providers/openclaw.js.map +1 -0
- package/dist/provisioning/adminPassport.d.ts +51 -0
- package/dist/provisioning/adminPassport.d.ts.map +1 -0
- package/dist/provisioning/adminPassport.js +101 -0
- package/dist/provisioning/adminPassport.js.map +1 -0
- package/dist/provisioning/index.d.ts +81 -0
- package/dist/provisioning/index.d.ts.map +1 -0
- package/dist/provisioning/index.js +141 -0
- package/dist/provisioning/index.js.map +1 -0
- package/dist/provisioning/provider.d.ts +59 -0
- package/dist/provisioning/provider.d.ts.map +1 -0
- package/dist/provisioning/provider.js +52 -0
- package/dist/provisioning/provider.js.map +1 -0
- package/dist/provisioning/providers/anthropic.d.ts +32 -0
- package/dist/provisioning/providers/anthropic.d.ts.map +1 -0
- package/dist/provisioning/providers/anthropic.js +116 -0
- package/dist/provisioning/providers/anthropic.js.map +1 -0
- package/dist/provisioning/providers/aws.d.ts +29 -0
- package/dist/provisioning/providers/aws.d.ts.map +1 -0
- package/dist/provisioning/providers/aws.js +455 -0
- package/dist/provisioning/providers/aws.js.map +1 -0
- package/dist/provisioning/providers/azure-entra.d.ts +32 -0
- package/dist/provisioning/providers/azure-entra.d.ts.map +1 -0
- package/dist/provisioning/providers/azure-entra.js +312 -0
- package/dist/provisioning/providers/azure-entra.js.map +1 -0
- package/dist/provisioning/providers/github.d.ts +24 -0
- package/dist/provisioning/providers/github.d.ts.map +1 -0
- package/dist/provisioning/providers/github.js +219 -0
- package/dist/provisioning/providers/github.js.map +1 -0
- package/dist/provisioning/providers/google-cloud.d.ts +34 -0
- package/dist/provisioning/providers/google-cloud.d.ts.map +1 -0
- package/dist/provisioning/providers/google-cloud.js +366 -0
- package/dist/provisioning/providers/google-cloud.js.map +1 -0
- package/dist/provisioning/providers/openai.d.ts +29 -0
- package/dist/provisioning/providers/openai.d.ts.map +1 -0
- package/dist/provisioning/providers/openai.js +263 -0
- package/dist/provisioning/providers/openai.js.map +1 -0
- package/dist/provisioning/providers/sendgrid.d.ts +27 -0
- package/dist/provisioning/providers/sendgrid.d.ts.map +1 -0
- package/dist/provisioning/providers/sendgrid.js +186 -0
- package/dist/provisioning/providers/sendgrid.js.map +1 -0
- package/dist/provisioning/providers/twilio.d.ts +27 -0
- package/dist/provisioning/providers/twilio.d.ts.map +1 -0
- package/dist/provisioning/providers/twilio.js +194 -0
- package/dist/provisioning/providers/twilio.js.map +1 -0
- package/dist/provisioning/types.d.ts +274 -0
- package/dist/provisioning/types.d.ts.map +1 -0
- package/dist/provisioning/types.js +6 -0
- package/dist/provisioning/types.js.map +1 -0
- package/dist/sharing.d.ts +60 -0
- package/dist/sharing.d.ts.map +1 -0
- package/dist/sharing.js +305 -0
- package/dist/sharing.js.map +1 -0
- package/dist/types.d.ts +396 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +88 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +45 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +110 -0
- package/dist/utils.js.map +1 -0
- package/dist/vault.d.ts +151 -0
- package/dist/vault.d.ts.map +1 -0
- package/dist/vault.js +499 -0
- package/dist/vault.js.map +1 -0
- package/package.json +117 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ID Wispera Core Types
|
|
3
|
+
* The passport/visa model for AI agent credential governance
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Visa types define the category of authorization a credential provides
|
|
7
|
+
*/
|
|
8
|
+
export type VisaType = 'access' | 'privilege' | 'data' | 'compliance' | 'ecosystem' | 'custom';
|
|
9
|
+
/**
|
|
10
|
+
* Human-readable descriptions for visa types
|
|
11
|
+
*/
|
|
12
|
+
export declare const VISA_TYPE_DESCRIPTIONS: Record<VisaType, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Types of credentials the system recognizes
|
|
15
|
+
*/
|
|
16
|
+
export type CredentialType = 'api-key' | 'oauth-token' | 'secret' | 'certificate' | 'mcp-credential' | 'jwt' | 'connection-string' | 'private-key' | 'session-keys' | 'bot-token' | 'custom';
|
|
17
|
+
/**
|
|
18
|
+
* Patterns and metadata for credential types
|
|
19
|
+
*/
|
|
20
|
+
export interface CredentialTypeInfo {
|
|
21
|
+
type: CredentialType;
|
|
22
|
+
name: string;
|
|
23
|
+
description: string;
|
|
24
|
+
patterns?: RegExp[];
|
|
25
|
+
redactPattern?: RegExp;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Supported platforms where credentials can be used
|
|
29
|
+
*/
|
|
30
|
+
export type Platform = 'mcp' | 'openai' | 'anthropic' | 'google-a2a' | 'langchain' | 'azure-ai' | 'aws' | 'crewai' | 'openclaw' | 'github' | 'slack' | 'custom';
|
|
31
|
+
/**
|
|
32
|
+
* Platform metadata
|
|
33
|
+
*/
|
|
34
|
+
export declare const PLATFORM_INFO: Record<Platform, {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Status of a passport in its lifecycle
|
|
40
|
+
*/
|
|
41
|
+
export type PassportStatus = 'active' | 'expiring' | 'expired' | 'revoked' | 'suspended';
|
|
42
|
+
/**
|
|
43
|
+
* Number of days before expiry to mark as "expiring"
|
|
44
|
+
*/
|
|
45
|
+
export declare const EXPIRING_THRESHOLD_DAYS = 14;
|
|
46
|
+
/**
|
|
47
|
+
* A single hop in the delegation chain
|
|
48
|
+
* Tracks how credentials flow from humans to agents and between agents
|
|
49
|
+
*/
|
|
50
|
+
export interface DelegationHop {
|
|
51
|
+
/** Entity name or ID that granted the delegation */
|
|
52
|
+
from: string;
|
|
53
|
+
/** Entity name or ID that received the delegation */
|
|
54
|
+
to: string;
|
|
55
|
+
/** When the delegation was granted (ISO 8601 datetime) */
|
|
56
|
+
grantedAt: string;
|
|
57
|
+
/** What scopes/permissions were delegated */
|
|
58
|
+
scope?: string[];
|
|
59
|
+
/** When this delegation expires (ISO 8601 datetime) */
|
|
60
|
+
expiresAt?: string;
|
|
61
|
+
/** Optional notes about the delegation */
|
|
62
|
+
notes?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The core Passport interface
|
|
66
|
+
* A passport wraps a credential with identity, authorization, and lifecycle management
|
|
67
|
+
*/
|
|
68
|
+
export interface Passport {
|
|
69
|
+
/** Unique identifier (UUID v4) */
|
|
70
|
+
id: string;
|
|
71
|
+
/** Schema version for forward compatibility */
|
|
72
|
+
version: number;
|
|
73
|
+
/** Human-readable name (e.g., "Salesforce Data Agent") */
|
|
74
|
+
name: string;
|
|
75
|
+
/** Optional machine identifier for the agent */
|
|
76
|
+
agentId?: string;
|
|
77
|
+
/** Type of credential this passport contains */
|
|
78
|
+
credentialType: CredentialType;
|
|
79
|
+
/** The actual credential value (encrypted at rest in vault) */
|
|
80
|
+
credentialValue: string;
|
|
81
|
+
/** Category of authorization */
|
|
82
|
+
visaType: VisaType;
|
|
83
|
+
/** Who issued this credential (e.g., "Okta", "Manual", "CyberArk") */
|
|
84
|
+
issuingAuthority: string;
|
|
85
|
+
/** What operations are permitted */
|
|
86
|
+
scope: string[];
|
|
87
|
+
/** Which platforms this credential is valid for */
|
|
88
|
+
platforms: Platform[];
|
|
89
|
+
/** Current status */
|
|
90
|
+
status: PassportStatus;
|
|
91
|
+
/** When the passport was issued (ISO 8601) */
|
|
92
|
+
issuedAt: string;
|
|
93
|
+
/** When the credential becomes valid (ISO 8601) */
|
|
94
|
+
validFrom: string;
|
|
95
|
+
/** When the credential expires (ISO 8601, undefined = no expiry) */
|
|
96
|
+
validUntil?: string;
|
|
97
|
+
/** When revoked (ISO 8601) */
|
|
98
|
+
revokedAt?: string;
|
|
99
|
+
/** Who revoked it */
|
|
100
|
+
revokedBy?: string;
|
|
101
|
+
/** Why it was revoked */
|
|
102
|
+
revokedReason?: string;
|
|
103
|
+
/** Chain of delegation from original issuer to current holder */
|
|
104
|
+
delegationChain?: DelegationHop[];
|
|
105
|
+
/** The human ultimately accountable for this credential */
|
|
106
|
+
humanOwner: string;
|
|
107
|
+
/** Tags for organization and filtering */
|
|
108
|
+
tags: string[];
|
|
109
|
+
/** Free-form notes */
|
|
110
|
+
notes?: string;
|
|
111
|
+
/** When this passport record was created (ISO 8601) */
|
|
112
|
+
createdAt: string;
|
|
113
|
+
/** When this passport record was last updated (ISO 8601) */
|
|
114
|
+
updatedAt: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Current passport schema version
|
|
118
|
+
*/
|
|
119
|
+
export declare const PASSPORT_SCHEMA_VERSION = 1;
|
|
120
|
+
/**
|
|
121
|
+
* Input for creating a new passport
|
|
122
|
+
*/
|
|
123
|
+
export interface CreatePassportInput {
|
|
124
|
+
name: string;
|
|
125
|
+
agentId?: string;
|
|
126
|
+
credentialType: CredentialType;
|
|
127
|
+
credentialValue: string;
|
|
128
|
+
visaType: VisaType;
|
|
129
|
+
issuingAuthority?: string;
|
|
130
|
+
scope: string[];
|
|
131
|
+
platforms: Platform[];
|
|
132
|
+
validFrom?: string;
|
|
133
|
+
validUntil?: string;
|
|
134
|
+
delegationChain?: DelegationHop[];
|
|
135
|
+
humanOwner: string;
|
|
136
|
+
tags?: string[];
|
|
137
|
+
notes?: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Filters for listing passports
|
|
141
|
+
*/
|
|
142
|
+
export interface PassportFilters {
|
|
143
|
+
status?: PassportStatus | PassportStatus[];
|
|
144
|
+
visaType?: VisaType | VisaType[];
|
|
145
|
+
platform?: Platform | Platform[];
|
|
146
|
+
credentialType?: CredentialType | CredentialType[];
|
|
147
|
+
humanOwner?: string;
|
|
148
|
+
tags?: string[];
|
|
149
|
+
search?: string;
|
|
150
|
+
isExpiring?: boolean;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Actions that can be logged in the audit trail
|
|
154
|
+
*/
|
|
155
|
+
export type AuditAction = 'created' | 'viewed' | 'shared' | 'modified' | 'revoked' | 'renewed' | 'accessed' | 'policy-checked' | 'detected' | 'exported' | 'imported';
|
|
156
|
+
/**
|
|
157
|
+
* A single audit log entry
|
|
158
|
+
*/
|
|
159
|
+
export interface AuditEntry {
|
|
160
|
+
/** Unique identifier for this entry */
|
|
161
|
+
id: string;
|
|
162
|
+
/** The passport this action relates to */
|
|
163
|
+
passportId: string;
|
|
164
|
+
/** What action was performed */
|
|
165
|
+
action: AuditAction;
|
|
166
|
+
/** Who performed the action (human or agent ID) */
|
|
167
|
+
actor: string;
|
|
168
|
+
/** When the action occurred (ISO 8601) */
|
|
169
|
+
timestamp: string;
|
|
170
|
+
/** Which platform the action occurred on */
|
|
171
|
+
platform?: Platform;
|
|
172
|
+
/** Human-readable description of the action */
|
|
173
|
+
details?: string;
|
|
174
|
+
/** Additional structured metadata */
|
|
175
|
+
metadata?: Record<string, unknown>;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Filters for querying audit logs
|
|
179
|
+
*/
|
|
180
|
+
export interface AuditFilters {
|
|
181
|
+
passportId?: string;
|
|
182
|
+
action?: AuditAction | AuditAction[];
|
|
183
|
+
actor?: string;
|
|
184
|
+
platform?: Platform;
|
|
185
|
+
startDate?: string;
|
|
186
|
+
endDate?: string;
|
|
187
|
+
limit?: number;
|
|
188
|
+
offset?: number;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Effect of a policy rule
|
|
192
|
+
*/
|
|
193
|
+
export type PolicyEffect = 'allow' | 'deny' | 'require-approval';
|
|
194
|
+
/**
|
|
195
|
+
* Conditions for policy evaluation
|
|
196
|
+
*/
|
|
197
|
+
export interface PolicyCondition {
|
|
198
|
+
/** Only apply to these visa types */
|
|
199
|
+
visaTypes?: VisaType[];
|
|
200
|
+
/** Only apply to these platforms */
|
|
201
|
+
platforms?: Platform[];
|
|
202
|
+
/** Only apply to these scopes */
|
|
203
|
+
scopes?: string[];
|
|
204
|
+
/** Maximum allowed delegation depth */
|
|
205
|
+
maxDelegationDepth?: number;
|
|
206
|
+
/** Require a human owner to be set */
|
|
207
|
+
requireHumanOwner?: boolean;
|
|
208
|
+
/** Maximum validity period in days */
|
|
209
|
+
maxValidityDays?: number;
|
|
210
|
+
/** Only apply to these credential types */
|
|
211
|
+
credentialTypes?: CredentialType[];
|
|
212
|
+
/** Only apply to passports with these tags */
|
|
213
|
+
tags?: string[];
|
|
214
|
+
/** Custom condition function (for advanced use) */
|
|
215
|
+
custom?: (passport: Passport) => boolean;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* A policy rule for credential governance
|
|
219
|
+
*/
|
|
220
|
+
export interface PolicyRule {
|
|
221
|
+
/** Unique identifier for this rule */
|
|
222
|
+
id: string;
|
|
223
|
+
/** Human-readable name */
|
|
224
|
+
name: string;
|
|
225
|
+
/** Description of what this rule enforces */
|
|
226
|
+
description: string;
|
|
227
|
+
/** Conditions that trigger this rule */
|
|
228
|
+
condition: PolicyCondition;
|
|
229
|
+
/** What happens when conditions are met */
|
|
230
|
+
effect: PolicyEffect;
|
|
231
|
+
/** Priority (higher = evaluated first) */
|
|
232
|
+
priority?: number;
|
|
233
|
+
/** Whether this rule is enabled */
|
|
234
|
+
enabled?: boolean;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Result of policy evaluation
|
|
238
|
+
*/
|
|
239
|
+
export interface PolicyDecision {
|
|
240
|
+
/** Whether the action is allowed */
|
|
241
|
+
allowed: boolean;
|
|
242
|
+
/** The effect that was applied */
|
|
243
|
+
effect: PolicyEffect;
|
|
244
|
+
/** Which rules matched */
|
|
245
|
+
matchedRules: PolicyRule[];
|
|
246
|
+
/** Human-readable explanation */
|
|
247
|
+
reason: string;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Result of validating a passport against rules
|
|
251
|
+
*/
|
|
252
|
+
export interface ValidationResult {
|
|
253
|
+
/** The rule that was violated */
|
|
254
|
+
rule: PolicyRule;
|
|
255
|
+
/** Description of the violation */
|
|
256
|
+
violation: string;
|
|
257
|
+
/** Severity: warning or error */
|
|
258
|
+
severity: 'warning' | 'error';
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Scope of what is shared
|
|
262
|
+
*/
|
|
263
|
+
export type ShareScope = 'full' | 'metadata-only' | 'read-only';
|
|
264
|
+
/**
|
|
265
|
+
* Options for creating a share link
|
|
266
|
+
*/
|
|
267
|
+
export interface ShareOptions {
|
|
268
|
+
/** What level of access to grant */
|
|
269
|
+
scope: ShareScope;
|
|
270
|
+
/** When the share expires (ISO 8601) */
|
|
271
|
+
expiresAt?: string;
|
|
272
|
+
/** Maximum number of times the share can be viewed */
|
|
273
|
+
maxViews?: number;
|
|
274
|
+
/** Require verification before viewing */
|
|
275
|
+
requireVerification?: boolean;
|
|
276
|
+
/** Who this is shared with (for audit) */
|
|
277
|
+
recipient?: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Encrypted share payload
|
|
281
|
+
*/
|
|
282
|
+
export interface SharePayload {
|
|
283
|
+
/** Version of the share format */
|
|
284
|
+
version: number;
|
|
285
|
+
/** Encrypted passport data */
|
|
286
|
+
encrypted: string;
|
|
287
|
+
/** Share options (not encrypted) */
|
|
288
|
+
options: ShareOptions;
|
|
289
|
+
/** When created (ISO 8601) */
|
|
290
|
+
createdAt: string;
|
|
291
|
+
/** ID of the original passport */
|
|
292
|
+
passportId: string;
|
|
293
|
+
/** Number of times viewed */
|
|
294
|
+
viewCount?: number;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Result of detecting a credential in text
|
|
298
|
+
*/
|
|
299
|
+
export interface DetectionResult {
|
|
300
|
+
/** Type of credential detected */
|
|
301
|
+
type: CredentialType;
|
|
302
|
+
/** The detected value (may be partial/masked) */
|
|
303
|
+
value: string;
|
|
304
|
+
/** Start position in the original text */
|
|
305
|
+
startIndex: number;
|
|
306
|
+
/** End position in the original text */
|
|
307
|
+
endIndex: number;
|
|
308
|
+
/** Confidence score (0-1) */
|
|
309
|
+
confidence: number;
|
|
310
|
+
/** Line number (1-indexed) */
|
|
311
|
+
line?: number;
|
|
312
|
+
/** Column number (1-indexed) */
|
|
313
|
+
column?: number;
|
|
314
|
+
/** The pattern that matched */
|
|
315
|
+
pattern?: string;
|
|
316
|
+
/** Context around the match */
|
|
317
|
+
context?: string;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Vault configuration
|
|
321
|
+
*/
|
|
322
|
+
export interface VaultConfig {
|
|
323
|
+
/** Path to vault storage (file system) */
|
|
324
|
+
storagePath?: string;
|
|
325
|
+
/** Storage backend type */
|
|
326
|
+
storageType: 'filesystem' | 'memory' | 'chrome-storage' | 'custom';
|
|
327
|
+
/** Key derivation iterations (for PBKDF2 fallback) */
|
|
328
|
+
keyDerivationIterations?: number;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Vault state (not persisted)
|
|
332
|
+
*/
|
|
333
|
+
export interface VaultState {
|
|
334
|
+
/** Whether the vault is unlocked */
|
|
335
|
+
isUnlocked: boolean;
|
|
336
|
+
/** Path to the vault */
|
|
337
|
+
path: string;
|
|
338
|
+
/** Number of passports in vault */
|
|
339
|
+
passportCount: number;
|
|
340
|
+
/** When the vault was created */
|
|
341
|
+
createdAt: string;
|
|
342
|
+
/** When the vault was last accessed */
|
|
343
|
+
lastAccessedAt: string;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Encrypted vault data structure (persisted)
|
|
347
|
+
*/
|
|
348
|
+
export interface VaultData {
|
|
349
|
+
/** Vault format version */
|
|
350
|
+
version: number;
|
|
351
|
+
/** Salt for key derivation */
|
|
352
|
+
salt: string;
|
|
353
|
+
/** IV for encryption */
|
|
354
|
+
iv: string;
|
|
355
|
+
/** Encrypted passports */
|
|
356
|
+
encryptedPassports: string;
|
|
357
|
+
/** Encrypted audit log */
|
|
358
|
+
encryptedAuditLog: string;
|
|
359
|
+
/** Vault metadata (not encrypted) */
|
|
360
|
+
metadata: {
|
|
361
|
+
createdAt: string;
|
|
362
|
+
updatedAt: string;
|
|
363
|
+
passportCount: number;
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Current vault data version
|
|
368
|
+
*/
|
|
369
|
+
export declare const VAULT_DATA_VERSION = 2;
|
|
370
|
+
/**
|
|
371
|
+
* Base error class for ID Wispera
|
|
372
|
+
*/
|
|
373
|
+
export declare class WisperaError extends Error {
|
|
374
|
+
code: string;
|
|
375
|
+
details?: Record<string, unknown> | undefined;
|
|
376
|
+
constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Vault-specific errors
|
|
380
|
+
*/
|
|
381
|
+
export declare class VaultError extends WisperaError {
|
|
382
|
+
constructor(message: string, code: string, details?: Record<string, unknown>);
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Passport-specific errors
|
|
386
|
+
*/
|
|
387
|
+
export declare class PassportError extends WisperaError {
|
|
388
|
+
constructor(message: string, code: string, details?: Record<string, unknown>);
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Policy-specific errors
|
|
392
|
+
*/
|
|
393
|
+
export declare class PolicyError extends WisperaError {
|
|
394
|
+
constructor(message: string, code: string, details?: Record<string, unknown>);
|
|
395
|
+
}
|
|
396
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE/F;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAO3D,CAAC;AAMF;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,aAAa,GACb,QAAQ,GACR,aAAa,GACb,gBAAgB,GAChB,KAAK,GACL,mBAAmB,GACnB,aAAa,GACb,cAAc,GACd,WAAW,GACX,QAA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+
/**
|
|
6
|
+
* Human-readable descriptions for visa types
|
|
7
|
+
*/
|
|
8
|
+
export const VISA_TYPE_DESCRIPTIONS = {
|
|
9
|
+
access: 'Basic platform access - standard API operations',
|
|
10
|
+
privilege: 'Elevated permissions - administrative or write operations',
|
|
11
|
+
data: 'Data access rights - database or storage credentials',
|
|
12
|
+
compliance: 'Regulatory scope - credentials with compliance requirements',
|
|
13
|
+
ecosystem: 'Cross-platform - multi-service integration tokens',
|
|
14
|
+
custom: 'Custom authorization - business-defined access policies',
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Platform metadata
|
|
18
|
+
*/
|
|
19
|
+
export const PLATFORM_INFO = {
|
|
20
|
+
mcp: { name: 'Model Context Protocol', description: 'MCP-compatible tools and servers' },
|
|
21
|
+
openai: { name: 'OpenAI', description: 'OpenAI API services' },
|
|
22
|
+
anthropic: { name: 'Anthropic', description: 'Anthropic Claude API' },
|
|
23
|
+
'google-a2a': { name: 'Google Agent-to-Agent', description: 'Google A2A protocol' },
|
|
24
|
+
langchain: { name: 'LangChain', description: 'LangChain framework' },
|
|
25
|
+
'azure-ai': { name: 'Azure AI', description: 'Microsoft Azure AI services' },
|
|
26
|
+
aws: { name: 'AWS', description: 'Amazon Web Services' },
|
|
27
|
+
crewai: { name: 'CrewAI', description: 'CrewAI multi-agent framework' },
|
|
28
|
+
openclaw: { name: 'OpenClaw', description: 'OpenClaw agent framework' },
|
|
29
|
+
github: { name: 'GitHub', description: 'GitHub API and services' },
|
|
30
|
+
slack: { name: 'Slack', description: 'Slack messaging platform' },
|
|
31
|
+
custom: { name: 'Custom', description: 'Custom platform integration' },
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Number of days before expiry to mark as "expiring"
|
|
35
|
+
*/
|
|
36
|
+
export const EXPIRING_THRESHOLD_DAYS = 14;
|
|
37
|
+
/**
|
|
38
|
+
* Current passport schema version
|
|
39
|
+
*/
|
|
40
|
+
export const PASSPORT_SCHEMA_VERSION = 1;
|
|
41
|
+
/**
|
|
42
|
+
* Current vault data version
|
|
43
|
+
*/
|
|
44
|
+
export const VAULT_DATA_VERSION = 2;
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// Errors
|
|
47
|
+
// ============================================================================
|
|
48
|
+
/**
|
|
49
|
+
* Base error class for ID Wispera
|
|
50
|
+
*/
|
|
51
|
+
export class WisperaError extends Error {
|
|
52
|
+
code;
|
|
53
|
+
details;
|
|
54
|
+
constructor(message, code, details) {
|
|
55
|
+
super(message);
|
|
56
|
+
this.code = code;
|
|
57
|
+
this.details = details;
|
|
58
|
+
this.name = 'WisperaError';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Vault-specific errors
|
|
63
|
+
*/
|
|
64
|
+
export class VaultError extends WisperaError {
|
|
65
|
+
constructor(message, code, details) {
|
|
66
|
+
super(message, code, details);
|
|
67
|
+
this.name = 'VaultError';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Passport-specific errors
|
|
72
|
+
*/
|
|
73
|
+
export class PassportError extends WisperaError {
|
|
74
|
+
constructor(message, code, details) {
|
|
75
|
+
super(message, code, details);
|
|
76
|
+
this.name = 'PassportError';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Policy-specific errors
|
|
81
|
+
*/
|
|
82
|
+
export class PolicyError extends WisperaError {
|
|
83
|
+
constructor(message, code, details) {
|
|
84
|
+
super(message, code, details);
|
|
85
|
+
this.name = 'PolicyError';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAA6B;IAC9D,MAAM,EAAE,iDAAiD;IACzD,SAAS,EAAE,2DAA2D;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G;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAG5B;IACA;IAHT,YACE,OAAe,EACR,IAAY,EACZ,OAAiC;QAExC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAA0B;QAGxC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,YAAY;IAC1C,YAAY,OAAe,EAAE,IAAY,EAAE,OAAiC;QAC1E,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,YAAY;IAC7C,YAAY,OAAe,EAAE,IAAY,EAAE,OAAiC;QAC1E,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,YAAY;IAC3C,YAAY,OAAe,EAAE,IAAY,EAAE,OAAiC;QAC1E,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ID Wispera Shared Utilities
|
|
3
|
+
* Common helpers used across core modules to eliminate code duplication
|
|
4
|
+
*/
|
|
5
|
+
/** Milliseconds in one day */
|
|
6
|
+
export declare const MS_PER_DAY = 86400000;
|
|
7
|
+
/**
|
|
8
|
+
* Mask a credential value for safe display
|
|
9
|
+
* Shows first and last `visibleChars` characters with asterisks in between
|
|
10
|
+
*/
|
|
11
|
+
export declare function maskValue(value: string, visibleChars?: number): string;
|
|
12
|
+
/**
|
|
13
|
+
* Capitalize the first character of a string
|
|
14
|
+
*/
|
|
15
|
+
export declare function capitalizeFirst(str: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Generate a preview of a token (first N chars + ... + last M chars)
|
|
18
|
+
*/
|
|
19
|
+
export declare function previewToken(token: string, prefixLen?: number, suffixLen?: number): string;
|
|
20
|
+
/**
|
|
21
|
+
* Normalize a value to an array (wraps single values in an array)
|
|
22
|
+
*/
|
|
23
|
+
export declare function toArray<T>(value: T | T[]): T[];
|
|
24
|
+
/**
|
|
25
|
+
* Extract error message from an unknown error value
|
|
26
|
+
*/
|
|
27
|
+
export declare function getErrorMessage(err: unknown, fallback?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Check if a path exists (async, works in Node.js)
|
|
30
|
+
*/
|
|
31
|
+
export declare function pathExists(path: string): Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Generate cryptographically secure random bytes
|
|
34
|
+
* Works in both browser (Web Crypto) and Node.js environments
|
|
35
|
+
*/
|
|
36
|
+
export declare function getRandomBytes(length: number): Uint8Array;
|
|
37
|
+
/**
|
|
38
|
+
* Get the SubtleCrypto instance (works in both browser and Node.js)
|
|
39
|
+
*/
|
|
40
|
+
export declare function getCryptoSubtle(): Promise<SubtleCrypto>;
|
|
41
|
+
/**
|
|
42
|
+
* Helper to convert Uint8Array to BufferSource for Web Crypto API
|
|
43
|
+
*/
|
|
44
|
+
export declare function toBufferSource(bytes: Uint8Array): BufferSource;
|
|
45
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,8BAA8B;AAC9B,eAAO,MAAM,UAAU,WAAa,CAAC;AAMrC;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,MAAU,GAAG,MAAM,CAQzE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,SAAK,EAAE,SAAS,SAAI,GAAG,MAAM,CAKjF;AAMD;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,CAE9C;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,SAAkB,GAAG,MAAM,CAEhF;AAMD;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQ/D;AAMD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAUzD;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,CAM7D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAE9D"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ID Wispera Shared Utilities
|
|
3
|
+
* Common helpers used across core modules to eliminate code duplication
|
|
4
|
+
*/
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Constants
|
|
7
|
+
// ============================================================================
|
|
8
|
+
/** Milliseconds in one day */
|
|
9
|
+
export const MS_PER_DAY = 86_400_000;
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// String Utilities
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Mask a credential value for safe display
|
|
15
|
+
* Shows first and last `visibleChars` characters with asterisks in between
|
|
16
|
+
*/
|
|
17
|
+
export function maskValue(value, visibleChars = 4) {
|
|
18
|
+
if (value.length <= visibleChars * 2) {
|
|
19
|
+
return '*'.repeat(value.length);
|
|
20
|
+
}
|
|
21
|
+
const start = value.substring(0, visibleChars);
|
|
22
|
+
const end = value.substring(value.length - visibleChars);
|
|
23
|
+
const middle = '*'.repeat(Math.min(value.length - visibleChars * 2, 20));
|
|
24
|
+
return `${start}${middle}${end}`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Capitalize the first character of a string
|
|
28
|
+
*/
|
|
29
|
+
export function capitalizeFirst(str) {
|
|
30
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Generate a preview of a token (first N chars + ... + last M chars)
|
|
34
|
+
*/
|
|
35
|
+
export function previewToken(token, prefixLen = 10, suffixLen = 4) {
|
|
36
|
+
if (token.length <= prefixLen + suffixLen + 3) {
|
|
37
|
+
return maskValue(token);
|
|
38
|
+
}
|
|
39
|
+
return `${token.substring(0, prefixLen)}...${token.substring(token.length - suffixLen)}`;
|
|
40
|
+
}
|
|
41
|
+
// ============================================================================
|
|
42
|
+
// Array Utilities
|
|
43
|
+
// ============================================================================
|
|
44
|
+
/**
|
|
45
|
+
* Normalize a value to an array (wraps single values in an array)
|
|
46
|
+
*/
|
|
47
|
+
export function toArray(value) {
|
|
48
|
+
return Array.isArray(value) ? value : [value];
|
|
49
|
+
}
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// Error Utilities
|
|
52
|
+
// ============================================================================
|
|
53
|
+
/**
|
|
54
|
+
* Extract error message from an unknown error value
|
|
55
|
+
*/
|
|
56
|
+
export function getErrorMessage(err, fallback = 'Unknown error') {
|
|
57
|
+
return err instanceof Error ? err.message : fallback;
|
|
58
|
+
}
|
|
59
|
+
// ============================================================================
|
|
60
|
+
// Filesystem Utilities
|
|
61
|
+
// ============================================================================
|
|
62
|
+
/**
|
|
63
|
+
* Check if a path exists (async, works in Node.js)
|
|
64
|
+
*/
|
|
65
|
+
export async function pathExists(path) {
|
|
66
|
+
const fs = await import('fs/promises');
|
|
67
|
+
try {
|
|
68
|
+
await fs.access(path);
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// ============================================================================
|
|
76
|
+
// Crypto Utilities
|
|
77
|
+
// ============================================================================
|
|
78
|
+
/**
|
|
79
|
+
* Generate cryptographically secure random bytes
|
|
80
|
+
* Works in both browser (Web Crypto) and Node.js environments
|
|
81
|
+
*/
|
|
82
|
+
export function getRandomBytes(length) {
|
|
83
|
+
const bytes = new Uint8Array(length);
|
|
84
|
+
if (typeof globalThis.crypto !== 'undefined' && globalThis.crypto.getRandomValues) {
|
|
85
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const { randomBytes } = require('crypto');
|
|
89
|
+
const nodeBytes = randomBytes(length);
|
|
90
|
+
bytes.set(nodeBytes);
|
|
91
|
+
}
|
|
92
|
+
return bytes;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get the SubtleCrypto instance (works in both browser and Node.js)
|
|
96
|
+
*/
|
|
97
|
+
export async function getCryptoSubtle() {
|
|
98
|
+
if (globalThis.crypto?.subtle) {
|
|
99
|
+
return globalThis.crypto.subtle;
|
|
100
|
+
}
|
|
101
|
+
const nodeCrypto = await import('crypto');
|
|
102
|
+
return nodeCrypto.webcrypto.subtle;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Helper to convert Uint8Array to BufferSource for Web Crypto API
|
|
106
|
+
*/
|
|
107
|
+
export function toBufferSource(bytes) {
|
|
108
|
+
return bytes;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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