create-openfort 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#186](https://github.com/openfort-xyz/openfort-react/pull/186) [`fdb39df`](https://github.com/openfort-xyz/openfort-react/commit/fdb39dffbfc52fd015ddb17a43cff321461047d1) Thanks [@isardmart](https://github.com/isardmart)! - added retries on connector of useWallets, fixed error on headless social login
8
+
3
9
  ## 0.1.9
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,28 +1,28 @@
1
1
  #!/usr/bin/env node
2
- import Oe from"path";import G from"fs-extra";import*as p from"@clack/prompts";import De from"chalk";import{Command as Fe,Option as Ue}from"commander";import M from"path";import{fileURLToPath as Ie}from"url";var ve=Ie(import.meta.url),xe=M.dirname(ve),_=M.join(xe,"../"),z=` ___ ___ ___ _ _ ___ ___ ___ _____
2
+ import Oe from"path";import G from"fs-extra";import*as p from"@clack/prompts";import Ue from"chalk";import{Command as De,Option as Fe}from"commander";import M from"path";import{fileURLToPath as Ie}from"url";var ve=Ie(import.meta.url),xe=M.dirname(ve),_=M.join(xe,"../"),z=` ___ ___ ___ _ _ ___ ___ ___ _____
3
3
  / _ \\| _ \\| __| \\| | __/ _ \\| _ \\_ _|
4
4
  | (_) | _/| _|| | _| (_) | / | |
5
5
  \\___/|_| |___|_|\\_|_| \\___/|_|_\\ |_|
