Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Should base64 encoding be in the String module? #387

Open
@tekul

Description

@tekul

The current APIs are of type String -> String, but it seems that in most cases base64 encoding would be used on primitive byte arrays rather that UTF-8 encoded strings. I would expect something like

toBase64 :: UArray Word8 -> String
fromBase64 :: String -> Either SomeError (UArray Word8)

Also, I'm not sure exposing the URL, OpenBSD versions are necessary there as these are specific to crypto use-cases. I'm just looking at writing slightly higher-level code for Argon2, which is yet another encoding version (standard table, but unpadded). So before I look at porting the code from memory it'd be nice to clear up what the APIs should look like.

I think what I'd like to have is something like toBase64Internal but with the scary #Addr argument hidden behind some Base64Scheme type and a similar decoding function going the other way. All combinations would then be available to anyone who really wanted to use them, and we could get rid of functions like toBase64UrlUnpadded, and just retain toBase64, fromBase64 for the most common standard case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions