{"id":13532250,"url":"https://github.com/sebastianv89/double-ratchet","last_synced_at":"2026-04-07T15:31:30.958Z","repository":{"id":52572789,"uuid":"174624499","full_name":"sebastianv89/double-ratchet","owner":"sebastianv89","description":"Pure Rust implementation of the Double Ratchet algorithm","archived":false,"fork":false,"pushed_at":"2021-04-25T13:45:31.000Z","size":23,"stargazers_count":71,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-12-13T23:41:17.590Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sebastianv89.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-08T23:23:14.000Z","updated_at":"2025-11-26T12:09:48.000Z","dependencies_parsed_at":"2022-09-19T09:41:38.758Z","dependency_job_id":null,"html_url":"https://github.com/sebastianv89/double-ratchet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sebastianv89/double-ratchet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastianv89%2Fdouble-ratchet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastianv89%2Fdouble-ratchet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastianv89%2Fdouble-ratchet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastianv89%2Fdouble-ratchet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sebastianv89","download_url":"https://codeload.github.com/sebastianv89/double-ratchet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sebastianv89%2Fdouble-ratchet/sbom","scorecard":{"id":808657,"data":{"date":"2025-08-11","repo":{"name":"github.com/sebastianv89/double-ratchet","commit":"e4feae22d93e192fa5a2e3e59d8df20a8b1c9c87"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":1,"reason":"Found 1/9 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T12:30:13.967Z","repository_id":52572789,"created_at":"2025-08-23T12:30:13.967Z","updated_at":"2025-08-23T12:30:13.967Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31518420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2024-08-01T07:01:09.430Z","updated_at":"2026-04-07T15:31:30.941Z","avatar_url":"https://github.com/sebastianv89.png","language":"Rust","funding_links":[],"categories":["Cryptography"],"sub_categories":["Others"],"readme":"# Double Ratchet\n\n[![](https://img.shields.io/crates/v/double-ratchet.svg)][crates]\n[![](https://docs.rs/double-ratchet/badge.svg)][docs]\n[![](https://api.travis-ci.org/sebastianv89/double-ratchet.svg)](https://travis-ci.org/sebastianv89/double-ratchet)\n\n\nA pure Rust implementation of the Double Ratchet, as [specified][specs] by\nTrevor Perrin and Moxie Marlinspike.\n\nThe Double Ratchet allows two users to communicate securely: it provides its\nusers with a *confidential* and *authentic* channel, which includes *forward\nsecrecy* and *future secrecy*. After initialization with a shared secret key\nand an authenticated public key, the Double Ratchet will automatically handle\nall key management required to support this channel, which includes handling\nthe decryption of messages that arrive out-of-order.\n\nThe Double Ratchet itself requires a public key crypto system that can perform\n[Diffie-Hellman][dh] (DH) operations, a secret key crypto system that provides\n[authenticated encryption with associated data][aead] (AEAD) and two [key\nderivation functions][kdf] (KDF). This crate aims to be agnostic towards the\nimplementation of these functions: users of the crate implement the\n`CryptoProvider` trait and the `DoubleRatchet` struct should take care of the\nrest (but contact me if you have a use-case where the interface is not\nsufficient and I'll see if I can accommodate).\n\n\n## Examples\n\nThe following example corresponds to the way the Double Ratchet is used in the\n[Signal protocol][signal].  For more details about the implementation, see\n`tests/signal.rs`, which also supplies `SignalCryptoProvider`. We assume\nthat Alice and Bob share a secret key `SK` and Alice knows Bob's public\nkey.\n\n```rust\nuse double_ratchet::{DoubleRatchet};\nuse rand_os::RandOs;\nlet mut rng = OsRng::new().unwrap();\n\ntype DR = DoubleRatchet\u003cSignalCryptoProvider\u003e;\n\n// Alice intializes and sends the first message\nlet mut alice = DR::new_alice(\u0026SK, bobs_public_prekey, None, \u0026mut rng);\nlet pt0 = b\"Hello Bob\";\nlet (h0, ct0) = alice.ratchet_encrypt(pt0, b\"A2B\", \u0026mut rng);\n\n// Bob initializes and receives the first message\nlet mut bob = DR::new_bob(\u0026SK, bobs_prekey_pair, None);\nassert_eq!(\n    Ok(Vec::from(\u0026pt0[..])),\n    bob.ratchet_decrypt(\u0026h0, \u0026ct0, b\"A2B\")\n);\n\n// After receiving the first message, Bob can send his replies\nlet pt1 = b\"Hi Alice\";\nlet (h1, ct1) = alice.ratchet_encrypt(pt1, b\"B2A\", \u0026mut rng);\nlet pt2 = b\"How are you?\";\nlet (h2, ct2) = bob.ratchet_encrypt(pt2, b\"B2A\", \u0026mut rng);\nassert_eq!(\n    Ok(Vec::from(\u0026pt_b_0[..])),\n    alice.ratchet_decrypt(\u0026h_b_0, \u0026ct_b_0, b\"B2A\")\n);\n\n// Note that Alice has not yet received Bob's first message...\nlet pt3 = b\"Good and you?\";\nlet (h3, ct3) = alice.ratchet_encrypt(pt3, b\"A2B\", \u0026mut rng);\nassert_eq!(\n    Ok(Vec::from(\u0026pt3[..])),\n    bob.ratchet_decrypt(\u0026h3, \u0026ct3, b\"A2B\")\n);\n// ...but when she does get it she will be able to decrypt\nassert_eq!(\n    Ok(Vec::from(\u0026pt1[..])),\n    alice.ratchet_decrypt(\u0026h1, \u0026ct1, b\"B2A\")\n);\n```\n\n\n## Installation\n\nThe Double Ratchet crate is distributed through [crates.io][crates]: install it\nby adding the following to your `Cargo.toml`:\n\n```toml\n[dependencies]\ndouble-ratchet = \"0.1\"\n```\n\nThe `std` feature is enabled by default. If you don't want to use `std`, compile with `--no-default-features`.\n\n\n## Documentation\n\nThe documentation is available [here][docs].\n\n\n## Future plans\n\nThis isn't even my final form! I intend to add at least the following features\nand am open for suggestions for more features.\n\n- [ ] a Header Encrypted variant of the Double Ratchet\n- [ ] generalize the `KeyStore` to allow automatic deletion of very old keys\n- [ ] provide a way for saving/restoring a `DoubleRatchet` to storage\n- [ ] Provide a non-allocating interface for encryption/decryption\n\n\n[aead]: https://en.wikipedia.org/wiki/Authenticated_encryption#Authenticated_encryption_with_associated_data_(AEAD)\n[crates]: https://crates.io/crates/double-ratchet\n[dh]: https://en.wikipedia.org/wiki/Diffie-Hellman_key_exchange\n[docs]: https://docs.rs/double-ratchet\n[kdf]: https://en.wikipedia.org/wiki/Key_derivation_function\n[signal]: https://signal.org/\n[specs]: https://signal.org/docs/specifications/doubleratchet/\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebastianv89%2Fdouble-ratchet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsebastianv89%2Fdouble-ratchet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebastianv89%2Fdouble-ratchet/lists"}