diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2020-06-02 19:24:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-02 19:24:53 +0200 |
commit | 5d8398c8b8b51ee7363e7d45acc560f489783e34 (patch) | |
tree | 1e0b663049feafdc003ad3c01b25bf5d5d793402 /app/serializers/rest/keys | |
parent | 9b7e3b4774d47c184aa759364d41f40e0cdfa210 (diff) |
Add E2EE API (#13820)
Diffstat (limited to 'app/serializers/rest/keys')
-rw-r--r-- | app/serializers/rest/keys/claim_result_serializer.rb | 9 | ||||
-rw-r--r-- | app/serializers/rest/keys/device_serializer.rb | 6 | ||||
-rw-r--r-- | app/serializers/rest/keys/query_result_serializer.rb | 11 |
3 files changed, 26 insertions, 0 deletions
diff --git a/app/serializers/rest/keys/claim_result_serializer.rb b/app/serializers/rest/keys/claim_result_serializer.rb new file mode 100644 index 000000000..145044f55 --- /dev/null +++ b/app/serializers/rest/keys/claim_result_serializer.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class REST::Keys::ClaimResultSerializer < ActiveModel::Serializer + attributes :account_id, :device_id, :key_id, :key, :signature + + def account_id + object.account.id.to_s + end +end diff --git a/app/serializers/rest/keys/device_serializer.rb b/app/serializers/rest/keys/device_serializer.rb new file mode 100644 index 000000000..f9b821b79 --- /dev/null +++ b/app/serializers/rest/keys/device_serializer.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +class REST::Keys::DeviceSerializer < ActiveModel::Serializer + attributes :device_id, :name, :identity_key, + :fingerprint_key +end diff --git a/app/serializers/rest/keys/query_result_serializer.rb b/app/serializers/rest/keys/query_result_serializer.rb new file mode 100644 index 000000000..8f8bdde28 --- /dev/null +++ b/app/serializers/rest/keys/query_result_serializer.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class REST::Keys::QueryResultSerializer < ActiveModel::Serializer + attributes :account_id + + has_many :devices, serializer: REST::Keys::DeviceSerializer + + def account_id + object.account.id.to_s + end +end |