summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-05-19 15:07:02 +0200
committerAzul <azul@leap.se>2014-05-19 15:21:42 +0200
commit3a84578cf33685800c9216cfb4da12ea1fb0032f (patch)
treeb2f3f2dcd5da823f371f0cc2e2deb3159de6a3c8 /app/models
parente8ba98df64cb537e85de8624c0ebb08c4135ccca (diff)
store fingerprints with timestamp
Only storing the date as that should suffice for normal expiry and is less useful for identifying users by timestamps
Diffstat (limited to 'app/models')
-rw-r--r--app/models/identity.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/models/identity.rb b/app/models/identity.rb
index 2f8d4eb..a4225e7 100644
--- a/app/models/identity.rb
+++ b/app/models/identity.rb
@@ -8,7 +8,7 @@ class Identity < CouchRest::Model::Base
property :address, LocalEmail
property :destination, Email
property :keys, HashWithIndifferentAccess
- property :cert_fingerprints, [String]
+ property :cert_fingerprints, Hash
validate :unique_forward
validate :alias_available
@@ -108,6 +108,16 @@ class Identity < CouchRest::Model::Base
write_attribute('keys', keys.merge(type => key.to_s))
end
+ def cert_fingerprints
+ read_attribute('cert_fingerprints') || Hash.new
+ end
+
+ def register_cert(cert)
+ today = DateTime.now.to_date.to_s
+ write_attribute 'cert_fingerprints',
+ cert_fingerprints.merge(cert.fingerprint => today)
+ end
+
# for LoginFormatValidation
def login
self.address.handle