@nordsym/apiclaw 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.
Files changed (77) hide show
  1. package/AGENTS.md +50 -33
  2. package/README.md +22 -12
  3. package/SOUL.md +60 -19
  4. package/STATUS.md +91 -169
  5. package/convex/_generated/api.d.ts +6 -0
  6. package/convex/directCall.ts +598 -0
  7. package/convex/providers.ts +341 -26
  8. package/convex/schema.ts +87 -0
  9. package/convex/usage.ts +260 -0
  10. package/convex/waitlist.ts +55 -0
  11. package/data/combined-02-26.json +22102 -0
  12. package/data/night-expansion-02-26-06-batch2.json +1898 -0
  13. package/data/night-expansion-02-26-06-batch3.json +1410 -0
  14. package/data/night-expansion-02-26-06.json +3146 -0
  15. package/data/night-expansion-02-26-full.json +9726 -0
  16. package/data/night-expansion-02-26-v2.json +330 -0
  17. package/data/night-expansion-02-26.json +171 -0
  18. package/dist/crypto.d.ts +7 -0
  19. package/dist/crypto.d.ts.map +1 -0
  20. package/dist/crypto.js +67 -0
  21. package/dist/crypto.js.map +1 -0
  22. package/dist/execute-dynamic.d.ts +116 -0
  23. package/dist/execute-dynamic.d.ts.map +1 -0
  24. package/dist/execute-dynamic.js +456 -0
  25. package/dist/execute-dynamic.js.map +1 -0
  26. package/dist/execute.d.ts +2 -1
  27. package/dist/execute.d.ts.map +1 -1
  28. package/dist/execute.js +35 -5
  29. package/dist/execute.js.map +1 -1
  30. package/dist/index.js +33 -4
  31. package/dist/index.js.map +1 -1
  32. package/dist/registry/apis.json +2081 -3
  33. package/docs/PRD-customer-key-passthrough.md +184 -0
  34. package/landing/public/badges/available-on-apiclaw.svg +14 -0
  35. package/landing/scripts/generate-stats.js +75 -4
  36. package/landing/src/app/admin/page.tsx +1 -1
  37. package/landing/src/app/api/auth/magic-link/route.ts +1 -1
  38. package/landing/src/app/api/auth/session/route.ts +1 -1
  39. package/landing/src/app/api/auth/verify/route.ts +1 -1
  40. package/landing/src/app/api/og/route.tsx +5 -3
  41. package/landing/src/app/docs/page.tsx +5 -4
  42. package/landing/src/app/earn/page.tsx +14 -11
  43. package/landing/src/app/globals.css +16 -15
  44. package/landing/src/app/layout.tsx +2 -2
  45. package/landing/src/app/page.tsx +425 -254
  46. package/landing/src/app/providers/dashboard/[apiId]/actions/[actionId]/edit/page.tsx +600 -0
  47. package/landing/src/app/providers/dashboard/[apiId]/actions/new/page.tsx +583 -0
  48. package/landing/src/app/providers/dashboard/[apiId]/actions/page.tsx +301 -0
  49. package/landing/src/app/providers/dashboard/[apiId]/direct-call/page.tsx +659 -0
  50. package/landing/src/app/providers/dashboard/[apiId]/page.tsx +381 -0
  51. package/landing/src/app/providers/dashboard/[apiId]/test/page.tsx +418 -0
  52. package/landing/src/app/providers/dashboard/layout.tsx +292 -0
  53. package/landing/src/app/providers/dashboard/page.tsx +353 -290
  54. package/landing/src/app/providers/register/page.tsx +87 -10
  55. package/landing/src/components/AiClientDropdown.tsx +85 -0
  56. package/landing/src/components/ConfigHelperModal.tsx +113 -0
  57. package/landing/src/components/HeroTabs.tsx +187 -0
  58. package/landing/src/components/ShareIntegrationModal.tsx +198 -0
  59. package/landing/src/hooks/useDashboardData.ts +53 -1
  60. package/landing/src/lib/apis.json +46554 -174
  61. package/landing/src/lib/convex-client.ts +22 -3
  62. package/landing/src/lib/stats.json +4 -4
  63. package/landing/tsconfig.tsbuildinfo +1 -1
  64. package/night-expansion-02-26-06-batch2.py +368 -0
  65. package/night-expansion-02-26-06-batch3.py +299 -0
  66. package/night-expansion-02-26-06.py +756 -0
  67. package/package.json +1 -1
  68. package/scripts/bulk-add-public-apis-v2.py +418 -0
  69. package/scripts/night-expansion-02-26-v2.py +296 -0
  70. package/scripts/night-expansion-02-26.py +890 -0
  71. package/scripts/seed-complete-api.js +181 -0
  72. package/scripts/seed-demo-api.sh +44 -0
  73. package/src/crypto.ts +75 -0
  74. package/src/execute-dynamic.ts +589 -0
  75. package/src/execute.ts +41 -5
  76. package/src/index.ts +38 -4
  77. package/src/registry/apis.json +2081 -3
