@hawcx/oauth-client 0.2.0 → 4.0.1

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 (71) hide show
  1. package/README.md +475 -210
  2. package/dist/delegation/credentials.d.ts +92 -0
  3. package/dist/delegation/credentials.d.ts.map +1 -0
  4. package/dist/delegation/credentials.js +215 -0
  5. package/dist/delegation/credentials.js.map +1 -0
  6. package/dist/delegation/crypto.d.ts +2 -2
  7. package/dist/delegation/crypto.d.ts.map +1 -1
  8. package/dist/delegation/crypto.js +41 -32
  9. package/dist/delegation/crypto.js.map +1 -1
  10. package/dist/delegation/exceptions.d.ts +12 -5
  11. package/dist/delegation/exceptions.d.ts.map +1 -1
  12. package/dist/delegation/exceptions.js +12 -14
  13. package/dist/delegation/exceptions.js.map +1 -1
  14. package/dist/delegation/factory.d.ts +20 -0
  15. package/dist/delegation/factory.d.ts.map +1 -0
  16. package/dist/delegation/factory.js +49 -0
  17. package/dist/delegation/factory.js.map +1 -0
  18. package/dist/delegation/hawcx.d.ts +67 -224
  19. package/dist/delegation/hawcx.d.ts.map +1 -1
  20. package/dist/delegation/hawcx.js +116 -299
  21. package/dist/delegation/hawcx.js.map +1 -1
  22. package/dist/delegation/index.d.ts +4 -9
  23. package/dist/delegation/index.d.ts.map +1 -1
  24. package/dist/delegation/index.js +5 -17
  25. package/dist/delegation/index.js.map +1 -1
  26. package/dist/delegation/transport.d.ts +40 -0
  27. package/dist/delegation/transport.d.ts.map +1 -0
  28. package/dist/delegation/transport.js +120 -0
  29. package/dist/delegation/transport.js.map +1 -0
  30. package/dist/errors.d.ts +14 -0
  31. package/dist/errors.d.ts.map +1 -0
  32. package/dist/errors.js +29 -0
  33. package/dist/errors.js.map +1 -0
  34. package/dist/index.d.ts +10 -15
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +15 -27
  37. package/dist/index.js.map +1 -1
  38. package/dist/oauth.d.ts +98 -0
  39. package/dist/oauth.d.ts.map +1 -0
  40. package/dist/oauth.js +150 -0
  41. package/dist/oauth.js.map +1 -0
  42. package/dist/stepup/client.d.ts +26 -0
  43. package/dist/stepup/client.d.ts.map +1 -0
  44. package/dist/stepup/client.js +84 -0
  45. package/dist/stepup/client.js.map +1 -0
  46. package/dist/stepup/index.d.ts +3 -0
  47. package/dist/stepup/index.d.ts.map +1 -0
  48. package/dist/stepup/index.js +19 -0
  49. package/dist/stepup/index.js.map +1 -0
  50. package/dist/stepup/types.d.ts +36 -0
  51. package/dist/stepup/types.d.ts.map +1 -0
  52. package/dist/stepup/types.js +3 -0
  53. package/dist/stepup/types.js.map +1 -0
  54. package/package.json +16 -17
  55. package/LICENSE +0 -22
  56. package/dist/client.d.ts +0 -134
  57. package/dist/client.d.ts.map +0 -1
  58. package/dist/client.js +0 -300
  59. package/dist/client.js.map +0 -1
  60. package/dist/delegation/client.d.ts +0 -116
  61. package/dist/delegation/client.d.ts.map +0 -1
  62. package/dist/delegation/client.js +0 -227
  63. package/dist/delegation/client.js.map +0 -1
  64. package/dist/exceptions.d.ts +0 -52
  65. package/dist/exceptions.d.ts.map +0 -1
  66. package/dist/exceptions.js +0 -81
  67. package/dist/exceptions.js.map +0 -1
  68. package/dist/utils.d.ts +0 -61
  69. package/dist/utils.d.ts.map +0 -1
  70. package/dist/utils.js +0 -263
  71. package/dist/utils.js.map +0 -1
