import t from "./engine/cookie.js";
import i from "./engine/local-storage.js";
function s(o = "did.auth.token", n = "ls", r = {}) {
  if (!o)
    throw new Error("storageKey must be specified to create a storage");
  let e = null;
  if (n === "ls")
    e = new i(o);
  else if (n === "cookie")
    e = new t(o, r);
  else
    throw new Error("storageEngine must be ls or cookie");
  return {
    getToken: e.getToken.bind(e),
    setToken: e.setToken.bind(e),
    removeToken: e.removeToken.bind(e),
    engine: n,
    key: o
  };
}
export {
  s as default
};