6
- `,b="openfort-project",L="create-openfort";var W=["openfort-ui","headless","firebase"],J=["auto","midnight","minimal","soft","web95","rounded","retro","nouns"];import Ne from"path";import ke from"fs-extra";var y=()=>{let e=Ne.join(_,"package.json");return ke.readJSONSync(e).version??"unknown"};var T=class extends Error{};var r={error:(...e)=>console.error(...e),warn:(...e)=>console.warn(...e),info:(...e)=>console.log(...e),success:(...e)=>console.log(...e),debug:(...e)=>console.log(...e)};import $e,{createHash as Z}from"crypto";import Ce from"https";import{hostname as Re,userInfo as Ae}from"os";var X="https://analytics.openfort.io",q="phc_HosujvcO5QzmU2MVvZo8AxWV0pplTZJLr3jEd8dRVPE",Le=()=>{let e=`${Re()}-${Ae().username}`;return Z("sha256").update(e).digest("hex").slice(0,16)},B=class{constructor(){this.enabled=!0;this.send=async({properties:o={},status:i})=>{if(r.debug("Sending telemetry...",{status:i,properties:o}),!this.enabled)return;if(!q||!X){r.warn("Telemetry is not configured properly. Please contact openfort developers at support@openfort.xyz.");return}let t={session_id:this.sessionId,cli_version:y(),node_version:process.version,platform:process.platform,cli_status:i,projectId:this.projectId,projectName:this.projectName,template:this.template,...o},n=JSON.stringify({api_key:q,event:"cli_tool_used",distinct_id:this.anonymousId,properties:t}),a=new URL(`${X}/capture/`),s={hostname:a.hostname,port:a.port||443,path:a.pathname,method:"POST",headers:{"Content-Type":"application/json","Content-Length":n.length}};return new Promise(c=>{let l=Ce.request(s,d=>{d.on("data",()=>{r.debug("Telemetry request response received",d.statusMessage)}),d.on("end",()=>{c()})});l.on("error",d=>{r.debug("Telemetry request error",d),c()}),l.write(n),l.end()})};this.anonymousId=Le(),this.sessionId=Z("sha256").update($e.randomBytes(16)).digest("hex").slice(0,15)}},g=new B;var x=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var Be=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,Q=e=>{let o=x(e),i=o.split("/"),t=i.findIndex(a=>a.startsWith("@")),n=i[i.length-1];if(i.findIndex(a=>a.startsWith("@"))!==-1&&(n=i.slice(t).join("/")),!(o==="."||Be.test(n??"")))return"App name must consist of only lowercase alphanumeric characters, '-', and '_'"};var ee="[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}",te=`(test|live)_${ee}`,Ke=new RegExp(`^sk_${te}$`),Ve=new RegExp(`^pk_${te}$`),He=new RegExp(`^${ee}$`),je=/^.{44}$/,P=({label:e,required:o=!0,regex:i,formatHint:t,customCheck:n})=>a=>{if(a!=="-"){if(o&&!a)return`${e} is required`;if(i&&a&&!i.test(a))return`${e} is invalid${t?` (${t})`:""}`;if(n)return n(a)}},ne=P({label:"Openfort Publishable Key",regex:Ve,formatHint:"expected format: pk_test_... or pk_live_..."}),oe=P({label:"Openfort Secret Key",regex:Ke,formatHint:"expected format: sk_test_... or sk_live_..."}),ie=P({label:"Shield Publishable Key",regex:He,formatHint:"expected UUID format"}),re=P({label:"Shield Secret",required:!0}),ae=P({label:"Shield Encryption Share",regex:je,formatHint:"expected 44 characters"}),se=P({label:"API endpoint",customCheck:e=>{try{new URL(e);return}catch{return"API endpoint must be a valid URL"}}}),le=async e=>{try{return!!(await(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).json()).session}catch{return!1}};var Ge={appName:b,template:"openfort-ui",createBackend:!0},pe=async()=>{let e=new Fe().name(L).description("A CLI for creating Openfort applications with embedded wallets").argument("[dir]","The name of the application, as well as the name of the directory to create").option("--noGit","Explicitly tell the CLI to not initialize a new git repo in the project",!1).option("--noInstall","Explicitly tell the CLI to not run the package manager's install command",!1).option("-y, --default","Bypass the CLI and use all default options to bootstrap a new Openfort app",!1).option("--CI","Boolean value if we're running in CI",!1).option("--template [string]","Specify the template to use").option("--theme [string]","Specify the theme to use (for openfort-ui template)").option("--noTelemetry","Disable sending anonymous usage data",!1).addOption(new Ue("--debug").hideHelp(!0)).version(y(),"-v, --version","Display the version number").addHelpText("afterAll",`
7
- Learn more about Openfort at ${De.hex("#5B87F5").bold("https://www.openfort.xyz")}
8
- `).parse(process.argv),o=e.args[0],i=e.opts();i.debug||(r.debug=()=>{}),g.enabled=!i.noTelemetry,r.debug("Telemetry enabled:",g.enabled),g.send({status:"started"});let t={...Ge,appName:o||b,flags:{noGit:i.noGit||!1,noInstall:i.noInstall||!1,default:i.default||!1,CI:i.CI||!1,template:i.template,theme:i.theme}};if(t.flags.CI)return t.template=i.template||"openfort-ui",t.theme=i.theme,t.createBackend=!1,t.openfortPublishableKey="pk_test_00000000-0000-0000-0000-000000000000",t.shieldPublishableKey="00000000-0000-0000-0000-000000000000",t;if(t.flags.default)return t.template="openfort-ui",t.createBackend=!1,t.openfortPublishableKey="",t.shieldPublishableKey="",t;try{if(process.env.TERM_PROGRAM?.toLowerCase().includes("mintty"))throw r.warn(` WARNING: It looks like you are using MinTTY, which is non-interactive. This is most likely because you are
9
- using Git Bash. If that's that case, please use Git Bash from another terminal, such as Windows Terminal.`),new T("Non-interactive environment");let n=await p.group({...!o&&{name:()=>p.text({message:"What will your project be called?",defaultValue:b,validate:Q})},template:()=>p.select({message:"Select an Openfort template:",options:W.map(a=>({value:a,label:a==="openfort-ui"?"Openfort UI (default)":a,hint:Ye(a)})),initialValue:"openfort-ui"}),createBackend:()=>p.confirm({message:"Do you want to create a backend for automatic account recovery?",initialValue:!0}),apiEndpoint:async({results:a})=>{if(!a.createBackend){let s=await p.confirm({message:"Do you have an existing API endpoint for account recovery?",initialValue:!1});if(p.isCancel(s)&&process.exit(1),s){let c=!1,l="";for(;!c;){let d=await p.text({message:"Enter your API endpoint for creating encryption sessions:",placeholder:"http://localhost:3110/api/protected-create-encryption-session",validate:se});p.isCancel(d)&&process.exit(1),l=d;let u=p.spinner();if(u.start("Testing API endpoint..."),await le(l))u.stop("API endpoint validated!"),c=!0;else{u.stop("API endpoint validation failed"),r.error("The endpoint did not return a valid session response");let h=await p.confirm({message:"Would you like to try another endpoint?",initialValue:!0});(p.isCancel(h)||!h)&&process.exit(1)}}return l}}},theme:({results:a})=>{if(a.template==="openfort-ui")return p.select({message:"Select a theme:",options:J.map(s=>({value:s,label:s==="auto"?"Auto (default)":s})),initialValue:"auto"})},openfortPublishableKey:()=>p.text({message:"Enter your Project Publishable Key:",placeholder:"pk_test_...",validate:ne}),openfortSecretKey:({results:a})=>{if(a.createBackend)return p.text({message:"Enter your Project Secret Key:",placeholder:"sk_test_...",validate:oe})},shieldEncryptionShare:({results:a})=>{if(a.createBackend)return p.text({message:"Enter your Shield Encryption Share:",placeholder:"Your 44-character encryption share",validate:ae})},shieldPublishableKey:()=>p.text({message:"Enter your Shield Publishable Key:",placeholder:"00000000-0000-0000-0000-000000000000",validate:ie}),shieldSecretKey:({results:a})=>{if(a.createBackend)return p.text({message:"Enter your Shield Secret Key:",placeholder:"Your Shield Secret",validate:re})},...!t.flags.noGit&&{git:()=>p.confirm({message:"Should we initialize a Git repository and stage the changes?",initialValue:!0})}},{onCancel(){process.exit(1)}});return g.template=n.template,g.projectId=n.openfortPublishableKey,{appName:n.name||t.appName,template:n.template,theme:n.theme,createBackend:n.createBackend,apiEndpoint:n.apiEndpoint,openfortPublishableKey:n.openfortPublishableKey,openfortSecretKey:n.openfortSecretKey,shieldPublishableKey:n.shieldPublishableKey,shieldSecretKey:n.shieldSecretKey,shieldEncryptionShare:n.shieldEncryptionShare,flags:{...t.flags,noGit:!n.git||t.flags.noGit}}}catch(n){if(n instanceof T)return r.warn(`
10
- ${L} needs an interactive terminal to provide options`),await p.confirm({message:"Continue scaffolding a default Openfort app?",initialValue:!0})||(r.info("Exiting..."),process.exit(0)),r.info(`Bootstrapping a default Openfort app in ./${t.appName}`),{...t,template:"openfort-ui",createBackend:!1,openfortPublishableKey:"",shieldPublishableKey:""};throw n}};function Ye(e){switch(e){case"openfort-ui":return"Pre-built UI components";case"headless":return"Custom, unstyled components";case"firebase":return"With Firebase authentication";default:return""}}import ge from"path";import N from"path";import k from"fs-extra";import Me from"ora";var ce=async({projectDir:e,openfortSecretKey:o,shieldSecretKey:i,shieldApiKey:t,shieldEncryptionShare:n,port:a=3110})=>{let s=Me("Creating backend...").start();try{let c=N.join(_,"template/backend"),l=N.join(e,"backend");k.copySync(c,l);let d=N.join(l,".env.example"),u=N.join(l,".env");if(k.existsSync(d)){let h=k.readFileSync(d,"utf-8").replace(/OPENFORT_SECRET_KEY=.*/g,`OPENFORT_SECRET_KEY=${o}`).replace(/SHIELD_SECRET_KEY=.*/g,`SHIELD_SECRET_KEY=${i}`).replace(/SHIELD_API_KEY=.*/g,`SHIELD_API_KEY=${t}`).replace(/SHIELD_ENCRYPTION_SHARE=.*/g,`SHIELD_ENCRYPTION_SHARE=${n}`).replace(/PORT=.*/g,`PORT=${a}`);k.writeFileSync(u,h)}await new Promise(m=>setTimeout(m,250)),s.succeed("Backend created successfully!")}catch(c){throw s.fail("Failed to create backend"),r.error(c instanceof Error?c.message:String(c)),c}};import de from"path";import*as E from"@clack/prompts";import S from"chalk";import w from"fs-extra";import ze from"ora";var fe=async({projectName:e,projectDir:o,template:i,createBackend:t})=>{r.info("");let n=ze(`Scaffolding in: ${o}...
11
- `).start();if(w.existsSync(o))if(w.readdirSync(o).length===0)e!=="."&&n.info(`${S.cyan.bold(e)} exists but is empty, continuing...
12
- `);else{n.stopAndPersist();let l=await E.select({message:`${S.redBright.bold("Warning:")} ${S.cyan.bold(e)} already exists and isn't empty. How would you like to proceed?`,options:[{label:"Abort installation (recommended)",value:"abort"},{label:"Clear the directory and continue installation",value:"clear"},{label:"Continue installation and overwrite conflicting files",value:"overwrite"}],initialValue:"abort"});(E.isCancel(l)||l==="abort")&&(n.fail("Aborting installation..."),process.exit(1));let d=await E.confirm({message:`Are you sure you want to ${l==="clear"?"clear the directory":"overwrite conflicting files"}?`,initialValue:!1});(E.isCancel(d)||!d)&&(n.fail("Aborting installation..."),process.exit(1)),l==="clear"&&(n.info(`Emptying ${S.cyan.bold(e)} and creating Openfort app..
13
- `),w.emptyDirSync(o))}n.start(),w.mkdirSync(o,{recursive:!0});let a=de.join(_,"template/openfort-templates",i),s=t?de.join(o,"frontend"):o;w.copySync(a,s);let c=e==="."?"App":S.cyan.bold(e);await new Promise(l=>setTimeout(l,250)),n.succeed(`${c} ${S.green("scaffolded successfully!")}
6
+ `,b="openfort-project",B="create-openfort";var W=["openfort-ui","headless","firebase"],J=["auto","midnight","minimal","soft","web95","rounded","retro","nouns"];import Ne from"path";import ke from"fs-extra";var g=()=>{let e=Ne.join(_,"package.json");return ke.readJSONSync(e).version??"unknown"};var T=class extends Error{};var r={error:(...e)=>console.error(...e),warn:(...e)=>console.warn(...e),info:(...e)=>console.log(...e),success:(...e)=>console.log(...e),debug:(...e)=>console.log(...e)};import $e,{createHash as Z}from"crypto";import Ce from"https";import{hostname as Re,userInfo as Le}from"os";var X="https://analytics.openfort.io",q="phc_HosujvcO5QzmU2MVvZo8AxWV0pplTZJLr3jEd8dRVPE",Be=()=>{let e=`${Re()}-${Le().username}`;return Z("sha256").update(e).digest("hex").slice(0,16)},A=class{constructor(){this.enabled=!0;this.send=async({properties:o={},status:i})=>{if(r.debug("Sending telemetry...",{status:i,properties:o}),!this.enabled)return;if(!q||!X){r.warn("Telemetry is not configured properly. Please contact openfort developers at support@openfort.xyz.");return}let t={session_id:this.sessionId,cli_version:g(),node_version:process.version,platform:process.platform,cli_status:i,projectId:this.projectId,projectName:this.projectName,template:this.template,...o},n=JSON.stringify({api_key:q,event:"cli_tool_used",distinct_id:this.anonymousId,properties:t}),a=new URL(`${X}/capture/`),s={hostname:a.hostname,port:a.port||443,path:a.pathname,method:"POST",headers:{"Content-Type":"application/json","Content-Length":n.length}};return new Promise(c=>{let l=Ce.request(s,d=>{d.on("data",()=>{r.debug("Telemetry request response received",d.statusMessage)}),d.on("end",()=>{c()})});l.on("error",d=>{r.debug("Telemetry request error",d),c()}),l.write(n),l.end()})};this.anonymousId=Be(),this.sessionId=Z("sha256").update($e.randomBytes(16)).digest("hex").slice(0,15)}},u=new A;var x=e=>(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),e);var Ae=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,Q=e=>{let o=x(e),i=o.split("/"),t=i.findIndex(a=>a.startsWith("@")),n=i[i.length-1];if(i.findIndex(a=>a.startsWith("@"))!==-1&&(n=i.slice(t).join("/")),!(o==="."||Ae.test(n??"")))return"App name must consist of only lowercase alphanumeric characters, '-', and '_'"};var ee="[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}",te=`(test|live)_${ee}`,Ke=new RegExp(`^sk_${te}$`),He=new RegExp(`^pk_${te}$`),Ve=new RegExp(`^${ee}$`),je=/^.{44}$/,S=({label:e,required:o=!0,regex:i,formatHint:t,customCheck:n})=>a=>{if(a!=="-"){if(o&&!a)return`${e} is required`;if(i&&a&&!i.test(a))return`${e} is invalid${t?` (${t})`:""}`;if(n)return n(a)}},ne=S({label:"Openfort Publishable Key",regex:He,formatHint:"expected format: pk_test_... or pk_live_..."}),oe=S({label:"Openfort Secret Key",regex:Ke,formatHint:"expected format: sk_test_... or sk_live_..."}),ie=S({label:"Shield Publishable Key",regex:Ve,formatHint:"expected UUID format"}),re=S({label:"Shield Secret",required:!0}),ae=S({label:"Shield Encryption Share",regex:je,formatHint:"expected 44 characters"}),se=S({label:"API endpoint",customCheck:e=>{try{new URL(e);return}catch{return"API endpoint must be a valid URL"}}}),le=async e=>{try{return!!(await(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).json()).session}catch{return!1}};var Ge={appName:b,template:"openfort-ui",createBackend:!0},pe=async()=>{let e=new De().name(B).description("A CLI for creating Openfort applications with embedded wallets").argument("[dir]","The name of the application, as well as the name of the directory to create").option("--noGit","Explicitly tell the CLI to not initialize a new git repo in the project",!1).option("--noInstall","Explicitly tell the CLI to not run the package manager's install command",!1).option("-y, --default","Bypass the CLI and use all default options to bootstrap a new Openfort app",!1).option("--CI","Boolean value if we're running in CI",!1).option("--template [string]","Specify the template to use").option("--theme [string]","Specify the theme to use (for openfort-ui template)").option("--noTelemetry","Disable sending anonymous usage data",!1).addOption(new Fe("--debug").hideHelp(!0)).version(g(),"-v, --version","Display the version number").addHelpText("afterAll",`
7
+ Learn more about Openfort at ${Ue.hex("#5B87F5").bold("https://www.openfort.xyz")}
8
+ `).parse(process.argv),o=e.args[0],i=e.opts();i.debug||(r.debug=()=>{}),u.enabled=!i.noTelemetry,r.debug("Telemetry enabled:",u.enabled),u.send({status:"started"});let t={...Ge,appName:o||b,flags:{noGit:i.noGit||!1,noInstall:i.noInstall||!1,default:i.default||!1,CI:i.CI||!1,template:i.template,theme:i.theme}};if(t.flags.CI)return t.template=i.template||"openfort-ui",t.theme=i.theme,t.createBackend=!1,t.openfortPublishableKey="pk_test_00000000-0000-0000-0000-000000000000",t.shieldPublishableKey="00000000-0000-0000-0000-000000000000",t;if(t.flags.default)return t.template="openfort-ui",t.createBackend=!1,t.openfortPublishableKey="",t.shieldPublishableKey="",t;try{if(process.env.TERM_PROGRAM?.toLowerCase().includes("mintty"))throw r.warn(` WARNING: It looks like you are using MinTTY, which is non-interactive. This is most likely because you are
9
+ using Git Bash. If that's that case, please use Git Bash from another terminal, such as Windows Terminal.`),new T("Non-interactive environment");let n=await p.group({...!o&&{name:()=>p.text({message:"What will your project be called?",defaultValue:b,validate:Q})},template:()=>p.select({message:"Select an Openfort template:",options:W.map(a=>({value:a,label:a==="openfort-ui"?"Openfort UI (default)":a,hint:Ye(a)})),initialValue:"openfort-ui"}),createBackend:()=>p.confirm({message:"Do you want to create a backend for automatic account recovery?",initialValue:!0}),apiEndpoint:async({results:a})=>{if(!a.createBackend){let s=await p.confirm({message:"Do you have an existing API endpoint for account recovery?",initialValue:!1});if(p.isCancel(s)&&process.exit(1),s){let c=!1,l="";for(;!c;){let d=await p.text({message:"Enter your API endpoint for creating encryption sessions:",placeholder:"http://localhost:3110/api/protected-create-encryption-session",validate:se});p.isCancel(d)&&process.exit(1),l=d;let m=p.spinner();if(m.start("Testing API endpoint..."),await le(l))m.stop("API endpoint validated!"),c=!0;else{m.stop("API endpoint validation failed"),r.error("The endpoint did not return a valid session response");let y=await p.confirm({message:"Would you like to try another endpoint?",initialValue:!0});(p.isCancel(y)||!y)&&process.exit(1)}}return l}}},theme:({results:a})=>{if(a.template==="openfort-ui")return p.select({message:"Select a theme:",options:J.map(s=>({value:s,label:s==="auto"?"Auto (default)":s})),initialValue:"auto"})},openfortPublishableKey:()=>p.text({message:"Enter your Project Publishable Key:",placeholder:"pk_test_...",validate:ne}),openfortSecretKey:({results:a})=>{if(a.createBackend)return p.text({message:"Enter your Project Secret Key:",placeholder:"sk_test_...",validate:oe})},shieldEncryptionShare:({results:a})=>{if(a.createBackend)return p.text({message:"Enter your Shield Encryption Share:",placeholder:"Your 44-character encryption share",validate:ae})},shieldPublishableKey:()=>p.text({message:"Enter your Shield Publishable Key:",placeholder:"00000000-0000-0000-0000-000000000000",validate:ie}),shieldSecretKey:({results:a})=>{if(a.createBackend)return p.text({message:"Enter your Shield Secret Key:",placeholder:"Your Shield Secret",validate:re})},...!t.flags.noGit&&{git:()=>p.confirm({message:"Should we initialize a Git repository and stage the changes?",initialValue:!0})}},{onCancel(){process.exit(1)}});return u.template=n.template,u.projectId=n.openfortPublishableKey,{appName:n.name||t.appName,template:n.template,theme:n.theme,createBackend:n.createBackend,apiEndpoint:n.apiEndpoint,openfortPublishableKey:n.openfortPublishableKey,openfortSecretKey:n.openfortSecretKey,shieldPublishableKey:n.shieldPublishableKey,shieldSecretKey:n.shieldSecretKey,shieldEncryptionShare:n.shieldEncryptionShare,flags:{...t.flags,noGit:!n.git||t.flags.noGit}}}catch(n){if(n instanceof T)return r.warn(`
10
+ ${B} needs an interactive terminal to provide options`),await p.confirm({message:"Continue scaffolding a default Openfort app?",initialValue:!0})||(r.info("Exiting..."),process.exit(0)),r.info(`Bootstrapping a default Openfort app in ./${t.appName}`),{...t,template:"openfort-ui",createBackend:!1,openfortPublishableKey:"",shieldPublishableKey:""};throw n}};function Ye(e){switch(e){case"openfort-ui":return"Pre-built UI components";case"headless":return"Custom, unstyled components";case"firebase":return"With Firebase authentication";default:return""}}import ge from"path";import N from"path";import k from"fs-extra";import Me from"ora";var ce=async({projectDir:e,openfortSecretKey:o,shieldSecretKey:i,shieldPublishableKey:t,shieldEncryptionShare:n,port:a=3110})=>{let s=Me("Creating backend...").start();try{let c=N.join(_,"template/backend"),l=N.join(e,"backend");k.copySync(c,l);let d=N.join(l,".env.example"),m=N.join(l,".env");if(k.existsSync(d)){let y=k.readFileSync(d,"utf-8").replace(/OPENFORT_SECRET_KEY=.*/g,`OPENFORT_SECRET_KEY=${o}`).replace(/SHIELD_SECRET_KEY=.*/g,`SHIELD_SECRET_KEY=${i}`).replace(/SHIELD_PUBLISHABLE_KEY=.*/g,`SHIELD_PUBLISHABLE_KEY=${t}`).replace(/SHIELD_ENCRYPTION_SHARE=.*/g,`SHIELD_ENCRYPTION_SHARE=${n}`).replace(/PORT=.*/g,`PORT=${a}`);k.writeFileSync(m,y)}await new Promise(h=>setTimeout(h,250)),s.succeed("Backend created successfully!")}catch(c){throw s.fail("Failed to create backend"),r.error(c instanceof Error?c.message:String(c)),c}};import de from"path";import*as E from"@clack/prompts";import P from"chalk";import w from"fs-extra";import ze from"ora";var fe=async({projectName:e,projectDir:o,template:i,createBackend:t})=>{r.info("");let n=ze(`Scaffolding in: ${o}...
11
+ `).start();if(w.existsSync(o))if(w.readdirSync(o).length===0)e!=="."&&n.info(`${P.cyan.bold(e)} exists but is empty, continuing...
12
+ `);else{n.stopAndPersist();let l=await E.select({message:`${P.redBright.bold("Warning:")} ${P.cyan.bold(e)} already exists and isn't empty. How would you like to proceed?`,options:[{label:"Abort installation (recommended)",value:"abort"},{label:"Clear the directory and continue installation",value:"clear"},{label:"Continue installation and overwrite conflicting files",value:"overwrite"}],initialValue:"abort"});(E.isCancel(l)||l==="abort")&&(n.fail("Aborting installation..."),process.exit(1));let d=await E.confirm({message:`Are you sure you want to ${l==="clear"?"clear the directory":"overwrite conflicting files"}?`,initialValue:!1});(E.isCancel(d)||!d)&&(n.fail("Aborting installation..."),process.exit(1)),l==="clear"&&(n.info(`Emptying ${P.cyan.bold(e)} and creating Openfort app..
13
+ `),w.emptyDirSync(o))}n.start(),w.mkdirSync(o,{recursive:!0});let a=de.join(_,"template/openfort-templates",i),s=t?de.join(o,"frontend"):o;w.copySync(a,s);let c=e==="."?"App":P.cyan.bold(e);await new Promise(l=>setTimeout(l,250)),n.succeed(`${c} ${P.green("scaffolded successfully!")}
14
14
  `)};import me from"path";import $ from"fs-extra";var ue=({projectDir:e,openfortPublishableKey:o,shieldPublishableKey:i,apiEndpoint:t,theme:n})=>{let a=me.join(e,".env.example"),s=me.join(e,".env");if(!$.existsSync(a)){let d=We({openfortPublishableKey:o,shieldPublishableKey:i,apiEndpoint:t,theme:n});$.writeFileSync(s,d);return}let l=$.readFileSync(a,"utf-8");l=l.replace(/VITE_OPENFORT_PUBLISHABLE_KEY=.*/g,`VITE_OPENFORT_PUBLISHABLE_KEY=${o}`).replace(/NEXT_PUBLIC_OPENFORT_PUBLISHABLE_KEY=.*/g,`NEXT_PUBLIC_OPENFORT_PUBLISHABLE_KEY=${o}`).replace(/OPENFORT_PUBLISHABLE_KEY=.*/g,`OPENFORT_PUBLISHABLE_KEY=${o}`),l=l.replace(/VITE_SHIELD_PUBLISHABLE_KEY=.*/g,`VITE_SHIELD_PUBLISHABLE_KEY=${i}`).replace(/NEXT_PUBLIC_SHIELD_PUBLISHABLE_KEY=.*/g,`NEXT_PUBLIC_SHIELD_PUBLISHABLE_KEY=${i}`).replace(/SHIELD_PUBLISHABLE_KEY=.*/g,`SHIELD_PUBLISHABLE_KEY=${i}`),t&&(l=l.replace(/VITE_CREATE_ENCRYPTED_SESSION_ENDPOINT=.*/g,`VITE_CREATE_ENCRYPTED_SESSION_ENDPOINT=${t}`).replace(/NEXT_PUBLIC_CREATE_ENCRYPTED_SESSION_ENDPOINT=.*/g,`NEXT_PUBLIC_CREATE_ENCRYPTED_SESSION_ENDPOINT=${t}`).replace(/CREATE_ENCRYPTED_SESSION_ENDPOINT=.*/g,`CREATE_ENCRYPTED_SESSION_ENDPOINT=${t}`)),n&&(l=l.replace(/VITE_OPENFORT_THEME=.*/g,`VITE_OPENFORT_THEME=${n}`).replace(/NEXT_PUBLIC_OPENFORT_THEME=.*/g,`NEXT_PUBLIC_OPENFORT_THEME=${n}`).replace(/OPENFORT_THEME=.*/g,`OPENFORT_THEME=${n}`)),$.writeFileSync(s,l)},We=({openfortPublishableKey:e,shieldPublishableKey:o,apiEndpoint:i,theme:t})=>{let n=`# Openfort Configuration
