@8wave/ai-elements 0.114.0-beta.8 → 0.115.0-beta.13
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/dist/_chunks/Agent-DK76k05_.js +566 -0
- package/dist/_chunks/Agent-DK76k05_.js.map +1 -0
- package/dist/_chunks/{PkStreamingMarkdown-C1sANAr5.js → PkStreamingMarkdown-BKxA6Ntl.js} +688 -672
- package/dist/_chunks/PkStreamingMarkdown-BKxA6Ntl.js.map +1 -0
- package/dist/_chunks/{PkToolRequestGeolocation-BbxYKt-9.js → PkToolRequestGeolocation-OF1PWhMw.js} +2 -2
- package/{dist-vue/_chunks/PkToolRequestGeolocation-9vfYNaQo.js.map → dist/_chunks/PkToolRequestGeolocation-OF1PWhMw.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-CTp2w60F.js → PkToolRequestOAuthConnection-CgQePKKb.js} +4 -4
- package/dist/_chunks/PkToolRequestOAuthConnection-CgQePKKb.js.map +1 -0
- package/dist/_chunks/{PkToolShowArtifact-BfTjxGOT.js → PkToolShowArtifact-CHxeuKEU.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-BfTjxGOT.js.map → PkToolShowArtifact-CHxeuKEU.js.map} +1 -1
- package/dist/_chunks/PkToolShowComparison-8d6fAhRp.js +72 -0
- package/dist/_chunks/PkToolShowComparison-8d6fAhRp.js.map +1 -0
- package/dist/_chunks/{PkToolShowContactForm-PFpY9dIp.js → PkToolShowContactForm-DqVLVwqJ.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-PFpY9dIp.js.map → PkToolShowContactForm-DqVLVwqJ.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-CMtSN0oX.js → PkToolShowForm-YJQPYfEe.js} +5 -5
- package/dist/_chunks/{PkToolShowForm-CMtSN0oX.js.map → PkToolShowForm-YJQPYfEe.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-C6cu66Ts.js → PkToolShowSources-kGQlIKaN.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-C6cu66Ts.js.map → PkToolShowSources-kGQlIKaN.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-CFO8wV1b.js → PkToolShowSuggestedReply-Dl4x_nEJ.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-CFO8wV1b.js.map → PkToolShowSuggestedReply-Dl4x_nEJ.js.map} +1 -1
- package/dist/_chunks/{markdown-BRD-hDrH.js → markdown-B4cYQGBo.js} +37 -21
- package/dist/_chunks/markdown-B4cYQGBo.js.map +1 -0
- package/dist/ai-elements.es.js +3177 -2748
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotAuth.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Agent-BNlmK-uJ.js → Agent-tbKw8Mdt.js} +2 -2
- package/dist-vue/_chunks/{Agent-BNlmK-uJ.js.map → Agent-tbKw8Mdt.js.map} +1 -1
- package/dist-vue/_chunks/{Document-2X01-F4Z.js → Document-BWz2HySu.js} +37 -21
- package/dist-vue/_chunks/Document-BWz2HySu.js.map +1 -0
- package/dist-vue/_chunks/Media-_HfFLHGD.js.map +1 -1
- package/dist-vue/_chunks/{PkChatbot-HRayDr2d.js → PkChatbot-DtyZYAzj.js} +8 -8
- package/dist-vue/_chunks/{PkChatbot-HRayDr2d.js.map → PkChatbot-DtyZYAzj.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotAuth-jzoNJkmH.js +421 -0
- package/dist-vue/_chunks/PkChatbotAuth-jzoNJkmH.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotEmptyState-CPOcfoRC.js → PkChatbotEmptyState-Dicjr_Fv.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-CPOcfoRC.js.map → PkChatbotEmptyState-Dicjr_Fv.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-pLJQIu7v.js → PkChatbotInput-DcLmOqA1.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-pLJQIu7v.js.map → PkChatbotInput-DcLmOqA1.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-GZStJbx_.js → PkChatbotMessages-CrhRrcBs.js} +258 -256
- package/dist-vue/_chunks/PkChatbotMessages-CrhRrcBs.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotStepPayload-DU0W-eUp.js → PkChatbotStepPayload-rKaeDQDj.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-DU0W-eUp.js.map → PkChatbotStepPayload-rKaeDQDj.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-etlBryOg.js → PkChatbotStepToolDetail-5HdSV8Im.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-etlBryOg.js.map → PkChatbotStepToolDetail-5HdSV8Im.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotSteps-CPPjwTJN.js +191 -0
- package/dist-vue/_chunks/PkChatbotSteps-CPPjwTJN.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-DIfBWFoG.js → PkChatbotViewChat-B13nCznB.js} +7 -7
- package/dist-vue/_chunks/{PkChatbotViewChat-DIfBWFoG.js.map → PkChatbotViewChat-B13nCznB.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-BCdolW0R.js → PkChatbotViewConversations-CHpN4vhm.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-BCdolW0R.js.map → PkChatbotViewConversations-CHpN4vhm.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-Cudao8ew.js → PkChatbotViewFiles-cRyG5X3P.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-Cudao8ew.js.map → PkChatbotViewFiles-cRyG5X3P.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-DDsKOkcC.js → PkChatbotViewProfile-CosaHA-g.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-DDsKOkcC.js.map → PkChatbotViewProfile-CosaHA-g.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-BloMJaIW.js → PkStreamingMarkdown-DYy79C1P.js} +214 -205
- package/dist-vue/_chunks/{PkStreamingMarkdown-BloMJaIW.js.map → PkStreamingMarkdown-DYy79C1P.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-9vfYNaQo.js → PkToolRequestGeolocation-BOVbaCzQ.js} +2 -2
- package/{dist/_chunks/PkToolRequestGeolocation-BbxYKt-9.js.map → dist-vue/_chunks/PkToolRequestGeolocation-BOVbaCzQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BorR5NmZ.js → PkToolRequestOAuthConnection-a2LegFoE.js} +4 -4
- package/dist-vue/_chunks/PkToolRequestOAuthConnection-a2LegFoE.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowArtifact-BuMY7GNj.js → PkToolShowArtifact-DUOnFdfa.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-BuMY7GNj.js.map → PkToolShowArtifact-DUOnFdfa.js.map} +1 -1
- package/dist-vue/_chunks/PkToolShowComparison-DQs3E6-k.js +72 -0
- package/dist-vue/_chunks/PkToolShowComparison-DQs3E6-k.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowContactForm-0OQRqT8m.js → PkToolShowContactForm-1TFKvG_s.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-0OQRqT8m.js.map → PkToolShowContactForm-1TFKvG_s.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-BGL27iHG.js → PkToolShowDiagram-BnbkymPD.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-BGL27iHG.js.map → PkToolShowDiagram-BnbkymPD.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowEmail-BJJpS69F.js → PkToolShowEmail-BDsBoETQ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowEmail-BJJpS69F.js.map → PkToolShowEmail-BDsBoETQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-DDcPpOZ8.js → PkToolShowForm-DwFKxMJd.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-DDcPpOZ8.js.map → PkToolShowForm-DwFKxMJd.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowMessage-BFGynf3p.js → PkToolShowMessage-Dau3agUy.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowMessage-BFGynf3p.js.map → PkToolShowMessage-Dau3agUy.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-6t1Ir5CW.js → PkToolShowProductList-CsupMsuy.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-6t1Ir5CW.js.map → PkToolShowProductList-CsupMsuy.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-cOF0ZxOj.js → PkToolShowSources-C8r1vKJk.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowSources-cOF0ZxOj.js.map → PkToolShowSources-C8r1vKJk.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DA4NEjHB.js → PkToolShowSuggestedReply-qAWdCUhr.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DA4NEjHB.js.map → PkToolShowSuggestedReply-qAWdCUhr.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-OgaT1vYJ.js → PkToolShowWebPages-D4E3Xzg1.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-OgaT1vYJ.js.map → PkToolShowWebPages-D4E3Xzg1.js.map} +1 -1
- package/dist-vue/_chunks/{PkUrl-Cd69XP5z.js → PkUrl-Cu3qKl4G.js} +2 -2
- package/dist-vue/_chunks/{PkUrl-Cd69XP5z.js.map → PkUrl-Cu3qKl4G.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-CaVLm5W9.js → createChatbotApiClient-BlWs282E.js} +137 -168
- package/dist-vue/_chunks/createChatbotApiClient-BlWs282E.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-BwrBZJCq.js → useChatbotStore-CMo47fnS.js} +3 -3
- package/dist-vue/_chunks/{useChatbotStore-BwrBZJCq.js.map → useChatbotStore-CMo47fnS.js.map} +1 -1
- package/dist-vue/_chunks/utils-B45A2ONa.js +184 -0
- package/dist-vue/_chunks/utils-B45A2ONa.js.map +1 -0
- package/dist-vue/api.js +1 -1
- package/dist-vue/apps/web-component/src/components/EmbeddedChatWidget.ce.d.ts +4 -4
- package/dist-vue/apps/web-component/src/composables/useChatbotAuth.d.ts +53 -5
- package/dist-vue/apps/web-component/src/composables/useChatbotAuthForm.d.ts +14 -0
- package/dist-vue/composables.js +524 -39
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +3366 -3240
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +46 -0
- package/dist-vue/packages/ability/src/index.d.ts +10 -14
- package/dist-vue/packages/auth/src/active-membership.d.ts +36 -0
- package/dist-vue/packages/auth/src/add-member-to-organization.d.ts +12 -2
- package/dist-vue/packages/auth/src/additional-fields.d.ts +48 -0
- package/dist-vue/packages/auth/src/organization-member-limit.d.ts +12 -0
- package/dist-vue/packages/auth/src/passkey-policy-client-plugin.d.ts +31 -0
- package/dist-vue/packages/auth/src/passkey-policy-plugin.d.ts +22 -0
- package/dist-vue/packages/auth/src/two-factor-admin-plugin.d.ts +2 -0
- package/dist-vue/packages/auth/src/two-factor-policy-client-plugin.d.ts +163 -0
- package/dist-vue/packages/auth/src/two-factor-policy-plugin.d.ts +106 -0
- package/dist-vue/packages/components/src/PkQrCode.d.ts +14 -0
- package/dist-vue/packages/components/src/chat/PkChatbotAuth.d.ts +19 -0
- package/dist-vue/packages/components/src/chat/PkChatbotMessages.d.ts +8 -4
- package/dist-vue/packages/components/src/chat/PkChatbotSteps.d.ts +1 -0
- package/dist-vue/packages/components/src/chat/PkTurnEvaluation.d.ts +8 -0
- package/dist-vue/packages/components/src/chat/utils.d.ts +9 -0
- package/dist-vue/packages/components/src/index.d.ts +2 -1
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +60 -0
- package/dist-vue/packages/models/src/schema/Chat.d.ts +42 -0
- package/dist-vue/packages/models/src/schema/Document.d.ts +494 -0
- package/dist-vue/packages/models/src/schema/DocumentFolder.d.ts +10 -0
- package/dist-vue/packages/models/src/schema/DocumentSyncSource.d.ts +71 -1
- package/dist-vue/packages/models/src/schema/Lead.d.ts +1 -1
- package/dist-vue/packages/models/src/schema/McpServer.d.ts +13 -0
- package/dist-vue/packages/models/src/schema/Media.d.ts +0 -1
- package/dist-vue/packages/models/src/schema/Member.d.ts +10 -0
- package/dist-vue/packages/models/src/schema/Notification.d.ts +31 -0
- package/dist-vue/packages/models/src/schema/Organization.d.ts +20 -0
- package/dist-vue/packages/models/src/schema/SignInSecurity.d.ts +168 -0
- package/dist-vue/packages/models/src/schema/User.d.ts +1 -0
- package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/Agent-DTLrWpzX.js +0 -460
- package/dist/_chunks/Agent-DTLrWpzX.js.map +0 -1
- package/dist/_chunks/Media-Cft7Pwrh.js +0 -108
- package/dist/_chunks/Media-Cft7Pwrh.js.map +0 -1
- package/dist/_chunks/PkStreamingMarkdown-C1sANAr5.js.map +0 -1
- package/dist/_chunks/PkToolRequestOAuthConnection-CTp2w60F.js.map +0 -1
- package/dist/_chunks/PkToolShowComparison-BJ7QBXtf.js +0 -60
- package/dist/_chunks/PkToolShowComparison-BJ7QBXtf.js.map +0 -1
- package/dist/_chunks/markdown-BRD-hDrH.js.map +0 -1
- package/dist-vue/_chunks/Document-2X01-F4Z.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotAuth-Bi508F1u.js +0 -349
- package/dist-vue/_chunks/PkChatbotAuth-Bi508F1u.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-GZStJbx_.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotSteps-Cl4pVtPJ.js +0 -190
- package/dist-vue/_chunks/PkChatbotSteps-Cl4pVtPJ.js.map +0 -1
- package/dist-vue/_chunks/PkToolRequestOAuthConnection-BorR5NmZ.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowComparison-BLn4pkno.js +0 -61
- package/dist-vue/_chunks/PkToolShowComparison-BLn4pkno.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-CaVLm5W9.js.map +0 -1
- package/dist-vue/_chunks/utils-h4C7rRcu.js +0 -177
- package/dist-vue/_chunks/utils-h4C7rRcu.js.map +0 -1
package/dist-vue/locales.js
CHANGED
|
@@ -305,6 +305,7 @@ var e = {
|
|
|
305
305
|
toolApprovalBadge: "User confirm",
|
|
306
306
|
calendarEvent: "Event",
|
|
307
307
|
comparison: "Comparison",
|
|
308
|
+
recommended: "Recommended",
|
|
308
309
|
contactUs: "Contact us",
|
|
309
310
|
phone: "Phone number",
|
|
310
311
|
diagram: "Diagram",
|
|
@@ -366,6 +367,7 @@ var e = {
|
|
|
366
367
|
voiceId: "Cloned voices are not listed: the provider forbids them here.",
|
|
367
368
|
freshnessScaleExplanationMonths: "A document updated today gets a +{weight} bonus. This bonus halves to +{halfWeight} after {half} days and practically drops to zero (+{zeroWeight}) after {zero} days (approx. {months} months).",
|
|
368
369
|
freshnessScaleExplanationDays: "A document updated today gets a +{weight} bonus. This bonus halves to +{halfWeight} after {half} days and practically drops to zero (+{zeroWeight}) after {zero} days.",
|
|
370
|
+
reasoningVisibility: "A reasoning agent is always visible to the members of its organization only.",
|
|
369
371
|
agentOnOwnEndpoint: "This agent runs on your organization's endpoint.",
|
|
370
372
|
providerTimeoutMs: "Timeout in milliseconds before falling back to the next provider (min 1000, max 789000). BYOK credentials only.",
|
|
371
373
|
showExtendedSteps: "Shows reasoning and tool calls as an expandable timeline in the chat.",
|
|
@@ -470,6 +472,18 @@ var e = {
|
|
|
470
472
|
untitled: "Untitled file",
|
|
471
473
|
exclude: "Remove file"
|
|
472
474
|
},
|
|
475
|
+
twoFactor: {
|
|
476
|
+
challengeBackup: "Enter one of the backup codes you saved.",
|
|
477
|
+
challengeEmailSent: "We sent a 6-digit code to your email. It expires in 5 minutes.",
|
|
478
|
+
challengeApp: "Enter the 6-digit code from your authenticator app.",
|
|
479
|
+
challengeTitle: "Two-step verification",
|
|
480
|
+
backupCode: "Backup code",
|
|
481
|
+
code: "6-digit code",
|
|
482
|
+
verify: "Verify",
|
|
483
|
+
useBackupCode: "Use a backup code",
|
|
484
|
+
useApp: "Use the authenticator app",
|
|
485
|
+
sendAgain: "Send a new code"
|
|
486
|
+
},
|
|
473
487
|
auth: {
|
|
474
488
|
signInTitle: "Sign in to your account",
|
|
475
489
|
signUpTitle: "Create your account",
|
|
@@ -527,6 +541,7 @@ var e = {
|
|
|
527
541
|
showImageGallery: "Loading gallery...",
|
|
528
542
|
showVideo: "Loading video...",
|
|
529
543
|
showSuggestedReply: "Suggest a reply...",
|
|
544
|
+
disconnectOAuthConnection: "Disconnecting...",
|
|
530
545
|
webSearch: "Searching the web...",
|
|
531
546
|
tool: "Running a tool...",
|
|
532
547
|
reasoning: "Reasoning...",
|
|
@@ -567,6 +582,14 @@ var e = {
|
|
|
567
582
|
feelsLike: "Feels like",
|
|
568
583
|
dailyForecast: "Daily forecast",
|
|
569
584
|
airQuality: "Air quality"
|
|
585
|
+
},
|
|
586
|
+
turnEvaluation: {
|
|
587
|
+
cost: "Cost, not charged to the organization: {cost}",
|
|
588
|
+
title: "Evaluation after the reply",
|
|
589
|
+
modeHint: "Recorded after the reply, with no effect: nothing reads these probabilities yet.",
|
|
590
|
+
version: "Questions version {version}",
|
|
591
|
+
leadFailed: "The evaluation failed or did not answer within {budget} ms: nothing was recorded.",
|
|
592
|
+
probability: "Probability the evaluation model gives to the question: from 0.5 it leans towards yes"
|
|
570
593
|
}
|
|
571
594
|
}, t = {
|
|
572
595
|
agentType: {
|
|
@@ -874,6 +897,7 @@ var e = {
|
|
|
874
897
|
toolApprovalBadge: "Conferma utente",
|
|
875
898
|
calendarEvent: "Evento",
|
|
876
899
|
comparison: "Confronto",
|
|
900
|
+
recommended: "Consigliato",
|
|
877
901
|
contactUs: "Contattaci",
|
|
878
902
|
phone: "Telefono",
|
|
879
903
|
diagram: "Diagramma",
|
|
@@ -935,6 +959,7 @@ var e = {
|
|
|
935
959
|
voiceId: "Le voci clonate non sono in elenco: il fornitore non le ammette qui.",
|
|
936
960
|
freshnessScaleExplanationMonths: "Un documento modificato oggi ottiene un bonus di +{weight}. Il bonus si dimezza a +{halfWeight} dopo {half} giorni e si azzera praticamente (+{zeroWeight}) dopo {zero} giorni (circa {months} mesi).",
|
|
937
961
|
freshnessScaleExplanationDays: "Un documento modificato oggi ottiene un bonus di +{weight}. Il bonus si dimezza a +{halfWeight} dopo {half} giorni e si azzera praticamente (+{zeroWeight}) dopo {zero} giorni.",
|
|
962
|
+
reasoningVisibility: "Un agente reasoning è sempre visibile solo ai membri dell'organizzazione.",
|
|
938
963
|
agentOnOwnEndpoint: "Questo agente gira sull’endpoint della tua organizzazione.",
|
|
939
964
|
providerTimeoutMs: "Timeout in millisecondi prima di passare al provider successivo (min 1000, max 789000). Solo credenziali BYOK.",
|
|
940
965
|
showExtendedSteps: "Visualizza la timeline con il ragionamento e gli strumenti nella chat.",
|
|
@@ -1039,6 +1064,18 @@ var e = {
|
|
|
1039
1064
|
untitled: "File senza nome",
|
|
1040
1065
|
exclude: "Rimuovi file"
|
|
1041
1066
|
},
|
|
1067
|
+
twoFactor: {
|
|
1068
|
+
challengeBackup: "Scrivi uno dei codici di recupero che hai salvato.",
|
|
1069
|
+
challengeEmailSent: "Ti abbiamo inviato un codice a 6 cifre via email. Scade fra 5 minuti.",
|
|
1070
|
+
challengeApp: "Scrivi il codice a 6 cifre della tua app di autenticazione.",
|
|
1071
|
+
challengeTitle: "Verifica in due passaggi",
|
|
1072
|
+
backupCode: "Codice di recupero",
|
|
1073
|
+
code: "Codice a 6 cifre",
|
|
1074
|
+
verify: "Verifica",
|
|
1075
|
+
useBackupCode: "Usa un codice di recupero",
|
|
1076
|
+
useApp: "Usa l'app di autenticazione",
|
|
1077
|
+
sendAgain: "Invia un nuovo codice"
|
|
1078
|
+
},
|
|
1042
1079
|
auth: {
|
|
1043
1080
|
signInTitle: "Accedi al tuo account",
|
|
1044
1081
|
signUpTitle: "Crea il tuo account",
|
|
@@ -1096,6 +1133,7 @@ var e = {
|
|
|
1096
1133
|
showImageGallery: "Caricamento galleria...",
|
|
1097
1134
|
showVideo: "Caricamento video...",
|
|
1098
1135
|
showSuggestedReply: "Suggerisco una risposta...",
|
|
1136
|
+
disconnectOAuthConnection: "Disconnessione in corso...",
|
|
1099
1137
|
webSearch: "Ricerca sul web...",
|
|
1100
1138
|
tool: "Esecuzione di un tool...",
|
|
1101
1139
|
reasoning: "Ragionamento...",
|
|
@@ -1136,6 +1174,14 @@ var e = {
|
|
|
1136
1174
|
feelsLike: "Percepita",
|
|
1137
1175
|
dailyForecast: "Previsioni giornaliere",
|
|
1138
1176
|
airQuality: "Qualità dell'aria"
|
|
1177
|
+
},
|
|
1178
|
+
turnEvaluation: {
|
|
1179
|
+
cost: "Costo, non addebitato all'organizzazione: {cost}",
|
|
1180
|
+
title: "Valutazione a fine turno",
|
|
1181
|
+
modeHint: "Registrata dopo la risposta, senza effetti: per ora nessuno legge queste probabilità.",
|
|
1182
|
+
version: "Versione delle domande: {version}",
|
|
1183
|
+
leadFailed: "La valutazione non è riuscita o non ha risposto entro {budget} ms: non è stato registrato niente.",
|
|
1184
|
+
probability: "Probabilità che il modello di valutazione dà alla domanda: da 0,5 in su propende per il sì"
|
|
1139
1185
|
}
|
|
1140
1186
|
};
|
|
1141
1187
|
//#endregion
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { MongoAbility, InferSubjects, ForcedSubject
|
|
1
|
+
import { MongoAbility, InferSubjects, ForcedSubject } from '@casl/ability';
|
|
2
2
|
import { Action, Capability, Subject, Session } from './types';
|
|
3
|
-
import { MongoQueryTopLevelOperators } from '@ucast/mongo2js';
|
|
4
3
|
import { Statements, RoleInput, Role, ExactRoleStatements } from 'better-auth/plugins';
|
|
5
4
|
export declare const OrganizationRoles: {
|
|
6
5
|
readonly admin: "admin";
|
|
@@ -13,23 +12,20 @@ export declare const UserRoles: {
|
|
|
13
12
|
readonly user: "user";
|
|
14
13
|
};
|
|
15
14
|
export type AbilitySubject = InferSubjects<'all' | Subject, true> | ForcedSubject<InferSubjects<'all' | Subject, true>>;
|
|
16
|
-
type
|
|
17
|
-
export declare const ability: PureAbility<[Action, AbilitySubject], {
|
|
18
|
-
[x: string]: any;
|
|
19
|
-
[x: number]: any;
|
|
20
|
-
[x: symbol]: any;
|
|
21
|
-
} & MongoQueryTopLevelOperators<Record<PropertyKey, any>>>;
|
|
15
|
+
export type AppAbility = MongoAbility<[Action, AbilitySubject]>;
|
|
22
16
|
export declare const isValidOrganizationRole: (role?: string | null) => role is keyof typeof OrganizationRoles;
|
|
23
17
|
export declare const isValidUserRole: (role?: string | null) => role is keyof typeof UserRoles;
|
|
24
18
|
export declare const getOrganizationRoleCapabilities: (currentSession?: Session | null) => Capability[];
|
|
25
19
|
export declare const getUserRoleCapabilities: (currentSession?: Session | null) => Capability[];
|
|
26
20
|
/**
|
|
27
|
-
* Builds
|
|
28
|
-
*
|
|
29
|
-
*
|
|
21
|
+
* Builds the ability of one caller: the session's roles, or the guest rules
|
|
22
|
+
* when there is no session. Every call returns a new instance and this package
|
|
23
|
+
* keeps none: a server judges many callers at once, so an instance shared
|
|
24
|
+
* between them is judged by whoever wrote it last. The backend builds one per
|
|
25
|
+
* request (`request.ability`), the Platform MCP one per tool call, and the
|
|
26
|
+
* frontend keeps its own for the single user of the tab.
|
|
30
27
|
*/
|
|
31
|
-
export declare const buildAbilityForSession: (currentSession?: Session | null) =>
|
|
32
|
-
export declare const updateAbilityFromSession: (currentSession?: Session | null) => void;
|
|
28
|
+
export declare const buildAbilityForSession: (currentSession?: Session | null) => AppAbility;
|
|
33
29
|
export type PermissionMap = Partial<Record<Action, Subject>>;
|
|
34
30
|
/**
|
|
35
31
|
* Evaluates a route-style permission map ({ action: Subject }) against an
|
|
@@ -39,7 +35,7 @@ export type PermissionMap = Partial<Record<Action, Subject>>;
|
|
|
39
35
|
* Single source of truth for both the HTTP preHandler and the Platform MCP
|
|
40
36
|
* tool handlers.
|
|
41
37
|
*/
|
|
42
|
-
export declare const findDeniedPermission: (abilityInstance: Pick<
|
|
38
|
+
export declare const findDeniedPermission: (abilityInstance: Pick<AppAbility, "can">, permissions: PermissionMap, payload?: unknown) => {
|
|
43
39
|
action: Action;
|
|
44
40
|
subject: Subject;
|
|
45
41
|
} | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The role `userId` holds in `organizationId` now, or `null` when they are
|
|
3
|
+
* not a member. A role is cached, an absence is not: a membership created
|
|
4
|
+
* after a refusal is seen on the next request, so the paths that add members
|
|
5
|
+
* have nothing to invalidate.
|
|
6
|
+
*/
|
|
7
|
+
export declare function currentMemberRole(userId: string, organizationId: string): Promise<string | null>;
|
|
8
|
+
type OrganizationSession = {
|
|
9
|
+
userId: string;
|
|
10
|
+
activeOrganizationId?: string | null;
|
|
11
|
+
organizationRole?: string | null;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The session as a request may trust it: its active organization only while
|
|
15
|
+
* the user is still a member of it, and the role they hold there now.
|
|
16
|
+
*
|
|
17
|
+
* The two fields are written when the organization is activated and nothing
|
|
18
|
+
* rewrites them when the membership changes. Every service reads the tenant
|
|
19
|
+
* from the first and every permission from the second, so a member removed
|
|
20
|
+
* from an organization kept reading and writing it for the life of their
|
|
21
|
+
* session (90 days, renewed daily), and a demoted admin kept the admin rules.
|
|
22
|
+
* A session whose organization was unset kept the role it had there, which
|
|
23
|
+
* still opened the audience gates.
|
|
24
|
+
*/
|
|
25
|
+
export declare function withCurrentMembership<T extends OrganizationSession>(session: T): Promise<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Brings the stored sessions of `userId` in line with their membership of
|
|
28
|
+
* `organizationId`, after a write to it: a new role replaces the old one, a
|
|
29
|
+
* membership that is gone takes the active organization with it. Call it
|
|
30
|
+
* after every role change and every removal. The request check does not
|
|
31
|
+
* depend on it, it reads the membership itself, but the client does: it
|
|
32
|
+
* reads its organization and role from the session. The role is read from
|
|
33
|
+
* the database, not the cache, which a request may still be refilling.
|
|
34
|
+
*/
|
|
35
|
+
export declare function syncSessionsWithMembership(userId: string, organizationId: string): Promise<void>;
|
|
36
|
+
export {};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Adds a user as member of an organization if not already present.
|
|
3
|
-
* Shared by external-auth and organization-auto-join flows.
|
|
3
|
+
* Shared by external-auth and organization-auto-join flows. Only auto-join
|
|
4
|
+
* passes `respectMemberLimit`: the widget's external login must never fail
|
|
5
|
+
* because the organization is full. An automatic join does not take a seat
|
|
6
|
+
* an open invitation holds either, and a skipped one is not retried at the
|
|
7
|
+
* next sign-in: the person joins through an invitation once a seat is free.
|
|
8
|
+
*
|
|
9
|
+
* The role has no default: it used to be `member`, and the external login,
|
|
10
|
+
* which did not pass one, made every visitor of the widget a member with the
|
|
11
|
+
* frontoffice of the organization, whatever its configuration said.
|
|
4
12
|
*/
|
|
5
|
-
export declare function addMemberToOrganizationIfNotExists(userId: string, organizationId: string, role
|
|
13
|
+
export declare function addMemberToOrganizationIfNotExists(userId: string, organizationId: string, role: string, { respectMemberLimit }?: {
|
|
14
|
+
respectMemberLimit?: boolean;
|
|
15
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** The columns the config adds to better-auth's session. */
|
|
2
|
+
export declare const sessionAdditionalFields: {
|
|
3
|
+
activeOrganizationId: {
|
|
4
|
+
type: "string";
|
|
5
|
+
};
|
|
6
|
+
impersonatedBy: {
|
|
7
|
+
type: "string";
|
|
8
|
+
};
|
|
9
|
+
organizationRole: {
|
|
10
|
+
type: "string";
|
|
11
|
+
};
|
|
12
|
+
hardExpiresAt: {
|
|
13
|
+
type: "date";
|
|
14
|
+
required: false;
|
|
15
|
+
input: false;
|
|
16
|
+
};
|
|
17
|
+
signedInWithPasskey: {
|
|
18
|
+
type: "boolean";
|
|
19
|
+
required: false;
|
|
20
|
+
input: false;
|
|
21
|
+
defaultValue: false;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/** The columns the config adds to better-auth's user. */
|
|
25
|
+
export declare const userAdditionalFields: {
|
|
26
|
+
media: {
|
|
27
|
+
type: "json";
|
|
28
|
+
required: false;
|
|
29
|
+
};
|
|
30
|
+
phoneNumber: {
|
|
31
|
+
type: "string";
|
|
32
|
+
required: false;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* What `inferAdditionalFields` reads of the server options, for a client that
|
|
37
|
+
* must not load the config itself. The widget's type declarations are built
|
|
38
|
+
* from its imports, and the inferred type of the config, with the two-step
|
|
39
|
+
* verification and passkey plugins, is too long to serialize (TS7056).
|
|
40
|
+
*/
|
|
41
|
+
export type AdditionalFieldsOptions = {
|
|
42
|
+
session: {
|
|
43
|
+
additionalFields: typeof sessionAdditionalFields;
|
|
44
|
+
};
|
|
45
|
+
user: {
|
|
46
|
+
additionalFields: typeof userAdditionalFields;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether an organization already holds as many members as the limit the
|
|
3
|
+
* system panel set on it. An organization with no limit is never full.
|
|
4
|
+
* With `countPendingInvitations` an open invitation holds a seat until it is
|
|
5
|
+
* accepted or expires, so a new one cannot be sent for a seat another
|
|
6
|
+
* invitation already promised. The count runs outside the write that
|
|
7
|
+
* follows, like better-auth's own check: two joins racing for the last seat
|
|
8
|
+
* can both pass.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isOrganizationFull(organizationId: string, { countPendingInvitations, }?: {
|
|
11
|
+
countPendingInvitations?: boolean;
|
|
12
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BetterFetch } from 'better-auth/client';
|
|
2
|
+
/**
|
|
3
|
+
* Client counterpart of the server `passkeyPolicy()` plugin, see
|
|
4
|
+
* docs/specs/released/two-factor-authentication.md, D10.
|
|
5
|
+
*/
|
|
6
|
+
export declare function passkeyPolicyClient(): {
|
|
7
|
+
id: "passkey-policy";
|
|
8
|
+
getActions: ($fetch: BetterFetch) => {
|
|
9
|
+
passkeyPolicy: {
|
|
10
|
+
/** Lets the session add a passkey for the next five minutes. */
|
|
11
|
+
confirmPassword: (data: {
|
|
12
|
+
password: string;
|
|
13
|
+
}) => Promise<{
|
|
14
|
+
data: null;
|
|
15
|
+
error: {
|
|
16
|
+
message?: string | undefined;
|
|
17
|
+
status: number;
|
|
18
|
+
statusText: string;
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
data: {
|
|
22
|
+
status: boolean;
|
|
23
|
+
};
|
|
24
|
+
error: null;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
pathMethods: {
|
|
29
|
+
'/passkey-policy/confirm-password': "POST";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BetterAuthPlugin } from 'better-auth';
|
|
2
|
+
/** Whether a session created on this route is opened with a passkey. */
|
|
3
|
+
export declare function isPasskeySessionPath(path: string | undefined): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Refuses a passkey that did not check who holds it (a PIN, a fingerprint, a
|
|
6
|
+
* face). With that check a passkey is two factors on its own, which is what
|
|
7
|
+
* lets it stand in for the password and the code; without it, it is a key
|
|
8
|
+
* anyone holding the device can use. better-auth leaves the check off.
|
|
9
|
+
*/
|
|
10
|
+
export declare function requirePasskeyUserVerification(userVerified: boolean | undefined): void;
|
|
11
|
+
/**
|
|
12
|
+
* The confirmation that guards adding a passkey, the announcements of D7 for
|
|
13
|
+
* passkeys and the rate limit of the confirmation.
|
|
14
|
+
*
|
|
15
|
+
* A passkey signs in without the password and without the code, so adding
|
|
16
|
+
* one is as strong as setting the password: the session alone is not enough,
|
|
17
|
+
* since a stolen one would leave a way in that outlives it (there is no
|
|
18
|
+
* freshness window, see `freshAge` in packages/auth/src/index.ts). The
|
|
19
|
+
* password is asked again, or, for an account without one, a sign-in in the
|
|
20
|
+
* last ten minutes.
|
|
21
|
+
*/
|
|
22
|
+
export declare function passkeyPolicy(): BetterAuthPlugin;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { SignInSecurityState } from '../../models/src';
|
|
2
|
+
import { BetterFetch } from 'better-auth/client';
|
|
3
|
+
/**
|
|
4
|
+
* What `GET /two-factor-policy/user-security` answers to a system
|
|
5
|
+
* administrator, see docs/specs/released/two-factor-system-assistance.md (D3). Dates
|
|
6
|
+
* arrive as ISO strings.
|
|
7
|
+
*/
|
|
8
|
+
export interface UserSignInSecurity {
|
|
9
|
+
state: SignInSecurityState;
|
|
10
|
+
factor: {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
method: 'totp' | 'otp' | null;
|
|
13
|
+
backupCodesRemaining: number | null;
|
|
14
|
+
/** Wrong codes in a row since the last right one. */
|
|
15
|
+
failedAttempts: number;
|
|
16
|
+
/** Set only while the pause after too many wrong codes lasts. */
|
|
17
|
+
lockedUntil: string | null;
|
|
18
|
+
};
|
|
19
|
+
passkeys: {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string | null;
|
|
22
|
+
/** `multiDevice` when synced across the user's devices. */
|
|
23
|
+
deviceType: string;
|
|
24
|
+
backedUp: boolean;
|
|
25
|
+
createdAt: string | null;
|
|
26
|
+
}[];
|
|
27
|
+
trustedDevices: {
|
|
28
|
+
count: number;
|
|
29
|
+
lastExpiresAt: string | null;
|
|
30
|
+
};
|
|
31
|
+
hasPassword: boolean;
|
|
32
|
+
requiredBy: {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
}[];
|
|
36
|
+
/** The latest changes, from the notices the user received. */
|
|
37
|
+
changes: {
|
|
38
|
+
action: string;
|
|
39
|
+
createdAt: string;
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
/** What `GET /two-factor-policy/status` answers. */
|
|
43
|
+
export interface TwoFactorStatus {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
/** `totp` for an authenticator app, `otp` for the code sent by email. */
|
|
46
|
+
method: 'totp' | 'otp' | null;
|
|
47
|
+
/** The second factor protects a password: without one it is not offered. */
|
|
48
|
+
hasPassword: boolean;
|
|
49
|
+
/** An organization of the user requires it and it is not set up yet. */
|
|
50
|
+
required: boolean;
|
|
51
|
+
/** The user's organizations that require it. */
|
|
52
|
+
requiredBy: {
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
}[];
|
|
56
|
+
/** Backup codes left, with an authenticator app; null otherwise. */
|
|
57
|
+
backupCodesRemaining: number | null;
|
|
58
|
+
/** Passkeys of the user: a session opened with one meets the policy. */
|
|
59
|
+
passkeys: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Client counterpart of the server `twoFactorPolicy()` and `twoFactorAdmin()`
|
|
63
|
+
* plugins, see docs/specs/released/two-factor-authentication.md and
|
|
64
|
+
* docs/specs/released/two-factor-system-assistance.md.
|
|
65
|
+
*/
|
|
66
|
+
export declare function twoFactorPolicyClient(): {
|
|
67
|
+
id: "two-factor-policy";
|
|
68
|
+
getActions: ($fetch: BetterFetch) => {
|
|
69
|
+
twoFactorPolicy: {
|
|
70
|
+
status: () => Promise<{
|
|
71
|
+
data: null;
|
|
72
|
+
error: {
|
|
73
|
+
message?: string | undefined;
|
|
74
|
+
status: number;
|
|
75
|
+
statusText: string;
|
|
76
|
+
};
|
|
77
|
+
} | {
|
|
78
|
+
data: TwoFactorStatus;
|
|
79
|
+
error: null;
|
|
80
|
+
}>;
|
|
81
|
+
reset: (data: {
|
|
82
|
+
userId: string;
|
|
83
|
+
}) => Promise<{
|
|
84
|
+
data: null;
|
|
85
|
+
error: {
|
|
86
|
+
message?: string | undefined;
|
|
87
|
+
status: number;
|
|
88
|
+
statusText: string;
|
|
89
|
+
};
|
|
90
|
+
} | {
|
|
91
|
+
data: {
|
|
92
|
+
status: boolean;
|
|
93
|
+
};
|
|
94
|
+
error: null;
|
|
95
|
+
}>;
|
|
96
|
+
userSecurity: (query: {
|
|
97
|
+
userId: string;
|
|
98
|
+
}) => Promise<{
|
|
99
|
+
data: null;
|
|
100
|
+
error: {
|
|
101
|
+
message?: string | undefined;
|
|
102
|
+
status: number;
|
|
103
|
+
statusText: string;
|
|
104
|
+
};
|
|
105
|
+
} | {
|
|
106
|
+
data: UserSignInSecurity;
|
|
107
|
+
error: null;
|
|
108
|
+
}>;
|
|
109
|
+
unlock: (data: {
|
|
110
|
+
userId: string;
|
|
111
|
+
}) => Promise<{
|
|
112
|
+
data: null;
|
|
113
|
+
error: {
|
|
114
|
+
message?: string | undefined;
|
|
115
|
+
status: number;
|
|
116
|
+
statusText: string;
|
|
117
|
+
};
|
|
118
|
+
} | {
|
|
119
|
+
data: {
|
|
120
|
+
status: boolean;
|
|
121
|
+
};
|
|
122
|
+
error: null;
|
|
123
|
+
}>;
|
|
124
|
+
removePasskey: (data: {
|
|
125
|
+
userId: string;
|
|
126
|
+
passkeyId: string;
|
|
127
|
+
}) => Promise<{
|
|
128
|
+
data: null;
|
|
129
|
+
error: {
|
|
130
|
+
message?: string | undefined;
|
|
131
|
+
status: number;
|
|
132
|
+
statusText: string;
|
|
133
|
+
};
|
|
134
|
+
} | {
|
|
135
|
+
data: {
|
|
136
|
+
status: boolean;
|
|
137
|
+
};
|
|
138
|
+
error: null;
|
|
139
|
+
}>;
|
|
140
|
+
forgetTrustedDevices: (data: {
|
|
141
|
+
userId: string;
|
|
142
|
+
}) => Promise<{
|
|
143
|
+
data: null;
|
|
144
|
+
error: {
|
|
145
|
+
message?: string | undefined;
|
|
146
|
+
status: number;
|
|
147
|
+
statusText: string;
|
|
148
|
+
};
|
|
149
|
+
} | {
|
|
150
|
+
data: {
|
|
151
|
+
status: boolean;
|
|
152
|
+
};
|
|
153
|
+
error: null;
|
|
154
|
+
}>;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
pathMethods: {
|
|
158
|
+
'/two-factor-policy/reset': "POST";
|
|
159
|
+
'/two-factor-policy/unlock': "POST";
|
|
160
|
+
'/two-factor-policy/remove-passkey': "POST";
|
|
161
|
+
'/two-factor-policy/forget-trusted-devices': "POST";
|
|
162
|
+
};
|
|
163
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { BetterAuthPlugin } from 'better-auth';
|
|
2
|
+
import { createAuthMiddleware } from 'better-auth/api';
|
|
3
|
+
import { symmetricDecrypt } from 'better-auth/crypto';
|
|
4
|
+
import { TwoFactorChange } from 'email';
|
|
5
|
+
/**
|
|
6
|
+
* Carries the challenge for a client that cannot hold the cookie: the widget,
|
|
7
|
+
* cross-origin and on bearer tokens (D4). The value is the signed cookie as
|
|
8
|
+
* the sign-in set it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const TWO_FACTOR_TOKEN_HEADER = "x-two-factor-token";
|
|
11
|
+
/** Time the code sent by email stays valid, in minutes. */
|
|
12
|
+
export declare const TWO_FACTOR_OTP_PERIOD_MINUTES = 5;
|
|
13
|
+
export type TwoFactorRow = {
|
|
14
|
+
id: string;
|
|
15
|
+
userId: string;
|
|
16
|
+
backupCodes: string;
|
|
17
|
+
verified?: boolean | null;
|
|
18
|
+
failedVerificationCount?: number | null;
|
|
19
|
+
lockedUntil?: Date | string | null;
|
|
20
|
+
};
|
|
21
|
+
type ChangedUser = {
|
|
22
|
+
id: string;
|
|
23
|
+
email: string;
|
|
24
|
+
name: string;
|
|
25
|
+
};
|
|
26
|
+
export type MiddlewareContext = Parameters<Parameters<typeof createAuthMiddleware>[0]>[0];
|
|
27
|
+
/**
|
|
28
|
+
* Tells the user that their second factor or their passkeys changed (D7, D10),
|
|
29
|
+
* by email and in the notification panel. Never throws: the change is already
|
|
30
|
+
* written.
|
|
31
|
+
*/
|
|
32
|
+
export declare function announceTwoFactorChange(user: ChangedUser, change: TwoFactorChange): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* The verification rows that remember a device on which the user chose to
|
|
35
|
+
* skip the code: the `twoFactor` plugin names them `trust-device-<id>` and
|
|
36
|
+
* stores the user id as their value.
|
|
37
|
+
*/
|
|
38
|
+
export declare function trustedDeviceWhere(userId: string): ({
|
|
39
|
+
field: string;
|
|
40
|
+
value: string;
|
|
41
|
+
operator?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
field: string;
|
|
44
|
+
operator: "starts_with";
|
|
45
|
+
value: string;
|
|
46
|
+
})[];
|
|
47
|
+
/**
|
|
48
|
+
* Forgets every device on which the user chose to skip the code. They are
|
|
49
|
+
* verification rows holding the user id: left in place, one would skip the
|
|
50
|
+
* code once the factor is on again, on a device that may be the lost one.
|
|
51
|
+
* The plugin itself forgets only the device the factor is turned off from.
|
|
52
|
+
*/
|
|
53
|
+
export declare function forgetTrustedDevices(adapter: MiddlewareContext['context']['adapter'], userId: string): Promise<number>;
|
|
54
|
+
/**
|
|
55
|
+
* How many recovery codes the user has left, or null when it cannot be told.
|
|
56
|
+
* better-auth keeps them encrypted with its secret, so only the count leaves
|
|
57
|
+
* this function, never a code.
|
|
58
|
+
*/
|
|
59
|
+
export declare function countBackupCodes(ctx: {
|
|
60
|
+
context: {
|
|
61
|
+
secretConfig: Parameters<typeof symmetricDecrypt>[0]['key'];
|
|
62
|
+
};
|
|
63
|
+
}, row: Pick<TwoFactorRow, 'backupCodes'>): Promise<number | null>;
|
|
64
|
+
type PolicyOrganization = {
|
|
65
|
+
requireTwoFactor?: boolean | null;
|
|
66
|
+
deleted?: boolean | null;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Whether the request has to stop for the organization policy (D6): the
|
|
70
|
+
* session of a member of an organization that requires a second factor, who
|
|
71
|
+
* signs in with a password and has none. `organizations` is what the caller
|
|
72
|
+
* already listed for the request, so the common case costs no query, or a
|
|
73
|
+
* loader that runs only once the cheap exemptions are past; the password
|
|
74
|
+
* check is cached, since most users have no second factor. Impersonation and
|
|
75
|
+
* anonymous sessions are exempt, and so is a deleted organization, which the
|
|
76
|
+
* status endpoint does not list either: counted here alone, it would bounce
|
|
77
|
+
* the user between the setup page and the app.
|
|
78
|
+
*
|
|
79
|
+
* A session opened with a passkey meets the policy (D10), and so does a user
|
|
80
|
+
* with a passkey where no session tells how they signed in: a Platform MCP
|
|
81
|
+
* token, whose authorization ran in a session the policy let through.
|
|
82
|
+
*/
|
|
83
|
+
export declare function isTwoFactorSetupRequiredForSession(input: {
|
|
84
|
+
user: {
|
|
85
|
+
id: string;
|
|
86
|
+
twoFactorEnabled?: boolean | null;
|
|
87
|
+
isAnonymous?: boolean | null;
|
|
88
|
+
hasPasskey?: boolean;
|
|
89
|
+
};
|
|
90
|
+
session: {
|
|
91
|
+
impersonatedBy?: string | null;
|
|
92
|
+
signedInWithPasskey?: boolean | null;
|
|
93
|
+
};
|
|
94
|
+
organizations: readonly PolicyOrganization[] | (() => Promise<readonly PolicyOrganization[]>);
|
|
95
|
+
}): Promise<boolean>;
|
|
96
|
+
/**
|
|
97
|
+
* The status endpoint, the widget bridge and the announcements of
|
|
98
|
+
* docs/specs/released/two-factor-authentication.md. The administrator's endpoints are
|
|
99
|
+
* in two-factor-admin-plugin.ts.
|
|
100
|
+
*
|
|
101
|
+
* The endpoints live under `/two-factor-policy/` and not `/two-factor/` on
|
|
102
|
+
* purpose: the `twoFactor` plugin rate limits its prefix to three requests
|
|
103
|
+
* every ten seconds, which a profile page reading the status would hit.
|
|
104
|
+
*/
|
|
105
|
+
export declare function twoFactorPolicy(): BetterAuthPlugin;
|
|
106
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* A QR code drawn as inline SVG, with `qrcode` loaded on first use. The
|
|
4
|
+
* code stays dark on a white ground whatever the theme: a scanner reads
|
|
5
|
+
* the contrast, and not every one reads it inverted.
|
|
6
|
+
*/
|
|
7
|
+
type __VLS_Props = {
|
|
8
|
+
value: string;
|
|
9
|
+
/** What the code holds, for a screen reader. */
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -4,6 +4,12 @@ type __VLS_Props = {
|
|
|
4
4
|
branding?: AgentBranding;
|
|
5
5
|
authMethods?: AuthMethods;
|
|
6
6
|
loading?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Set while an email sign-in waits for its second factor: the
|
|
9
|
+
* methods the account has (`totp`, `otp`). The code step replaces
|
|
10
|
+
* the forms until it is answered or cancelled.
|
|
11
|
+
*/
|
|
12
|
+
twoFactorMethods?: string[];
|
|
7
13
|
};
|
|
8
14
|
type __VLS_ModelProps = {
|
|
9
15
|
'errorMessage'?: string | undefined;
|
|
@@ -43,6 +49,12 @@ declare const __VLS_export: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, C
|
|
|
43
49
|
email: string;
|
|
44
50
|
}) => any;
|
|
45
51
|
social: (provider: "google" | "microsoft") => any;
|
|
52
|
+
"verify-two-factor": (payload: {
|
|
53
|
+
kind: "totp" | "otp" | "backup";
|
|
54
|
+
code: string;
|
|
55
|
+
}) => any;
|
|
56
|
+
"send-two-factor-code": () => any;
|
|
57
|
+
"cancel-two-factor": () => any;
|
|
46
58
|
}, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
47
59
|
"onUpdate:errorMessage"?: ((message?: string | undefined) => any) | undefined;
|
|
48
60
|
"onUpdate:success"?: ((value?: {
|
|
@@ -63,10 +75,17 @@ declare const __VLS_export: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, C
|
|
|
63
75
|
email: string;
|
|
64
76
|
}) => any) | undefined;
|
|
65
77
|
onSocial?: ((provider: "google" | "microsoft") => any) | undefined;
|
|
78
|
+
"onVerify-two-factor"?: ((payload: {
|
|
79
|
+
kind: "totp" | "otp" | "backup";
|
|
80
|
+
code: string;
|
|
81
|
+
}) => any) | undefined;
|
|
82
|
+
"onSend-two-factor-code"?: (() => any) | undefined;
|
|
83
|
+
"onCancel-two-factor"?: (() => any) | undefined;
|
|
66
84
|
}>, {
|
|
67
85
|
branding: AgentBranding;
|
|
68
86
|
authMethods: AuthMethods;
|
|
69
87
|
loading: boolean;
|
|
88
|
+
twoFactorMethods: string[];
|
|
70
89
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
71
90
|
declare const _default: typeof __VLS_export;
|
|
72
91
|
export default _default;
|