https://github.com/encryption4all/postguard-js
https://github.com/encryption4all/postguard-js
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/encryption4all/postguard-js
- Owner: encryption4all
- Created: 2026-03-25T12:12:25.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-04-15T09:41:49.000Z (2 months ago)
- Last Synced: 2026-04-15T11:33:49.384Z (2 months ago)
- Language: TypeScript
- Size: 147 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#

> For full documentation, visit [docs.postguard.eu](https://docs.postguard.eu/repos/postguard-js).
TypeScript/JavaScript SDK for PostGuard, published as `@e4a/pg-js` on npm. Works in both browsers and Node.js.
PostGuard encrypts data for recipients based on their identity attributes (email address, phone number, etc.) rather than traditional public keys. Recipients prove their identity via [Yivi](https://yivi.app) to decrypt. This SDK is the main way web applications and email add-ons integrate with PostGuard.
## Quick Start
```bash
npm install @e4a/pg-js
```
```ts
import { PostGuard } from '@e4a/pg-js';
const pg = new PostGuard({
pkgUrl: 'https://pkg.postguard.eu',
});
// Encrypt
const sealed = pg.encrypt({
sign: pg.sign.apiKey('your-api-key'),
recipients: [pg.recipient.email('bob@example.com')],
files: fileList,
});
const { uuid } = await sealed.upload();
// Decrypt
const opened = pg.open({ uuid });
const result = await opened.decrypt({ element: '#yivi-popup' });
result.download();
```
See the [full API reference](https://docs.postguard.eu/repos/postguard-js) for encryption options, signing methods, recipient types, and email helpers.
## Development
Install dependencies and build:
```bash
npm install
npm run prebuild
npm run build
```
Run the tests:
```bash
npm run test
```
## Releasing
Releases are handled by [semantic-release](https://semantic-release.gitbook.io/) on the `main` branch. When commits land on `main`, semantic-release determines the next version from conventional commit messages and publishes to npm automatically.
## License
MIT