{"id":22356234,"url":"https://github.com/kseen715/double-ratchet","last_synced_at":"2026-01-30T13:05:37.022Z","repository":{"id":265135145,"uuid":"895223768","full_name":"Kseen715/double-ratchet","owner":"Kseen715","description":"Implementation of Double Ratchet encryption algorithm","archived":false,"fork":false,"pushed_at":"2024-12-11T20:49:41.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-03T07:18:06.381Z","etag":null,"topics":["cryptography","double-ratchet","encryption"],"latest_commit_sha":null,"homepage":"","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/Kseen715.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-27T19:41:49.000Z","updated_at":"2024-12-11T20:49:44.000Z","dependencies_parsed_at":"2025-01-31T14:29:41.115Z","dependency_job_id":"c454e042-9929-442d-b313-e2a0be096480","html_url":"https://github.com/Kseen715/double-ratchet","commit_stats":null,"previous_names":["kseen715/double-ratchet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Kseen715/double-ratchet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kseen715%2Fdouble-ratchet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kseen715%2Fdouble-ratchet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kseen715%2Fdouble-ratchet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kseen715%2Fdouble-ratchet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kseen715","download_url":"https://codeload.github.com/Kseen715/double-ratchet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kseen715%2Fdouble-ratchet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28913390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T12:13:43.263Z","status":"ssl_error","status_checked_at":"2026-01-30T12:13:22.389Z","response_time":66,"last_error":"SSL_read: 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":["cryptography","double-ratchet","encryption"],"created_at":"2024-12-04T14:09:36.352Z","updated_at":"2026-01-30T13:05:37.001Z","avatar_url":"https://github.com/Kseen715.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Double Ratchet\n\n[![Crates.io Version][cargo-version-badge]][cargo-crate] \n[![Crates.io License][cargo-license-badge]][cargo-license]\n[![docs.rs][cargo-docs-badge]][cargo-docs]\n[![Crates.io Dependents][cargo-dependents-badge]][cargo-dependents]\n[![Crates.io Downloads (recent)][cargo-downloads-badge]][cargo-crate] \n\n\u003e [!NOTE]\n\u003e This is re-implementation of the original [double-ratchet][origianl-crate] crate. The original crate is not maintained anymore and has some issues. This crate is a drop-in replacement for the original crate and should work with the same API. The main difference is that this crate uses modern versions of the dependencies and has some bug fixes.\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][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.\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,ignore\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## Installation\n\nThe Double Ratchet crate is distributed through [crates.io][cargo-crate]: install it\nby running:\n\n```ignore\ncargo add ksi-double-ratchet\n```\n\nThe `std` feature is enabled by default. If you don't want to use `std`, compile with `--no-default-features`.\n\n## Documentation\n\nThe documentation is available [here][docs].\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[aead]: https://en.wikipedia.org/wiki/Authenticated_encryption#Authenticated_encryption_with_associated_data_(AEAD)\n[dh]: https://en.wikipedia.org/wiki/Diffie-Hellman_key_exchange\n[docs]: https://docs.rs/ksi-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[origianl-crate]: https://crates.io/crates/double-ratchet\n\n[cargo-crate]: https://crates.io/crates/ksi-double-ratchet\n[cargo-license]: https://github.com/Kseen715/double-ratchet/blob/main/LICENSE\n[cargo-docs]: https://docs.rs/ksi-double-ratchet\n[cargo-dependents]: https://crates.io/crates/ksi-double-ratchet/reverse_dependencies\n\n[cargo-version-badge]: https://img.shields.io/crates/v/ksi-double-ratchet\n[cargo-license-badge]: https://img.shields.io/crates/l/ksi-double-ratchet\n[cargo-docs-badge]: https://img.shields.io/docsrs/ksi-double-ratchet\n[cargo-dependents-badge]: https://img.shields.io/crates/dependents/ksi-double-ratchet\n[cargo-downloads-badge]: https://img.shields.io/crates/dr/ksi-double-ratchet\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkseen715%2Fdouble-ratchet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkseen715%2Fdouble-ratchet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkseen715%2Fdouble-ratchet/lists"}