add base64 code to d2 library