diff --git a/src/status_im/contacts/validations.cljs b/src/status_im/contacts/validations.cljs index 9747fe9fb3..ca3feee759 100644 --- a/src/status_im/contacts/validations.cljs +++ b/src/status_im/contacts/validations.cljs @@ -2,14 +2,20 @@ (:require [cljs.spec :as s] [status-im.persistence.realm :as realm])) -(s/def ::not-empty-string (s/and string? not-empty)) (defn unique-identity? [identity] (println identity) (not (realm/exists? :contacts :whisper-identity identity))) +(defn valid-length? [identity] + (= 64 (count identity))) + +(s/def ::identity-length valid-length?) (s/def ::unique-identity unique-identity?) +(s/def ::not-empty-string (s/and string? not-empty)) (s/def ::name ::not-empty-string) -(s/def ::whisper-identity (s/and ::not-empty-string ::unique-identity)) +(s/def ::whisper-identity (s/and ::not-empty-string + ::unique-identity + ::identity-length)) (s/def ::contact (s/keys :req-un [::name ::whisper-identity] :opt-un [::phone ::photo-path ::address]))