about summary refs log tree commit diff
path: root/spec/fabricators
diff options
context:
space:
mode:
Diffstat (limited to 'spec/fabricators')
-rw-r--r--spec/fabricators/device_fabricator.rb8
-rw-r--r--spec/fabricators/encrypted_message_fabricator.rb8
-rw-r--r--spec/fabricators/one_time_key_fabricator.rb11
-rw-r--r--spec/fabricators/system_key_fabricator.rb3
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