mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-25 16:41:36 +01:00
14 lines
449 B
Ruby
14 lines
449 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
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
|