mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-14 10:46:21 +00:00
check identity length
This commit is contained in:
parent
4181541ae2
commit
fa2e2c2f28
@ -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…
x
Reference in New Issue
Block a user