kotanipay-sdk 1.0.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.
Files changed (202) hide show
  1. package/README.md +329 -0
  2. package/dist/cjs/client/index.d.ts +2 -0
  3. package/dist/cjs/client/index.d.ts.map +1 -0
  4. package/dist/cjs/client/index.js +18 -0
  5. package/dist/cjs/client/index.js.map +1 -0
  6. package/dist/cjs/client/kotani-pay.client.d.ts +42 -0
  7. package/dist/cjs/client/kotani-pay.client.d.ts.map +1 -0
  8. package/dist/cjs/client/kotani-pay.client.js +61 -0
  9. package/dist/cjs/client/kotani-pay.client.js.map +1 -0
  10. package/dist/cjs/exceptions/index.d.ts +2 -0
  11. package/dist/cjs/exceptions/index.d.ts.map +1 -0
  12. package/dist/cjs/exceptions/index.js +18 -0
  13. package/dist/cjs/exceptions/index.js.map +1 -0
  14. package/dist/cjs/exceptions/kotani-pay.exception.d.ts +31 -0
  15. package/dist/cjs/exceptions/kotani-pay.exception.d.ts.map +1 -0
  16. package/dist/cjs/exceptions/kotani-pay.exception.js +49 -0
  17. package/dist/cjs/exceptions/kotani-pay.exception.js.map +1 -0
  18. package/dist/cjs/index.d.ts +6 -0
  19. package/dist/cjs/index.d.ts.map +1 -0
  20. package/dist/cjs/index.js +25 -0
  21. package/dist/cjs/index.js.map +1 -0
  22. package/dist/cjs/modules/auth/auth.service.d.ts +37 -0
  23. package/dist/cjs/modules/auth/auth.service.d.ts.map +1 -0
  24. package/dist/cjs/modules/auth/auth.service.js +74 -0
  25. package/dist/cjs/modules/auth/auth.service.js.map +1 -0
  26. package/dist/cjs/modules/auth/index.d.ts +2 -0
  27. package/dist/cjs/modules/auth/index.d.ts.map +1 -0
  28. package/dist/cjs/modules/auth/index.js +18 -0
  29. package/dist/cjs/modules/auth/index.js.map +1 -0
  30. package/dist/cjs/modules/index.d.ts +3 -0
  31. package/dist/cjs/modules/index.d.ts.map +1 -0
  32. package/dist/cjs/modules/index.js +19 -0
  33. package/dist/cjs/modules/index.js.map +1 -0
  34. package/dist/cjs/modules/integrator/index.d.ts +2 -0
  35. package/dist/cjs/modules/integrator/index.d.ts.map +1 -0
  36. package/dist/cjs/modules/integrator/index.js +18 -0
  37. package/dist/cjs/modules/integrator/index.js.map +1 -0
  38. package/dist/cjs/modules/integrator/integrator.service.d.ts +10 -0
  39. package/dist/cjs/modules/integrator/integrator.service.d.ts.map +1 -0
  40. package/dist/cjs/modules/integrator/integrator.service.js +33 -0
  41. package/dist/cjs/modules/integrator/integrator.service.js.map +1 -0
  42. package/dist/cjs/modules/mobile-money/mobile-money.service.d.ts +25 -0
  43. package/dist/cjs/modules/mobile-money/mobile-money.service.d.ts.map +1 -0
  44. package/dist/cjs/modules/mobile-money/mobile-money.service.js +70 -0
  45. package/dist/cjs/modules/mobile-money/mobile-money.service.js.map +1 -0
  46. package/dist/cjs/types/authentication.types.d.ts +38 -0
  47. package/dist/cjs/types/authentication.types.d.ts.map +1 -0
  48. package/dist/cjs/types/authentication.types.js +3 -0
  49. package/dist/cjs/types/authentication.types.js.map +1 -0
  50. package/dist/cjs/types/common.types.d.ts +23 -0
  51. package/dist/cjs/types/common.types.d.ts.map +1 -0
  52. package/dist/cjs/types/common.types.js +3 -0
  53. package/dist/cjs/types/common.types.js.map +1 -0
  54. package/dist/cjs/types/error.types.d.ts +12 -0
  55. package/dist/cjs/types/error.types.d.ts.map +1 -0
  56. package/dist/cjs/types/error.types.js +27 -0
  57. package/dist/cjs/types/error.types.js.map +1 -0
  58. package/dist/cjs/types/index.d.ts +6 -0
  59. package/dist/cjs/types/index.d.ts.map +1 -0
  60. package/dist/cjs/types/index.js +22 -0
  61. package/dist/cjs/types/index.js.map +1 -0
  62. package/dist/cjs/types/integrator.types.d.ts +25 -0
  63. package/dist/cjs/types/integrator.types.d.ts.map +1 -0
  64. package/dist/cjs/types/integrator.types.js +3 -0
  65. package/dist/cjs/types/integrator.types.js.map +1 -0
  66. package/dist/cjs/types/mobile-money.types.d.ts +26 -0
  67. package/dist/cjs/types/mobile-money.types.d.ts.map +1 -0
  68. package/dist/cjs/types/mobile-money.types.js +4 -0
  69. package/dist/cjs/types/mobile-money.types.js.map +1 -0
  70. package/dist/cjs/utils/http-client.util.d.ts +32 -0
  71. package/dist/cjs/utils/http-client.util.d.ts.map +1 -0
  72. package/dist/cjs/utils/http-client.util.js +117 -0
  73. package/dist/cjs/utils/http-client.util.js.map +1 -0
  74. package/dist/cjs/utils/index.d.ts +3 -0
  75. package/dist/cjs/utils/index.d.ts.map +1 -0
  76. package/dist/cjs/utils/index.js +19 -0
  77. package/dist/cjs/utils/index.js.map +1 -0
  78. package/dist/cjs/utils/validation.util.d.ts +7 -0
  79. package/dist/cjs/utils/validation.util.d.ts.map +1 -0
  80. package/dist/cjs/utils/validation.util.js +32 -0
  81. package/dist/cjs/utils/validation.util.js.map +1 -0
  82. package/dist/esm/client/index.d.ts +2 -0
  83. package/dist/esm/client/index.d.ts.map +1 -0
  84. package/dist/esm/client/index.js +2 -0
  85. package/dist/esm/client/index.js.map +1 -0
  86. package/dist/esm/client/kotani-pay.client.d.ts +42 -0
  87. package/dist/esm/client/kotani-pay.client.d.ts.map +1 -0
  88. package/dist/esm/client/kotani-pay.client.js +57 -0
  89. package/dist/esm/client/kotani-pay.client.js.map +1 -0
  90. package/dist/esm/exceptions/index.d.ts +2 -0
  91. package/dist/esm/exceptions/index.d.ts.map +1 -0
  92. package/dist/esm/exceptions/index.js +2 -0
  93. package/dist/esm/exceptions/index.js.map +1 -0
  94. package/dist/esm/exceptions/kotani-pay.exception.d.ts +31 -0
  95. package/dist/esm/exceptions/kotani-pay.exception.d.ts.map +1 -0
  96. package/dist/esm/exceptions/kotani-pay.exception.js +43 -0
  97. package/dist/esm/exceptions/kotani-pay.exception.js.map +1 -0
  98. package/dist/esm/index.d.ts +6 -0
  99. package/dist/esm/index.d.ts.map +1 -0
  100. package/dist/esm/index.js +6 -0
  101. package/dist/esm/index.js.map +1 -0
  102. package/dist/esm/modules/auth/auth.service.d.ts +37 -0
  103. package/dist/esm/modules/auth/auth.service.d.ts.map +1 -0
  104. package/dist/esm/modules/auth/auth.service.js +70 -0
  105. package/dist/esm/modules/auth/auth.service.js.map +1 -0
  106. package/dist/esm/modules/auth/index.d.ts +2 -0
  107. package/dist/esm/modules/auth/index.d.ts.map +1 -0
  108. package/dist/esm/modules/auth/index.js +2 -0
  109. package/dist/esm/modules/auth/index.js.map +1 -0
  110. package/dist/esm/modules/index.d.ts +3 -0
  111. package/dist/esm/modules/index.d.ts.map +1 -0
  112. package/dist/esm/modules/index.js +3 -0
  113. package/dist/esm/modules/index.js.map +1 -0
  114. package/dist/esm/modules/integrator/index.d.ts +2 -0
  115. package/dist/esm/modules/integrator/index.d.ts.map +1 -0
  116. package/dist/esm/modules/integrator/index.js +2 -0
  117. package/dist/esm/modules/integrator/index.js.map +1 -0
  118. package/dist/esm/modules/integrator/integrator.service.d.ts +10 -0
  119. package/dist/esm/modules/integrator/integrator.service.d.ts.map +1 -0
  120. package/dist/esm/modules/integrator/integrator.service.js +29 -0
  121. package/dist/esm/modules/integrator/integrator.service.js.map +1 -0
  122. package/dist/esm/modules/mobile-money/mobile-money.service.d.ts +25 -0
  123. package/dist/esm/modules/mobile-money/mobile-money.service.d.ts.map +1 -0
  124. package/dist/esm/modules/mobile-money/mobile-money.service.js +66 -0
  125. package/dist/esm/modules/mobile-money/mobile-money.service.js.map +1 -0
  126. package/dist/esm/types/authentication.types.d.ts +38 -0
  127. package/dist/esm/types/authentication.types.d.ts.map +1 -0
  128. package/dist/esm/types/authentication.types.js +2 -0
  129. package/dist/esm/types/authentication.types.js.map +1 -0
  130. package/dist/esm/types/common.types.d.ts +23 -0
  131. package/dist/esm/types/common.types.d.ts.map +1 -0
  132. package/dist/esm/types/common.types.js +2 -0
  133. package/dist/esm/types/common.types.js.map +1 -0
  134. package/dist/esm/types/error.types.d.ts +12 -0
  135. package/dist/esm/types/error.types.d.ts.map +1 -0
  136. package/dist/esm/types/error.types.js +21 -0
  137. package/dist/esm/types/error.types.js.map +1 -0
  138. package/dist/esm/types/index.d.ts +6 -0
  139. package/dist/esm/types/index.d.ts.map +1 -0
  140. package/dist/esm/types/index.js +6 -0
  141. package/dist/esm/types/index.js.map +1 -0
  142. package/dist/esm/types/integrator.types.d.ts +25 -0
  143. package/dist/esm/types/integrator.types.d.ts.map +1 -0
  144. package/dist/esm/types/integrator.types.js +2 -0
  145. package/dist/esm/types/integrator.types.js.map +1 -0
  146. package/dist/esm/types/mobile-money.types.d.ts +26 -0
  147. package/dist/esm/types/mobile-money.types.d.ts.map +1 -0
  148. package/dist/esm/types/mobile-money.types.js +3 -0
  149. package/dist/esm/types/mobile-money.types.js.map +1 -0
  150. package/dist/esm/utils/http-client.util.d.ts +32 -0
  151. package/dist/esm/utils/http-client.util.d.ts.map +1 -0
  152. package/dist/esm/utils/http-client.util.js +110 -0
  153. package/dist/esm/utils/http-client.util.js.map +1 -0
  154. package/dist/esm/utils/index.d.ts +3 -0
  155. package/dist/esm/utils/index.d.ts.map +1 -0
  156. package/dist/esm/utils/index.js +3 -0
  157. package/dist/esm/utils/index.js.map +1 -0
  158. package/dist/esm/utils/validation.util.d.ts +7 -0
  159. package/dist/esm/utils/validation.util.d.ts.map +1 -0
  160. package/dist/esm/utils/validation.util.js +28 -0
  161. package/dist/esm/utils/validation.util.js.map +1 -0
  162. package/dist/types/client/index.d.ts +2 -0
  163. package/dist/types/client/index.d.ts.map +1 -0
  164. package/dist/types/client/kotani-pay.client.d.ts +42 -0
  165. package/dist/types/client/kotani-pay.client.d.ts.map +1 -0
  166. package/dist/types/exceptions/index.d.ts +2 -0
  167. package/dist/types/exceptions/index.d.ts.map +1 -0
  168. package/dist/types/exceptions/kotani-pay.exception.d.ts +31 -0
  169. package/dist/types/exceptions/kotani-pay.exception.d.ts.map +1 -0
  170. package/dist/types/index.d.ts +6 -0
  171. package/dist/types/index.d.ts.map +1 -0
  172. package/dist/types/modules/auth/auth.service.d.ts +37 -0
  173. package/dist/types/modules/auth/auth.service.d.ts.map +1 -0
  174. package/dist/types/modules/auth/index.d.ts +2 -0
  175. package/dist/types/modules/auth/index.d.ts.map +1 -0
  176. package/dist/types/modules/index.d.ts +3 -0
  177. package/dist/types/modules/index.d.ts.map +1 -0
  178. package/dist/types/modules/integrator/index.d.ts +2 -0
  179. package/dist/types/modules/integrator/index.d.ts.map +1 -0
  180. package/dist/types/modules/integrator/integrator.service.d.ts +10 -0
  181. package/dist/types/modules/integrator/integrator.service.d.ts.map +1 -0
  182. package/dist/types/modules/mobile-money/mobile-money.service.d.ts +25 -0
  183. package/dist/types/modules/mobile-money/mobile-money.service.d.ts.map +1 -0
  184. package/dist/types/types/authentication.types.d.ts +38 -0
  185. package/dist/types/types/authentication.types.d.ts.map +1 -0
  186. package/dist/types/types/common.types.d.ts +23 -0
  187. package/dist/types/types/common.types.d.ts.map +1 -0
  188. package/dist/types/types/error.types.d.ts +12 -0
  189. package/dist/types/types/error.types.d.ts.map +1 -0
  190. package/dist/types/types/index.d.ts +6 -0
  191. package/dist/types/types/index.d.ts.map +1 -0
  192. package/dist/types/types/integrator.types.d.ts +25 -0
  193. package/dist/types/types/integrator.types.d.ts.map +1 -0
  194. package/dist/types/types/mobile-money.types.d.ts +26 -0
  195. package/dist/types/types/mobile-money.types.d.ts.map +1 -0
  196. package/dist/types/utils/http-client.util.d.ts +32 -0
  197. package/dist/types/utils/http-client.util.d.ts.map +1 -0
  198. package/dist/types/utils/index.d.ts +3 -0
  199. package/dist/types/utils/index.d.ts.map +1 -0
  200. package/dist/types/utils/validation.util.d.ts +7 -0
  201. package/dist/types/utils/validation.util.d.ts.map +1 -0
  202. package/package.json +61 -0
