Files
op-packages/luci-app-honk/root/etc/honk/dashboard/assets/auth-DmBaDwOI.js
T

2 lines
814 B
JavaScript

import{D as r}from"./auth-BGnwk8Hi.js";import{A as o,o as a}from"./index-CXHBmSa5.js";import"./vendor-react-Bf71BWbF.js";const n="demo-session-",c=12*36e5;function f(){return{mode:"password",setup_required:!1}}function w(e,t){if(e==="setup")throw new o(409,"setup_already_completed","Setup already completed");if(t.username!==r.username||t.password!==r.password)throw new o(401,"invalid_credentials","Invalid credentials");return{token:n+a(),expires_at:new Date(Date.now()+c).toISOString()}}function l(e){return!!e?.startsWith(n)}function _(e){const t=()=>Promise.reject(new o(401,"authentication_required","Authentication required"));return new Proxy(e,{get:(i,s,u)=>typeof Reflect.get(i,s,u)=="function"?t:void 0})}export{f as mockDiscovery,w as mockOpenSession,l as mockSessionValid,_ as refuseWithoutSession};