const o="mcp_pkce_verifier",r="mcp_oauth_state";function c(e){let n="";for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function a(){const e=c(crypto.getRandomValues(new Uint8Array(48))),n=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e)),t=c(new Uint8Array(n)),s=crypto.randomUUID();return sessionStorage.setItem(o,e),sessionStorage.setItem(r,s),{verifier:e,challenge:t,state:s}}function i(){const e=sessionStorage.getItem(o);return sessionStorage.removeItem(o),e}function g(){const e=sessionStorage.getItem(r);return sessionStorage.removeItem(r),e}export{i as a,g as b,a as c};
