Add obfuscated viewing key
This commit is contained in:
parent
24d8f25ed1
commit
e0f631fd03
1 changed files with 7 additions and 2 deletions
|
@ -324,6 +324,7 @@ data OwnerSettings =
|
|||
, os_expiration :: UTCTime
|
||||
, os_payconf :: Bool
|
||||
, os_crmToken :: T.Text
|
||||
, os_viewKey :: T.Text
|
||||
}
|
||||
deriving (Eq, Show, Generic)
|
||||
|
||||
|
@ -344,10 +345,12 @@ instance FromJSON OwnerSettings where
|
|||
e <- obj .: "expiration"
|
||||
pc <- obj .: "payconf"
|
||||
cT <- obj .: "crmToken"
|
||||
pure $ OwnerSettings ((Just . read) =<< i) a n c t tV v vV p z inv e pc cT
|
||||
vK <- obj .: "viewkey"
|
||||
pure $
|
||||
OwnerSettings ((Just . read) =<< i) a n c t tV v vV p z inv e pc cT vK
|
||||
|
||||
instance ToJSON OwnerSettings where
|
||||
toJSON (OwnerSettings i a n c t tV v vV p z inv e pc cT) =
|
||||
toJSON (OwnerSettings i a n c t tV v vV p z inv e pc cT vK) =
|
||||
object
|
||||
[ "_id" .= maybe "" show i
|
||||
, "address" .= a
|
||||
|
@ -363,6 +366,7 @@ instance ToJSON OwnerSettings where
|
|||
, "expiration" .= e
|
||||
, "payconf" .= pc
|
||||
, "crmToken" .= cT
|
||||
, "viewkey" .= (T.take 5 vK <> "...." <> T.takeEnd 5 vK)
|
||||
]
|
||||
|
||||
-- Helper Functions
|
||||
|
@ -383,6 +387,7 @@ getOwnerSettings o =
|
|||
(oexpiration o)
|
||||
(opayconf o)
|
||||
(ocrmToken o)
|
||||
(oviewkey o)
|
||||
|
||||
-- Database actions
|
||||
-- | Function to upsert an Owner
|
||||
|
|
Loading…
Reference in a new issue