This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2023-03-04 09:31:13 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
Fabricator(:one_time_key) do
|
2023-06-10 09:29:01 -07:00
|
|
|
device { Fabricate.build(:device) }
|
2023-03-04 09:31:13 -08:00
|
|
|
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
|