15
15
  VITE_OPENFORT_PUBLISHABLE_KEY=${e}
16
16
  VITE_SHIELD_PUBLISHABLE_KEY=${o}
17
17
  `;return i&&(n+=`VITE_CREATE_ENCRYPTED_SESSION_ENDPOINT=${i}
18
18
  `),t&&(n+=`VITE_OPENFORT_THEME=${t}
19
- `),n};var he=async({projectName:e,template:o,openfortPublishableKey:i,shieldPublishableKey:t,apiEndpoint:n,theme:a,createBackendOption:s,openfortSecretKey:c,shieldSecretKey:l,shieldApiKey:d,shieldEncryptionShare:u})=>{let m=ge.resolve(process.cwd(),e);await fe({projectName:e,projectDir:m,template:o,createBackend:s});let h=s?ge.join(m,"frontend"):m;return ue({projectDir:h,openfortPublishableKey:i,shieldPublishableKey:t,apiEndpoint:n,theme:a}),s&&c&&l&&d&&u&&await ce({projectDir:m,openfortSecretKey:c,shieldSecretKey:l,shieldApiKey:d,shieldEncryptionShare:u}),r.info("All done!"),m};import{execSync as H}from"child_process";import K from"path";import*as V from"@clack/prompts";import O from"chalk";import{execa as I}from"execa";import ye from"fs-extra";import Je from"ora";var Xe=e=>{try{return H("git --version",{cwd:e}),!0}catch{return!1}},j=e=>ye.existsSync(K.join(e,".git")),D=async e=>{try{return await I("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}},qe=()=>{let o=H("git --version").toString().trim().split(" ")[2],i=o?.split(".")[0],t=o?.split(".")[1];return{major:Number(i),minor:Number(t)}},Ze=()=>H("git config --global init.defaultBranch || echo main").toString().trim(),Ee=async e=>{if(r.info("Initializing Git..."),!Xe(e)){r.warn("Git is not installed. Skipping Git initialization.");return}let o=Je(`Creating a new git repo...
20
- `).start(),i=j(e),t=await D(e),n=K.parse(e).name;if(t&&i){if(o.stop(),!await V.confirm({message:`${O.redBright.bold("Warning:")} Git is already initialized in "${n}". Initializing a new git repository would delete the previous history. Would you like to continue anyways?`,initialValue:!1})){o.info("Skipping Git initialization.");return}ye.removeSync(K.join(e,".git"))}else if(t&&!i&&(o.stop(),!await V.confirm({message:`${O.redBright.bold("Warning:")} "${n}" is already in a git worktree. Would you still like to initialize a new git repository in this directory?`,initialValue:!1}))){o.info("Skipping Git initialization.");return}try{let a=Ze(),{major:s,minor:c}=qe();s<2||s===2&&c<28?(await I("git",["init"],{cwd:e}),await I("git",["symbolic-ref","HEAD",`refs/heads/${a}`],{cwd:e})):await I("git",["init",`--initial-branch=${a}`],{cwd:e}),await I("git",["add","."],{cwd:e}),o.succeed(`${O.green("Successfully initialized and staged")} ${O.green.bold("git")}
19
+ `),n};var he=async({projectName:e,template:o,openfortPublishableKey:i,shieldPublishableKey:t,apiEndpoint:n,theme:a,createBackendOption:s,openfortSecretKey:c,shieldSecretKey:l,shieldEncryptionShare:d})=>{let m=ge.resolve(process.cwd(),e);await fe({projectName:e,projectDir:m,template:o,createBackend:s});let h=s?ge.join(m,"frontend"):m;return ue({projectDir:h,openfortPublishableKey:i,shieldPublishableKey:t,apiEndpoint:n,theme:a}),s&&c&&l&&t&&d&&await ce({projectDir:m,openfortSecretKey:c,shieldSecretKey:l,shieldPublishableKey:t,shieldEncryptionShare:d}),r.info("All done!"),m};import{execSync as V}from"child_process";import K from"path";import*as H from"@clack/prompts";import O from"chalk";import{execa as I}from"execa";import ye from"fs-extra";import Je from"ora";var Xe=e=>{try{return V("git --version",{cwd:e}),!0}catch{return!1}},j=e=>ye.existsSync(K.join(e,".git")),U=async e=>{try{return await I("git",["rev-parse","--is-inside-work-tree"],{cwd:e,stdout:"ignore"}),!0}catch{return!1}},qe=()=>{let o=V("git --version").toString().trim().split(" ")[2],i=o?.split(".")[0],t=o?.split(".")[1];return{major:Number(i),minor:Number(t)}},Ze=()=>V("git config --global init.defaultBranch || echo main").toString().trim(),Ee=async e=>{if(r.info("Initializing Git..."),!Xe(e)){r.warn("Git is not installed. Skipping Git initialization.");return}let o=Je(`Creating a new git repo...
20
+ `).start(),i=j(e),t=await U(e),n=K.parse(e).name;if(t&&i){if(o.stop(),!await H.confirm({message:`${O.redBright.bold("Warning:")} Git is already initialized in "${n}". Initializing a new git repository would delete the previous history. Would you like to continue anyways?`,initialValue:!1})){o.info("Skipping Git initialization.");return}ye.removeSync(K.join(e,".git"))}else if(t&&!i&&(o.stop(),!await H.confirm({message:`${O.redBright.bold("Warning:")} "${n}" is already in a git worktree. Would you still like to initialize a new git repository in this directory?`,initialValue:!1}))){o.info("Skipping Git initialization.");return}try{let a=Ze(),{major:s,minor:c}=qe();s<2||s===2&&c<28?(await I("git",["init"],{cwd:e}),await I("git",["symbolic-ref","HEAD",`refs/heads/${a}`],{cwd:e})):await I("git",["init",`--initial-branch=${a}`],{cwd:e}),await I("git",["add","."],{cwd:e}),o.succeed(`${O.green("Successfully initialized and staged")} ${O.green.bold("git")}
21
21
  `)}catch{o.fail(`${O.bold.red("Failed:")} could not initialize git. Update git to the latest version!
