summaryrefslogtreecommitdiffhomepage
path: root/keysafe.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-08-19 13:00:34 -0400
committerJoey Hess <joeyh@joeyh.name>2016-08-19 13:00:34 -0400
commit6261f7e58b764ae48293bee3b1863b518e9f0442 (patch)
treed9260d1beeced137e36c1ae1945c499d85e91608 /keysafe.hs
parentd3323ab8e9e39bcb0a6493d33efa265073920a7d (diff)
downloadkeysafe-6261f7e58b764ae48293bee3b1863b518e9f0442.tar.gz
rename shard -> share
This makes it clearer that it's not a chunk of data, but a Shamir share.
Diffstat (limited to 'keysafe.hs')
-rw-r--r--keysafe.hs28
1 files changed, 14 insertions, 14 deletions
diff --git a/keysafe.hs b/keysafe.hs
index 93efa63..f417319 100644
--- a/keysafe.hs
+++ b/keysafe.hs
@@ -16,7 +16,7 @@ import Entropy
import ExpensiveHash
import Cost
import SecretKey
-import Shard
+import Share
import Storage
import qualified Gpg
import Data.Maybe
@@ -32,7 +32,7 @@ main :: IO ()
main = do
cmdline <- CmdLine.get
ui <- selectUI (CmdLine.gui cmdline)
- let mkt = CmdLine.customizeShardParams cmdline
+ let mkt = CmdLine.customizeShareParams cmdline
(tunables, possibletunables) <- if CmdLine.testMode cmdline
then do
showInfo ui "Test mode"
@@ -78,17 +78,17 @@ backup storagelocations ui tunables secretkeysource secretkey = do
othernamedesc Nothing validateName
let name = Name (theirname <> " " <> othername)
kek <- promptkek name
- let sis = shardIdents tunables name secretkeysource
+ let sis = shareIdents tunables name secretkeysource
let cost = getCreationCost kek <> getCreationCost sis
r <- withProgress ui "Encrypting and storing data"
(encryptdesc cost) $ \setpercent -> do
let esk = encrypt tunables kek secretkey
- shards <- genShards esk tunables
+ shares <- genShares esk tunables
_ <- esk `deepseq` setpercent 25
_ <- sis `deepseq` setpercent 50
- let step = 50 `div` length shards
+ let step = 50 `div` length shares
let percentsteps = map setpercent [50+step, 50+step*2..100]
- storeShards storagelocations sis (zip percentsteps shards)
+ storeShares storagelocations sis (zip percentsteps shares)
case r of
StoreSuccess -> showInfo ui "Success" "Your secret key successfully encrypted and backed up."
StoreFailure s -> showError ui ("There was a problem storing your encrypted secret key: " ++ s)
@@ -187,13 +187,13 @@ restore storagelocations ui possibletunables secretkeydest = do
password <- fromMaybe (error "Aborting on no password")
<$> promptPassword ui True "Enter password" passworddesc
- let mksis tunables = shardIdents tunables name secretkeydest
- (tunables, shards) <- downloadShards storagelocations ui mksis possibletunables
+ let mksis tunables = shareIdents tunables name secretkeydest
+ (tunables, shares) <- downloadShares storagelocations ui mksis possibletunables
let candidatekeys = candidateKeyEncryptionKeys tunables name password
let cost = getCreationCost candidatekeys
<> castCost (getDecryptionCost candidatekeys)
- case combineShards tunables shards of
+ case combineShares tunables shares of
Left e -> showError ui e
Right esk -> withProgress ui "Decrypting"
(decryptdesc cost) $ \setpercent -> do
@@ -228,8 +228,8 @@ restore storagelocations ui possibletunables secretkeydest = do
, "Please wait..."
]
-downloadShards :: StorageLocations -> UI -> (Tunables -> ShardIdents) -> [Tunables] -> IO (Tunables, [Shard])
-downloadShards storagelocations ui mksis possibletunables =
+downloadShares :: StorageLocations -> UI -> (Tunables -> ShareIdents) -> [Tunables] -> IO (Tunables, [Share])
+downloadShares storagelocations ui mksis possibletunables =
withProgress ui "Downloading encrypted data" message $
go possibletunables
where
@@ -242,10 +242,10 @@ downloadShards storagelocations ui mksis possibletunables =
_ <- l `deepseq` setpercent 50
let step = 50 `div` length l
let percentsteps = map setpercent [50+step, 50+step*2..100]
- shards <- retrieveShards storagelocations (zip percentsteps l)
- if null shards
+ shares <- retrieveShares storagelocations (zip percentsteps l)
+ if null shares
then go othertunables setpercent
- else return (tunables, shards)
+ else return (tunables, shares)
possiblesis = map mksis possibletunables
message = unlines