{"id":28731642,"url":"https://github.com/matrix-org/matrix-sdk-crypto-wasm","last_synced_at":"2026-01-07T19:17:40.326Z","repository":{"id":97241141,"uuid":"605602083","full_name":"matrix-org/matrix-sdk-crypto-wasm","owner":"matrix-org","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-13T19:57:19.000Z","size":1337,"stargazers_count":29,"open_issues_count":5,"forks_count":14,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-07-20T06:22:03.124Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matrix-org.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-23T14:05:32.000Z","updated_at":"2025-07-13T19:56:42.000Z","dependencies_parsed_at":"2023-12-13T15:44:04.300Z","dependency_job_id":"a3d16030-bdb0-48a2-9a46-08b55c4de38a","html_url":"https://github.com/matrix-org/matrix-sdk-crypto-wasm","commit_stats":null,"previous_names":["matrix-org/matrix-rust-sdk-crypto-wasm","matrix-org/matrix-sdk-crypto-wasm"],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/matrix-org/matrix-sdk-crypto-wasm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-org%2Fmatrix-sdk-crypto-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-org%2Fmatrix-sdk-crypto-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-org%2Fmatrix-sdk-crypto-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-org%2Fmatrix-sdk-crypto-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matrix-org","download_url":"https://codeload.github.com/matrix-org/matrix-sdk-crypto-wasm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matrix-org%2Fmatrix-sdk-crypto-wasm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266448496,"owners_count":23930222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-15T18:35:51.982Z","updated_at":"2026-01-07T19:17:40.296Z","avatar_url":"https://github.com/matrix-org.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `matrix-sdk-crypto-wasm`\n\nWelcome to the [WebAssembly] + JavaScript binding for the Rust\n[`matrix-sdk-crypto`] library! WebAssembly can run anywhere, but these\nbindings are designed to run on a JavaScript host. These bindings are\npart of the [`matrix-rust-sdk`] project, which is a library\nimplementation of a [Matrix] client-server.\n\n`matrix-sdk-crypto` is a no-network-IO implementation of a state\nmachine, named `OlmMachine`, that handles E2EE ([End-to-End\nEncryption](https://en.wikipedia.org/wiki/End-to-end_encryption)) for\n[Matrix] clients.\n\n## Usage\n\n1. Install in your project:\n\n    ```\n    npm install --save @matrix-org/matrix-sdk-crypto-wasm\n    ```\n\n    or:\n\n    ```\n    yarn add @matrix-org/matrix-sdk-crypto-wasm\n    ```\n\n2. Import the library into your project and initialise it.\n\n    On Web platforms, the library must be initialised by calling `initAsync`\n    before it can be used, else it will throw an error. This is also recommended\n    on other platforms, as it allows the WebAssembly module to be loaded\n    asynchronously.\n\n    ```javascript\n    import { initAsync, Tracing, LoggerLevel, OlmMachine, UserId, DeviceId } from \"@matrix-org/matrix-sdk-crypto-wasm\";\n\n    async function loadCrypto(userId, deviceId) {\n        // Do this before any other calls to the library\n        await initAsync();\n\n        // Optional: enable tracing in the rust-sdk\n        new Tracing(LoggerLevel.Trace).turnOn();\n\n        // Create a new OlmMachine\n        //\n        // The following will use an in-memory store. It is recommended to use\n        // indexedDB where that is available.\n        // See https://matrix-org.github.io/matrix-rust-sdk-crypto-wasm/classes/OlmMachine.html#initialize\n        const olmMachine = await OlmMachine.initialize(new UserId(userId), new DeviceId(deviceId));\n\n        return olmMachine;\n    }\n    ```\n\n    See the [API documentation](https://matrix-org.github.io/matrix-rust-sdk-crypto-wasm/) for more information.\n\n3. Build your project.\n\n    The packaging of this library aims to \"just work\" the same as any plain-javascript project would: it includes\n    separate entry points for Node.js-like environments (which read the WASM file via\n    [`fs.readFile()`](https://nodejs.org/api/fs.html#fsreadfilepath-options-callback)) and web-like environments (which\n    download the WASM file with [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch)). There are\n    both CommonJS and ES Module entry points for each environment; an appropriate entrypoint should be selected\n    automatically.\n\n    If your environment supports the experimental [ES Module Integration Proposal for WebAssembly](https://github.com/WebAssembly/esm-integration),\n    you can instead use that, by setting the `matrix-org:wasm-esm` custom [export condition](https://nodejs.org/api/packages.html#conditional-exports).\n    This is only supported when the library is imported as an ES Module. For example:\n\n    - In Webpack, set [`experiments.asyncWebAssembly`](https://webpack.js.org/configuration/experiments/#experiments)\n      to `true` and [`resolve.conditionNames`](https://webpack.js.org/configuration/resolve/#resolveconditionnames)\n      to `[\"matrix-org:wasm-esm\", \"...\"]` (the `\"...\"` preserves default condition names).\n    - In Node.js, invoke with commandline arguments [`--experimental-wasm-modules`](https://nodejs.org/api/esm.html#wasm-modules)\n      [`--conditions=wasm-esm`](https://nodejs.org/api/cli.html#-c-condition---conditionscondition).\n\n## Building matrix-sdk-crypto-wasm\n\nThese WebAssembly bindings are written in [Rust]. To build them, you\nneed to install the Rust compiler, see [the Install Rust\nPage](https://www.rust-lang.org/tools/install). Then, the workflow is\npretty classical by using [yarn](https://yarnpkg.com/), see [the Downloading and installing\nNode.js and npm\nPage](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) and [installing yarn](https://classic.yarnpkg.com/lang/en/docs/install).\n\nOnce the Rust compiler, Node.js and yarn are installed, you can run the\nfollowing commands:\n\n```sh\n$ yarn install\n$ yarn build  # or 'yarn build:dev' to make an unoptimised build\n$ yarn test\n```\n\nThe compiled output should be generated in the `pkg/` directory.\n\n## Local development with matrix-rust-sdk\n\nTo build based on a local `matrix-rust-sdk`, add something like this to your\n`.cargo/config` file:\n\n```\n[patch.'https://github.com/matrix-org/matrix-rust-sdk']\nmatrix-sdk-base = { path = \"../matrix-rust-sdk/crates/matrix-sdk-base\" }\nmatrix-sdk-common = { path = \"../matrix-rust-sdk/crates/matrix-sdk-common\" }\nmatrix-sdk-crypto = { path = \"../matrix-rust-sdk/crates/matrix-sdk-crypto\" }\nmatrix-sdk-indexeddb = { path = \"../matrix-rust-sdk/crates/matrix-sdk-indexeddb\" }\nmatrix-sdk-qrcode = { path = \"../matrix-rust-sdk/crates/matrix-sdk-qrcode\" }\n```\n\n## Documentation\n\n[The documentation can be found\nonline](https://matrix-org.github.io/matrix-sdk-crypto-wasm/).\n\nTo generate the documentation locally, please run the following\ncommand:\n\n```sh\n$ yarn doc\n```\n\nThe documentation is generated in the `./docs` directory.\n\n[WebAssembly]: https://webassembly.org/\n[`matrix-sdk-crypto`]: https://github.com/matrix-org/matrix-rust-sdk/tree/main/crates/matrix-sdk-crypto\n[`matrix-rust-sdk`]: https://github.com/matrix-org/matrix-rust-sdk\n[Matrix]: https://matrix.org/\n[Rust]: https://www.rust-lang.org/\n[npm]: https://www.npmjs.com/\n\n## Contributing\n\nThank you! See the [contributing](CONTRIBUTING.md) doc for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrix-org%2Fmatrix-sdk-crypto-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatrix-org%2Fmatrix-sdk-crypto-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatrix-org%2Fmatrix-sdk-crypto-wasm/lists"}