22
- `)}};import F from"path";import f from"chalk";import U from"fs-extra";var C=()=>{let e=process.env.npm_config_user_agent;return e?e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":e.startsWith("bun")?"bun":"npm":"npm"};var _e=async({projectName:e=b,projectDir:o,createBackend:i})=>{let t=C();if(r.info(`
22
+ `)}};import D from"path";import f from"chalk";import F from"fs-extra";var C=()=>{let e=process.env.npm_config_user_agent;return e?e.startsWith("yarn")?"yarn":e.startsWith("pnpm")?"pnpm":e.startsWith("bun")?"bun":"npm":"npm"};var _e=async({projectName:e=b,projectDir:o,createBackend:i})=>{let t=C();if(r.info(`
23
23
  ${f.green("Success! Your Openfort project is ready.")}`),r.info(`
24
- Next steps:`),e!=="."&&r.info(` ${f.cyan(`cd ${e}`)}`),i){let n=F.join(o,"backend","node_modules"),a=F.join(o,"frontend","node_modules"),s=!U.existsSync(n)||!U.existsSync(a);r.info(`
24
+ Next steps:`),e!=="."&&r.info(` ${f.cyan(`cd ${e}`)}`),i){let n=D.join(o,"backend","node_modules"),a=D.join(o,"frontend","node_modules"),s=!F.existsSync(n)||!F.existsSync(a);r.info(`
25
25
  ${f.yellow("For the backend:")}`),r.info(` ${f.cyan("cd backend")}`),s&&(t==="yarn"?r.info(` ${f.cyan(t)}`):r.info(` ${f.cyan(`${t} install`)}`)),["npm","bun"].includes(t)?r.info(` ${f.cyan(`${t} run dev`)}`):r.info(` ${f.cyan(`${t} dev`)}`),r.info(`