@@ -1,152 +1,132 @@
1
1
  "use strict";
2
2
  /**
3
- * Hawcx-specific delegation client with high-level convenience methods.
4
- *
5
- * This module provides a streamlined API for common Hawcx operations like
6
- * MFA configuration, user management, and device operations. All cryptographic
7
- * operations (encryption, signing, verification) are handled automatically.
3
+ * Hawcx delegation client with ergonomic, high-level operations.
8
4
  */
9
5
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.HawcxDelegationClient = exports.MfaMethod = void 0;
11
- const client_1 = require("./client");
12
- const crypto_1 = require("./crypto");
6
+ exports.DelegationClient = exports.MfaMethod = void 0;
7
+ const factory_1 = require("./factory");
13
8
  const exceptions_1 = require("./exceptions");
14
- /**
15
- * Supported MFA methods for Hawcx authentication.
16
- *
17
- * This enum ensures type safety and prevents typos when specifying MFA methods.
18
- *
19
- * @example
20
- * ```typescript
21
- * import { MfaMethod } from '@hawcx/oauth-client';
22
- *
23
- * // Use enum for type safety
24
- * await client.initiateMfaChange({
25
- * userid: "user@example.com",
26
- * mfaMethod: MfaMethod.SMS, // Type-safe!
27
- * phoneNumber: "+15551234567"
28
- * });
29
- *
30
- * // String values still work for backwards compatibility
31
- * await client.initiateMfaChange({
32
- * userid: "user@example.com",
33
- * mfaMethod: "sms", // Also works
34
- * phoneNumber: "+15551234567"
35
- * });
36
- * ```
37
- */
38
9
  var MfaMethod;
39
10
  (function (MfaMethod) {
40
11
  MfaMethod["EMAIL"] = "email";
41
12
  MfaMethod["SMS"] = "sms";
42
13
  MfaMethod["TOTP"] = "totp";
43
14
  })(MfaMethod || (exports.MfaMethod = MfaMethod = {}));
