       else
         throw new @Error "Construction error: Invalid storageType: #{storageType}"
 
+  # Add a user to the store, given a valid `user`.
   addUser: (user, cb) ->
     unless user instanceof User
       return cb new @Error "User instance required to add user."

    @store.clearAll (err) ->
      return cb err

  getUserByName: (username, cb) ->
    @store.getUserByName username, (err, user) ->
      return cb new @Error("Failed getting user: " + username, err) if err
      return cb null, user

  # Get a password hash by username.
  getPasswordHash: (username, cb) ->
    @store.getPasswordHash username, (err, password_hash) ->
      return cb new @Error("Failed getting user: "  + username, err) if err
      return cb null, password_hash

  getAllUsers: (cb) ->
    @store.getAllUsers (err, users) ->
      return cb new @Error "Failed getting all users from store." if err

  # Errors
  # ------

  # A custom error class for general storage errors.
  Error: @Error = class StorageError extends Base.Error

  # A storage error indicating a resource conflict,
  # ie, attempts to overwrite existing users or objects.
  ConflictError: @ConflictError = class ConflictError extends StorageError

  # Construction
  # ------------

  # Constructs a new storage instance, backed by a particular type of store.
  constructor: (@options = {}) ->
    {storageType} = @options

