cardano-sl-0.4.3: Cardano SL main implementation

Safe HaskellNone
LanguageHaskell2010

Pos.Util.UserSecret

Description

Secret key file storage and management functions based on file locking.

Synopsis

Documentation

data UserSecret Source #

User secret data. Includes secret keys only for now (not including auxiliary _usPath).

simpleUserSecret :: SecretKey -> FilePath -> UserSecret Source #

Create a simple UserSecret from secret key and file path

initializeUserSecret :: (MonadIO m, WithLogger m) => FilePath -> m () Source #

Create user secret file at the given path, but only when one doesn't already exist.

readUserSecret :: (MonadIO m, WithLogger m) => FilePath -> m UserSecret Source #

Reads user secret from file, assuming that file exists, and has mode 600, throws exception in other case

peekUserSecret :: (MonadIO m, WithLogger m) => FilePath -> m UserSecret Source #

Reads user secret from the given file. If the file does not exist/is empty, returns empty user secret

takeUserSecret :: (MonadIO m, WithLogger m) => FilePath -> m UserSecret Source #

Read user secret putting an exclusive lock on it. To unlock, use writeUserSecretRelease.

writeUserSecret :: MonadIO m => UserSecret -> m () Source #

Writes user secret .

writeUserSecretRelease :: (MonadFail m, MonadIO m) => UserSecret -> m () Source #

Writes user secret and releases the lock. UserSecret can't be used after this function call anymore.