Skip to content

getKey and getKeyEnv silently default. #27

@gregwebs

Description

@gregwebs

There is a problem with the getKey and getKeyEnv from clientsession: they both silently default to generating a new key when one is missing.

Can we change these functions (actually add new ones) that essentially return an Either? Left would be a default, and in that case a warning can be logged for the user.

I would suggest as new function names keyFromFile and keyFromEnv.
However, this points to the fact that some kind of generic key generator is needed. Also, Either may not be descriptive enough.

data KeyGenerator = KeyGenerator { gatherKey :: IO ByteString, writeKey :: ByteString -> IO () }


data KeyInit = KeyGenerated Text Key -- ^ no key was found, generated and recorded a new one
                   | KeyFound Key -- ^ found the existing key

keyFrom :: KeyGenerator -> KeyInit
keyFromDef :: KeyGenerator -> Key

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions