diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2020-06-02 19:24:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-02 19:24:53 +0200 |
commit | 5d8398c8b8b51ee7363e7d45acc560f489783e34 (patch) | |
tree | 1e0b663049feafdc003ad3c01b25bf5d5d793402 /spec/fabricators | |
parent | 9b7e3b4774d47c184aa759364d41f40e0cdfa210 (diff) |
Add E2EE API (#13820)
Diffstat (limited to 'spec/fabricators')
-rw-r--r-- | spec/fabricators/device_fabricator.rb | 8 | ||||
-rw-r--r-- | spec/fabricators/encrypted_message_fabricator.rb | 8 | ||||
-rw-r--r-- | spec/fabricators/one_time_key_fabricator.rb | 11 | ||||
-rw-r--r-- | spec/fabricators/system_key_fabricator.rb | 3 |
4 files changed, 30 insertions, 0 deletions
diff --git a/spec/fabricators/device_fabricator.rb b/spec/fabricators/device_fabricator.rb new file mode 100644 index 000000000..b15d8248f --- /dev/null +++ b/spec/fabricators/device_fabricator.rb @@ -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 diff --git a/spec/fabricators/encrypted_message_fabricator.rb b/spec/fabricators/encrypted_message_fabricator.rb new file mode 100644 index 000000000..e65f66302 --- /dev/null +++ b/spec/fabricators/encrypted_message_fabricator.rb @@ -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 diff --git a/spec/fabricators/one_time_key_fabricator.rb b/spec/fabricators/one_time_key_fabricator.rb new file mode 100644 index 000000000..8794baeb5 --- /dev/null +++ b/spec/fabricators/one_time_key_fabricator.rb @@ -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 diff --git a/spec/fabricators/system_key_fabricator.rb b/spec/fabricators/system_key_fabricator.rb new file mode 100644 index 000000000..f808495e0 --- /dev/null +++ b/spec/fabricators/system_key_fabricator.rb @@ -0,0 +1,3 @@ +Fabricator(:system_key) do + +end |