summaryrefslogtreecommitdiff
path: root/users/app/models/identity.rb
diff options
context:
space:
mode:
Diffstat (limited to 'users/app/models/identity.rb')
-rw-r--r--users/app/models/identity.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/users/app/models/identity.rb b/users/app/models/identity.rb
index 4dff93a..b862590 100644
--- a/users/app/models/identity.rb
+++ b/users/app/models/identity.rb
@@ -6,6 +6,7 @@ class Identity < CouchRest::Model::Base
property :address, LocalEmail
property :destination, Email
+ property :keys, Hash
validate :unique_forward
validate :alias_available
@@ -14,6 +15,16 @@ class Identity < CouchRest::Model::Base
view :by_user_id
view :by_address_and_destination
view :by_address
+ view :pgp_key_by_email,
+ map: <<-EOJS
+ function(doc) {
+ if (doc.type != 'Identity') {
+ return;
+ }
+ emit(doc.address, doc.keys["pgp"]);
+ }
+ EOJS
+
end
protected