package/README.md ADDED
@@ -0,0 +1,329 @@
1
+ # KotaniPay TypeScript/JavaScript SDK
2
+
3
+ Official TypeScript/JavaScript SDK for the KotaniPay API. Simplify crypto-to-mobile money transactions across Africa.
4
+
5
+ ## Features
6
+
7
+ - 🚀 **TypeScript Support** - Full type definitions included
8
+ - 🔐 **Authentication Management** - Magic link login flow
9
+ - 📱 **Mobile Money** - Create and manage mobile money customers
10
+ - 🏢 **Integrator Management** - Create and manage integrator accounts
11
+ - 🛡️ **Error Handling** - Comprehensive error types and validation
12
+ - 🌍 **Multi-Environment** - Sandbox and production support
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @kotanipay/sdk
18
+ ```
19
+
20
+ ```bash
21
+ yarn add @kotanipay/sdk
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ```typescript
27
+ import { KotaniPayClient } from '@kotanipay/sdk';
28
+
29
+ // Initialize client
30
+ const client = new KotaniPayClient({
31
+ environment: 'sandbox' // or 'production'
32
+ });
33
+
34
+ // Create integrator (no auth required)
35
+ const integrator = await client.integrator.create({
36
+ organization: 'My Company',
37
+ product_name: 'My Product',
38
+ first_name: 'John',
39
+ last_name: 'Doe',
40
+ email: 'john@company.com',
41
+ phone: '+1234567890',
42
+ country_code: 'US'
43
+ });
44
+
45
+ // Start authentication flow
46
+ await client.auth.login('john@company.com');
47
+ // User receives magic link in email...
48
+
49
+ // After user clicks magic link, set session
50
+ client.initializeWithSession(sessionData);
51
+
52
+ // Generate API key
53
+ const apiKey = await client.auth.generateApiKey();
54
+ client.initializeWithApiKey(apiKey.key);
55
+
56
+ // Create mobile money customer
57
+ const customer = await client.mobileMoney.createCustomer({
58
+ phone_number: '+254700123456',
59
+ country_code: 'KEN',
60
+ network: 'MPESA',
61
+ account_name: 'John Doe'
62
+ });
63
+ ```
64
+
65
+ ## Authentication Flow
66
+
67
+ KotaniPay uses a magic link authentication system:
68
+
69
+ 1. **Send Magic Link**: Call `client.auth.login(email)`
70
+ 2. **User Action**: User clicks verification link in email
71
+ 3. **Get Session Data**: Copy JSON response from browser
72
+ 4. **Initialize Session**: Call `client.initializeWithSession(sessionData)`
73
+ 5. **Generate API Key**: Call `client.auth.generateApiKey()`
74
+ 6. **Ready**: Use authenticated endpoints
75
+
76
+ ### Example Session Data
77
+
78
+ When user clicks the magic link, they'll see JSON like this:
79
+
80
+ ```json
81
+ {
82
+ "success": true,
83
+ "message": "ok",
84
+ "data": {
85
+ "user_id": "66262fda6c7024bcf925636f",
86
+ "session_id": "8d1d3429b8075d53993c58a3a1b3bcec",
87
+ "token_id": "PrsCEicJ",
88
+ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
89
+ "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
90
+ }
91
+ }
92
+ ```
93
+
94
+ Pass the `data` object to `initializeWithSession()`.
95
+
96
+ ## API Reference
97
+
98
+ ### Client Initialization
99
+
100
+ ```typescript
101
+ const client = new KotaniPayClient({
102
+ environment: 'sandbox' | 'production',
103
+ timeout?: number,
104
+ apiKey?: string // Optional: for direct API key usage
105
+ });
106
+ ```
107
+
108
+ ### Integrator Management
109
+
110
+ ```typescript
111
+ // Create integrator (no auth required)
112
+ await client.integrator.create({
113
+ organization: string,
114
+ product_name: string,
115
+ first_name: string,
116
+ last_name: string,
117
+ email: string,
118
+ phone: string,
119
+ country_code: string
120
+ });
121
+
122
+ // Get integrator by ID (requires auth)
123
+ await client.integrator.getById(id);
124
+ ```
125
+
126
+ ### Authentication
127
+
128
+ ```typescript
129
+ // Send magic link
130
+ await client.auth.login(email);
131
+
132
+ // Set session after magic link click
133
+ client.initializeWithSession(sessionData);
134
+
135
+ // Generate API key
136
+ await client.auth.generateApiKey();
137
+
138
+ // Set API key directly
139
+ client.initializeWithApiKey(apiKey);
140
+
141
+ // Check authentication status
142
+ client.isAuthenticated();
143
+ ```
144
+
145
+ ### Mobile Money
146
+
147
+ ```typescript
148
+ // Create customer (requires auth)
149
+ await client.mobileMoney.createCustomer({
150
+ phone_number: string,
151
+ country_code: 'GHA' | 'KEN' | 'ZAC' | 'CIV' | ...,
152
+ network?: 'MPESA' | 'MTN' | 'AIRTEL' | ...,
153
+ account_name?: string
154
+ });
155
+
156
+ // Get all customers (requires auth)
157
+ await client.mobileMoney.getAllCustomers();
158
+
159
+ // Get customer by ID (requires auth)
160
+ await client.mobileMoney.getCustomerById(id);
161
+ ```
162
+
163
+ ## Supported Countries & Networks
164
+
165
+ ### Countries
166
+
167
+ - 🇬🇭 Ghana (GHA)
168
+ - 🇰🇪 Kenya (KEN)
169
+ - 🇿🇦 South Africa (ZAC)
170
+ - 🇨🇮 Ivory Coast (CIV)
171
+ - 🇿🇲 Zambia (ZMB)
172
+ - And more...
173
+
174
+ ### Networks
175
+
176
+ - M-Pesa
177
+ - MTN Mobile Money
178
+ - Airtel Money
179
+ - Vodafone Cash
180
+ - Tigo Pesa
181
+ - Orange Money
182
+
183
+ ## Error Handling
184
+
185
+ ```typescript
186
+ import { ValidationError, AuthenticationError, KotaniPayError } from '@kotanipay/sdk';
187
+
188
+ try {
189
+ await client.mobileMoney.createCustomer(customerData);
190
+ } catch (error) {
191
+ if (error instanceof ValidationError) {
192
+ console.log('Validation error:', error.message);
193
+ } else if (error instanceof AuthenticationError) {
194
+ console.log('Auth error:', error.message);
195
+ } else if (error instanceof KotaniPayError) {
196
+ console.log('API error:', error.message, error.statusCode);
197
+ }
198
+ }
199
+ ```
200
+
201
+ ## Environment Variables
202
+
203
+ For server-side usage, you can set:
204
+
205
+ ```bash
206
+ KOTANIPAY_API_KEY=your-api-key
207
+ KOTANIPAY_ENVIRONMENT=sandbox
208
+ ```
209
+
210
+ ## Examples
211
+
212
+ ### React Integration
213
+
214
+ ```typescript
215
+ import React, { useState } from 'react';
216
+ import { KotaniPayClient } from '@kotanipay/sdk';
217
+
218
+ function PaymentComponent() {
219
+ const [client] = useState(() => new KotaniPayClient({
220
+ environment: 'sandbox'
221
+ }));
222
+
223
+ const [authStatus, setAuthStatus] = useState('idle');
224
+
225
+ const handleLogin = async (email: string) => {
226
+ try {
227
+ setAuthStatus('sending');
228
+ await client.auth.login(email);
229
+ setAuthStatus('waiting'); // Wait for user to click magic link
230
+ } catch (error) {
231
+ setAuthStatus('error');
232
+ }
233
+ };
234
+
235
+ const handleSessionData = async (sessionData: any) => {
236
+ try {
237
+ client.initializeWithSession(sessionData);
238
+ const apiKey = await client.auth.generateApiKey();
239
+ client.initializeWithApiKey(apiKey.key);
240
+ setAuthStatus('authenticated');
241
+ } catch (error) {
242
+ setAuthStatus('error');
243
+ }
244
+ };
245
+
246
+ return (
247
+ <div>
248
+ {authStatus === 'idle' && (
249
+ <button onClick={() => handleLogin('user@example.com')}>
250
+ Login with Email
251
+ </button>
252
+ )}
253
+ {authStatus === 'waiting' && (
254
+ <div>
255
+ <p>Magic link sent! Check your email.</p>
256
+ <textarea
257
+ placeholder="Paste session data here..."
258
+ onChange={(e) => {
259
+ try {
260
+ const data = JSON.parse(e.target.value);
261
+ handleSessionData(data.data);
262
+ } catch {}
263
+ }}
264
+ />
265
+ </div>
266
+ )}
267
+ {authStatus === 'authenticated' && (
268
+ <p>Ready to make payments!</p>
269
+ )}
270
+ </div>
271
+ );
272
+ }
273
+ ```
274
+
275
+ ### Node.js Integration
276
+
277
+ ```typescript
278
+ import { KotaniPayClient } from '@kotanipay/sdk';
279
+
280
+ const client = new KotaniPayClient({
281
+ environment: 'sandbox',
282
+ apiKey: process.env.KOTANIPAY_API_KEY // If you already have an API key
283
+ });
284
+
285
+ async function processPayment() {
286
+ try {
287
+ // Create customer
288
+ const customer = await client.mobileMoney.createCustomer({
289
+ phone_number: '+254700123456',
290
+ country_code: 'KEN',
291
+ network: 'MPESA'
292
+ });
293
+
294
+ console.log('Customer created:', customer);
295
+ return customer;
296
+ } catch (error) {
297
+ console.error('Payment failed:', error);
298
+ throw error;
299
+ }
300
+ }
301
+ ```
302
+
303
+ ## Contributing
304
+
305
+ 1. Fork the repository
306
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
307
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
308
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
309
+ 5. Open a Pull Request
310
+
311
+ ## License
312
+
313
+ This project is licensed under the MIT License - see the LICENSE file for details.
314
+
315
+ ## Support
316
+
317
+ - 📧 **Email**: support@kotanipay.com
318
+ - 📖 **Documentation**: https://docs.kotanipay.com
319
+ - 🐛 **Issues**: https://github.com/kotanipay/sdk-typescript/issues
320
+
321
+ ## Changelog
322
+
323
+ ### v1.0.0
324
+
325
+ - Initial release
326
+ - Magic link authentication
327
+ - Integrator management
328
+ - Mobile money customer management
329
+ - TypeScript support
@@ -0,0 +1,2 @@
1
+ export * from './kotani-pay.client';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./kotani-pay.client"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC"}
@@ -0,0 +1,42 @@
1
+ import { IntegratorService } from '../modules/integrator';
2
+ import { AuthService } from '../modules/auth';
3
+ import { MobileMoneyService } from '../modules/mobile-money/mobile-money.service';
4
+ import { KotaniPayConfig, AuthenticatedSession } from '../types';
5
+ export declare class KotaniPayClient {
6
+ private httpClient;
7
+ integrator: IntegratorService;
8
+ auth: AuthService;
9
+ mobileMoney: MobileMoneyService;
10
+ constructor(config: KotaniPayConfig);
11
+ /**
12
+ * Initialize client with session data after user login
13
+ */
14
+ initializeWithSession(sessionData: AuthenticatedSession): void;
15
+ /**
16
+ * Initialize client with API key (for authenticated operations)
17
+ */
18
+ initializeWithApiKey(apiKey: string): void;
19
+ healthCheck(): Promise<{
20
+ status: string;
21
+ timestamp: string;
22
+ }>;
23
+ getConfig(): {
24
+ environment: string;
25
+ baseURL: string;
26
+ };
27
+ getVersion(): string;
28
+ /**
29
+ * Check if client is authenticated
30
+ */
31
+ isAuthenticated(): boolean;
32
+ /**
33
+ * Get authentication status with detailed info
34
+ */
35
+ getAuthStatus(): {
36
+ isAuthenticated: boolean;
37
+ hasSession: boolean;
38
+ hasApiKey: boolean;
39
+ tokenInfo?: any;
40
+ };
41
+ }
42
+ //# sourceMappingURL=kotani-pay.client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kotani-pay.client.d.ts","sourceRoot":"","sources":["../../../src/client/kotani-pay.client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEjE,qBAAa,eAAe;IAC1B,OAAO,CAAC,UAAU,CAAiB;IAC5B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,kBAAkB,CAAC;gBAE3B,MAAM,EAAE,eAAe;IAUnC;;OAEG;IACH,qBAAqB,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI;IAI9D;;OAEG;IACH,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIpC,WAAW,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAKnE,SAAS,IAAI;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAIrD,UAAU,IAAI,MAAM;IAIpB;;OAEG;IACH,eAAe,IAAI,OAAO;IAI1B;;OAEG;IACH,aAAa,IAAI;QACf,eAAe,EAAE,OAAO,CAAC;QACzB,UAAU,EAAE,OAAO,CAAC;QACpB,SAAS,EAAE,OAAO,CAAC;QACnB,SAAS,CAAC,EAAE,GAAG,CAAC;KACjB;CAYF"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.KotaniPayClient = void 0;
4
+ const http_client_util_1 = require("../utils/http-client.util");
5
+ const integrator_1 = require("../modules/integrator");
6
+ const auth_1 = require("../modules/auth");
7
+ const mobile_money_service_1 = require("../modules/mobile-money/mobile-money.service");
8
+ class KotaniPayClient {
9
+ constructor(config) {
10
+ // Create HTTP client with config
11
+ this.httpClient = new http_client_util_1.HttpClientUtil(config);
12
+ // Initialize services
13
+ this.integrator = new integrator_1.IntegratorService(this.httpClient);
14
+ this.auth = new auth_1.AuthService(this.httpClient);
15
+ this.mobileMoney = new mobile_money_service_1.MobileMoneyService(this.httpClient);
16
+ }
17
+ /**
18
+ * Initialize client with session data after user login
19
+ */
20
+ initializeWithSession(sessionData) {
21
+ this.auth.setSession(sessionData);
22
+ }
23
+ /**
24
+ * Initialize client with API key (for authenticated operations)
25
+ */
26
+ initializeWithApiKey(apiKey) {
27
+ this.httpClient.setAuthToken(apiKey, 'Bearer');
28
+ }
29
+ async healthCheck() {
30
+ const response = await this.httpClient.get('/health');
31
+ return response;
32
+ }
33
+ getConfig() {
34
+ return this.httpClient.getConfig();
35
+ }
36
+ getVersion() {
37
+ return '1.0.0';
38
+ }
39
+ /**
40
+ * Check if client is authenticated
41
+ */
42
+ isAuthenticated() {
43
+ return this.auth.isAuthenticated() || !!this.httpClient.getAuthToken();
44
+ }
45
+ /**
46
+ * Get authentication status with detailed info
47
+ */
48
+ getAuthStatus() {
49
+ const hasSession = !!this.auth.getSession();
50
+ const hasApiKey = !!this.httpClient.getAuthToken();
51
+ const tokenInfo = this.auth.getTokenInfo ? this.auth.getTokenInfo() : null;
52
+ return {
53
+ isAuthenticated: this.isAuthenticated(),
54
+ hasSession,
55
+ hasApiKey,
56
+ tokenInfo
57
+ };
58
+ }
59
+ }
60
+ exports.KotaniPayClient = KotaniPayClient;
61
+ //# sourceMappingURL=kotani-pay.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kotani-pay.client.js","sourceRoot":"","sources":["../../../src/client/kotani-pay.client.ts"],"names":[],"mappings":";;;AACA,gEAA2D;AAC3D,sDAA0D;AAC1D,0CAA8C;AAC9C,uFAAkF;AAGlF,MAAa,eAAe;IAM1B,YAAY,MAAuB;QACjC,iCAAiC;QACjC,IAAI,CAAC,UAAU,GAAG,IAAI,iCAAc,CAAC,MAAM,CAAC,CAAC;QAE7C,sBAAsB;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,8BAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,kBAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,IAAI,yCAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,qBAAqB,CAAC,WAAiC;QACrD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,MAAc;QACjC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,WAAW;QACf,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAwC,SAAS,CAAC,CAAC;QAC7F,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;IACrC,CAAC;IAED,UAAU;QACR,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;IACzE,CAAC;IAED;;OAEG;IACH,aAAa;QAMX,MAAM,UAAU,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QAC5C,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC;QACnD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAE3E,OAAO;YACL,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE;YACvC,UAAU;YACV,SAAS;YACT,SAAS;SACV,CAAC;IACJ,CAAC;CACF;AAtED,0CAsEC"}
@@ -0,0 +1,2 @@
1
+ export * from './kotani-pay.exception';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./kotani-pay.exception"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exceptions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC"}
@@ -0,0 +1,31 @@
1
+ export declare enum HttpStatus {
2
+ OK = 200,
3
+ CREATED = 201,
4
+ BAD_REQUEST = 400,
5
+ UNAUTHORIZED = 401,
6
+ FORBIDDEN = 403,
7
+ NOT_FOUND = 404,
8
+ INTERNAL_SERVER_ERROR = 500
9
+ }
10
+ export declare class KotaniPayException extends Error {
11
+ readonly status: HttpStatus;
12
+ readonly errorCode?: string;
13
+ readonly details?: any;
14
+ readonly timestamp: string;
15
+ constructor(message: string, status?: HttpStatus, errorCode?: string, details?: any);
16
+ toJSON(): {
17
+ name: string;
18
+ message: string;
19
+ status: HttpStatus;
20
+ errorCode: string | undefined;
21
+ details: any;
22
+ timestamp: string;
23
+ };
24
+ }
25
+ export declare class ValidationException extends KotaniPayException {
26
+ constructor(message: string, details?: any);
27
+ }
28
+ export declare class AuthenticationException extends KotaniPayException {
29
+ constructor(message?: string);
30
+ }
31
+ //# sourceMappingURL=kotani-pay.exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kotani-pay.exception.d.ts","sourceRoot":"","sources":["../../../src/exceptions/kotani-pay.exception.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,EAAE,MAAM;IACR,OAAO,MAAM;IACb,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,qBAAqB,MAAM;CAC5B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,SAAgB,MAAM,EAAE,UAAU,CAAC;IACnC,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnC,SAAgB,OAAO,CAAC,EAAE,GAAG,CAAC;IAC9B,SAAgB,SAAS,EAAE,MAAM,CAAC;gBAGhC,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,UAA6C,EACrD,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,GAAG;IAUf,MAAM;;;;;;;;CAUP;AAED,qBAAa,mBAAoB,SAAQ,kBAAkB;gBAC7C,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;CAI3C;AAED,qBAAa,uBAAwB,SAAQ,kBAAkB;gBACjD,OAAO,GAAE,MAAgC;CAItD"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthenticationException = exports.ValidationException = exports.KotaniPayException = exports.HttpStatus = void 0;
4
+ var HttpStatus;
5
+ (function (HttpStatus) {
6
+ HttpStatus[HttpStatus["OK"] = 200] = "OK";
7
+ HttpStatus[HttpStatus["CREATED"] = 201] = "CREATED";
8
+ HttpStatus[HttpStatus["BAD_REQUEST"] = 400] = "BAD_REQUEST";
9
+ HttpStatus[HttpStatus["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
10
+ HttpStatus[HttpStatus["FORBIDDEN"] = 403] = "FORBIDDEN";
11
+ HttpStatus[HttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
12
+ HttpStatus[HttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
13
+ })(HttpStatus || (exports.HttpStatus = HttpStatus = {}));
14
+ class KotaniPayException extends Error {
15
+ constructor(message, status = HttpStatus.INTERNAL_SERVER_ERROR, errorCode, details) {
16
+ super(message);
17
+ this.name = 'KotaniPayException';
18
+ this.status = status;
19
+ this.errorCode = errorCode;
20
+ this.details = details;
21
+ this.timestamp = new Date().toISOString();
22
+ }
23
+ toJSON() {
24
+ return {
25
+ name: this.name,
26
+ message: this.message,
27
+ status: this.status,
28
+ errorCode: this.errorCode,
29
+ details: this.details,
30
+ timestamp: this.timestamp,
31
+ };
32
+ }
33
+ }
34
+ exports.KotaniPayException = KotaniPayException;
35
+ class ValidationException extends KotaniPayException {
36
+ constructor(message, details) {
37
+ super(message, HttpStatus.BAD_REQUEST, 'VALIDATION_ERROR', details);
38
+ this.name = 'ValidationException';
39
+ }
40
+ }
41
+ exports.ValidationException = ValidationException;
42
+ class AuthenticationException extends KotaniPayException {
43
+ constructor(message = 'Authentication failed') {
44
+ super(message, HttpStatus.UNAUTHORIZED, 'AUTHENTICATION_ERROR');
45
+ this.name = 'AuthenticationException';
46
+ }
47
+ }
48
+ exports.AuthenticationException = AuthenticationException;
49
+ //# sourceMappingURL=kotani-pay.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kotani-pay.exception.js","sourceRoot":"","sources":["../../../src/exceptions/kotani-pay.exception.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAQX;AARD,WAAY,UAAU;IACpB,yCAAQ,CAAA;IACR,mDAAa,CAAA;IACb,2DAAiB,CAAA;IACjB,6DAAkB,CAAA;IAClB,uDAAe,CAAA;IACf,uDAAe,CAAA;IACf,+EAA2B,CAAA;AAC7B,CAAC,EARW,UAAU,0BAAV,UAAU,QAQrB;AAED,MAAa,kBAAmB,SAAQ,KAAK;IAM3C,YACE,OAAe,EACf,SAAqB,UAAU,CAAC,qBAAqB,EACrD,SAAkB,EAClB,OAAa;QAEb,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC5C,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;IACJ,CAAC;CACF;AA9BD,gDA8BC;AAED,MAAa,mBAAoB,SAAQ,kBAAkB;IACzD,YAAY,OAAe,EAAE,OAAa;QACxC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,WAAW,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC;AAED,MAAa,uBAAwB,SAAQ,kBAAkB;IAC7D,YAAY,UAAkB,uBAAuB;QACnD,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AALD,0DAKC"}
@@ -0,0 +1,6 @@
1
+ export { KotaniPayClient } from './client';
2
+ export * from './modules';
3
+ export * from './types';
4
+ export * from './utils';
5
+ export { KotaniPayClient as default } from './client';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.default = exports.KotaniPayClient = void 0;
18
+ var client_1 = require("./client");
19
+ Object.defineProperty(exports, "KotaniPayClient", { enumerable: true, get: function () { return client_1.KotaniPayClient; } });
20
+ __exportStar(require("./modules"), exports);
21
+ __exportStar(require("./types"), exports);
22
+ __exportStar(require("./utils"), exports);
23
+ var client_2 = require("./client");
24
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_2.KotaniPayClient; } });
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AACxB,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AAGxB,mCAAsD;AAA7C,iGAAA,eAAe,OAAW"}
@@ -0,0 +1,37 @@
1
+ import { HttpClientUtil } from '../../utils/http-client.util';
2
+ import { LoginResponse, ApiKeyResponse, GenerateApiKeyRequest, AuthenticatedSession } from '../../types';
3
+ export declare class AuthService {
4
+ private httpClient;
5
+ private session?;
6
+ constructor(httpClient: HttpClientUtil);
7
+ /**
8
+ * Login with email - sends login link to email
9
+ */
10
+ login(email: string): Promise<LoginResponse>;
11
+ /**
12
+ * Set session data after user clicks login link
13
+ */
14
+ setSession(sessionData: AuthenticatedSession): void;
15
+ /**
16
+ * Generate API key using the JWT token from login
17
+ */
18
+ generateApiKey(request?: GenerateApiKeyRequest): Promise<ApiKeyResponse>;
19
+ /**
20
+ * Refresh the JWT token using refresh token
21
+ */
22
+ refreshToken(): Promise<AuthenticatedSession>;
23
+ /**
24
+ * Get current session data
25
+ */
26
+ getSession(): AuthenticatedSession | undefined;
27
+ getTokenInfo(): any;
28
+ /**
29
+ * Check if user is authenticated
30
+ */
31
+ isAuthenticated(): boolean;
32
+ /**
33
+ * Logout and clear session
34
+ */
35
+ logout(): void;
36
+ }
37
+ //# sourceMappingURL=auth.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/auth/auth.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EACL,aAAa,EAEb,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AAErB,qBAAa,WAAW;IAGV,OAAO,CAAC,UAAU;IAF9B,OAAO,CAAC,OAAO,CAAC,CAAuB;gBAEnB,UAAU,EAAE,cAAc;IAE9C;;OAEG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAelD;;OAEG;IACH,UAAU,CAAC,WAAW,EAAE,oBAAoB,GAAG,IAAI;IAMnD;;OAEG;IACG,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC;IAY9E;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAgBnD;;OAEG;IACH,UAAU,IAAI,oBAAoB,GAAG,SAAS;IAI7C,YAAY,IAAI,GAAG;IAIpB;;OAEG;IACH,eAAe,IAAI,OAAO;IAI1B;;OAEG;IACH,MAAM,IAAI,IAAI;CAIf"}