@stacksjs/ts-cloud 0.2.2 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aws/acm.d.ts +215 -0
- package/dist/aws/application-autoscaling.d.ts +345 -0
- package/dist/aws/bedrock.d.ts +2672 -0
- package/dist/aws/client.d.ts +181 -0
- package/dist/aws/cloudformation.d.ts +187 -0
- package/dist/aws/cloudfront.d.ts +416 -0
- package/dist/aws/cloudwatch-logs.d.ts +70 -0
- package/dist/aws/comprehend.d.ts +616 -0
- package/dist/aws/connect.d.ts +533 -0
- package/dist/aws/deploy-imap.d.ts +26 -0
- package/dist/aws/dynamodb.d.ts +270 -0
- package/dist/aws/ec2.d.ts +545 -0
- package/dist/aws/ecr.d.ts +240 -0
- package/dist/aws/ecs.d.ts +267 -0
- package/dist/aws/efs.d.ts +36 -0
- package/dist/aws/elasticache.d.ts +112 -0
- package/dist/aws/elbv2.d.ts +389 -0
- package/dist/aws/email.d.ts +260 -0
- package/dist/aws/eventbridge.d.ts +197 -0
- package/dist/aws/iam.d.ts +1013 -0
- package/dist/aws/imap-server.d.ts +298 -0
- package/dist/aws/index.d.ts +53 -0
- package/dist/aws/kendra.d.ts +831 -0
- package/dist/aws/lambda.d.ts +319 -0
- package/dist/aws/opensearch.d.ts +121 -0
- package/dist/aws/personalize.d.ts +586 -0
- package/dist/aws/polly.d.ts +243 -0
- package/dist/aws/rds.d.ts +346 -0
- package/dist/aws/rekognition.d.ts +691 -0
- package/dist/aws/route53-domains.d.ts +161 -0
- package/dist/aws/route53.d.ts +330 -0
- package/dist/aws/s3.d.ts +535 -0
- package/dist/aws/scheduler.d.ts +224 -0
- package/dist/aws/secrets-manager.d.ts +267 -0
- package/dist/aws/ses.d.ts +441 -0
- package/dist/aws/setup-phone.d.ts +1 -0
- package/dist/aws/setup-sms.d.ts +116 -0
- package/dist/aws/sms.d.ts +477 -0
- package/dist/aws/smtp-server.d.ts +108 -0
- package/dist/aws/sns.d.ts +224 -0
- package/dist/aws/sqs.d.ts +107 -0
- package/dist/aws/ssm.d.ts +311 -0
- package/dist/aws/sts.d.ts +21 -0
- package/dist/aws/support.d.ts +139 -0
- package/dist/aws/test-imap.d.ts +15 -0
- package/dist/aws/textract.d.ts +477 -0
- package/dist/aws/transcribe.d.ts +79 -0
- package/dist/aws/translate.d.ts +424 -0
- package/dist/aws/voice.d.ts +361 -0
- package/dist/bin/cli.js +4500 -809
- package/dist/config.d.ts +5 -0
- package/dist/deploy/index.d.ts +6 -0
- package/dist/deploy/static-site-external-dns.d.ts +70 -0
- package/dist/deploy/static-site.d.ts +110 -0
- package/dist/dns/cloudflare.d.ts +74 -0
- package/dist/dns/godaddy.d.ts +63 -0
- package/dist/dns/index.d.ts +67 -0
- package/dist/dns/porkbun.d.ts +43 -0
- package/dist/dns/route53-adapter.d.ts +67 -0
- package/dist/dns/types.d.ts +100 -0
- package/dist/dns/validator.d.ts +105 -0
- package/dist/generators/index.d.ts +4 -0
- package/dist/generators/infrastructure.d.ts +115 -0
- package/dist/index.d.ts +9 -165
- package/dist/index.js +24067 -6430
- package/dist/push/apns.d.ts +140 -0
- package/dist/push/fcm.d.ts +205 -0
- package/dist/push/index.d.ts +44 -0
- package/dist/security/pre-deploy-scanner.d.ts +97 -0
- package/dist/ssl/acme-client.d.ts +133 -0
- package/dist/ssl/index.d.ts +6 -0
- package/dist/ssl/letsencrypt.d.ts +96 -0
- package/dist/utils/cli.d.ts +121 -0
- package/dist/validation/index.d.ts +4 -0
- package/dist/validation/template.d.ts +27 -0
- package/package.json +6 -6
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apple Push Notification Service (APNs) Client
|
|
3
|
+
* Uses HTTP/2 with JWT token authentication
|
|
4
|
+
*
|
|
5
|
+
* Prerequisites:
|
|
6
|
+
* - Apple Developer account
|
|
7
|
+
* - APNs Key (p8 file) from Apple Developer Portal
|
|
8
|
+
* - Key ID and Team ID
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const apns = new APNsClient({
|
|
13
|
+
* keyId: 'ABC123DEFG',
|
|
14
|
+
* teamId: 'DEF456GHIJ',
|
|
15
|
+
* privateKey: fs.readFileSync('AuthKey_ABC123DEFG.p8', 'utf8'),
|
|
16
|
+
* bundleId: 'com.example.app',
|
|
17
|
+
* production: false // true for production, false for sandbox
|
|
18
|
+
* })
|
|
19
|
+
*
|
|
20
|
+
* await apns.send({
|
|
21
|
+
* deviceToken: '...',
|
|
22
|
+
* title: 'Hello',
|
|
23
|
+
* body: 'World',
|
|
24
|
+
* })
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export interface APNsConfig {
|
|
28
|
+
/** APNs Key ID from Apple Developer Portal */
|
|
29
|
+
keyId: string;
|
|
30
|
+
/** Team ID from Apple Developer Portal */
|
|
31
|
+
teamId: string;
|
|
32
|
+
/** Private key content (p8 file content) */
|
|
33
|
+
privateKey: string;
|
|
34
|
+
/** iOS app bundle ID (e.g., com.example.app) */
|
|
35
|
+
bundleId: string;
|
|
36
|
+
/** Use production APNs server (default: false) */
|
|
37
|
+
production?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface APNsNotification {
|
|
40
|
+
/** Device token to send to */
|
|
41
|
+
deviceToken: string;
|
|
42
|
+
/** Alert title */
|
|
43
|
+
title?: string;
|
|
44
|
+
/** Alert subtitle */
|
|
45
|
+
subtitle?: string;
|
|
46
|
+
/** Alert body */
|
|
47
|
+
body?: string;
|
|
48
|
+
/** Badge number to display on app icon */
|
|
49
|
+
badge?: number;
|
|
50
|
+
/** Sound to play (use 'default' for default sound) */
|
|
51
|
+
sound?: string | {
|
|
52
|
+
name: string;
|
|
53
|
+
critical?: number;
|
|
54
|
+
volume?: number;
|
|
55
|
+
};
|
|
56
|
+
/** Category identifier for actionable notifications */
|
|
57
|
+
category?: string;
|
|
58
|
+
/** Thread identifier for grouping notifications */
|
|
59
|
+
threadId?: string;
|
|
60
|
+
/** Custom data payload */
|
|
61
|
+
data?: Record<string, any>;
|
|
62
|
+
/** Content available flag for background updates */
|
|
63
|
+
contentAvailable?: boolean;
|
|
64
|
+
/** Mutable content flag for notification service extension */
|
|
65
|
+
mutableContent?: boolean;
|
|
66
|
+
/** Push type (default: 'alert') */
|
|
67
|
+
pushType?: 'alert' | 'background' | 'voip' | 'complication' | 'fileprovider' | 'mdm' | 'liveactivity';
|
|
68
|
+
/** Notification priority (10 = immediate, 5 = can be delayed) */
|
|
69
|
+
priority?: 5 | 10;
|
|
70
|
+
/** Expiration timestamp (Unix time in seconds) */
|
|
71
|
+
expiration?: number;
|
|
72
|
+
/** Collapse identifier for coalescing notifications */
|
|
73
|
+
collapseId?: string;
|
|
74
|
+
/** Target content id for live activities */
|
|
75
|
+
targetContentId?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface APNsSendResult {
|
|
78
|
+
success: boolean;
|
|
79
|
+
deviceToken: string;
|
|
80
|
+
apnsId?: string;
|
|
81
|
+
statusCode?: number;
|
|
82
|
+
error?: string;
|
|
83
|
+
reason?: string;
|
|
84
|
+
timestamp?: number;
|
|
85
|
+
}
|
|
86
|
+
export interface APNsBatchResult {
|
|
87
|
+
sent: number;
|
|
88
|
+
failed: number;
|
|
89
|
+
results: APNsSendResult[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Apple Push Notification Service client
|
|
93
|
+
*/
|
|
94
|
+
export declare class APNsClient {
|
|
95
|
+
private config;
|
|
96
|
+
private token;
|
|
97
|
+
private tokenGeneratedAt;
|
|
98
|
+
private client;
|
|
99
|
+
private host;
|
|
100
|
+
constructor(config: APNsConfig);
|
|
101
|
+
/**
|
|
102
|
+
* Generate a new JWT token for APNs authentication
|
|
103
|
+
*/
|
|
104
|
+
private generateToken;
|
|
105
|
+
/**
|
|
106
|
+
* Convert DER encoded ECDSA signature to raw format
|
|
107
|
+
*/
|
|
108
|
+
private derToRaw;
|
|
109
|
+
/**
|
|
110
|
+
* Get or create HTTP/2 client connection
|
|
111
|
+
*/
|
|
112
|
+
private getClient;
|
|
113
|
+
/**
|
|
114
|
+
* Build APNs payload from notification options
|
|
115
|
+
*/
|
|
116
|
+
private buildPayload;
|
|
117
|
+
/**
|
|
118
|
+
* Send a push notification to a single device
|
|
119
|
+
*/
|
|
120
|
+
send(notification: APNsNotification): Promise<APNsSendResult>;
|
|
121
|
+
/**
|
|
122
|
+
* Send push notifications to multiple devices
|
|
123
|
+
*/
|
|
124
|
+
sendBatch(notifications: APNsNotification[], options?: {
|
|
125
|
+
concurrency?: number;
|
|
126
|
+
}): Promise<APNsBatchResult>;
|
|
127
|
+
/**
|
|
128
|
+
* Send a simple notification (convenience method)
|
|
129
|
+
*/
|
|
130
|
+
sendSimple(deviceToken: string, title: string, body: string, data?: Record<string, any>): Promise<APNsSendResult>;
|
|
131
|
+
/**
|
|
132
|
+
* Send a silent/background notification
|
|
133
|
+
*/
|
|
134
|
+
sendSilent(deviceToken: string, data?: Record<string, any>): Promise<APNsSendResult>;
|
|
135
|
+
/**
|
|
136
|
+
* Close the HTTP/2 connection
|
|
137
|
+
*/
|
|
138
|
+
close(): void;
|
|
139
|
+
}
|
|
140
|
+
export default APNsClient;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Cloud Messaging (FCM) Client
|
|
3
|
+
* Uses FCM HTTP v1 API with Google OAuth2 authentication
|
|
4
|
+
*
|
|
5
|
+
* Prerequisites:
|
|
6
|
+
* - Firebase project
|
|
7
|
+
* - Service account JSON key from Firebase Console
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const fcm = new FCMClient({
|
|
12
|
+
* projectId: 'your-project-id',
|
|
13
|
+
* clientEmail: 'firebase-adminsdk@project.iam.gserviceaccount.com',
|
|
14
|
+
* privateKey: '-----BEGIN PRIVATE KEY-----\n...',
|
|
15
|
+
* })
|
|
16
|
+
*
|
|
17
|
+
* await fcm.send({
|
|
18
|
+
* token: '...',
|
|
19
|
+
* title: 'Hello',
|
|
20
|
+
* body: 'World',
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export interface FCMConfig {
|
|
25
|
+
/** Firebase project ID */
|
|
26
|
+
projectId: string;
|
|
27
|
+
/** Service account client email */
|
|
28
|
+
clientEmail: string;
|
|
29
|
+
/** Service account private key (PEM format) */
|
|
30
|
+
privateKey: string;
|
|
31
|
+
}
|
|
32
|
+
export interface FCMNotification {
|
|
33
|
+
/** Device FCM token */
|
|
34
|
+
token?: string;
|
|
35
|
+
/** Topic to send to (instead of token) */
|
|
36
|
+
topic?: string;
|
|
37
|
+
/** Condition expression for targeting multiple topics */
|
|
38
|
+
condition?: string;
|
|
39
|
+
/** Notification title */
|
|
40
|
+
title?: string;
|
|
41
|
+
/** Notification body */
|
|
42
|
+
body?: string;
|
|
43
|
+
/** Notification image URL */
|
|
44
|
+
imageUrl?: string;
|
|
45
|
+
/** Custom data payload */
|
|
46
|
+
data?: Record<string, string>;
|
|
47
|
+
/** Android-specific options */
|
|
48
|
+
android?: {
|
|
49
|
+
/** Channel ID for Android O+ */
|
|
50
|
+
channelId?: string;
|
|
51
|
+
/** Notification priority */
|
|
52
|
+
priority?: 'normal' | 'high';
|
|
53
|
+
/** Time to live in seconds */
|
|
54
|
+
ttl?: number;
|
|
55
|
+
/** Collapse key for message deduplication */
|
|
56
|
+
collapseKey?: string;
|
|
57
|
+
/** Notification icon */
|
|
58
|
+
icon?: string;
|
|
59
|
+
/** Notification icon color (hex) */
|
|
60
|
+
color?: string;
|
|
61
|
+
/** Sound to play */
|
|
62
|
+
sound?: string;
|
|
63
|
+
/** Click action */
|
|
64
|
+
clickAction?: string;
|
|
65
|
+
/** Tag for notification replacement */
|
|
66
|
+
tag?: string;
|
|
67
|
+
/** Direct boot aware */
|
|
68
|
+
directBootOk?: boolean;
|
|
69
|
+
/** Visibility: private, public, secret */
|
|
70
|
+
visibility?: 'private' | 'public' | 'secret';
|
|
71
|
+
/** Notification count */
|
|
72
|
+
notificationCount?: number;
|
|
73
|
+
};
|
|
74
|
+
/** Web push options */
|
|
75
|
+
webpush?: {
|
|
76
|
+
/** Web notification options */
|
|
77
|
+
notification?: {
|
|
78
|
+
title?: string;
|
|
79
|
+
body?: string;
|
|
80
|
+
icon?: string;
|
|
81
|
+
badge?: string;
|
|
82
|
+
image?: string;
|
|
83
|
+
requireInteraction?: boolean;
|
|
84
|
+
silent?: boolean;
|
|
85
|
+
tag?: string;
|
|
86
|
+
actions?: Array<{
|
|
87
|
+
action: string;
|
|
88
|
+
title: string;
|
|
89
|
+
icon?: string;
|
|
90
|
+
}>;
|
|
91
|
+
};
|
|
92
|
+
/** FCM options for web */
|
|
93
|
+
fcmOptions?: {
|
|
94
|
+
link?: string;
|
|
95
|
+
analyticsLabel?: string;
|
|
96
|
+
};
|
|
97
|
+
/** Custom headers */
|
|
98
|
+
headers?: Record<string, string>;
|
|
99
|
+
/** Custom data */
|
|
100
|
+
data?: Record<string, string>;
|
|
101
|
+
};
|
|
102
|
+
/** APNS options (for iOS via FCM) */
|
|
103
|
+
apns?: {
|
|
104
|
+
/** APNs headers */
|
|
105
|
+
headers?: Record<string, string>;
|
|
106
|
+
/** APNs payload */
|
|
107
|
+
payload?: {
|
|
108
|
+
aps?: Record<string, any>;
|
|
109
|
+
[key: string]: any;
|
|
110
|
+
};
|
|
111
|
+
/** FCM options */
|
|
112
|
+
fcmOptions?: {
|
|
113
|
+
analyticsLabel?: string;
|
|
114
|
+
image?: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
/** FCM options */
|
|
118
|
+
fcmOptions?: {
|
|
119
|
+
analyticsLabel?: string;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export interface FCMSendResult {
|
|
123
|
+
success: boolean;
|
|
124
|
+
messageId?: string;
|
|
125
|
+
error?: string;
|
|
126
|
+
errorCode?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface FCMBatchResult {
|
|
129
|
+
sent: number;
|
|
130
|
+
failed: number;
|
|
131
|
+
results: Array<FCMSendResult & {
|
|
132
|
+
token?: string;
|
|
133
|
+
}>;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Firebase Cloud Messaging client
|
|
137
|
+
*/
|
|
138
|
+
export declare class FCMClient {
|
|
139
|
+
private config;
|
|
140
|
+
private accessToken;
|
|
141
|
+
private tokenExpiresAt;
|
|
142
|
+
constructor(config: FCMConfig);
|
|
143
|
+
/**
|
|
144
|
+
* Load config from service account JSON
|
|
145
|
+
*/
|
|
146
|
+
static fromServiceAccount(serviceAccount: {
|
|
147
|
+
project_id: string;
|
|
148
|
+
client_email: string;
|
|
149
|
+
private_key: string;
|
|
150
|
+
}): FCMClient;
|
|
151
|
+
/**
|
|
152
|
+
* Generate a JWT for Google OAuth2
|
|
153
|
+
*/
|
|
154
|
+
private generateJWT;
|
|
155
|
+
/**
|
|
156
|
+
* Get a valid access token, refreshing if needed
|
|
157
|
+
*/
|
|
158
|
+
private getAccessToken;
|
|
159
|
+
/**
|
|
160
|
+
* Build FCM message payload
|
|
161
|
+
*/
|
|
162
|
+
private buildMessage;
|
|
163
|
+
/**
|
|
164
|
+
* Send a push notification
|
|
165
|
+
*/
|
|
166
|
+
send(notification: FCMNotification): Promise<FCMSendResult>;
|
|
167
|
+
/**
|
|
168
|
+
* Send to multiple device tokens
|
|
169
|
+
*/
|
|
170
|
+
sendBatch(tokens: string[], notification: Omit<FCMNotification, 'token' | 'topic' | 'condition'>, options?: {
|
|
171
|
+
concurrency?: number;
|
|
172
|
+
}): Promise<FCMBatchResult>;
|
|
173
|
+
/**
|
|
174
|
+
* Send to a topic
|
|
175
|
+
*/
|
|
176
|
+
sendToTopic(topic: string, notification: Omit<FCMNotification, 'token' | 'topic' | 'condition'>): Promise<FCMSendResult>;
|
|
177
|
+
/**
|
|
178
|
+
* Send to topics with a condition
|
|
179
|
+
* @example sendToCondition("'TopicA' in topics && 'TopicB' in topics", {...})
|
|
180
|
+
*/
|
|
181
|
+
sendToCondition(condition: string, notification: Omit<FCMNotification, 'token' | 'topic' | 'condition'>): Promise<FCMSendResult>;
|
|
182
|
+
/**
|
|
183
|
+
* Send a simple notification (convenience method)
|
|
184
|
+
*/
|
|
185
|
+
sendSimple(token: string, title: string, body: string, data?: Record<string, string>): Promise<FCMSendResult>;
|
|
186
|
+
/**
|
|
187
|
+
* Send a data-only (silent) notification
|
|
188
|
+
*/
|
|
189
|
+
sendSilent(token: string, data: Record<string, string>): Promise<FCMSendResult>;
|
|
190
|
+
/**
|
|
191
|
+
* Subscribe a token to a topic
|
|
192
|
+
*/
|
|
193
|
+
subscribeToTopic(tokens: string[], topic: string): Promise<{
|
|
194
|
+
success: boolean;
|
|
195
|
+
error?: string;
|
|
196
|
+
}>;
|
|
197
|
+
/**
|
|
198
|
+
* Unsubscribe a token from a topic
|
|
199
|
+
*/
|
|
200
|
+
unsubscribeFromTopic(tokens: string[], topic: string): Promise<{
|
|
201
|
+
success: boolean;
|
|
202
|
+
error?: string;
|
|
203
|
+
}>;
|
|
204
|
+
}
|
|
205
|
+
export default FCMClient;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Push Notifications Module
|
|
3
|
+
*
|
|
4
|
+
* Provides clients for Apple Push Notification Service (APNs) and
|
|
5
|
+
* Firebase Cloud Messaging (FCM).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // Apple Push Notifications
|
|
10
|
+
* import { APNsClient } from 'ts-cloud/push'
|
|
11
|
+
*
|
|
12
|
+
* const apns = new APNsClient({
|
|
13
|
+
* keyId: 'ABC123DEFG',
|
|
14
|
+
* teamId: 'DEF456GHIJ',
|
|
15
|
+
* privateKey: fs.readFileSync('AuthKey.p8', 'utf8'),
|
|
16
|
+
* bundleId: 'com.example.app',
|
|
17
|
+
* })
|
|
18
|
+
*
|
|
19
|
+
* await apns.send({
|
|
20
|
+
* deviceToken: '...',
|
|
21
|
+
* title: 'Hello',
|
|
22
|
+
* body: 'World',
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* // Firebase Cloud Messaging
|
|
26
|
+
* import { FCMClient } from 'ts-cloud/push'
|
|
27
|
+
*
|
|
28
|
+
* const fcm = new FCMClient({
|
|
29
|
+
* projectId: 'your-project-id',
|
|
30
|
+
* clientEmail: 'firebase-adminsdk@project.iam.gserviceaccount.com',
|
|
31
|
+
* privateKey: '-----BEGIN PRIVATE KEY-----\n...',
|
|
32
|
+
* })
|
|
33
|
+
*
|
|
34
|
+
* await fcm.send({
|
|
35
|
+
* token: '...',
|
|
36
|
+
* title: 'Hello',
|
|
37
|
+
* body: 'World',
|
|
38
|
+
* })
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export * from './apns';
|
|
42
|
+
export * from './fcm';
|
|
43
|
+
export type { APNsConfig, APNsNotification, APNsSendResult, APNsBatchResult, } from './apns';
|
|
44
|
+
export type { FCMConfig, FCMNotification, FCMSendResult, FCMBatchResult, } from './fcm';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-Deployment Security Scanner
|
|
3
|
+
* Scans source code for leaked secrets, credentials, and sensitive data before deployment
|
|
4
|
+
*/
|
|
5
|
+
export interface SecretPattern {
|
|
6
|
+
name: string;
|
|
7
|
+
pattern: RegExp;
|
|
8
|
+
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
9
|
+
description: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SecurityFinding {
|
|
12
|
+
file: string;
|
|
13
|
+
line: number;
|
|
14
|
+
column: number;
|
|
15
|
+
match: string;
|
|
16
|
+
pattern: SecretPattern;
|
|
17
|
+
context: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ScanResult {
|
|
20
|
+
passed: boolean;
|
|
21
|
+
findings: SecurityFinding[];
|
|
22
|
+
scannedFiles: number;
|
|
23
|
+
duration: number;
|
|
24
|
+
summary: {
|
|
25
|
+
critical: number;
|
|
26
|
+
high: number;
|
|
27
|
+
medium: number;
|
|
28
|
+
low: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface ScanOptions {
|
|
32
|
+
directory: string;
|
|
33
|
+
exclude?: string[];
|
|
34
|
+
include?: string[];
|
|
35
|
+
skipPatterns?: string[];
|
|
36
|
+
maxFileSize?: number;
|
|
37
|
+
failOnSeverity?: 'critical' | 'high' | 'medium' | 'low';
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Common secret patterns to detect
|
|
41
|
+
*/
|
|
42
|
+
export declare const SECRET_PATTERNS: SecretPattern[];
|
|
43
|
+
/**
|
|
44
|
+
* Pre-deployment security scanner
|
|
45
|
+
*/
|
|
46
|
+
export declare class PreDeployScanner {
|
|
47
|
+
private patterns;
|
|
48
|
+
private excludeDirs;
|
|
49
|
+
private excludeFiles;
|
|
50
|
+
private maxFileSize;
|
|
51
|
+
constructor(options?: {
|
|
52
|
+
customPatterns?: SecretPattern[];
|
|
53
|
+
excludeDirs?: string[];
|
|
54
|
+
excludeFiles?: string[];
|
|
55
|
+
maxFileSize?: number;
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Scan a directory for secrets
|
|
59
|
+
*/
|
|
60
|
+
scan(options: ScanOptions): Promise<ScanResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Scan content for secrets
|
|
63
|
+
*/
|
|
64
|
+
private scanContent;
|
|
65
|
+
/**
|
|
66
|
+
* Check if a match is likely a placeholder/example
|
|
67
|
+
*/
|
|
68
|
+
private isLikelyPlaceholder;
|
|
69
|
+
/**
|
|
70
|
+
* Mask a secret for display
|
|
71
|
+
*/
|
|
72
|
+
private maskSecret;
|
|
73
|
+
/**
|
|
74
|
+
* Get all files to scan in a directory
|
|
75
|
+
*/
|
|
76
|
+
private getFilesToScan;
|
|
77
|
+
/**
|
|
78
|
+
* Check if a file should be excluded
|
|
79
|
+
*/
|
|
80
|
+
private shouldExcludeFile;
|
|
81
|
+
/**
|
|
82
|
+
* Add custom patterns
|
|
83
|
+
*/
|
|
84
|
+
addPattern(pattern: SecretPattern): void;
|
|
85
|
+
/**
|
|
86
|
+
* Get all registered patterns
|
|
87
|
+
*/
|
|
88
|
+
getPatterns(): SecretPattern[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Convenience function to scan a directory
|
|
92
|
+
*/
|
|
93
|
+
export declare function scanForSecrets(options: ScanOptions): Promise<ScanResult>;
|
|
94
|
+
/**
|
|
95
|
+
* Format scan results for CLI output
|
|
96
|
+
*/
|
|
97
|
+
export declare function formatScanResults(result: ScanResult): string;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ACME Client for Let's Encrypt
|
|
3
|
+
* Implements RFC 8555 (ACME Protocol) for certificate issuance
|
|
4
|
+
*
|
|
5
|
+
* This is a pure TypeScript/Bun implementation without external dependencies.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ACME_DIRECTORIES: {
|
|
8
|
+
readonly production: "https://acme-v02.api.letsencrypt.org/directory";
|
|
9
|
+
readonly staging: "https://acme-staging-v02.api.letsencrypt.org/directory";
|
|
10
|
+
};
|
|
11
|
+
export interface AcmeClientOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Use staging server for testing
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
staging?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Account email for Let's Encrypt notifications
|
|
19
|
+
*/
|
|
20
|
+
email: string;
|
|
21
|
+
/**
|
|
22
|
+
* Account key in PEM format (optional, will be generated if not provided)
|
|
23
|
+
*/
|
|
24
|
+
accountKey?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface AcmeChallenge {
|
|
27
|
+
type: 'http-01' | 'dns-01';
|
|
28
|
+
token: string;
|
|
29
|
+
keyAuthorization: string;
|
|
30
|
+
/**
|
|
31
|
+
* For HTTP-01: URL path to serve the challenge
|
|
32
|
+
* For DNS-01: TXT record name
|
|
33
|
+
*/
|
|
34
|
+
identifier: string;
|
|
35
|
+
/**
|
|
36
|
+
* For DNS-01: The value to put in the TXT record
|
|
37
|
+
*/
|
|
38
|
+
dnsValue?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface AcmeCertificate {
|
|
41
|
+
certificate: string;
|
|
42
|
+
privateKey: string;
|
|
43
|
+
chain: string;
|
|
44
|
+
fullchain: string;
|
|
45
|
+
expiresAt: Date;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* ACME Client for Let's Encrypt certificate management
|
|
49
|
+
*/
|
|
50
|
+
export declare class AcmeClient {
|
|
51
|
+
private directoryUrl;
|
|
52
|
+
private email;
|
|
53
|
+
private accountKey;
|
|
54
|
+
private accountUrl;
|
|
55
|
+
private directory;
|
|
56
|
+
private nonce;
|
|
57
|
+
constructor(options: AcmeClientOptions);
|
|
58
|
+
/**
|
|
59
|
+
* Generate a new account key pair
|
|
60
|
+
*/
|
|
61
|
+
private generateAccountKey;
|
|
62
|
+
/**
|
|
63
|
+
* Get the ACME directory
|
|
64
|
+
*/
|
|
65
|
+
private getDirectory;
|
|
66
|
+
/**
|
|
67
|
+
* Get a fresh nonce for requests
|
|
68
|
+
*/
|
|
69
|
+
private getNonce;
|
|
70
|
+
/**
|
|
71
|
+
* Create JWK from account key
|
|
72
|
+
*/
|
|
73
|
+
private getJwk;
|
|
74
|
+
/**
|
|
75
|
+
* Calculate JWK thumbprint
|
|
76
|
+
*/
|
|
77
|
+
private getJwkThumbprint;
|
|
78
|
+
/**
|
|
79
|
+
* Base64URL encode
|
|
80
|
+
*/
|
|
81
|
+
private base64UrlEncode;
|
|
82
|
+
/**
|
|
83
|
+
* Sign a payload for ACME request
|
|
84
|
+
*/
|
|
85
|
+
private signPayload;
|
|
86
|
+
/**
|
|
87
|
+
* Make a signed ACME request
|
|
88
|
+
*/
|
|
89
|
+
private acmeRequest;
|
|
90
|
+
/**
|
|
91
|
+
* Register or get existing account
|
|
92
|
+
*/
|
|
93
|
+
registerAccount(): Promise<string>;
|
|
94
|
+
/**
|
|
95
|
+
* Create a new certificate order
|
|
96
|
+
*/
|
|
97
|
+
createOrder(domains: string[]): Promise<{
|
|
98
|
+
orderUrl: string;
|
|
99
|
+
authorizations: string[];
|
|
100
|
+
finalize: string;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Get authorization challenges
|
|
104
|
+
*/
|
|
105
|
+
getAuthorization(authUrl: string): Promise<{
|
|
106
|
+
domain: string;
|
|
107
|
+
challenges: AcmeChallenge[];
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* Respond to a challenge (tell ACME server we're ready)
|
|
111
|
+
*/
|
|
112
|
+
respondToChallenge(challengeUrl: string): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Poll for authorization status
|
|
115
|
+
*/
|
|
116
|
+
waitForAuthorization(authUrl: string, maxAttempts?: number): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Generate a CSR (Certificate Signing Request)
|
|
119
|
+
*/
|
|
120
|
+
private generateCsr;
|
|
121
|
+
/**
|
|
122
|
+
* Create a simple CSR (placeholder - would need proper implementation)
|
|
123
|
+
*/
|
|
124
|
+
private createSimpleCsr;
|
|
125
|
+
/**
|
|
126
|
+
* Finalize the order and get the certificate
|
|
127
|
+
*/
|
|
128
|
+
finalizeOrder(finalizeUrl: string, domains: string[]): Promise<AcmeCertificate>;
|
|
129
|
+
/**
|
|
130
|
+
* Get the account key (for storage/reuse)
|
|
131
|
+
*/
|
|
132
|
+
getAccountKey(): string;
|
|
133
|
+
}
|