@dainprotocol/service-sdk 1.2.2 → 1.2.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.
@@ -1,7 +1,15 @@
1
+ /**
2
+ * CLIENT-SIDE JWT Authentication (Users Only)
3
+ *
4
+ * Users authenticate with JWT tokens from DAIN ID OAuth.
5
+ * NO orgId, NO agentId, NO keypair - completely removed for client-side.
6
+ *
7
+ * For SERVICE-SIDE keypair authentication (services/agents), see /src/service/auth.ts
8
+ */
1
9
  /**
2
10
  * JWT Authentication Config (Users)
3
11
  */
4
- export interface DainClientAuthConfigJWT {
12
+ export interface DainClientAuthConfig {
5
13
  /** JWT access token from DAIN ID OAuth */
6
14
  jwt: string;
7
15
  /** Smart Account ID (optional, will be extracted from JWT if not provided) */
@@ -12,39 +20,16 @@ export interface DainClientAuthConfigJWT {
12
20
  webhookUrl?: string;
13
21
  }
14
22
  /**
15
- * Keypair Authentication Config (Services/Agents)
16
- */
17
- export interface DainClientAuthConfigKeypair {
18
- /** Base58 encoded private key */
19
- privateKeyBase58?: string;
20
- /** Agent ID */
21
- agentId?: string;
22
- /** Organization ID */
23
- orgId?: string;
24
- /** API Key (alternative to privateKeyBase58/agentId/orgId) */
25
- apiKey?: string;
26
- /** Smart Account PDA on Solana (optional) */
27
- smartAccountPDA?: string;
28
- /** Webhook URL for async operations (optional) */
29
- webhookUrl?: string;
30
- }
31
- /**
32
- * Union type for authentication config
33
- */
34
- export type DainClientAuthConfig = DainClientAuthConfigJWT | DainClientAuthConfigKeypair;
35
- /**
36
- * Unified DainClientAuth class
23
+ * DainClientAuth - JWT-only authentication for users
24
+ *
25
+ * This class is for CLIENT-SIDE use only (e.g., butterfly-web).
26
+ * Users authenticate with JWT tokens - NO keypairs, NO orgId, NO agentId.
37
27
  *
38
- * Supports both JWT (users) and Keypair (services/agents) authentication
28
+ * For SERVICE-SIDE authentication with keypairs, use the service SDK's built-in auth.
39
29
  */
40
30
  export declare class DainClientAuth {
41
- private authType;
42
- private jwt?;
43
- private smartAccountId?;
44
- private privateKey?;
45
- private agentId?;
46
- private orgId?;
47
- private publicKey?;
31
+ private jwt;
32
+ private smartAccountId;
48
33
  private smartAccountPDA?;
49
34
  private webhookUrl?;
50
35
  constructor(config: DainClientAuthConfig);
@@ -54,65 +39,28 @@ export declare class DainClientAuth {
54
39
  */
55
40
  private decodeJWTPayload;
56
41
  /**
57
- * Parse API key into components
58
- * @private
59
- */
60
- private parseApiKey;
61
- /**
62
- * Sign request
63
- * - JWT mode: returns empty (no signing needed)
64
- * - Keypair mode: signs with Ed25519
42
+ * Sign request - NOT NEEDED for JWT (returns empty for compatibility)
65
43
  */
66
- signRequest(method: string, path: string, body: string): Promise<{
44
+ signRequest(_method: string, _path: string, _body: string): Promise<{
67
45
  signature: string;
68
46
  timestamp: string;
69
47
  }>;
70
48
  /**
71
49
  * Get headers for HTTP requests
72
- * - JWT mode: returns Authorization Bearer header
73
- * - Keypair mode: returns signature headers
74
50
  */
75
- getHeaders(signature: string, timestamp: string): Record<string, string>;
51
+ getHeaders(_signature: string, _timestamp: string): Record<string, string>;
76
52
  /**
77
- * Sign a message (keypair mode only)
78
- */
79
- signMessage(message: string): string;
80
- /**
81
- * Verify a message signature (static method)
82
- */
83
- static verifyMessage(message: string, signature: string, publicKey: Uint8Array): boolean;
84
- /**
85
- * Verify SSE event signature (keypair mode only)
86
- */
87
- verifyEventSignature(data: string, signature: string, timestamp: string, publicKeyBase58: string): boolean;
88
- /**
89
- * Check if using JWT authentication
53
+ * Check if using JWT authentication (always true for client-side)
90
54
  */
91
55
  isJWT(): boolean;
92
56
  /**
93
- * Get JWT token (JWT mode only)
94
- */
95
- getJWT(): string | undefined;
96
- /**
97
- * Get smart account ID (JWT mode only)
57
+ * Get JWT token
98
58
  */
99
- getSmartAccountId(): string | undefined;
59
+ getJWT(): string;
100
60
  /**
101
- * Get agent ID (keypair mode only)
61
+ * Get smart account ID
102
62
  */
103
- getAgentId(): string | undefined;
104
- /**
105
- * Get org ID (keypair mode only)
106
- */
107
- getOrgId(): string | undefined;
108
- /**
109
- * Get public key (keypair mode only)
110
- */
111
- getPublicKey(): Uint8Array | undefined;
112
- /**
113
- * Get public key as base58 (keypair mode only)
114
- */
115
- getPublicKeyBase58(): string | undefined;
63
+ getSmartAccountId(): string;
116
64
  /**
117
65
  * Get smart account PDA
118
66
  */
@@ -121,6 +69,11 @@ export declare class DainClientAuth {
121
69
  * Get webhook URL
122
70
  */
123
71
  getWebhookUrl(): string | undefined;
72
+ /**
73
+ * Verify SSE event signature from service
74
+ * (Services sign their event responses, users verify them)
75
+ */
76
+ verifyEventSignature(data: string, signature: string, timestamp: string, publicKeyBase58: string): boolean;
124
77
  /**
125
78
  * Serialize auth config
126
79
  */
@@ -1,85 +1,43 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DainClientAuth = void 0;
4
- const tslib_1 = require("tslib");
5
2
  //File: src/client/client-auth.ts
6
3
  /**
7
- * Unified Authentication for DAIN Services
4
+ * CLIENT-SIDE JWT Authentication (Users Only)
8
5
  *
9
- * Supports two authentication modes:
10
- * 1. JWT (for end users) - NO orgId, NO agentId, NO keypair
11
- * 2. Keypair (for services/agents) - uses orgId, agentId, Ed25519 keypair
12
- */
13
- const ed25519_1 = require("@noble/curves/ed25519");
14
- const sha256_1 = require("@noble/hashes/sha256");
15
- const utils_1 = require("@noble/hashes/utils");
16
- const bs58_1 = tslib_1.__importDefault(require("bs58"));
17
- /**
18
- * Type guard to check if config is JWT
6
+ * Users authenticate with JWT tokens from DAIN ID OAuth.
7
+ * NO orgId, NO agentId, NO keypair - completely removed for client-side.
8
+ *
9
+ * For SERVICE-SIDE keypair authentication (services/agents), see /src/service/auth.ts
19
10
  */
20
- function isJWTConfig(config) {
21
- return 'jwt' in config && typeof config.jwt === 'string';
22
- }
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DainClientAuth = void 0;
23
13
  /**
24
- * Unified DainClientAuth class
14
+ * DainClientAuth - JWT-only authentication for users
15
+ *
16
+ * This class is for CLIENT-SIDE use only (e.g., butterfly-web).
17
+ * Users authenticate with JWT tokens - NO keypairs, NO orgId, NO agentId.
25
18
  *
26
- * Supports both JWT (users) and Keypair (services/agents) authentication
19
+ * For SERVICE-SIDE authentication with keypairs, use the service SDK's built-in auth.
27
20
  */
28
21
  class DainClientAuth {
29
- // Auth type
30
- authType;
31
- // JWT fields (users only)
32
22
  jwt;
33
23
  smartAccountId;
34
- // Keypair fields (services/agents only)
35
- privateKey;
36
- agentId;
37
- orgId;
38
- publicKey;
39
- // Shared fields
40
24
  smartAccountPDA;
41
25
  webhookUrl;
42
26
  constructor(config) {
43
- if (isJWTConfig(config)) {
44
- // JWT Authentication (Users)
45
- this.authType = 'jwt';
46
- if (!config.jwt) {
47
- throw new Error('JWT token is required for user authentication');
48
- }
49
- this.jwt = config.jwt;
50
- // Extract smartAccountId from config or decode from JWT
51
- if (config.smartAccountId) {
52
- this.smartAccountId = config.smartAccountId;
53
- }
54
- else {
55
- const payload = this.decodeJWTPayload(config.jwt);
56
- this.smartAccountId = payload.smart_account_id || payload.sub;
57
- }
58
- this.smartAccountPDA = config.smartAccountPDA;
59
- this.webhookUrl = config.webhookUrl;
27
+ if (!config.jwt) {
28
+ throw new Error('JWT token is required for user authentication');
29
+ }
30
+ this.jwt = config.jwt;
31
+ // Extract smartAccountId from config or decode from JWT
32
+ if (config.smartAccountId) {
33
+ this.smartAccountId = config.smartAccountId;
60
34
  }
61
35
  else {
62
- // Keypair Authentication (Services/Agents)
63
- this.authType = 'keypair';
64
- if (config.apiKey) {
65
- const { privateKey, agentId, orgId, publicKey } = this.parseApiKey(config.apiKey);
66
- this.privateKey = privateKey;
67
- this.agentId = agentId;
68
- this.orgId = orgId;
69
- this.publicKey = publicKey;
70
- }
71
- else if (config.privateKeyBase58 && config.agentId && config.orgId) {
72
- this.privateKey = bs58_1.default.decode(config.privateKeyBase58);
73
- this.agentId = config.agentId.replace('agent_', '');
74
- this.orgId = config.orgId.replace('org_', '');
75
- this.publicKey = ed25519_1.ed25519.getPublicKey(this.privateKey);
76
- }
77
- else {
78
- throw new Error('Invalid configuration. Provide either jwt (for users) or apiKey/privateKeyBase58+agentId+orgId (for services/agents).');
79
- }
80
- this.smartAccountPDA = config.smartAccountPDA;
81
- this.webhookUrl = config.webhookUrl;
36
+ const payload = this.decodeJWTPayload(config.jwt);
37
+ this.smartAccountId = payload.smart_account_id || payload.sub;
82
38
  }
39
+ this.smartAccountPDA = config.smartAccountPDA;
40
+ this.webhookUrl = config.webhookUrl;
83
41
  }
84
42
  /**
85
43
  * Decode JWT payload (without verification)
@@ -94,144 +52,45 @@ class DainClientAuth {
94
52
  return JSON.parse(payload);
95
53
  }
96
54
  /**
97
- * Parse API key into components
98
- * @private
99
- */
100
- parseApiKey(apiKey) {
101
- const parts = apiKey.split('_');
102
- if (parts.length !== 5 || parts[0] !== 'sk' || parts[1] !== 'agent') {
103
- throw new Error('Invalid API key format');
104
- }
105
- const orgId = parts[2].replace('org_', '');
106
- const agentId = parts[3].replace('agent_', '');
107
- const privateKeyBase58 = parts[4];
108
- const privateKey = bs58_1.default.decode(privateKeyBase58).slice(0, 32);
109
- const publicKey = bs58_1.default.decode(privateKeyBase58).slice(32);
110
- return { privateKey, agentId, orgId, publicKey };
111
- }
112
- /**
113
- * Sign request
114
- * - JWT mode: returns empty (no signing needed)
115
- * - Keypair mode: signs with Ed25519
55
+ * Sign request - NOT NEEDED for JWT (returns empty for compatibility)
116
56
  */
117
- async signRequest(method, path, body) {
118
- if (this.authType === 'jwt') {
119
- // JWT doesn't need request signing
120
- return { signature: '', timestamp: '' };
121
- }
122
- // Keypair signing for services/agents
123
- const timestamp = Date.now().toString();
124
- const message = `${method}:${path}:${timestamp}:${body}`;
125
- const messageHash = (0, sha256_1.sha256)(message);
126
- const signature = ed25519_1.ed25519.sign(messageHash, this.privateKey);
127
- return { signature: (0, utils_1.bytesToHex)(signature), timestamp };
57
+ async signRequest(_method, _path, _body) {
58
+ return { signature: '', timestamp: '' };
128
59
  }
129
60
  /**
130
61
  * Get headers for HTTP requests
131
- * - JWT mode: returns Authorization Bearer header
132
- * - Keypair mode: returns signature headers
133
62
  */
134
- getHeaders(signature, timestamp) {
135
- const baseHeaders = {};
63
+ getHeaders(_signature, _timestamp) {
64
+ const headers = {
65
+ "Authorization": `Bearer ${this.jwt}`,
66
+ };
136
67
  if (this.smartAccountPDA) {
137
- baseHeaders["X-DAIN-SMART-ACCOUNT-PDA"] = this.smartAccountPDA;
68
+ headers["X-DAIN-SMART-ACCOUNT-PDA"] = this.smartAccountPDA;
138
69
  }
139
70
  if (this.webhookUrl) {
140
- baseHeaders["X-DAIN-WEBHOOK-URL"] = this.webhookUrl;
141
- }
142
- if (this.authType === 'jwt') {
143
- // JWT authentication headers
144
- return {
145
- ...baseHeaders,
146
- "Authorization": `Bearer ${this.jwt}`,
147
- };
148
- }
149
- // Keypair authentication headers
150
- return {
151
- ...baseHeaders,
152
- "X-DAIN-SIGNATURE": signature,
153
- "X-DAIN-TIMESTAMP": timestamp,
154
- "X-DAIN-AGENT-ID": this.agentId,
155
- "X-DAIN-ORG-ID": this.orgId,
156
- "X-DAIN-ADDRESS": bs58_1.default.encode(this.publicKey),
157
- };
158
- }
159
- /**
160
- * Sign a message (keypair mode only)
161
- */
162
- signMessage(message) {
163
- if (this.authType === 'jwt') {
164
- throw new Error('signMessage not available in JWT mode');
165
- }
166
- const messageHash = (0, sha256_1.sha256)(message);
167
- const signature = ed25519_1.ed25519.sign(messageHash, this.privateKey);
168
- return (0, utils_1.bytesToHex)(signature);
169
- }
170
- /**
171
- * Verify a message signature (static method)
172
- */
173
- static verifyMessage(message, signature, publicKey) {
174
- const messageHash = (0, sha256_1.sha256)(message);
175
- return ed25519_1.ed25519.verify(signature, messageHash, publicKey);
176
- }
177
- /**
178
- * Verify SSE event signature (keypair mode only)
179
- */
180
- verifyEventSignature(data, signature, timestamp, publicKeyBase58) {
181
- try {
182
- const message = `${data}:${timestamp}`;
183
- const messageHash = (0, sha256_1.sha256)(message);
184
- const publicKey = bs58_1.default.decode(publicKeyBase58);
185
- return ed25519_1.ed25519.verify(signature, messageHash, publicKey);
186
- }
187
- catch (error) {
188
- console.error('Error verifying event signature:', error);
189
- return false;
71
+ headers["X-DAIN-WEBHOOK-URL"] = this.webhookUrl;
190
72
  }
73
+ return headers;
191
74
  }
192
75
  // ===== Getter Methods =====
193
76
  /**
194
- * Check if using JWT authentication
77
+ * Check if using JWT authentication (always true for client-side)
195
78
  */
196
79
  isJWT() {
197
- return this.authType === 'jwt';
80
+ return true;
198
81
  }
199
82
  /**
200
- * Get JWT token (JWT mode only)
83
+ * Get JWT token
201
84
  */
202
85
  getJWT() {
203
86
  return this.jwt;
204
87
  }
205
88
  /**
206
- * Get smart account ID (JWT mode only)
89
+ * Get smart account ID
207
90
  */
208
91
  getSmartAccountId() {
209
92
  return this.smartAccountId;
210
93
  }
211
- /**
212
- * Get agent ID (keypair mode only)
213
- */
214
- getAgentId() {
215
- return this.agentId;
216
- }
217
- /**
218
- * Get org ID (keypair mode only)
219
- */
220
- getOrgId() {
221
- return this.orgId;
222
- }
223
- /**
224
- * Get public key (keypair mode only)
225
- */
226
- getPublicKey() {
227
- return this.publicKey;
228
- }
229
- /**
230
- * Get public key as base58 (keypair mode only)
231
- */
232
- getPublicKeyBase58() {
233
- return this.publicKey ? bs58_1.default.encode(this.publicKey) : undefined;
234
- }
235
94
  /**
236
95
  * Get smart account PDA
237
96
  */
@@ -244,66 +103,56 @@ class DainClientAuth {
244
103
  getWebhookUrl() {
245
104
  return this.webhookUrl;
246
105
  }
106
+ /**
107
+ * Verify SSE event signature from service
108
+ * (Services sign their event responses, users verify them)
109
+ */
110
+ verifyEventSignature(data, signature, timestamp, publicKeyBase58) {
111
+ try {
112
+ // This is for verifying SERVICE signatures, not user signatures
113
+ // Import crypto libs only when needed
114
+ const { ed25519 } = require("@noble/curves/ed25519");
115
+ const { sha256 } = require("@noble/hashes/sha256");
116
+ const bs58 = require("bs58");
117
+ const message = `${data}:${timestamp}`;
118
+ const messageHash = sha256(message);
119
+ const publicKey = bs58.decode(publicKeyBase58);
120
+ return ed25519.verify(signature, messageHash, publicKey);
121
+ }
122
+ catch (error) {
123
+ console.error('Error verifying event signature:', error);
124
+ return false;
125
+ }
126
+ }
247
127
  // ===== Serialization =====
248
128
  /**
249
129
  * Serialize auth config
250
130
  */
251
131
  serialize() {
252
- if (this.authType === 'jwt') {
253
- const data = {
254
- authMethod: 'jwt',
255
- jwt: this.jwt,
256
- smartAccountId: this.smartAccountId,
257
- smartAccountPDA: this.smartAccountPDA,
258
- webhookUrl: this.webhookUrl
259
- };
260
- return Buffer.from(JSON.stringify(data)).toString('base64');
261
- }
262
- else {
263
- const data = {
264
- authMethod: 'keypair',
265
- privateKey: Array.from(this.privateKey),
266
- agentId: this.agentId,
267
- orgId: this.orgId,
268
- publicKey: Array.from(this.publicKey),
269
- smartAccountPDA: this.smartAccountPDA,
270
- webhookUrl: this.webhookUrl
271
- };
272
- return bs58_1.default.encode(Buffer.from(JSON.stringify(data)));
273
- }
132
+ const data = {
133
+ authMethod: 'jwt',
134
+ jwt: this.jwt,
135
+ smartAccountId: this.smartAccountId,
136
+ smartAccountPDA: this.smartAccountPDA,
137
+ webhookUrl: this.webhookUrl
138
+ };
139
+ return Buffer.from(JSON.stringify(data)).toString('base64');
274
140
  }
275
141
  /**
276
142
  * Deserialize auth config
277
143
  */
278
144
  static deserialize(serialized) {
279
145
  try {
280
- // Try JWT format first (base64)
281
- try {
282
- const data = JSON.parse(Buffer.from(serialized, 'base64').toString());
283
- if (data.authMethod === 'jwt') {
284
- return new DainClientAuth({
285
- jwt: data.jwt,
286
- smartAccountId: data.smartAccountId,
287
- smartAccountPDA: data.smartAccountPDA,
288
- webhookUrl: data.webhookUrl
289
- });
290
- }
291
- }
292
- catch {
293
- // Not JWT format, try keypair
294
- }
295
- // Try keypair format (bs58)
296
- const data = JSON.parse(Buffer.from(bs58_1.default.decode(serialized)).toString());
297
- if (data.authMethod === 'keypair') {
298
- return new DainClientAuth({
299
- privateKeyBase58: bs58_1.default.encode(new Uint8Array(data.privateKey)),
300
- agentId: data.agentId,
301
- orgId: data.orgId,
302
- smartAccountPDA: data.smartAccountPDA,
303
- webhookUrl: data.webhookUrl
304
- });
146
+ const data = JSON.parse(Buffer.from(serialized, 'base64').toString());
147
+ if (data.authMethod !== 'jwt') {
148
+ throw new Error('Invalid auth method - client-side only supports JWT');
305
149
  }
306
- throw new Error('Unknown auth method');
150
+ return new DainClientAuth({
151
+ jwt: data.jwt,
152
+ smartAccountId: data.smartAccountId,
153
+ smartAccountPDA: data.smartAccountPDA,
154
+ webhookUrl: data.webhookUrl
155
+ });
307
156
  }
308
157
  catch (error) {
309
158
  throw new Error('Failed to deserialize DainClientAuth: ' + error.message);
@@ -1 +1 @@
1
- {"version":3,"file":"client-auth.js","sourceRoot":"","sources":["../../src/client/client-auth.ts"],"names":[],"mappings":";;;;AAAA,iCAAiC;AACjC;;;;;;GAMG;AACH,mDAAgD;AAChD,iDAA8C;AAC9C,+CAAiD;AACjD,wDAAwB;AA+CxB;;GAEG;AACH,SAAS,WAAW,CAAC,MAA4B;IAC/C,OAAO,KAAK,IAAI,MAAM,IAAI,OAAQ,MAAc,CAAC,GAAG,KAAK,QAAQ,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAa,cAAc;IACzB,YAAY;IACJ,QAAQ,CAAoB;IAEpC,0BAA0B;IAClB,GAAG,CAAU;IACb,cAAc,CAAU;IAEhC,wCAAwC;IAChC,UAAU,CAAc;IACxB,OAAO,CAAU;IACjB,KAAK,CAAU;IACf,SAAS,CAAc;IAE/B,gBAAgB;IACR,eAAe,CAAU;IACzB,UAAU,CAAU;IAE5B,YAAY,MAA4B;QACtC,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;YACxB,6BAA6B;YAC7B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;YAE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AAwC,GAAI,KAAe,CAAC,OAAO,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;CACF;AArKD,wCAqKC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dainprotocol/service-sdk",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "DAIN Service SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",