JS/TS library for encrypting and decrypting file attachments in Matrix
  • TypeScript 54.6%
  • JavaScript 36.7%
  • Python 8.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
dependabot[bot] b7c300ae8f
chore(deps-dev): bump shell-quote from 1.7.3 to 1.12.0 (#105)
Signed-off-by: dependabot[bot] <support@github.com>
2026-11-10 17:41:12 +00:00
.github chore: migrate from ESLint to oxlint (type-aware) + oxfmt, upgrade TypeScript to 6 (#106) 2026-11-10 17:38:11 +00:00
src chore: migrate from ESLint to oxlint (type-aware) + oxfmt, upgrade TypeScript to 6 (#106) 2026-11-10 17:38:11 +00:00
test chore: migrate from ESLint to oxlint (type-aware) + oxfmt, upgrade TypeScript to 6 (#106) 2026-11-10 17:38:11 +00:00
.gitattributes Initial commit 2021-11-09 09:29:25 +00:00
.gitignore chore: ignore .DS_Store 2023-03-30 22:36:21 +01:00
.npmrc Specify npm registry 2021-11-14 09:37:53 +00:00
.nvmrc chore(ci): build using Node.js 22 (#72) 2024-10-22 13:28:27 +01:00
.oxfmtrc.json chore: migrate from ESLint to oxlint (type-aware) + oxfmt, upgrade TypeScript to 6 (#106) 2026-11-10 17:38:11 +00:00
.oxlintrc.json chore: migrate from ESLint to oxlint (type-aware) + oxfmt, upgrade TypeScript to 6 (#106) 2026-11-10 17:38:11 +00:00
CHANGELOG.md chore(ci): replace semantic-release with manual GitHub Release based publishing (#89) 2026-11-10 16:31:36 +00:00
CONTRIBUTING.md chore(ci): replace semantic-release with manual GitHub Release based publishing (#89) 2026-11-10 16:31:36 +00:00
LICENSE Initial commit 2021-11-09 09:29:25 +00:00
package.json chore: migrate from ESLint to oxlint (type-aware) + oxfmt, upgrade TypeScript to 6 (#106) 2026-11-10 17:38:11 +00:00
README.md chore: migrate from ESLint to oxlint (type-aware) + oxfmt, upgrade TypeScript to 6 (#106) 2026-11-10 17:38:11 +00:00
tsconfig.json chore: migrate from ESLint to oxlint (type-aware) + oxfmt, upgrade TypeScript to 6 (#106) 2026-11-10 17:38:11 +00:00
web-test-runner.config.mjs chore: migrate from ESLint to oxlint (type-aware) + oxfmt, upgrade TypeScript to 6 (#106) 2026-11-10 17:38:11 +00:00
yarn.lock chore(deps-dev): bump shell-quote from 1.7.3 to 1.12.0 (#105) 2026-11-10 17:41:12 +00:00

Matrix Encrypt Attachment

Encrypt and decrypt attachments in accordance with the Matrix Client-Server API spec.

Supports browsers using WebCryptoAPI and Node.js via crypto.

This project builds on and deprecates browser-encrypt-attachment to add support for non-browser environments.

Protocol versions

Previous versions of the protocol are not currently documented in the spec, and are described here for reference:

Protocol Description
v0 use all 128 bits of the counter
v1 use only 64 bits of the counter
v2 (current) use only 64 bits and also zero out the other half to maximise the space before it wraps

Encryption

The library will encrypt to the following protocol versions:

Protocol Browser Node.js
Encrypt v2 v2

Decryption

The library supports decryption of the following protocol versions:

Protocol Browser Node.js
Decrypt v0 ✅ ❌
Decrypt v1 ✅ ❌
Decrypt v2 ✅ ✅