better-auth
Version:
The most comprehensive authentication framework for TypeScript.
1 lines • 1.26 kB
Source Map (JSON)
{"version":3,"file":"prompt.mjs","names":[],"sources":["../../../../src/plugins/oidc-provider/utils/prompt.ts"],"sourcesContent":["import { InvalidRequest } from \"../error\";\n\nexport type AuthorizePrompt = \"login\" | \"consent\" | \"select_account\" | \"none\";\nexport type AuthorizePromptSet = ReadonlySet<AuthorizePrompt>;\n\n/**\n * Parse space-separated prompt string into a set of prompts\n *\n * @param prompt\n */\nexport function parsePrompt(prompt: string) {\n\tconst prompts = prompt.split(\" \").map((p) => p.trim());\n\tconst set = new Set<AuthorizePrompt>();\n\tfor (const p of prompts) {\n\t\tif (\n\t\t\tp === \"login\" ||\n\t\t\tp === \"consent\" ||\n\t\t\tp === \"select_account\" ||\n\t\t\tp === \"none\"\n\t\t) {\n\t\t\tset.add(p);\n\t\t}\n\t}\n\n\tif (set.has(\"none\") && set.size > 1) {\n\t\tthrow new InvalidRequest(\"prompt none must only be used alone\");\n\t}\n\n\treturn new Set(set) as AuthorizePromptSet;\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,YAAY,QAAgB;CAC3C,MAAM,UAAU,OAAO,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC;CACtD,MAAM,sBAAM,IAAI,KAAsB;AACtC,MAAK,MAAM,KAAK,QACf,KACC,MAAM,WACN,MAAM,aACN,MAAM,oBACN,MAAM,OAEN,KAAI,IAAI,EAAE;AAIZ,KAAI,IAAI,IAAI,OAAO,IAAI,IAAI,OAAO,EACjC,OAAM,IAAI,eAAe,sCAAsC;AAGhE,QAAO,IAAI,IAAI,IAAI"}