Skip to content

Commit

Permalink
Remove buffer usage in favour of base-64 lib
Browse files Browse the repository at this point in the history
  • Loading branch information
perry-mitchell committed Dec 12, 2018
1 parent e6da97f commit 18777e4
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 44 deletions.
85 changes: 45 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"homepage": "https://github.com/perry-mitchell/webdav-client#readme",
"dependencies": {
"axios": "^0.18.0",
"base-64": "^0.1.0",
"hot-patcher": "^0.5.0",
"merge": "^1.2.1",
"path-posix": "^1.0.0",
Expand Down
6 changes: 4 additions & 2 deletions source/auth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const { toBase64 } = require("./encode.js");

function generateBasicAuthHeader(username, password) {
const buffer = Buffer.from(`${username}:${password}`);
return `Basic ${buffer.toString("base64")}`;
const encoded = toBase64(`${username}:${password}`);
return `Basic ${encoded}`;
}

function generateTokenAuthHeader(tokenInfo) {
Expand Down
Loading

0 comments on commit 18777e4

Please sign in to comment.