{"id":13876204,"url":"https://github.com/denosaurs/sodium","last_synced_at":"2025-10-16T15:24:29.074Z","repository":{"id":51340821,"uuid":"292582570","full_name":"denosaurs/sodium","owner":"denosaurs","description":"🧂 Sodium is a modern, easy-to-use library for encryption, decryption, signatures, password hashing and more","archived":false,"fork":false,"pushed_at":"2021-05-14T11:37:16.000Z","size":945,"stargazers_count":30,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-30T01:22:24.905Z","etag":null,"topics":["crypto","decryption","deno","encryption","hashing","password","signatures","wasm"],"latest_commit_sha":null,"homepage":"https://deno.land/x/sodium","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/denosaurs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"open_collective":"denosaurs","github":"denosaurs"}},"created_at":"2020-09-03T13:46:07.000Z","updated_at":"2023-06-13T14:42:12.000Z","dependencies_parsed_at":"2022-09-10T19:40:11.371Z","dependency_job_id":null,"html_url":"https://github.com/denosaurs/sodium","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denosaurs%2Fsodium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denosaurs%2Fsodium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denosaurs%2Fsodium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denosaurs%2Fsodium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denosaurs","download_url":"https://codeload.github.com/denosaurs/sodium/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238147600,"owners_count":19424291,"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","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":["crypto","decryption","deno","encryption","hashing","password","signatures","wasm"],"created_at":"2024-08-06T06:01:08.620Z","updated_at":"2025-10-16T15:24:24.049Z","avatar_url":"https://github.com/denosaurs.png","language":"TypeScript","funding_links":["https://opencollective.com/denosaurs","https://github.com/sponsors/denosaurs"],"categories":["TypeScript","wasm"],"sub_categories":[],"readme":"# sodium\n\n[![Tags](https://img.shields.io/github/release/denosaurs/sodium)](https://github.com/denosaurs/sodium/releases)\n[![CI Status](https://img.shields.io/github/workflow/status/denosaurs/sodium/check)](https://github.com/denosaurs/sodium/actions)\n[![License](https://img.shields.io/github/license/denosaurs/sodium)](https://github.com/denosaurs/sodium/blob/master/LICENSE)\n\nExtremely fast WASM wrapper of [libsodium] by @jedisct1, based on the work from the [libsodium.js] repository.\n\n```typescript\nimport sodium from \"https://deno.land/x/sodium/basic.ts\";\n\nawait sodium.ready;\n\nlet key = sodium.crypto_secretstream_xchacha20poly1305_keygen();\n\nlet res = sodium.crypto_secretstream_xchacha20poly1305_init_push(key);\nlet [state_out, header] = [res.state, res.header];\nlet c1 = sodium.crypto_secretstream_xchacha20poly1305_push(\n  state_out,\n  sodium.from_string(\"message 1\"),\n  null,\n  sodium.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE,\n);\nlet c2 = sodium.crypto_secretstream_xchacha20poly1305_push(\n  state_out,\n  sodium.from_string(\"message 2\"),\n  null,\n  sodium.crypto_secretstream_xchacha20poly1305_TAG_FINAL,\n);\n\nlet state_in = sodium.crypto_secretstream_xchacha20poly1305_init_pull(\n  header,\n  key,\n);\nlet r1 = sodium.crypto_secretstream_xchacha20poly1305_pull(state_in, c1);\nlet [m1, tag1] = [sodium.to_string(r1.message), r1.tag];\nlet r2 = sodium.crypto_secretstream_xchacha20poly1305_pull(state_in, c2);\nlet [m2, tag2] = [sodium.to_string(r2.message), r2.tag];\n\nconsole.log(m1);\nconsole.log(m2);\n\n```\n\n## Basic vs Sumo\n\nThe **basic** version (in the `dist/browsers` and `dist/modules` directories) contains the high-level functions, and is the recommended one for most projects.\n\nAlternatively, the **sumo** version, available in the `dist/browsers-sumo` and `dist/modules-sumo` directories contains all the symbols from the original library. This includes undocumented, untested, deprecated, low-level and easy to misuse functions.\n\nThe `crypto_pwhash_*` function set is included in both versions.\n\nThe **sumo** version is slightly larger than the **basic** version, and should be used only if you really need the extra symbols it provides.\n\n### Documentation\n\n- **basic**: [API]\n- **sumo**: [API_sumo]\n\n### Imports\n\nTo import **basic**:\n\n```typescript\nimport sodium from \"https://deno.land/x/sodium/basic.ts\";\n```\n\nTo import **sumo**:\n\n```typescript\nimport sodium from \"https://deno.land/x/sodium/sumo.ts\";\n```\n\n## Building\n\n### Requirements\n\n- emscripten\n- binaryen\n- git\n- nodejs\n- make\n\n### Compilation\n\n```bash\n$ make\n```\n\nThis will create the following directory structure.\n\n```text\ndist\n├── browsers\n│   └── sodium.js              # basic libsodium\n├── browsers-sumo\n│   └── sodium.js              # sumo libsodium\n├── modules\n│   ├── libsodium-wrappers.js  # not used (nodejs)\n│   └── libsodium.js           # not used (nodejs)\n└── modules-sumo\n    ├── libsodium-sumo.js      # not used (nodejs)\n    └── libsodium-wrappers.js  # not used (nodejs)\n```\n\n## Maintainers\n\n- [Filippo Rossi](https://github.com/qu4k) - Deno support\n- Ahmad Ben Mrad - original wrapper\n- Frank Denis - original wrapper\n- Ryan Lester - original wrapper\n\n## Other\n\n### Related\n\n- [libsodium] - A modern, portable, easy to use crypto library.\n- [libsodium.js] - ... and it's wasm release\n\n### Contribution\n\nPull request, issues and feedback are very welcome. Code style is formatted with `deno fmt` and commit messages are done following Conventional Commits spec.\n\n### Licence\n\n- **Modifications**: Copyright 2020-present, the denosaurs team. All rights reserved. MIT license.\n\n- **Original work**: ISC License.\n\n[libsodium]: https://github.com/jedisct1/libsodium\n[libsodium.js]: https://github.com/jedisct1/libsodium.js\n[api]: API.md\n[api_sumo]: API_sumo.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenosaurs%2Fsodium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenosaurs%2Fsodium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenosaurs%2Fsodium/lists"}