44
- /**
45
- * High-level client for Hawcx delegation operations.
46
- *
47
- * This client provides simplified methods for common Hawcx operations:
48
- * - MFA configuration (email, SMS, TOTP)
49
- * - User credential management
50
- * - Device operations
51
- *
52
- * All requests are automatically encrypted (ECIES) and signed (Ed25519/RSA-PSS).
53
- * All responses are automatically verified and decrypted.
54
- *
55
- * @example
56
- * ```typescript
57
- * // Initialize from keys
58
- * const client = HawcxDelegationClient.fromKeys({
59
- * spSigningKey: process.env.SP_SIGNING_KEY!,
60
- * spEncryptionKey: process.env.SP_ENCRYPTION_KEY!,
61
- * idpVerifyKey: process.env.IDP_VERIFY_KEY!,
62
- * idpEncryptionKey: process.env.IDP_ENCRYPTION_KEY!,
63
- * baseUrl: 'https://example.hawcx.com',
64
- * spId: 'my-client-id'
65
- * });
66
- *
67
- * // Initiate SMS MFA setup
68
- * const result = await client.initiateMfaChange({
69
- * userid: "user@example.com",
70
- * mfaMethod: "sms",
71
- * phoneNumber: "+15551234567"
72
- * });
73
- * console.log(result.session_id);
74
- *
75
- * // Verify OTP
76
- * await client.verifyMfaChange({
77
- * userid: "user@example.com",
78
- * sessionId: result.session_id,
79
- * otp: "123456"
80
- * });
81
- * ```
82
- */
83
- class HawcxDelegationClient {
15
+ class DelegationClient {
84
16
  constructor(options) {
85
- this.client = new client_1.IdpDelegationClient({
86
- baseUrl: options.baseUrl,
87
- signer: options.signer,
88
- verifier: options.verifier,
89
- encryptor: options.encryptor,
90
- decryptor: options.decryptor,
91
- spId: options.spId,
92
- timeout: options.timeout,
93
- });
17
+ this.mfa = {
18
+ initiate: async (options) => {
19
+ const { userId, mfaMethod, phoneNumber, mfaChangeTo } = options;
20
+ const mfaMethodStr = typeof mfaMethod === 'string' ? mfaMethod : String(mfaMethod);
21
+ const mfaChangeToStr = mfaChangeTo ? String(mfaChangeTo) : undefined;
22
+ const validMethods = [MfaMethod.EMAIL, MfaMethod.SMS, MfaMethod.TOTP];
23
+ if (!validMethods.includes(mfaMethodStr)) {
24
+ throw new exceptions_1.DelegationRequestError(`Invalid mfa_method '${mfaMethodStr}'. Must be one of: ${validMethods.join(', ')}`);
25
+ }
26
+ if (mfaMethodStr === MfaMethod.SMS && !phoneNumber) {
27
+ throw new exceptions_1.DelegationRequestError('phoneNumber is required for SMS MFA');
28
+ }
29
+ const payload = {
30
+ userid: userId,
31
+ mfa_method: mfaMethodStr,
32
+ };
33
+ if (mfaMethodStr === MfaMethod.SMS && phoneNumber) {
34
+ payload.contact = phoneNumber;
35
+ }
36
+ if (mfaChangeToStr) {
37
+ payload.mfa_change_to = mfaChangeToStr;
38
+ }
39
+ return await this.request({
40
+ endpoint: '/hc_auth/v5/update/initiate',
41
+ payload,
42
+ });
43
+ },
44
+ verify: async (options) => {
45
+ const { userId, sessionId, otp } = options;
46
+ if (otp?.length !== 6 || !/^\d{6}$/.test(otp)) {
47
+ throw new exceptions_1.DelegationRequestError('OTP must be a 6-digit code');
48
+ }
49
+ const payload = {
50
+ userid: userId,
51
+ session_id: sessionId,
52
+ otp,
53
+ };
54
+ return await this.request({
55
+ endpoint: '/hc_auth/v5/update/verify',
56
+ payload,
57
+ });
58
+ },
59
+ };
60
+ this.users = {
61
+ getCredentials: async (userId) => {
62
+ const payload = { userid: userId };
63
+ return await this.request({
64
+ endpoint: '/hc_auth/v5/update/get-creds',
65
+ payload,
66
+ });
67
+ },
68
+ getPhone: async (userId) => {
69
+ const payload = { userid: userId };
70
+ return await this.request({
71
+ endpoint: '/hc_auth/v5/management/users/phone',
72
+ payload,
73
+ });
74
+ },
75
+ updatePhone: async (options) => {
76
+ const payload = {
77
+ userid: options.userId,
78
+ new_phone_number: options.newPhoneNumber,
79
+ };
80
+ return await this.request({
81
+ endpoint: '/hc_auth/v5/management/users/phone',
82
+ payload,
83
+ });
84
+ },
85
+ };
86
+ this.devices = {
87
+ list: async (userId) => {
88
+ const payload = { userid: userId };
89
+ return await this.request({
90
+ endpoint: '/hc_auth/v5/manage/devices',
91
+ payload,
92
+ });
93
+ },
94
+ revoke: async (options) => {
95
+ const payload = { userid: options.userId, h2index: options.deviceId };
96
+ return await this.request({
97
+ endpoint: '/hc_auth/v5/manage/revoke',
98
+ payload,
99
+ });
100
+ },
101
+ unrevoke: async (options) => {
102
+ const payload = { userid: options.userId, h2index: options.deviceId };
103
+ return await this.request({
104
+ endpoint: '/hc_auth/v5/manage/unrevoke',
105
+ payload,
106
+ });
107
+ },
108
+ delete: async (options) => {
109
+ const payload = { userid: options.userId, h2index: options.deviceId };
110
+ return await this.request({
111
+ endpoint: '/hc_auth/v5/manage/delete',
112
+ payload,
113
+ });
114
+ },
115
+ };
116
+ this.transport = options.transport;
94
117
  this.apiKey = options.apiKey;
95
118
  this.baseUrl = options.baseUrl;
96
- this.spId = options.spId;
97
119
  }
98
- /**
99
- * Create client from explicit key values (recommended).
100
- *
101
- * This method allows the application to load keys from any source
102
- * (env vars, config files, secrets manager, etc.) and pass them
103
- * as values to the SDK.
104
- *
105
- * @param options - Configuration options
106
- * @returns Configured HawcxDelegationClient instance
107
- * @throws DelegationRequestError if key initialization fails
108
- *
109
- * @example
110
- * ```typescript
111
- * import * as process from 'process';
112
- *
113
- * // App controls how to load keys
114
- * const client = HawcxDelegationClient.fromKeys({
115
- * spSigningKey: process.env.MY_SIGNING_KEY!,
116
- * spEncryptionKey: process.env.MY_ENCRYPTION_KEY!,
117
- * idpVerifyKey: process.env.IDP_VERIFY_KEY!,
118
- * idpEncryptionKey: process.env.IDP_ENCRYPT_KEY!,
119
- * baseUrl: process.env.HAWCX_URL!,
120
- * spId: process.env.MY_CLIENT_ID!
121
- * });
122
- * ```
123
- */
120
+ static fromSecretKey(options) {
121
+ const { apiKey, baseUrl } = options;
122
+ const transport = (0, factory_1.buildTransportFromSecretKey)(options);
123
+ return new DelegationClient({ transport, apiKey, baseUrl });
124
+ }
124
125
  static fromKeys(options) {
125
- const { spSigningKey, spEncryptionKey, idpVerifyKey, idpEncryptionKey, baseUrl, spId, apiKey, timeout = 15, kid = 'hawcx', idpKid = 'hawcx', } = options;
126
- try {
127
- const signer = new crypto_1.Ed25519Signer(spSigningKey, kid);
128
- const verifier = new crypto_1.Verifier({ [idpKid]: idpVerifyKey });
129
- const encryptor = new crypto_1.EciesX25519Encryptor(idpEncryptionKey);
130
- const decryptor = new crypto_1.EciesX25519Decryptor(spEncryptionKey);
131
- console.log(`Initialized HawcxDelegationClient with base_url=${baseUrl}, sp_id=${spId}`);
132
- return new HawcxDelegationClient({
133
- baseUrl,
134
- signer,
135
- verifier,
136
- encryptor,
137
- decryptor,
138
- spId,
139
- apiKey,
140
- timeout,
141
- });
142
- }
143
- catch (error) {
144
- throw new exceptions_1.DelegationRequestError(`Failed to initialize crypto helpers: ${error}`);
145
- }
126
+ const { apiKey, baseUrl } = options;
127
+ const transport = (0, factory_1.buildTransportFromKeys)(options);
128
+ return new DelegationClient({ transport, apiKey, baseUrl });
146
129
  }
147
- /**
148
- * Build Hawcx API authentication headers
149
- */
150
130
  buildAuthHeaders() {
151
131
  const headers = {};
152
132
  if (this.apiKey) {
@@ -154,173 +134,10 @@ class HawcxDelegationClient {
154
134
  }
155
135
  return headers;
156
136
  }
157
- /**
158
- * Initiate MFA setup or change for a user.
159
- *
160
- * This method starts the MFA enrollment/update process by sending an OTP
161
- * to the user via their chosen method (email, SMS, or generating a TOTP secret).
162
- *
163
- * @param options - MFA initiation configuration
164
- * @returns Dictionary containing session_id and optional TOTP details
165
- * @throws DelegationRequestError if request fails or parameters are invalid
166
- * @throws Error if SMS method specified without phone_number
167
- *
168
- * @example
169
- * ```typescript
170
- * import { MfaMethod } from '@hawcx/oauth-client';
171
- *
172
- * // Email MFA (with enum - recommended!)
173
- * const result = await client.initiateMfaChange({
174
- * userid: "user@example.com",
175
- * mfaMethod: MfaMethod.EMAIL
176
- * });
177
- *
178
- * // SMS MFA (string also works)
179
- * const result = await client.initiateMfaChange({
180
- * userid: "user@example.com",
181
- * mfaMethod: "sms",
182
- * phoneNumber: "+15551234567"
183
- * });
184
- *
185
- * // TOTP MFA
186
- * const result = await client.initiateMfaChange({
187
- * userid: "user@example.com",
188
- * mfaMethod: MfaMethod.TOTP
189
- * });
190
- * console.log(`Scan QR code: ${result.otpauth_uri}`);
191
- * ```
192
- */
193
- async initiateMfaChange(options) {
194
- const { userid, mfaMethod, phoneNumber, mfaChangeTo } = options;
195
- // Convert enum to string if needed
196
- const mfaMethodStr = typeof mfaMethod === 'string' ? mfaMethod : String(mfaMethod);
197
- const mfaChangeToStr = mfaChangeTo
198
- ? typeof mfaChangeTo === 'string'
199
- ? mfaChangeTo
200
- : String(mfaChangeTo)
201
- : undefined;
202
- // Validate method
203
- const validMethods = [MfaMethod.EMAIL, MfaMethod.SMS, MfaMethod.TOTP];
204
- if (!validMethods.includes(mfaMethodStr)) {
205
- throw new Error(`Invalid mfa_method '${mfaMethodStr}'. Must be one of: ${validMethods.join(', ')}`);
206
- }
207
- // Validate SMS requires phone number
208
- if (mfaMethodStr === MfaMethod.SMS && !phoneNumber) {
209
- throw new Error('phone_number is required for SMS MFA');
210
- }
211
- // Build Hawcx UpdateTable API payload
212
- const payload = {
213
- userid,
214
- mfa_method: mfaMethodStr,
215
- };
216
- // Add SMS phone number
217
- if (mfaMethodStr === MfaMethod.SMS && phoneNumber) {
218
- payload.contact = phoneNumber;
219
- }
220
- // Add target method if changing
221
- if (mfaChangeToStr) {
222
- payload.mfa_change_to = mfaChangeToStr;
223
- }
224
- console.log(`[MFA Initiate] Method=${mfaMethodStr} for user=${userid}`);
225
- try {
226
- const response = await this.client.sendSecureRequest({
227
- endpoint: '/hc_auth/v5/update/initiate',
228
- payload,
229
- extraHeaders: this.buildAuthHeaders(),
230
- });
231
- console.log(`[MFA Initiate] Success for user=${userid}, session_id=${response.session_id}`);
232
- return response;
233
- }
234
- catch (error) {
235
- console.error(`[MFA Initiate] Failed for user=${userid}:`, error);
236
- throw error;
237
- }
238
- }
239
- /**
240
- * Verify OTP and complete MFA configuration change.
241
- *
242
- * This method verifies the OTP sent to the user and completes the MFA
243
- * enrollment/update process.
244
- *
245
- * @param options - MFA verification configuration
246
- * @returns Dictionary containing success message and optional mfa_changed_to
247
- * @throws DelegationRequestError if verification fails
248
- * @throws Error if OTP format is invalid
249
- *
250
- * @example
251
- * ```typescript
252
- * // Get OTP from user
253
- * const otp = getUserInput();
254
- *
255
- * // Verify and complete MFA setup
256
- * const result = await client.verifyMfaChange({
257
- * userid: "user@example.com",
258
- * sessionId: sessionId,
259
- * otp: otp
260
- * });
261
- * console.log(`MFA updated: ${result.detail}`);
262
- * ```
263
- */
264
- async verifyMfaChange(options) {
265
- const { userid, sessionId, otp } = options;
266
- // Validate OTP format
267
- if (!otp || otp.length !== 6 || !/^\d{6}$/.test(otp)) {
268
- throw new Error('OTP must be a 6-digit code');
269
- }
270
- // Build Hawcx UpdateTable API payload
271
- const payload = {
272
- userid,
273
- session_id: sessionId,
274
- otp,
275
- };
276
- console.log(`[MFA Verify] Verifying OTP for user=${userid}, session=${sessionId}`);
277
- try {
278
- const response = await this.client.sendSecureRequest({
279
- endpoint: '/hc_auth/v5/update/verify',
280
- payload,
281
- extraHeaders: this.buildAuthHeaders(),
282
- });
283
- console.log(`[MFA Verify] Success for user=${userid}`);
284
- return response;
285
- }
286
- catch (error) {
287
- console.error(`[MFA Verify] Failed for user=${userid}:`, error);
288
- throw error;
289
- }
290
- }
291
- /**
292
- * Get user's stored credentials and MFA status.
293
- *
294
- * This method retrieves the user's credentials from Hawcx, including
295
- * their current MFA configuration.
296
- *
297
- * @param userid - User identifier
298
- * @returns Dictionary containing user credentials and MFA status
299
- *
300
- * @example
301
- * ```typescript
302
- * const creds = await client.getUserCredentials("user@example.com");
303
- * console.log(`MFA method: ${creds.mfa_method}`);
304
- * console.log(`Phone: ${creds.contact}`);
305
- * ```
306
- */
307
- async getUserCredentials(userid) {
308
- const payload = { userid };
309
- console.log(`[Get Creds] Fetching credentials for user=${userid}`);
310
- try {
311
- const response = await this.client.sendSecureRequest({
312
- endpoint: '/hc_auth/v5/update/get-creds',
313
- payload,
314
- extraHeaders: this.buildAuthHeaders(),
315
- });
316
- console.log(`[Get Creds] Success for user=${userid}`);
317
- return response;
318
- }
319
- catch (error) {
320
- console.error(`[Get Creds] Failed for user=${userid}:`, error);
321
- throw error;
322
- }
137
+ async request(options) {
138
+ const headers = { ...this.buildAuthHeaders(), ...(options.headers ?? {}) };
139
+ return await this.transport.send({ ...options, headers });
323
140
  }
324
141
  }
325
- exports.HawcxDelegationClient = HawcxDelegationClient;
142
+ exports.DelegationClient = DelegationClient;
326
143
  //# sourceMappingURL=hawcx.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hawcx.js","sourceRoot":"","sources":["../../src/delegation/hawcx.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,qCAAuD;AACvD,qCAKkB;AAClB,6CAAsD;AAEtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAJW,S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C,MAAM,EAAE,CAAC;YAChB,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QAClC,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,OAAO,CACX,OAAuC;QAEvC,MAAM,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,gBAAgB,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;QAC3E,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAa,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;CAmHF;AAxJD,4CAwJC"}
@@ -1,14 +1,9 @@
1
1
  /**
2
2
  * Hawcx OAuth Client SDK - Delegation Module
3
- *
4
- * Exposes the client and utilities for making secure, backend-to-backend
5
- * delegated requests to an IDP.
6
- *
7
- * For Hawcx-specific operations, use HawcxDelegationClient for simplified high-level API.
8
- * For generic delegation operations, use IdpDelegationClient for lower-level control.
9
3
  */
10
- export { IdpDelegationClient } from './client';
11
- export { HawcxDelegationClient, MfaMethod } from './hawcx';
12
- export { Ed25519Signer, RsaPssSigner, Verifier, EciesX25519Encryptor, EciesX25519Decryptor, nowS, } from './crypto';
4
+ export { DelegationClient, MfaMethod, } from './hawcx';
5
+ export type { DelegationClientBaseOptions, DelegationClientSecretKeyOptions, DelegationClientKeyOptions, MfaInitiateOptions, MfaVerifyOptions, UpdatePhoneOptions, DeviceOperationOptions, DelegationRequestOptions, } from './hawcx';
6
+ export { parseHawcxSecretKey, generateCredentialBlob, } from './credentials';
7
+ export type { ParsedCredentials, HawcxCredentialBlob, } from './credentials';
13
8
  export { DelegationError, DelegationCryptoError, DelegationRequestError, DelegationResponseError, } from './exceptions';
14
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EACL,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,oBAAoB,EACpB,oBAAoB,EACpB,IAAI,GACL,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,gBAAgB,EAChB,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,2BAA2B,EAC3B,gCAAgC,EAChC,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,cAAc,CAAC"}
@@ -1,27 +1,15 @@
1
1
  "use strict";
2
2
  /**
3
3
  * Hawcx OAuth Client SDK - Delegation Module
4
- *
5
- * Exposes the client and utilities for making secure, backend-to-backend
6
- * delegated requests to an IDP.
7
- *
8
- * For Hawcx-specific operations, use HawcxDelegationClient for simplified high-level API.
9
- * For generic delegation operations, use IdpDelegationClient for lower-level control.
10
4
  */
11
5
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DelegationResponseError = exports.DelegationRequestError = exports.DelegationCryptoError = exports.DelegationError = exports.nowS = exports.EciesX25519Decryptor = exports.EciesX25519Encryptor = exports.Verifier = exports.RsaPssSigner = exports.Ed25519Signer = exports.MfaMethod = exports.HawcxDelegationClient = exports.IdpDelegationClient = void 0;
13
- var client_1 = require("./client");
14
- Object.defineProperty(exports, "IdpDelegationClient", { enumerable: true, get: function () { return client_1.IdpDelegationClient; } });
6
+ exports.DelegationResponseError = exports.DelegationRequestError = exports.DelegationCryptoError = exports.DelegationError = exports.generateCredentialBlob = exports.parseHawcxSecretKey = exports.MfaMethod = exports.DelegationClient = void 0;
15
7
  var hawcx_1 = require("./hawcx");
16
- Object.defineProperty(exports, "HawcxDelegationClient", { enumerable: true, get: function () { return hawcx_1.HawcxDelegationClient; } });
8
+ Object.defineProperty(exports, "DelegationClient", { enumerable: true, get: function () { return hawcx_1.DelegationClient; } });
17
9
  Object.defineProperty(exports, "MfaMethod", { enumerable: true, get: function () { return hawcx_1.MfaMethod; } });
18
- var crypto_1 = require("./crypto");
19
- Object.defineProperty(exports, "Ed25519Signer", { enumerable: true, get: function () { return crypto_1.Ed25519Signer; } });
20
- Object.defineProperty(exports, "RsaPssSigner", { enumerable: true, get: function () { return crypto_1.RsaPssSigner; } });
21
- Object.defineProperty(exports, "Verifier", { enumerable: true, get: function () { return crypto_1.Verifier; } });
22
- Object.defineProperty(exports, "EciesX25519Encryptor", { enumerable: true, get: function () { return crypto_1.EciesX25519Encryptor; } });
23
- Object.defineProperty(exports, "EciesX25519Decryptor", { enumerable: true, get: function () { return crypto_1.EciesX25519Decryptor; } });
24
- Object.defineProperty(exports, "nowS", { enumerable: true, get: function () { return crypto_1.nowS; } });
10
+ var credentials_1 = require("./credentials");
11
+ Object.defineProperty(exports, "parseHawcxSecretKey", { enumerable: true, get: function () { return credentials_1.parseHawcxSecretKey; } });
12
+ Object.defineProperty(exports, "generateCredentialBlob", { enumerable: true, get: function () { return credentials_1.generateCredentialBlob; } });
25
13
  var exceptions_1 = require("./exceptions");
26
14
  Object.defineProperty(exports, "DelegationError", { enumerable: true, get: function () { return exceptions_1.DelegationError; } });
27
15
  Object.defineProperty(exports, "DelegationCryptoError", { enumerable: true, get: function () { return exceptions_1.DelegationCryptoError; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,mCAA+C;AAAtC,6GAAA,mBAAmB,OAAA;AAC5B,iCAA2D;AAAlD,8GAAA,qBAAqB,OAAA;AAAE,kGAAA,SAAS,OAAA;AACzC,mCAOkB;AANhB,uGAAA,aAAa,OAAA;AACb,sGAAA,YAAY,OAAA;AACZ,kGAAA,QAAQ,OAAA;AACR,8GAAA,oBAAoB,OAAA;AACpB,8GAAA,oBAAoB,OAAA;AACpB,8FAAA,IAAI,OAAA;AAEN,2CAKsB;AAJpB,6GAAA,eAAe,OAAA;AACf,mHAAA,qBAAqB,OAAA;AACrB,oHAAA,sBAAsB,OAAA;AACtB,qHAAA,uBAAuB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delegation/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iCAGiB;AAFf,yGAAA,gBAAgB,OAAA;AAChB,kGAAA,SAAS,OAAA;AAaX,6CAGuB;AAFrB,kHAAA,mBAAmB,OAAA;AACnB,qHAAA,sBAAsB,OAAA;AAOxB,2CAKsB;AAJpB,6GAAA,eAAe,OAAA;AACf,mHAAA,qBAAqB,OAAA;AACrB,oHAAA,sBAAsB,OAAA;AACtB,qHAAA,uBAAuB,OAAA"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Secure transport for ECIES-encrypted and signed delegation requests.
3
+ */
4
+ import { Verifier, EciesX25519Encryptor, EciesX25519Decryptor, Ed25519Signer, RsaPssSigner } from './crypto';
5
+ export type Signer = Ed25519Signer | RsaPssSigner;
6
+ export type JsonObject = Record<string, unknown> | object;
7
+ export interface SecureRequestOptions<TPayload extends JsonObject> {
8
+ /** API endpoint path (e.g., "/mfa/update" or "/device/revoke") */
9
+ endpoint: string;
10
+ /** Request payload dictionary to be encrypted and sent */
11
+ payload: TPayload;
12
+ /** If true, prepends base_url to endpoint (default: true) */
13
+ includeBaseUrl?: boolean;
14
+ /** Optional additional HTTP headers (e.g., API keys) */
15
+ headers?: Record<string, string>;
16
+ }
17
+ export interface DelegationTransportOptions {
18
+ baseUrl: string;
19
+ signer: Signer;
20
+ verifier: Verifier;
21
+ encryptor: EciesX25519Encryptor;
22
+ decryptor: EciesX25519Decryptor;
23
+ timeoutSeconds?: number;
24
+ clockSkewSeconds?: number;
25
+ }
26
+ export declare class DelegationTransport {
27
+ private baseUrl;
28
+ private signer;
29
+ private verifier;
30
+ private encryptor;
31
+ private decryptor;
32
+ private timeoutSeconds;
33
+ private clockSkewSeconds;
34
+ constructor(options: DelegationTransportOptions);
35
+ /**
36
+ * Send an encrypted and signed delegation request to the IDP.
37
+ */
38
+ send<TReq extends JsonObject, TRes extends JsonObject>(options: SecureRequestOptions<TReq>): Promise<TRes>;
39
+ }
40
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/delegation/transport.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,QAAQ,EACR,oBAAoB,EACpB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACb,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,MAAM,GAAG,aAAa,GAAG,YAAY,CAAC;AAClD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;AAE1D,MAAM,WAAW,oBAAoB,CAAC,QAAQ,SAAS,UAAU;IAC/D,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,OAAO,EAAE,QAAQ,CAAC;IAClB,6DAA6D;IAC7D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,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