funcool / buddy

Security library for Clojure
Apache License 2.0
827 stars 38 forks source link

No such var: codecs/bytes->safebase64 #35

Closed nha closed 8 years ago

nha commented 8 years ago

When pulling 0.12.0 I get this error:

clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: No such var: codecs/bytes->safebase64, compiling:(buddy/sign/jws.clj:79:9)
             java.lang.RuntimeException: No such var: codecs/bytes->safebase64

When pulling 0.13 I get the following error as well (I do not get why 0.13.0 is in the README while it is still 0.12.0 in project.clj). So I assume this is a versioning error somewhere.

niwinz commented 8 years ago

Yes, this is an expected error, in the latest version of buddy-core, the codecs ns is refactored: https://github.com/funcool/buddy-core/blob/master/CHANGES.adoc#version-0120 and the base64 related stuff is moved to its own namespace.

The codecs/bytes->safebase64 should be replaced by (-> data (b64/encode true) codecs/bytes->str) where b64 ns alias to buddy.core.codecs.base64.

niwinz commented 8 years ago

That is done because base64 related stuf starts growing because the existing methods returns always strings and adding more methods with similar and confusing methods for return bytes will make that more worse.

For better usability of that namespace, the base64 stuff is splitted into separated namespace and they are normalized to return always bytes instead of strings (because they a more universal) and if the user needs string he can encode it using functions from codecs ns.