-
Notifications
You must be signed in to change notification settings - Fork 0
fix(pg-node): clean up stale Node 20 references and README style #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,21 @@ | ||
| # pg-node: PostGuard Node.js example | ||
|
|
||
| Node.js example demonstrating how to use the [@e4a/pg-js](https://www.npmjs.com/package/@e4a/pg-js) SDK from a server runtime. Mirrors the [pg-sveltekit](../pg-sveltekit) example's "Informatierijk notificeren" flow (citizen + organisation recipients) but as a CLI script — drop-in starting point for backend integrations. | ||
| Node.js example demonstrating how to use the [@e4a/pg-js](https://www.npmjs.com/package/@e4a/pg-js) SDK from a server runtime. Mirrors the [pg-sveltekit](../pg-sveltekit) example's "Informatierijk notificeren" flow (citizen + organisation recipients) as a CLI script. Drop-in starting point for backend integrations. | ||
|
|
||
| ## What it does | ||
|
|
||
| Two modes, selected by the script flag: | ||
| Two modes, selected by an npm script: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Code review] Wording changed from |
||
|
|
||
| 1. **Send** (`npm run send`) — encrypts the input files for a citizen (exact email) and an organisation (email domain), uploads to Cryptify, and asks Cryptify to email each recipient a download link. | ||
| 2. **Upload-only** (`npm run upload`) — same encryption + upload, but silent. Cryptify returns a UUID you can distribute through some other channel. | ||
| | Mode | Command | What it does | | ||
| | ----------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Send | `npm run send` | Encrypts the input files for a citizen (exact email) and an organisation (email domain), uploads to Cryptify, and asks Cryptify to email each recipient. | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Code review] Two-row Markdown table whose content rows are 220–250 chars wide. Renders fine on GitHub but the raw markdown is awkward to read and edit (and the existing Configuration table further down doesn't need to be this wide). Consider either dropping back to a list (without the inline-header pattern) or keeping commands+modes as one column and moving the descriptions to prose. |
||
| | Upload-only | `npm run upload` | Same encryption and upload, but silent. Cryptify returns a UUID you can distribute through some other channel. | | ||
|
|
||
| Files come from `PG_INPUT_FILES` (comma-separated paths) or two in-memory demo files if that is unset. | ||
| Files come from `PG_INPUT_FILES` (comma-separated paths), or two in-memory demo files if that is unset. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Code review] Diff inserts a comma here: |
||
|
|
||
| ## Prerequisites | ||
|
|
||
| - **Node.js 22+** — matches `@e4a/pg-js`'s `engines.node`. The SDK also supports Bun and Deno; the same encryption code in `src/encryption.mjs` works there too. | ||
| - **Node.js 22+**, matching `@e4a/pg-js`'s `engines.node`. The SDK also supports Bun and Deno; the same encryption code in `src/encryption.mjs` works there too. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Code review + Rule: writing-rules #48] PR claims to eliminate the writing-rules #48 inline-header + sentence list pattern, but this line still has it: |
||
| - A PostGuard for Business API key. | ||
|
|
||
| ## Setup | ||
|
|
@@ -38,7 +40,7 @@ The script prints the resulting `uuid` and the corresponding `…/download?uuid= | |
|
|
||
| ## Staging Cryptify does not send email | ||
|
|
||
| The default `PG_CRYPTIFY_URL` is `storage.staging.postguard.eu` — the staging deployment. It **does not actually deliver notification emails**, so you can exercise the full upload + notify flow without spamming real inboxes while you integrate. | ||
| The default `PG_CRYPTIFY_URL` is `storage.staging.postguard.eu`, the staging deployment. It **does not actually deliver notification emails**, so you can exercise the full upload + notify flow without spamming real inboxes while you integrate. | ||
|
|
||
| - The upload itself works. You get back a real UUID and the download URL is usable. | ||
| - `npm run send` succeeds, but no recipient mail is sent. Open the printed URL yourself to verify the decrypt flow end-to-end. | ||
|
|
@@ -72,4 +74,4 @@ const sealed = pg.encrypt({ | |
| const { uuid } = await sealed.upload({ notify: { recipients: true, message, language: 'EN' } }); | ||
| ``` | ||
|
|
||
| `notify` must be nested under an object — the SDK validates the shape and throws a clear `TypeError` if you pass `{ notify: true }` or forget to nest. See the [SDK README](https://github.com/encryption4all/postguard-js#server-side-usage-node-bun-deno) for the full server-side surface. | ||
| `notify` must be nested under an object. The SDK validates the shape and throws a clear `TypeError` if you pass `{ notify: true }` or forget to nest. See the [SDK README](https://github.com/encryption4all/postguard-js#server-side-usage-node-bun-deno) for the full server-side surface. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| // Env-driven config. Run with `node --env-file=.env index.mjs` to load | ||
| // from .env (Node 20.6+). Mirrors pg-sveltekit's config.ts. | ||
| // Env-driven config. `.env` is loaded automatically by the npm scripts | ||
| // via Node's `--env-file-if-exists`. Mirrors pg-sveltekit's config.ts. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Code review] Comment now says |
||
|
|
||
| export const PKG_URL = process.env.PG_PKG_URL || 'https://pkg.staging.postguard.eu'; | ||
| export const CRYPTIFY_URL = process.env.PG_CRYPTIFY_URL || 'https://storage.staging.postguard.eu'; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Code review + Rule: writing-rules #33]
Drop-in starting point for backend integrationsis borderline promotional and pattern-matches what writing-rules calls AI-slop (press-release voice / vague aspirational uplift). Not banned and pre-existing from #46, but the PR touched this line — replacement candidate:Use as a starting point when integrating PostGuard from a backend.