one_time_key_serializer.rb 573 B

1234567891011121314151617181920212223242526272829303132333435
  1. # frozen_string_literal: true
  2. class ActivityPub::OneTimeKeySerializer < ActivityPub::Serializer
  3. context :security
  4. context_extensions :olm
  5. class SignatureSerializer < ActivityPub::Serializer
  6. attributes :type, :signature_value
  7. def type
  8. 'Ed25519Signature'
  9. end
  10. def signature_value
  11. object.signature
  12. end
  13. end
  14. attributes :key_id, :type, :public_key_base64
  15. has_one :signature, serializer: SignatureSerializer
  16. def type
  17. 'Curve25519Key'
  18. end
  19. def public_key_base64
  20. object.key
  21. end
  22. def signature
  23. object
  24. end
  25. end