hunt-jwt/source/hunt/jwt/Base64Codec.d

21 lines
411 B
D
Raw Normal View History

2020-11-23 10:00:11 +00:00
module hunt.jwt.Base64Codec;
import std.base64;
alias Base64URLNoPadding = Base64Impl!('-', '_', Base64.NoPadding);
/**
* Encode a string with URL-safe Base64.
*/
string urlsafeB64Encode(string inp) pure nothrow {
return Base64URLNoPadding.encode(cast(ubyte[])inp);
}
/**
* Decode a string with URL-safe Base64.
*/
2021-03-04 12:38:00 +00:00
ubyte[] urlsafeB64Decode(string inp) pure {
return Base64URLNoPadding.decode(inp);
2020-11-23 10:00:11 +00:00
}