@@ -0,0 +1,330 @@
1
+ [
2
+ {
3
+ "id": "openfda-drug-labels",
4
+ "name": "openFDA Drug Labels",
5
+ "description": "Drug labeling information",
6
+ "category": "Healthcare",
7
+ "link": "https://open.fda.gov/apis/drug/label/",
8
+ "auth": "None"
9
+ },
10
+ {
11
+ "id": "human-protein-atlas",
12
+ "name": "Human Protein Atlas",
13
+ "description": "Human proteome data",
14
+ "category": "Science",
15
+ "link": "https://www.proteinatlas.org/about/help/dataaccess",
16
+ "auth": "None"
17
+ },
18
+ {
19
+ "id": "bioportal",
20
+ "name": "BioPortal",
21
+ "description": "Biomedical ontologies",
22
+ "category": "Science",
23
+ "link": "http://data.bioontology.org/documentation",
24
+ "auth": "apiKey"
25
+ },
26
+ {
27
+ "id": "nasa-mars-rover-photos",
28
+ "name": "NASA Mars Rover Photos",
29
+ "description": "Mars rover imagery",
30
+ "category": "Science",
31
+ "link": "https://api.nasa.gov/",
32
+ "auth": "apiKey"
33
+ },
34
+ {
35
+ "id": "nasa-exoplanet-archive",
36
+ "name": "NASA Exoplanet Archive",
37
+ "description": "Exoplanet data",
38
+ "category": "Science",
39
+ "link": "https://exoplanetarchive.ipac.caltech.edu/docs/TAP/usingTAP.html",
40
+ "auth": "None"
41
+ },
42
+ {
43
+ "id": "astrobin",
44
+ "name": "AstroBin",
45
+ "description": "Astrophotography community",
46
+ "category": "Science",
47
+ "link": "https://www.astrobin.com/help/api/",
48
+ "auth": "apiKey"
49
+ },
50
+ {
51
+ "id": "open-trivia-database",
52
+ "name": "Open Trivia Database",
53
+ "description": "Trivia questions",
54
+ "category": "Entertainment",
55
+ "link": "https://opentdb.com/api_config.php",
56
+ "auth": "None"
57
+ },
58
+ {
59
+ "id": "agify",
60
+ "name": "Agify",
61
+ "description": "Age prediction from name",
62
+ "category": "Data",
63
+ "link": "https://agify.io/",
64
+ "auth": "None"
65
+ },
66
+ {
67
+ "id": "genderize",
68
+ "name": "Genderize",
69
+ "description": "Gender prediction from name",
70
+ "category": "Data",
71
+ "link": "https://genderize.io/",
72
+ "auth": "None"
73
+ },
74
+ {
75
+ "id": "nationalize",
76
+ "name": "Nationalize",
77
+ "description": "Nationality prediction from name",
78
+ "category": "Data",
79
+ "link": "https://nationalize.io/",
80
+ "auth": "None"
81
+ },
82
+ {
83
+ "id": "university-domains",
84
+ "name": "University Domains",
85
+ "description": "University domains worldwide",
86
+ "category": "Education",
87
+ "link": "https://github.com/Hipo/university-domains-list",
88
+ "auth": "None"
89
+ },
90
+ {
91
+ "id": "edamam-food",
92
+ "name": "Edamam Food",
93
+ "description": "Nutrition analysis",
94
+ "category": "Food",
95
+ "link": "https://developer.edamam.com/",
96
+ "auth": "apiKey"
97
+ },
98
+ {
99
+ "id": "usgs-earthquake-hazards",
100
+ "name": "USGS Earthquake Hazards",
101
+ "description": "Real-time earthquakes",
102
+ "category": "Environment",
103
+ "link": "https://earthquake.usgs.gov/fdsnws/event/1/",
104
+ "auth": "None"
105
+ },
106
+ {
107
+ "id": "global-fishing-watch",
108
+ "name": "Global Fishing Watch",
109
+ "description": "Fishing activity data",
110
+ "category": "Environment",
111
+ "link": "https://globalfishingwatch.org/our-apis/",
112
+ "auth": "apiKey"
113
+ },
114
+ {
115
+ "id": "oceancurrent",
116
+ "name": "OceanCurrent",
117
+ "description": "Ocean temperature data",
118
+ "category": "Environment",
119
+ "link": "https://imos.org.au/facilities/oceandata",
120
+ "auth": "None"
121
+ },
122
+ {
123
+ "id": "sunrisesunset-io",
124
+ "name": "SunriseSunset.io",
125
+ "description": "Sun position and times",
126
+ "category": "Environment",
127
+ "link": "https://sunrisesunset.io/api/",
128
+ "auth": "None"
129
+ },
130
+ {
131
+ "id": "uv-index",
132
+ "name": "UV Index",
133
+ "description": "UV radiation data",
134
+ "category": "Environment",
135
+ "link": "https://www.openuv.io/",
136
+ "auth": "apiKey"
137
+ },
138
+ {
139
+ "id": "fullcontact",
140
+ "name": "FullContact",
141
+ "description": "Identity resolution API",
142
+ "category": "Business",
143
+ "link": "https://docs.fullcontact.com/",
144
+ "auth": "apiKey"
145
+ },
146
+ {
147
+ "id": "abstract-company-enrichment",
148
+ "name": "Abstract Company Enrichment",
149
+ "description": "Company data lookup",
150
+ "category": "Business",
151
+ "link": "https://www.abstractapi.com/api/company-enrichment",
152
+ "auth": "apiKey"
153
+ },
154
+ {
155
+ "id": "rocketreach",
156
+ "name": "RocketReach",
157
+ "description": "Professional contact data",
158
+ "category": "Business",
159
+ "link": "https://rocketreach.co/api",
160
+ "auth": "apiKey"
161
+ },
162
+ {
163
+ "id": "angellist",
164
+ "name": "AngelList",
165
+ "description": "Startup ecosystem data",
166
+ "category": "Business",
167
+ "link": "https://angel.co/api",
168
+ "auth": "OAuth"
169
+ },
170
+ {
171
+ "id": "reed-co-uk",
172
+ "name": "Reed.co.uk",
173
+ "description": "UK job listings",
174
+ "category": "Jobs",
175
+ "link": "https://www.reed.co.uk/developers",
176
+ "auth": "apiKey"
177
+ },
178
+ {
179
+ "id": "remotive",
180
+ "name": "Remotive",
181
+ "description": "Remote jobs",
182
+ "category": "Jobs",
183
+ "link": "https://remotive.io/api-documentation",
184
+ "auth": "None"
185
+ },
186
+ {
187
+ "id": "working-nomads",
188
+ "name": "Working Nomads",
189
+ "description": "Remote job listings",
190
+ "category": "Jobs",
191
+ "link": "https://www.workingnomads.co/api/exposed_jobs/",
192
+ "auth": "None"
193
+ },
194
+ {
195
+ "id": "jsearch",
196
+ "name": "JSearch",
197
+ "description": "Job listings API",
198
+ "category": "Jobs",
199
+ "link": "https://rapidapi.com/letscrape-6bRBa3QguO5/api/jsearch",
200
+ "auth": "apiKey"
201
+ },
202
+ {
203
+ "id": "api-nba",
204
+ "name": "API-NBA",
205
+ "description": "NBA statistics",
206
+ "category": "Sports",
207
+ "link": "https://www.api-basketball.com/documentation",
208
+ "auth": "apiKey"
209
+ },
210
+ {
211
+ "id": "wger-workout-manager",
212
+ "name": "Wger Workout Manager",
213
+ "description": "Workout and exercise data",
214
+ "category": "Sports",
215
+ "link": "https://wger.de/en/software/api",
216
+ "auth": "None"
217
+ },
218
+ {
219
+ "id": "matrix",
220
+ "name": "Matrix",
221
+ "description": "Decentralized communication",
222
+ "category": "Communication",
223
+ "link": "https://matrix.org/docs/api/",
224
+ "auth": "OAuth"
225
+ },
226
+ {
227
+ "id": "line-messaging",
228
+ "name": "LINE Messaging",
229
+ "description": "LINE messenger API",
230
+ "category": "Communication",
231
+ "link": "https://developers.line.biz/en/docs/messaging-api/",
232
+ "auth": "apiKey"
233
+ },
234
+ {
235
+ "id": "packagist",
236
+ "name": "Packagist",
237
+ "description": "PHP package data",
238
+ "category": "Development",
239
+ "link": "https://packagist.org/apidoc",
240
+ "auth": "None"
241
+ },
242
+ {
243
+ "id": "rubygems",
244
+ "name": "RubyGems",
245
+ "description": "Ruby gems data",
246
+ "category": "Development",
247
+ "link": "https://guides.rubygems.org/rubygems-org-api/",
248
+ "auth": "None"
249
+ },
250
+ {
251
+ "id": "crates-io",
252
+ "name": "Crates.io",
253
+ "description": "Rust packages",
254
+ "category": "Development",
255
+ "link": "https://crates.io/data-access",
256
+ "auth": "None"
257
+ },
258
+ {
259
+ "id": "libraries-io",
260
+ "name": "Libraries.io",
261
+ "description": "Package monitoring",
262
+ "category": "Development",
263
+ "link": "https://libraries.io/api",
264
+ "auth": "apiKey"
265
+ },
266
+ {
267
+ "id": "snyk-vulnerability-db",
268
+ "name": "Snyk Vulnerability DB",
269
+ "description": "Security vulnerabilities",
270
+ "category": "Security",
271
+ "link": "https://snyk.io/api/",
272
+ "auth": "apiKey"
273
+ },
274
+ {
275
+ "id": "hytale-api",
276
+ "name": "Hytale API",
277
+ "description": "Hytale game news",
278
+ "category": "Games",
279
+ "link": "https://hytale-api.com/",
280
+ "auth": "None"
281
+ },
282
+ {
283
+ "id": "osrs-api",
284
+ "name": "OSRS API",
285
+ "description": "Old School RuneScape",
286
+ "category": "Games",
287
+ "link": "https://oldschool.runescape.wiki/w/API",
288
+ "auth": "None"
289
+ },
290
+ {
291
+ "id": "pok-mon-tcg-api",
292
+ "name": "Pok\u00e9mon TCG API",
293
+ "description": "Pok\u00e9mon Trading Card Game",
294
+ "category": "Games",
295
+ "link": "https://pokemontcg.io/",
296
+ "auth": "None"
297
+ },
298
+ {
299
+ "id": "yu-gi-oh-api",
300
+ "name": "Yu-Gi-Oh! API",
301
+ "description": "Yu-Gi-Oh! card database",
302
+ "category": "Games",
303
+ "link": "https://db.ygoprodeck.com/api-guide/",
304
+ "auth": "None"
305
+ },
306
+ {
307
+ "id": "rentberry",
308
+ "name": "Rentberry",
309
+ "description": "Rental property data",
310
+ "category": "Real Estate",
311
+ "link": "https://rentberry.com/api",
312
+ "auth": "apiKey"
313
+ },
314
+ {
315
+ "id": "whoisxml",
316
+ "name": "WhoisXML",
317
+ "description": "Domain WHOIS data",
318
+ "category": "Utilities",
319
+ "link": "https://www.whoisxmlapi.com/",
320
+ "auth": "apiKey"
321
+ },
322
+ {
323
+ "id": "url-shortener-api",
324
+ "name": "URL Shortener API",
325
+ "description": "Shorten URLs",
326
+ "category": "Utilities",
327
+ "link": "https://t.ly/docs",
328
+ "auth": "apiKey"
329
+ }
330
+ ]
@@ -0,0 +1,171 @@
1
+ [
2
+ {
3
+ "id": "microsoft-advertising-api",
4
+ "name": "Microsoft Advertising API",
5
+ "description": "Programmatic access to Bing Ads advertising technologies",
6
+ "category": "Advertising",
7
+ "auth": "OAuth",
8
+ "https": true,
9
+ "cors": "unknown",
10
+ "link": "https://msdn.microsoft.com/en-us/library/bing-ads-api.aspx",
11
+ "pricing": "unknown",
12
+ "keywords": [],
13
+ "source": "n0shake-public-apis"
14
+ },
15
+ {
16
+ "id": "vuforia-ar",
17
+ "name": "Vuforia AR",
18
+ "description": "Solid SDK with robust AR development options",
19
+ "category": "AR/VR",
20
+ "auth": "API Key",
21
+ "https": true,
22
+ "cors": "unknown",
23
+ "link": "https://library.vuforia.com/",
24
+ "pricing": "unknown",
25
+ "keywords": [],
26
+ "source": "n0shake-public-apis"
27
+ },
28
+ {
29
+ "id": "wikitude-ar",
30
+ "name": "Wikitude AR",
31
+ "description": "All-in-one AR solution with image recognition and 3D rendering",
32
+ "category": "AR/VR",
33
+ "auth": "API Key",
34
+ "https": true,
35
+ "cors": "unknown",
36
+ "link": "http://www.wikitude.com/download/",
37
+ "pricing": "unknown",
38
+ "keywords": [],
39
+ "source": "n0shake-public-apis"
40
+ },
41
+ {
42
+ "id": "sakari-sms",
43
+ "name": "Sakari SMS",
44
+ "description": "Send and receive SMS to 200+ countries",
45
+ "category": "Communication",
46
+ "auth": "API Key",
47
+ "https": true,
48
+ "cors": "unknown",
49
+ "link": "https://developer.sakari.io",
50
+ "pricing": "unknown",
51
+ "keywords": [],
52
+ "source": "n0shake-public-apis"
53
+ },
54
+ {
55
+ "id": "amazon-maps-api-v2",
56
+ "name": "Amazon Maps API v2",
57
+ "description": "Add interactive 3D maps to Fire apps",
58
+ "category": "Geocoding",
59
+ "auth": "API Key",
60
+ "https": true,
61
+ "cors": "unknown",
62
+ "link": "https://developer.amazon.com/maps",
63
+ "pricing": "unknown",
64
+ "keywords": [],
65
+ "source": "n0shake-public-apis"
66
+ },
67
+ {
68
+ "id": "open-street-map",
69
+ "name": "Open Street Map",
70
+ "description": "API access to OSM",
71
+ "category": "Geocoding",
72
+ "auth": "OAuth",
73
+ "https": true,
74
+ "cors": "unknown",
75
+ "link": "http://wiki.openstreetmap.org/wiki/API",
76
+ "pricing": "unknown",
77
+ "keywords": [],
78
+ "source": "n0shake-public-apis"
79
+ },
80
+ {
81
+ "id": "shotstack-video-api",
82
+ "name": "Shotstack Video API",
83
+ "description": "Build scalable video automation workflows",
84
+ "category": "Media",
85
+ "auth": "API Key",
86
+ "https": true,
87
+ "cors": "unknown",
88
+ "link": "https://shotstack.io/docs/guide/getting-started/core-concepts/",
89
+ "pricing": "unknown",
90
+ "keywords": [],
91
+ "source": "n0shake-public-apis"
92
+ },
93
+ {
94
+ "id": "lololyrics-api",
95
+ "name": "Lololyrics API",
96
+ "description": "Obtain lyrics and metadata for songs",
97
+ "category": "Media",
98
+ "auth": "None",
99
+ "https": true,
100
+ "cors": "unknown",
101
+ "link": "http://api.lololyrics.com/",
102
+ "pricing": "unknown",
103
+ "keywords": [],
104
+ "source": "n0shake-public-apis"
105
+ },
106
+ {
107
+ "id": "cloudmersive-nlp-apis",
108
+ "name": "Cloudmersive NLP APIs",
109
+ "description": "Unified NLP APIs for translation, sentiment and more",
110
+ "category": "AI/ML",
111
+ "auth": "API Key",
112
+ "https": true,
113
+ "cors": "unknown",
114
+ "link": "https://cloudmersive.com/nlp-api",
115
+ "pricing": "unknown",
116
+ "keywords": [],
117
+ "source": "n0shake-public-apis"
118
+ },
119
+ {
120
+ "id": "shakespeare-translator-api",
121
+ "name": "Shakespeare Translator API",
122
+ "description": "Shakespeare English Translation",
123
+ "category": "Entertainment",
124
+ "auth": "API Key",
125
+ "https": true,
126
+ "cors": "unknown",
127
+ "link": "https://funtranslations.com/api/shakespeare",
128
+ "pricing": "unknown",
129
+ "keywords": [],
130
+ "source": "n0shake-public-apis"
131
+ },
132
+ {
133
+ "id": "nokia-places",
134
+ "name": "Nokia Places",
135
+ "description": "JavaScript places search with JS widget",
136
+ "category": "Geocoding",
137
+ "auth": "API Key",
138
+ "https": true,
139
+ "cors": "unknown",
140
+ "link": "https://developer.here.com/develop/javascript-api",
141
+ "pricing": "unknown",
142
+ "keywords": [],
143
+ "source": "n0shake-public-apis"
144
+ },
145
+ {
146
+ "id": "eventbrite-sdk",
147
+ "name": "EventBrite SDK",
148
+ "description": "Python SDK for EventBrite API",
149
+ "category": "Social",
150
+ "auth": "OAuth",
151
+ "https": true,
152
+ "cors": "unknown",
153
+ "link": "https://github.com/eventbrite/eventbrite-sdk-python",
154
+ "pricing": "unknown",
155
+ "keywords": [],
156
+ "source": "n0shake-public-apis"
157
+ },
158
+ {
159
+ "id": "paypal-identity",
160
+ "name": "PayPal Identity",
161
+ "description": "Sign in with PayPal credentials",
162
+ "category": "Security",
163
+ "auth": "OAuth",
164
+ "https": true,
165
+ "cors": "unknown",
166
+ "link": "https://developer.paypal.com/docs/integration/direct/identity/log-in-with-paypal/",
167
+ "pricing": "unknown",
168
+ "keywords": [],
169
+ "source": "n0shake-public-apis"
170
+ }
171
+ ]
@@ -0,0 +1,7 @@
1
+ export declare function encryptKey(plainKey: string): string;
2
+ export declare function decryptKey(encryptedKey: string): string;
3
+ export declare function validateBaseUrl(url: string): {
4
+ valid: boolean;
5
+ error?: string;
6
+ };
7
+ //# sourceMappingURL=crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAiBA,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOnD;AAED,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAavD;AAGD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAgC/E"}
package/dist/crypto.js ADDED
@@ -0,0 +1,67 @@
1
+ import { createCipheriv, createDecipheriv, randomBytes } from 'crypto';
2
+ const ENCRYPTION_KEY = process.env.APICLAW_KEY_ENCRYPTION_SECRET;
3
+ // Validate key exists and is correct length
4
+ function getKey() {
5
+ if (!ENCRYPTION_KEY) {
6
+ throw new Error('APICLAW_KEY_ENCRYPTION_SECRET not set');
7
+ }
8
+ // Key should be 32 bytes for AES-256
9
+ const key = Buffer.from(ENCRYPTION_KEY, 'hex');
10
+ if (key.length !== 32) {
11
+ throw new Error('APICLAW_KEY_ENCRYPTION_SECRET must be 64 hex chars (32 bytes)');
12
+ }
13
+ return key;
14
+ }
15
+ export function encryptKey(plainKey) {
16
+ const key = getKey();
17
+ const iv = randomBytes(16);
18
+ const cipher = createCipheriv('aes-256-gcm', key, iv);
19
+ const encrypted = Buffer.concat([cipher.update(plainKey, 'utf8'), cipher.final()]);
20
+ const tag = cipher.getAuthTag();
21
+ return `${iv.toString('hex')}:${tag.toString('hex')}:${encrypted.toString('hex')}`;
22
+ }
23
+ export function decryptKey(encryptedKey) {
24
+ const key = getKey();
25
+ const [ivHex, tagHex, dataHex] = encryptedKey.split(':');
26
+ if (!ivHex || !tagHex || !dataHex) {
27
+ throw new Error('Invalid encrypted key format');
28
+ }
29
+ const decipher = createDecipheriv('aes-256-gcm', key, Buffer.from(ivHex, 'hex'));
30
+ decipher.setAuthTag(Buffer.from(tagHex, 'hex'));
31
+ const decrypted = Buffer.concat([
32
+ decipher.update(Buffer.from(dataHex, 'hex')),
33
+ decipher.final()
34
+ ]);
35
+ return decrypted.toString('utf8');
36
+ }
37
+ // SSRF Prevention
38
+ export function validateBaseUrl(url) {
39
+ try {
40
+ const parsed = new URL(url);
41
+ if (parsed.protocol !== 'https:') {
42
+ return { valid: false, error: 'URL must use HTTPS' };
43
+ }
44
+ const host = parsed.hostname.toLowerCase();
45
+ const blockedPatterns = [
46
+ /^127\./,
47
+ /^10\./,
48
+ /^192\.168\./,
49
+ /^172\.(1[6-9]|2[0-9]|3[0-1])\./,
50
+ /^localhost$/,
51
+ /^0\.0\.0\.0$/,
52
+ /^::1$/,
53
+ /\.local$/,
54
+ /\.internal$/,
55
+ ];
56
+ for (const pattern of blockedPatterns) {
57
+ if (pattern.test(host)) {
58
+ return { valid: false, error: 'Internal/private URLs not allowed' };
59
+ }
60
+ }
61
+ return { valid: true };
62
+ }
63
+ catch {
64
+ return { valid: false, error: 'Invalid URL format' };
65
+ }
66
+ }
67
+ //# sourceMappingURL=crypto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEvE,MAAM,cAAc,GAAG,OAAO,CAAC,GA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