26
- ${f.yellow("For the frontend (in a new terminal):")}`),r.info(` ${f.cyan("cd frontend")}`),s&&(t==="yarn"?r.info(` ${f.cyan(t)}`):r.info(` ${f.cyan(`${t} install`)}`)),["npm","bun"].includes(t)?r.info(` ${f.cyan(`${t} run dev`)}`):r.info(` ${f.cyan(`${t} dev`)}`)}else{let n=F.join(o,"node_modules");!U.existsSync(n)&&(t==="yarn"?r.info(` ${f.cyan(t)}`):r.info(` ${f.cyan(`${t} install`)}`)),["npm","bun"].includes(t)?r.info(` ${f.cyan(`${t} run dev`)}`):r.info(` ${f.cyan(`${t} dev`)}`)}!await D(o)&&!j(o)&&(r.info(`
26
+ ${f.yellow("For the frontend (in a new terminal):")}`),r.info(` ${f.cyan("cd frontend")}`),s&&(t==="yarn"?r.info(` ${f.cyan(t)}`):r.info(` ${f.cyan(`${t} install`)}`)),["npm","bun"].includes(t)?r.info(` ${f.cyan(`${t} run dev`)}`):r.info(` ${f.cyan(`${t} dev`)}`)}else{let n=D.join(o,"node_modules");!F.existsSync(n)&&(t==="yarn"?r.info(` ${f.cyan(t)}`):r.info(` ${f.cyan(`${t} install`)}`)),["npm","bun"].includes(t)?r.info(` ${f.cyan(`${t} run dev`)}`):r.info(` ${f.cyan(`${t} dev`)}`)}!await U(o)&&!j(o)&&(r.info(`
27
27
  ${f.cyan("git init")}`),r.info(` ${f.cyan('git commit -m "initial commit"')}`)),r.info(`
