status-go/protocol/encryption
Igor Sirotin 679391999f
feat_: `LogOnPanic` linter (#5969)
* feat_: LogOnPanic linter

* fix_: add missing defer LogOnPanic

* chore_: make vendor

* fix_: tests, address pr comments

* fix_: address pr comments
2024-10-23 21:33:05 +01:00
..
migrations/sqlite refactor_: remove generated files from source control (#5878) 2024-10-03 20:59:44 +01:00
multidevice chore!: simplify local pairing API (#5643) 2024-08-14 21:10:19 +01:00
publisher feat_: `LogOnPanic` linter (#5969) 2024-10-23 21:33:05 +01:00
sharedsecret
README.md
encryption_multi_device_test.go
encryption_test.go
encryptor.go fix: archive decryption fail (#5076) 2024-05-27 13:49:09 +01:00
helpers.go feat(communities)_: introduce bloom filter members list 2024-07-04 17:54:29 +02:00
persistence.go fix_: loading hash_ratchet_encryption from database checks group_id 2024-05-20 14:39:46 +03:00
persistence_keys_storage_test.go
persistence_test.go
protocol.go feat: fallback pairing seed (#5614) 2024-07-30 17:14:05 +08:00
protocol_message.proto
protocol_test.go
x3dh.go
x3dh_test.go

README.md

protocol/encryption package

Hash ratchet encryption

encryptor.GenerateHashRatchetKey() generates a hash ratchet key and stores it in in the DB. There, 2 new tables are created: hash_ratchet_encryption and hash_ratchet_encryption_cache. Each hash ratchet key is uniquely identified by the (groupId, keyId) pair, where keyId is derived from a clock value.

protocol.BuildHashRatchetKeyExchangeMessage builds an 1-on-1 message containing the hash ratchet key, given it's ID.

protocol.BuildHashRatchetMessage builds a hash ratchet message with arbitrary payload, given groupId. It will use the latest hash ratchet key available. encryptor.encryptWithHR encrypts the payload using Hash Ratchet algorithms. Intermediate hashes are stored in hash_ratchet_encryption_cache table.

protocol.HandleMessage uses encryptor.decryptWithHR fn for decryption.