@agenticmail/enterprise 0.5.6 → 0.5.8
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/chunk-2QYDZGOO.js +12666 -0
- package/dist/chunk-BRKFYP4K.js +878 -0
- package/dist/chunk-G5OKUKJH.js +48 -0
- package/dist/chunk-L3MSZRJB.js +9040 -0
- package/dist/chunk-QURS6HT5.js +1943 -0
- package/dist/chunk-VVQLDBGG.js +889 -0
- package/dist/cli-recover-LHRRZHAL.js +97 -0
- package/dist/cli-verify-JMWR6QC6.js +98 -0
- package/dist/cli.js +6 -6
- package/dist/dynamodb-QS64UREL.js +424 -0
- package/dist/factory-OVJZELPA.js +9 -0
- package/dist/index.js +8 -8
- package/dist/mongodb-MWH3DGZY.js +320 -0
- package/dist/mysql-SPPOCBFA.js +575 -0
- package/dist/postgres-AYNOP46Z.js +573 -0
- package/dist/registry/cli.js +1 -1
- package/dist/resolve-driver-VQXMFKLJ.js +27 -0
- package/dist/routes-T7QCPI6D.js +5674 -0
- package/dist/runtime-6PFTQWCV.js +47 -0
- package/dist/server-EQ454T4F.js +11 -0
- package/dist/setup-SKZG3MS5.js +20 -0
- package/dist/setup-UIYXH2L3.js +20 -0
- package/dist/sqlite-BA2TMKVB.js +491 -0
- package/dist/turso-CEAPRUFX.js +496 -0
- package/package.json +1 -1
- package/src/db/dynamodb.ts +4 -6
- package/src/db/mongodb.ts +1 -1
- package/src/db/mysql.ts +1 -1
- package/src/db/postgres.ts +5 -8
- package/src/db/resolve-driver.ts +29 -0
- package/src/db/sqlite.ts +1 -1
- package/src/db/turso.ts +1 -1
- package/src/setup/index.ts +23 -17
- package/src/setup/registration.ts +86 -12
|
@@ -91,23 +91,97 @@ export async function promptRegistration(
|
|
|
91
91
|
const data = await res.json().catch(() => ({})) as any;
|
|
92
92
|
|
|
93
93
|
if (res.status === 409) {
|
|
94
|
-
spinner.
|
|
94
|
+
spinner.info('Domain already registered — verifying ownership');
|
|
95
95
|
console.log('');
|
|
96
96
|
console.log(chalk.yellow(' This domain is already registered and verified.'));
|
|
97
|
-
console.log(chalk.dim('
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
console.log(chalk.dim(' Enter your deployment key to prove ownership and continue.\n'));
|
|
98
|
+
|
|
99
|
+
const { deploymentKey } = await inquirer.prompt([{
|
|
100
|
+
type: 'password',
|
|
101
|
+
name: 'deploymentKey',
|
|
102
|
+
message: 'Deployment key:',
|
|
103
|
+
mask: '*',
|
|
104
|
+
validate: (v: string) => v.length === 64 || 'Deployment key should be 64 hex characters',
|
|
105
105
|
}]);
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
// Recover via registry — this re-registers with a new challenge
|
|
108
|
+
const recoverSpinner = ora('Verifying deployment key...').start();
|
|
109
|
+
try {
|
|
110
|
+
const recoverRes = await fetch(`${registryUrl}/domains/recover`, {
|
|
111
|
+
method: 'POST',
|
|
112
|
+
headers: { 'Content-Type': 'application/json' },
|
|
113
|
+
body: JSON.stringify({
|
|
114
|
+
domain: domain!.toLowerCase().trim(),
|
|
115
|
+
deploymentKey,
|
|
116
|
+
}),
|
|
117
|
+
signal: AbortSignal.timeout(15_000),
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const recoverData = await recoverRes.json().catch(() => ({})) as any;
|
|
121
|
+
|
|
122
|
+
if (recoverRes.status === 403) {
|
|
123
|
+
recoverSpinner.fail('Invalid deployment key');
|
|
124
|
+
console.log('');
|
|
125
|
+
console.log(chalk.red(' The deployment key does not match this domain.'));
|
|
126
|
+
console.log('');
|
|
127
|
+
|
|
128
|
+
const { continueAnyway } = await inquirer.prompt([{
|
|
129
|
+
type: 'confirm',
|
|
130
|
+
name: 'continueAnyway',
|
|
131
|
+
message: 'Continue setup without registration?',
|
|
132
|
+
default: true,
|
|
133
|
+
}]);
|
|
134
|
+
|
|
135
|
+
if (continueAnyway) {
|
|
136
|
+
return { registered: false, verificationStatus: 'skipped' };
|
|
137
|
+
}
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (!recoverRes.ok) {
|
|
142
|
+
throw new Error(recoverData.error || `HTTP ${recoverRes.status}`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
recoverSpinner.succeed('Ownership verified — domain recovered');
|
|
146
|
+
|
|
147
|
+
// Now verify DNS with the new challenge
|
|
148
|
+
registrationId = recoverData.registrationId;
|
|
149
|
+
dnsChallenge = recoverData.dnsChallenge;
|
|
150
|
+
|
|
151
|
+
// Auto-verify DNS since they already own the domain
|
|
152
|
+
const verifyRes = await fetch(`${registryUrl}/domains/verify`, {
|
|
153
|
+
method: 'POST',
|
|
154
|
+
headers: { 'Content-Type': 'application/json' },
|
|
155
|
+
body: JSON.stringify({ domain: domain!.toLowerCase().trim() }),
|
|
156
|
+
signal: AbortSignal.timeout(15_000),
|
|
157
|
+
});
|
|
158
|
+
const verifyData = await verifyRes.json().catch(() => ({})) as any;
|
|
159
|
+
|
|
160
|
+
// Re-hash the provided key for local storage
|
|
161
|
+
const { createHash } = await import('crypto');
|
|
162
|
+
const localKeyHash = createHash('sha256').update(deploymentKey).digest('hex');
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
registered: true,
|
|
166
|
+
deploymentKeyHash: localKeyHash,
|
|
167
|
+
dnsChallenge,
|
|
168
|
+
registrationId,
|
|
169
|
+
verificationStatus: verifyData?.verified ? 'verified' : 'pending_dns',
|
|
170
|
+
};
|
|
171
|
+
} catch (err: any) {
|
|
172
|
+
recoverSpinner.fail(`Recovery failed: ${err.message}`);
|
|
173
|
+
const { continueAnyway } = await inquirer.prompt([{
|
|
174
|
+
type: 'confirm',
|
|
175
|
+
name: 'continueAnyway',
|
|
176
|
+
message: 'Continue setup without registration?',
|
|
177
|
+
default: true,
|
|
178
|
+
}]);
|
|
179
|
+
|
|
180
|
+
if (continueAnyway) {
|
|
181
|
+
return { registered: false, verificationStatus: 'skipped' };
|
|
182
|
+
}
|
|
183
|
+
process.exit(1);
|
|
109
184
|
}
|
|
110
|
-
process.exit(1);
|
|
111
185
|
}
|
|
112
186
|
|
|
113
187
|
if (!res.ok) {
|