You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
449 B

  1. # frozen_string_literal: true
  2. Fabricator(:one_time_key) do
  3. device
  4. key_id { Faker::Alphanumeric.alphanumeric(number: 10) }
  5. key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
  6. signature do |attrs|
  7. signing_key = Ed25519::SigningKey.generate
  8. attrs[:device].update(fingerprint_key: Base64.strict_encode64(signing_key.verify_key.to_bytes))
  9. Base64.strict_encode64(signing_key.sign(attrs[:key]))
  10. end
  11. end