{"id":29068583,"url":"https://github.com/mixinnetwork/libsignal_protocol_dart","last_synced_at":"2025-06-27T11:08:40.342Z","repository":{"id":38198767,"uuid":"257770230","full_name":"MixinNetwork/libsignal_protocol_dart","owner":"MixinNetwork","description":"Signal Protocol library for Dart/Flutter","archived":false,"fork":false,"pushed_at":"2025-06-04T09:44:55.000Z","size":5874,"stargazers_count":166,"open_issues_count":11,"forks_count":48,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-06-24T22:08:32.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/libsignal_protocol_dart","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MixinNetwork.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-22T02:29:21.000Z","updated_at":"2025-06-17T19:05:41.000Z","dependencies_parsed_at":"2023-01-29T03:15:53.498Z","dependency_job_id":"df1c20ac-c6f0-44a3-b21e-3ff534ead2a2","html_url":"https://github.com/MixinNetwork/libsignal_protocol_dart","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/MixinNetwork/libsignal_protocol_dart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MixinNetwork%2Flibsignal_protocol_dart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MixinNetwork%2Flibsignal_protocol_dart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MixinNetwork%2Flibsignal_protocol_dart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MixinNetwork%2Flibsignal_protocol_dart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MixinNetwork","download_url":"https://codeload.github.com/MixinNetwork/libsignal_protocol_dart/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MixinNetwork%2Flibsignal_protocol_dart/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262244893,"owners_count":23281027,"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":[],"created_at":"2025-06-27T11:08:36.406Z","updated_at":"2025-06-27T11:08:40.314Z","avatar_url":"https://github.com/MixinNetwork.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libsignal_protocol_dart\n\n[![pub package](https://img.shields.io/pub/v/libsignal_protocol_dart.svg)](https://pub.dartlang.org/packages/libsignal_protocol_dart)\n[![Dart CI](https://github.com/MixinNetwork/libsignal_protocol_dart/workflows/Dart/badge.svg)](https://github.com/MixinNetwork/libsignal_protocol_dart/actions)\n\nlibsignal_protocol_dart is a pure Dart/Flutter implementation of the Signal Protocol.\n\n## Documentation\n\nFor more information on how the Signal Protocol works:\n\n- [Double Ratchet](https://whispersystems.org/docs/specifications/doubleratchet/)\n- [X3DH Key Agreement](https://whispersystems.org/docs/specifications/x3dh/)\n- [XEdDSA Signature Schemes](https://whispersystems.org/docs/specifications/xeddsa/)\n- [Signal Protocol Java](https://github.com/signalapp/libsignal-protocol-java/)\n\n## Usage\n\n## Install time\n\nAt install time, a signal client needs to generate its identity keys, registration id, and prekeys.\n\n```dart\nFuture\u003cvoid\u003e install() async {\n  final identityKeyPair = generateIdentityKeyPair();\n  final registrationId = generateRegistrationId(false);\n\n  final preKeys = generatePreKeys(0, 110);\n\n  final signedPreKey = generateSignedPreKey(identityKeyPair, 0);\n\n  final sessionStore = InMemorySessionStore();\n  final preKeyStore = InMemoryPreKeyStore();\n  final signedPreKeyStore = InMemorySignedPreKeyStore();\n  final identityStore =\n  InMemoryIdentityKeyStore(identityKeyPair, registrationId);\n\n  for (var p in preKeys) {\n    await preKeyStore.storePreKey(p.id, p);\n  }\n  await signedPreKeyStore.storeSignedPreKey(signedPreKey.id, signedPreKey);\n}\n```\n\n## Building a session\n\nA signal client needs to implement four interfaces: IdentityKeyStore, PreKeyStore, SignedPreKeyStore, and SessionStore. These will manage loading and storing of identity, prekeys, signed prekeys, and session state.\n\nOnce those are implemented, you can build a session in this way:\n\n```dart\n  final remoteAddress = SignalProtocolAddress(\"remote\", 1);\n  final sessionBuilder = SessionBuilder(sessionStore, preKeyStore,\n      signedPreKeyStore, identityStore, remoteAddress);\n\n  sessionBuilder.processPreKeyBundle(retrievedPreKey);\n\n  final sessionCipher = SessionCipher(sessionStore, preKeyStore,\n      signedPreKeyStore, identityStore, remoteAddress);\n  final ciphertext = sessionCipher.encrypt(utf8.encode(\"Hello Mixin\"));\n\n  deliver(ciphertext);\n```\n\n## Building a group session\n\nIf you wanna send message to a group, send a SenderKeyDistributionMessage to all members of the group.\n\n```dart\n  const alice = SignalProtocolAddress('+00000000001', 1);\n  const groupSender = SenderKeyName('Private group', alice);\n  final aliceStore = InMemorySenderKeyStore();\n  final bobStore = InMemorySenderKeyStore();\n\n  final aliceSessionBuilder = GroupSessionBuilder(aliceStore);\n  final bobSessionBuilder = GroupSessionBuilder(bobStore);\n\n  final aliceGroupCipher = GroupCipher(aliceStore, groupSender);\n  final bobGroupCipher = GroupCipher(bobStore, groupSender);\n\n  final sentAliceDistributionMessage =\n      await aliceSessionBuilder.create(groupSender);\n  final receivedAliceDistributionMessage =\n      SenderKeyDistributionMessageWrapper.fromSerialized(\n          sentAliceDistributionMessage.serialize());\n  await bobSessionBuilder.process(\n      groupSender, receivedAliceDistributionMessage);\n\n  final ciphertextFromAlice = await aliceGroupCipher\n      .encrypt(Uint8List.fromList(utf8.encode('Hello Mixin')));\n  final plaintextFromAlice = await bobGroupCipher.decrypt(ciphertextFromAlice);\n  // ignore: avoid_print\n  print(utf8.decode(plaintextFromAlice));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmixinnetwork%2Flibsignal_protocol_dart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmixinnetwork%2Flibsignal_protocol_dart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmixinnetwork%2Flibsignal_protocol_dart/lists"}