Permalink
Browse files

This is already included into restify since 1.4.x

  • Loading branch information...
1 parent c05fb47 commit 6fe97ccfb55eabcd74c718e22d372f80a85ac0e1 @kusor kusor committed Jul 17, 2012
Showing with 0 additions and 27 deletions.
  1. +0 −27 lib/utils.js
View
@@ -1,27 +0,0 @@
-// Copyright 2012 Joyent, Inc. All rights reserved.
-
-var sprintf = require('util').format;
-
-module.exports = {
-
- /**
- * Constructs a new HTTP Authorization header with the 'Basic' scheme.
- *
- * HTTP defines basic auth to be nothing but:
- * Authorization: Basic Base64(<user>:<pass>)
- *
- * So that's what this gives back (the value for an Authorization header).
- *
- * @param {String} username duh.
- * @param {String} password another duh.
- * @return {String} value for an HTTP Authorization header.
- */
- basicAuth: function(username, password) {
- if (!username) throw new TypeError('username required');
- if (!password) throw new TypeError('password required');
-
- var buffer = new Buffer(username + ':' + password, 'utf8');
- return 'Basic ' + buffer.toString('base64');
- }
-
-};

0 comments on commit 6fe97cc

Please sign in to comment.