1
0
mirror of https://github.com/whippyshou/mastodon synced 2024-12-11 13:18:56 +09:00
whippy-edition/spec/fabricators/one_time_key_fabricator.rb
2020-06-02 19:24:53 +02:00

12 lines
421 B
Ruby

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