carlyemail 0.7.0 → 0.8.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.
- package/README.md +1 -0
- package/carlyemail.js +33 -2
- package/package.json +1 -1
- package/sdk.d.ts +10 -0
- package/sdk.js +5 -0
package/README.md
CHANGED
|
@@ -80,6 +80,7 @@ npm install -g carlyemail
|
|
|
80
80
|
| | |
|
|
81
81
|
|---|---|
|
|
82
82
|
| `signup --human-email <e> --username <u>` | Create an account and an inbox |
|
|
83
|
+
| `send-code` | Email the owner a code to confirm the account |
|
|
83
84
|
| `verify <code>` | Confirm the owner email |
|
|
84
85
|
| `whoami` | Identity and scope of the current key |
|
|
85
86
|
| `env` | Print `CARLYEMAIL_API_KEY` and `CARLYEMAIL_INBOX` shell exports |
|
package/carlyemail.js
CHANGED
|
@@ -18,7 +18,7 @@ import { basename, extname, join } from "node:path";
|
|
|
18
18
|
import { fileURLToPath } from "node:url";
|
|
19
19
|
import { randomBytes } from "node:crypto";
|
|
20
20
|
|
|
21
|
-
export const VERSION = "0.
|
|
21
|
+
export const VERSION = "0.8.0";
|
|
22
22
|
|
|
23
23
|
const DEFAULT_API = "https://api.carlyemail.com";
|
|
24
24
|
const CONFIG_DIR = join(homedir(), ".carlyemail");
|
|
@@ -416,7 +416,17 @@ define(
|
|
|
416
416
|
ctx.print(ok(bold(out.inbox_id)));
|
|
417
417
|
ctx.print(ok(`key saved to ${saved}`));
|
|
418
418
|
ctx.print("");
|
|
419
|
-
|
|
419
|
+
|
|
420
|
+
// Sign-up emails nothing by itself. The person at this terminal is the one
|
|
421
|
+
// asking, so ask for them; the key is already saved if this fails.
|
|
422
|
+
try {
|
|
423
|
+
await request(config, "POST", "/v0/agent/verification-code");
|
|
424
|
+
ctx.print(arrow(`check ${human_email} for a 6-digit code, then:`));
|
|
425
|
+
} catch {
|
|
426
|
+
ctx.print(arrow("the code did not send — try again with:"));
|
|
427
|
+
ctx.print(` carlyemail send-code`);
|
|
428
|
+
ctx.print(arrow("then:"));
|
|
429
|
+
}
|
|
420
430
|
ctx.print(` carlyemail verify <code>`);
|
|
421
431
|
ctx.print("");
|
|
422
432
|
ctx.print(dim(`Until the code is confirmed the account can only email ${human_email}.`));
|
|
@@ -462,6 +472,27 @@ define("verify", "Confirm the owner email with the code", "carlyemail verify 123
|
|
|
462
472
|
ctx.print(ok("verified — this account can send anywhere now"));
|
|
463
473
|
});
|
|
464
474
|
|
|
475
|
+
define(
|
|
476
|
+
"send-code",
|
|
477
|
+
"Email the owner a code to confirm the account",
|
|
478
|
+
"carlyemail send-code",
|
|
479
|
+
async (ctx) => {
|
|
480
|
+
const out = await request(ctx.config, "POST", "/v0/agent/verification-code");
|
|
481
|
+
if (out.verified) {
|
|
482
|
+
ctx.print(ok("already verified — this account can send anywhere"));
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
ctx.print(
|
|
486
|
+
arrow(
|
|
487
|
+
out.sent
|
|
488
|
+
? `check ${out.owner_email} for a 6-digit code, then:`
|
|
489
|
+
: `a code went to ${out.owner_email} in the last 10 minutes — use that one:`
|
|
490
|
+
)
|
|
491
|
+
);
|
|
492
|
+
ctx.print(` carlyemail verify <code>`);
|
|
493
|
+
}
|
|
494
|
+
);
|
|
495
|
+
|
|
465
496
|
define("whoami", "Show the key's identity and scope", "carlyemail whoami", async (ctx) => {
|
|
466
497
|
const me = await request(ctx.config, "GET", "/v0/auth/me");
|
|
467
498
|
emit(ctx, me, () => {
|
package/package.json
CHANGED
package/sdk.d.ts
CHANGED
|
@@ -43,6 +43,15 @@ export interface AgentSignupResponse {
|
|
|
43
43
|
organization_id: string;
|
|
44
44
|
inbox_id: string;
|
|
45
45
|
api_key: string;
|
|
46
|
+
verified?: boolean;
|
|
47
|
+
next_step?: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface AgentVerificationCodeResponse {
|
|
51
|
+
sent: boolean;
|
|
52
|
+
verified: boolean;
|
|
53
|
+
owner_email?: string | null;
|
|
54
|
+
detail: string;
|
|
46
55
|
}
|
|
47
56
|
|
|
48
57
|
export interface AgentVerifyRequest {
|
|
@@ -781,6 +790,7 @@ export declare class Agent {
|
|
|
781
790
|
signUp(body: AgentSignupRequest): Promise<AgentSignupResponse>;
|
|
782
791
|
signIn(body: AgentSigninRequest): Promise<AgentSigninResponse>;
|
|
783
792
|
verifySignIn(body: AgentSigninVerifyRequest): Promise<AgentSigninVerifyResponse>;
|
|
793
|
+
requestVerificationCode(): Promise<AgentVerificationCodeResponse>;
|
|
784
794
|
verify(body: AgentVerifyRequest): Promise<AgentVerifyResponse>;
|
|
785
795
|
}
|
|
786
796
|
|
package/sdk.js
CHANGED
|
@@ -88,6 +88,11 @@ class Agent {
|
|
|
88
88
|
return this.$.request("POST", `/v0/agent/sign-in/verify`, { body, auth: false });
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
/** Request Verification Code */
|
|
92
|
+
requestVerificationCode() {
|
|
93
|
+
return this.$.request("POST", `/v0/agent/verification-code`);
|
|
94
|
+
}
|
|
95
|
+
|
|
91
96
|
/** Verify */
|
|
92
97
|
verify(body) {
|
|
93
98
|
return this.$.request("POST", `/v0/agent/verify`, { body });
|