Skip to content

Commit

Permalink
ndncert: delete createEthereal
Browse files Browse the repository at this point in the history
Ethereal test account no longer supports inbound email.
  • Loading branch information
yoursunny committed Nov 22, 2024
1 parent 51f25db commit b63f7a6
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 38 deletions.
4 changes: 2 additions & 2 deletions integ/browser-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
"devDependencies": {
"@nodelib/fs.walk": "^2.0.0",
"@types/webpack": "^5.28.5",
"@zenfs/core": "^1.3.3",
"@zenfs/core": "^1.3.5",
"@zenfs/dom": "^1.0.6",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"html-webpack-plugin": "^5.6.3",
"puppeteer": "^23.8.0",
"puppeteer": "^23.9.0",
"ts-loader": "^9.5.1",
"tslib": "^2.8.1",
"type-fest": "^4.27.0",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"test": "vitest",
"typedoc": "bash mk/typedoc.sh"
},
"packageManager": "pnpm@9.13.2+sha512.88c9c3864450350e65a33587ab801acf946d7c814ed1134da4a924f6df5a2120fd36b46aab68f7cd1d413149112d53c7db3a4136624cfd00ff1846a0c6cef48a",
"packageManager": "pnpm@9.14.2+sha512.6e2baf77d06b9362294152c851c4f278ede37ab1eba3a55fda317a4a17b209f4dbb973fb250a77abc463a341fcb1f17f17cfa24091c4eb319cda0d9b84278387",
"devDependencies": {
"@types/node": "^20.17.6",
"@types/wtfnode": "^0.7.3",
"@typescript/lib-dom": "npm:@types/[email protected].179",
"@typescript/lib-dom": "npm:@types/[email protected].182",
"@vitest/coverage-v8": "^2.1.5",
"@yoursunny/xo-config": "0.59.0",
"codedown": "^3.2.1",
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
"dotenv": "^16.4.5",
"env-var": "^7.5.0",
"tslib": "^2.8.1",
"wtfnode": "^0.9.3"
"wtfnode": "^0.9.4"
}
}
2 changes: 1 addition & 1 deletion pkg/fileserver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@ndn/segmented-object": "workspace:*",
"@ndn/tlv": "workspace:*",
"@ndn/util": "workspace:*",
"@zenfs/core": "^1.3.3",
"@zenfs/core": "^1.3.5",
"mnemonist": "^0.39.8",
"obliterator": "^2.0.4",
"streaming-iterables": "^8.0.1",
Expand Down
2 changes: 0 additions & 2 deletions pkg/fileserver/src/zenfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,9 @@ const fileMethodsNotsup = [
"chownSync",
"chmodSync",
"utimesSync",
"_setTypeSync",
] as const satisfies ReadonlyArray<keyof File>;
const fileMethodsAsync = [
"stat",
"_setType",
"utimes",
"sync",
"chown",
Expand Down
1 change: 0 additions & 1 deletion pkg/keychain-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ See `@ndn/ndnsec` package for more information.
* `--challenge pin` enables "pin" challenge.
* `--challenge email` enables "email" challenge.
* `--email` specifies email address to use in the email challenge.
The special value `ethereal` generates a test account on [Ethereal Email](https://ethereal.email/) and automatically solves the email challenge.
* `--challenge possession` enables "possession" challenge.
* `--possession-cert` specifies existing certificate name to fulfill possession challenge.
If `--key` is a certificate name, this may be omitted if using the same certificate.
Expand Down
2 changes: 1 addition & 1 deletion pkg/keychain-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"devDependencies": {
"@types/fast-chunk-string": "^1.0.3",
"@types/nodemailer": "^6.4.16",
"@types/nodemailer": "^6.4.17",
"@types/prompts": "^2.4.9",
"@types/stdout-stream": "^1.4.2",
"@types/yargs": "^17.0.33"
Expand Down
12 changes: 3 additions & 9 deletions pkg/keychain-cli/src/ndncert03-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import fs from "node:fs/promises";
import { openUplinks } from "@ndn/cli-common";
import { CertNaming, generateSigningKey, type KeyChain, type NamedSigner, type NamedVerifier } from "@ndn/keychain";
import { AltUri } from "@ndn/naming-convention2";
import { type CaProfile, type ClientChallenge, type ClientChallengeContext, ClientEmailChallenge, ClientEmailInboxImap, ClientNopChallenge, ClientPinChallenge, type ClientPinLikeChallenge, ClientPossessionChallenge, matchProbe, requestCertificate, requestProbe } from "@ndn/ndncert";
import { type CaProfile, type ClientChallenge, type ClientChallengeContext, ClientEmailChallenge, type ClientEmailInboxImap, ClientNopChallenge, ClientPinChallenge, type ClientPinLikeChallenge, ClientPossessionChallenge, matchProbe, requestCertificate, requestProbe } from "@ndn/ndncert";
import { NdnsecKeyChain } from "@ndn/ndnsec";
import { Name } from "@ndn/packet";
import { console, toHex } from "@ndn/util";
Expand Down Expand Up @@ -76,7 +76,7 @@ export const Ndncert03ClientCommand: CommandModule<{}, Args> = {
return true;
})
.check(({ challenge, email }) => {
if (challenge.includes("email") && !(email === "ethereal" || email?.includes("@"))) {
if (challenge.includes("email") && !email?.includes("@")) {
throw new Error("email challenge enabled but --email is not an email address");
}
return true;
Expand Down Expand Up @@ -177,13 +177,7 @@ class InteractiveClient {
break;
}
case "email": {
if (this.args.email === "ethereal") {
this.inbox = await ClientEmailInboxImap.createEthereal();
console.log(`Using Ethereal Email inbox ${this.inbox.address}`);
challenges.push(new ClientEmailChallenge(this.inbox.address, this.inbox.promptCallback));
} else {
challenges.push(new ClientEmailChallenge(this.args.email!, this.promptPin()));
}
challenges.push(new ClientEmailChallenge(this.args.email!, this.promptPin()));
break;
}
case "possession": {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ndncert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@ndn/tlv": "workspace:*",
"@ndn/util": "workspace:*",
"@types/imap": "^0.8.42",
"@types/nodemailer": "^6.4.16",
"@types/nodemailer": "^6.4.17",
"ajv": "^8.17.1",
"b64-lite": "^1.4.0",
"imap-emails": "^1.0.4",
Expand Down
18 changes: 1 addition & 17 deletions pkg/ndncert/src/client/email-inbox-imap_node.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { crypto, toHex } from "@ndn/util";
import type { Config as ImapConfig } from "imap";
import { ImapEmails, type ImapEmailsProps } from "imap-emails";
import type { AddressObject, ParsedMail } from "mailparser";
import { createTestAccount } from "nodemailer";
import pTimeout from "p-timeout";

import type { ClientChallengeContext } from "./challenge";
Expand Down Expand Up @@ -125,24 +123,10 @@ export namespace ClientEmailInboxImap {
useHtml?: boolean;

/**
* Regular Expression to extract PIN.
* Regular Expression to extract PIN into capture group 1.
* @defaultValue
* Accepting any 6-digit token.
*/
regex?: RegExp;
}

/** Create IMAP inbox hosted by Ethereal. */
export async function createEthereal(extract: ExtractOptions = {}): Promise<ClientEmailInboxImap> {
const a = await createTestAccount();
const addressParts = a.user.split("@");
addressParts[0] += `+${toHex(crypto.getRandomValues(new Uint8Array(8)))}`;
return new ClientEmailInboxImap(addressParts.join("@"), {
user: a.user,
password: a.pass,
host: a.imap.host,
port: a.imap.port,
tls: a.imap.secure,
}, extract);
}
}
2 changes: 1 addition & 1 deletion pkg/segmented-object/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@ndn/naming-convention2": "workspace:*",
"@ndn/packet": "workspace:*",
"@ndn/util": "workspace:*",
"@zenfs/core": "^1.3.3",
"@zenfs/core": "^1.3.5",
"it-keepalive": "^1.2.0",
"mnemonist": "^0.39.8",
"obliterator": "^2.0.4",
Expand Down

0 comments on commit b63f7a6

Please sign in to comment.