Add E2EE API (#13820)
This commit is contained in:
parent
9b7e3b4774
commit
5d8398c8b8
72 changed files with 1463 additions and 233 deletions
8
spec/fabricators/device_fabricator.rb
Normal file
8
spec/fabricators/device_fabricator.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
Fabricator(:device) do
|
||||
access_token
|
||||
account
|
||||
device_id { Faker::Number.number(digits: 5) }
|
||||
name { Faker::App.name }
|
||||
fingerprint_key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
|
||||
identity_key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
|
||||
end
|
8
spec/fabricators/encrypted_message_fabricator.rb
Normal file
8
spec/fabricators/encrypted_message_fabricator.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
Fabricator(:encrypted_message) do
|
||||
device
|
||||
from_account
|
||||
from_device_id { Faker::Number.number(digits: 5) }
|
||||
type 0
|
||||
body ""
|
||||
message_franking ""
|
||||
end
|
11
spec/fabricators/one_time_key_fabricator.rb
Normal file
11
spec/fabricators/one_time_key_fabricator.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
Fabricator(:one_time_key) do
|
||||
device
|
||||
key_id { Faker::Alphanumeric.alphanumeric(number: 10) }
|
||||
key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
|
||||
|
||||
signature do |attrs|
|
||||
signing_key = Ed25519::SigningKey.generate
|
||||
attrs[:device].update(fingerprint_key: Base64.strict_encode64(signing_key.verify_key.to_bytes))
|
||||
Base64.strict_encode64(signing_key.sign(attrs[:key]))
|
||||
end
|
||||
end
|
3
spec/fabricators/system_key_fabricator.rb
Normal file
3
spec/fabricators/system_key_fabricator.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
Fabricator(:system_key) do
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue