parent
cbb56e499c
commit
b505a3dc05
|
@ -2,14 +2,20 @@
|
||||||
(:require [cljs.spec :as s]
|
(:require [cljs.spec :as s]
|
||||||
[status-im.persistence.realm :as realm]))
|
[status-im.persistence.realm :as realm]))
|
||||||
|
|
||||||
(s/def ::not-empty-string (s/and string? not-empty))
|
|
||||||
(defn unique-identity? [identity]
|
(defn unique-identity? [identity]
|
||||||
(println identity)
|
(println identity)
|
||||||
(not (realm/exists? :contacts :whisper-identity 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 ::unique-identity unique-identity?)
|
||||||
|
(s/def ::not-empty-string (s/and string? not-empty))
|
||||||
(s/def ::name ::not-empty-string)
|
(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]
|
(s/def ::contact (s/keys :req-un [::name ::whisper-identity]
|
||||||
:opt-un [::phone ::photo-path ::address]))
|
:opt-un [::phone ::photo-path ::address]))
|
||||||
|
|
Loading…
Reference in New Issue