28
- ${f.blue("Learn more at https://www.openfort.xyz/docs")}`)};import be from"path";var Pe=e=>{let i=x(e).split("/"),t=i[i.length-1];if(t==="."){let s=be.resolve(process.cwd());t=be.basename(s)}let n=i.findIndex(s=>s.startsWith("@"));i.findIndex(s=>s.startsWith("@"))!==-1&&(t=i.slice(n).join("/"));let a=i.filter(s=>!s.startsWith("@")).join("/");return[t,a]};import Qe from"gradient-string";var et=["#c3c3c3ff","#ff3b30"],Se=async()=>{let e=Qe(et),o=C();(o==="yarn"||o==="pnpm")&&console.log(""),console.log(e.multiline(z))};import{execSync as tt}from"child_process";import nt from"https";var Te=e=>{let o=y();o.includes("beta")?(r.warn(" You are using a beta version of create-openfort."),r.warn(" Please report any bugs you encounter.")):o.includes("next")?(r.warn(" You are running create-openfort with the @next tag which is no longer maintained."),r.warn(" Please run the CLI with @latest instead.")):o!==e&&(r.warn(" You are using an outdated version of create-openfort."),r.warn(" Your version:",`${o}.`,"Latest version in the npm registry:",e),r.warn(" Please run the CLI with @latest to get the latest updates."))};function ot(){return new Promise((e,o)=>{nt.get("https://registry.npmjs.org/-/package/create-openfort/dist-tags",i=>{if(i.statusCode===200){let t="";i.on("data",n=>{t+=n}),i.on("end",()=>{e(JSON.parse(t).latest)})}else o()}).on("error",()=>{o()})})}var we=()=>ot().catch(()=>{try{return tt("npm view create-openfort version").toString().trim()}catch{return null}});var it=async()=>{let e=await we();await Se(),e&&Te(e);let{appName:o,template:i,theme:t,createBackend:n,apiEndpoint:a,openfortPublishableKey:s,openfortSecretKey:c,shieldPublishableKey:l,shieldSecretKey:d,shieldEncryptionShare:u,flags:{noGit:m}}=await pe(),[h,Y]=Pe(o);g.projectName=h;let v=await he({projectName:Y,template:i,openfortPublishableKey:s,shieldPublishableKey:l,apiEndpoint:a||(n?"http://localhost:3110/api/protected-create-encryption-session":void 0),theme:t,createBackendOption:n,openfortSecretKey:c,shieldSecretKey:d,shieldApiKey:l,shieldEncryptionShare:u}),R=n?Oe.join(v,"frontend","package.json"):Oe.join(v,"package.json");if(G.existsSync(R)){let A=G.readJSONSync(R);A.name=h,A.openfortMetadata={initVersion:y(),template:i},G.writeJSONSync(R,A,{spaces:2})}m||await Ee(v),await _e({projectName:Y,projectDir:v,createBackend:n}),g.send({status:"completed"}),process.exit(0)};it().catch(e=>{r.error("Aborting installation..."),e instanceof Error?r.error(e):r.error("An unknown error has occurred. Please open an issue on GitHub with the below:"),g.send({status:"error",properties:{error:e instanceof Error?e.message:String(e)}}),process.exit(1)});
28
+ ${f.blue("Learn more at https://www.openfort.xyz/docs")}`)};import be from"path";var Se=e=>{let i=x(e).split("/"),t=i[i.length-1];if(t==="."){let s=be.resolve(process.cwd());t=be.basename(s)}let n=i.findIndex(s=>s.startsWith("@"));i.findIndex(s=>s.startsWith("@"))!==-1&&(t=i.slice(n).join("/"));let a=i.filter(s=>!s.startsWith("@")).join("/");return[t,a]};import Qe from"gradient-string";var et=["#c3c3c3ff","#ff3b30"],Pe=async()=>{let e=Qe(et),o=C();(o==="yarn"||o==="pnpm")&&console.log(""),console.log(e.multiline(z))};import{execSync as tt}from"child_process";import nt from"https";var Te=e=>{let o=g();o.includes("beta")?(r.warn(" You are using a beta version of create-openfort."),r.warn(" Please report any bugs you encounter.")):o.includes("next")?(r.warn(" You are running create-openfort with the @next tag which is no longer maintained."),r.warn(" Please run the CLI with @latest instead.")):o!==e&&(r.warn(" You are using an outdated version of create-openfort."),r.warn(" Your version:",`${o}.`,"Latest version in the npm registry:",e),r.warn(" Please run the CLI with @latest to get the latest updates."))};function ot(){return new Promise((e,o)=>{nt.get("https://registry.npmjs.org/-/package/create-openfort/dist-tags",i=>{if(i.statusCode===200){let t="";i.on("data",n=>{t+=n}),i.on("end",()=>{e(JSON.parse(t).latest)})}else o()}).on("error",()=>{o()})})}var we=()=>ot().catch(()=>{try{return tt("npm view create-openfort version").toString().trim()}catch{return null}});var it=async()=>{let e=await we();await Pe(),e&&Te(e);let{appName:o,template:i,theme:t,createBackend:n,apiEndpoint:a,openfortPublishableKey:s,openfortSecretKey:c,shieldPublishableKey:l,shieldSecretKey:d,shieldEncryptionShare:m,flags:{noGit:h}}=await pe(),[y,Y]=Se(o);u.projectName=y;let v=await he({projectName:Y,template:i,openfortPublishableKey:s,apiEndpoint:a||(n?"http://localhost:3110/api/protected-create-encryption-session":void 0),theme:t,createBackendOption:n,openfortSecretKey:c,shieldSecretKey:d,shieldPublishableKey:l,shieldEncryptionShare:m}),R=n?Oe.join(v,"frontend","package.json"):Oe.join(v,"package.json");if(G.existsSync(R)){let L=G.readJSONSync(R);L.name=y,L.openfortMetadata={initVersion:g(),template:i},G.writeJSONSync(R,L,{spaces:2})}h||await Ee(v),await _e({projectName:Y,projectDir:v,createBackend:n}),u.send({status:"completed"}),process.exit(0)};it().catch(e=>{r.error("Aborting installation..."),e instanceof Error?r.error(e):r.error("An unknown error has occurred. Please open an issue on GitHub with the below:"),u.send({status:"error",properties:{error:e instanceof Error?e.message:String(e)}}),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-openfort",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Create Openfort applications with embedded wallets",
5
5
  "license": "MIT",
6
6
  "author": "Openfort (https://www.openfort.xyz)",
@@ -443,7 +443,7 @@ packages:
443
443
 
444
444
  glob@7.2.3:
445
445
  resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
446
- deprecated: Glob versions prior to v9 are no longer supported
446
+ deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
447
447
 
448
448
  gopd@1.2.0:
449
449
  resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}
@@ -625,8 +625,8 @@ packages:
625
625
  proxy-from-env@1.1.0:
626
626
  resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
627
627
 
628
- qs@6.14.1:
629
- resolution: {integrity: sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==}
628
+ qs@6.14.2:
629
+ resolution: {integrity: sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q==}
630
630
  engines: {node: '>=0.6'}
631
631
 
632
632
  range-parser@1.2.1:
@@ -1038,7 +1038,7 @@ snapshots:
1038
1038
  http-errors: 2.0.0
1039
1039
  iconv-lite: 0.4.24
1040
1040
  on-finished: 2.4.1
1041
- qs: 6.14.1
1041
+ qs: 6.14.2
1042
1042
  raw-body: 2.5.2
1043
1043
  type-is: 1.6.18
1044
1044
  unpipe: 1.0.0
@@ -1179,7 +1179,7 @@ snapshots:
1179
1179
  parseurl: 1.3.3
1180
1180
  path-to-regexp: 0.1.12
1181
1181
  proxy-addr: 2.0.7
1182
- qs: 6.14.1
1182
+ qs: 6.14.2
1183
1183
  range-parser: 1.2.1
1184
1184
  safe-buffer: 5.2.1
1185
1185
  send: 0.19.0
@@ -1399,7 +1399,7 @@ snapshots:
1399
1399
 
1400
1400
  proxy-from-env@1.1.0: {}
1401
1401
 
1402
- qs@6.14.1:
1402
+ qs@6.14.2:
1403
1403
  dependencies:
1404
1404
  side-channel: 1.1.0
1405
1405
 
@@ -29,8 +29,11 @@ export function OpenfortProviders({ children }: { children: React.ReactNode }) {
29
29
  walletConfig={{
30
30
  shieldPublishableKey: import.meta.env.VITE_SHIELD_PUBLISHABLE_KEY!, // Get it from https://dashboard.openfort.io
31
31
  ethereumProviderPolicyId: import.meta.env.VITE_POLICY_ID, // Policy ID for sponsoring transactions
32
+ // If you want to use AUTOMATIC embedded wallet recovery, an encryption session is required.
33
+ // See: https://www.openfort.io/docs/products/embedded-wallet/react-native/quickstart/automatic
34
+ // For backend setup, check: https://github.com/openfort-xyz/openfort-backend-quickstart
32
35
  createEncryptedSessionEndpoint: import.meta.env
33
- .VITE_CREATE_ENCRYPTED_SESSION_ENDPOINT, // Endpoint for encryption session
36
+ .VITE_CREATE_ENCRYPTED_SESSION_ENDPOINT,
34
37
  recoverWalletAutomaticallyAfterAuth: false, // Wallet creation handled manually after auth
35
38
  }}
36
39
  thirdPartyAuth={{
@@ -110,10 +110,10 @@ const AuthForm = () => {
110
110
  const [isLogin, setIsLogin] = useState(true)
111
111
  const { isLoading } = useAuthCallback({
112
112
  onSuccess: () => {
113
- alert('Authentication verified!')
113
+ console.log('Authentication verified!')
114
114
  },
115
115
  onError: (e) => {
116
- alert(`Authentication verification failed!${e.message}`)
116
+ console.error(`Authentication verification failed!${e.message}`)
117
117
  },
118
118
  })
119
119
 
@@ -24,8 +24,11 @@ export function Providers({ children }: { children: React.ReactNode }) {
24
24
  walletConfig={{
25
25
  shieldPublishableKey: import.meta.env.VITE_SHIELD_PUBLISHABLE_KEY!, // The public key for your Openfort Shield account get it from https://dashboard.openfort.io
26
26
  ethereumProviderPolicyId: import.meta.env.VITE_POLICY_ID, // The policy ID for sponsoring transactions
27
+ // If you want to use AUTOMATIC embedded wallet recovery, an encryption session is required.
28
+ // See: https://www.openfort.io/docs/products/embedded-wallet/react-native/quickstart/automatic
29
+ // For backend setup, check: https://github.com/openfort-xyz/openfort-backend-quickstart
27
30
  createEncryptedSessionEndpoint: import.meta.env
28
- .VITE_CREATE_ENCRYPTED_SESSION_ENDPOINT, // The endpoint to create an encryption session for automatic wallet recovery
31
+ .VITE_CREATE_ENCRYPTED_SESSION_ENDPOINT,
29
32
  recoverWalletAutomaticallyAfterAuth: true, // We will manually call create/setActive wallet after auth
30
33
  }}
31
34
  >
@@ -26,8 +26,11 @@ export function Providers({ children }: { children: React.ReactNode }) {
26
26
 
27
27
  ethereumProviderPolicyId: import.meta.env.VITE_POLICY_ID, // The policy ID for sponsoring transactions
28
28
 
29
+ // If you want to use AUTOMATIC embedded wallet recovery, an encryption session is required.
30
+ // See: https://www.openfort.io/docs/products/embedded-wallet/react-native/quickstart/automatic
31
+ // For backend setup, check: https://github.com/openfort-xyz/openfort-backend-quickstart
29
32
  createEncryptedSessionEndpoint: import.meta.env
30
- .VITE_CREATE_ENCRYPTED_SESSION_ENDPOINT, // The endpoint to create an encryption session for automatic wallet recovery
33
+ .VITE_CREATE_ENCRYPTED_SESSION_ENDPOINT,
31
34
 
32
35
  recoverWalletAutomaticallyAfterAuth: false, // We will manually call create/setActive wallet after auth
33
36
  }}