@syncello/auth 2.5.1 → 3.1.0

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/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { PgTableWithColumns, PgTable } from 'drizzle-orm/pg-core';
3
3
  import * as hono from 'hono';
4
4
  import { Context } from 'hono';
5
5
  import { InferInsertModel, InferSelectModel } from 'drizzle-orm';
6
+ import * as hono_types from 'hono/types';
6
7
  import { OpenAPIHono } from '@hono/zod-openapi';
7
8
  import * as hono_utils_types from 'hono/utils/types';
8
9
  import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
@@ -850,10 +851,1354 @@ declare const requireVerifiedEmail: hono.MiddlewareHandler<{
850
851
  Variables: Variables;
851
852
  }, string, {}, Response>;
852
853
 
853
- declare const auth: OpenAPIHono<{
854
+ declare const authRoutes: OpenAPIHono<{
854
855
  Bindings: Env;
855
856
  Variables: Variables;
856
- }, {}, "/">;
857
+ }, hono_types.MergeSchemaPath<{
858
+ "/:provider/authorize": {
859
+ $get: {
860
+ input: {
861
+ param: {
862
+ provider: "google" | "microsoft";
863
+ };
864
+ } & {
865
+ query: {
866
+ redirect?: string | undefined;
867
+ invitationToken?: string | undefined;
868
+ code_challenge?: string | undefined;
869
+ code_challenge_method?: "S256" | undefined;
870
+ redirect_uri?: string | undefined;
871
+ };
872
+ };
873
+ output: {};
874
+ outputFormat: string;
875
+ status: 302;
876
+ };
877
+ };
878
+ } & {
879
+ "/:provider/callback": {
880
+ $get: {
881
+ input: {
882
+ param: {
883
+ provider: "google" | "microsoft";
884
+ };
885
+ } & {
886
+ query: {
887
+ code?: string | undefined;
888
+ state?: string | undefined;
889
+ error?: string | undefined;
890
+ };
891
+ };
892
+ output: {};
893
+ outputFormat: string;
894
+ status: 302;
895
+ };
896
+ };
897
+ } & {
898
+ "/complete": {
899
+ $post: {
900
+ input: {
901
+ json: {
902
+ code: string;
903
+ };
904
+ };
905
+ output: {
906
+ type: string;
907
+ title: string;
908
+ status: number;
909
+ detail?: string | undefined;
910
+ };
911
+ outputFormat: "json";
912
+ status: 401;
913
+ } | {
914
+ input: {
915
+ json: {
916
+ code: string;
917
+ };
918
+ };
919
+ output: {
920
+ message: string;
921
+ redirect: string;
922
+ user: {
923
+ id: string;
924
+ email: string;
925
+ emailVerified: boolean;
926
+ };
927
+ };
928
+ outputFormat: "json";
929
+ status: 200;
930
+ };
931
+ };
932
+ }, "/oauth"> & hono_types.MergeSchemaPath<{
933
+ "/status": {
934
+ $get: {
935
+ input: {};
936
+ output: {
937
+ type: string;
938
+ title: string;
939
+ status: number;
940
+ detail?: string | undefined;
941
+ instance?: string | undefined;
942
+ traceId?: string | undefined;
943
+ requestId?: string | undefined;
944
+ };
945
+ outputFormat: "json";
946
+ status: 401;
947
+ } | {
948
+ input: {};
949
+ output: {
950
+ enabled: boolean;
951
+ methods: ("email" | "totp")[];
952
+ backupCodesRemaining: number;
953
+ };
954
+ outputFormat: "json";
955
+ status: 200;
956
+ };
957
+ };
958
+ } & {
959
+ "/totp/setup": {
960
+ $post: {
961
+ input: {};
962
+ output: {
963
+ type: string;
964
+ title: string;
965
+ status: number;
966
+ detail?: string | undefined;
967
+ instance?: string | undefined;
968
+ traceId?: string | undefined;
969
+ requestId?: string | undefined;
970
+ };
971
+ outputFormat: "json";
972
+ status: 401;
973
+ } | {
974
+ input: {};
975
+ output: {
976
+ type: string;
977
+ title: string;
978
+ status: number;
979
+ detail?: string | undefined;
980
+ instance?: string | undefined;
981
+ traceId?: string | undefined;
982
+ requestId?: string | undefined;
983
+ };
984
+ outputFormat: "json";
985
+ status: 400;
986
+ } | {
987
+ input: {};
988
+ output: {
989
+ type: string;
990
+ title: string;
991
+ status: number;
992
+ detail?: string | undefined;
993
+ instance?: string | undefined;
994
+ traceId?: string | undefined;
995
+ requestId?: string | undefined;
996
+ };
997
+ outputFormat: "json";
998
+ status: 404;
999
+ } | {
1000
+ input: {};
1001
+ output: {
1002
+ secret: string;
1003
+ qrCodeUri: string;
1004
+ };
1005
+ outputFormat: "json";
1006
+ status: 200;
1007
+ };
1008
+ };
1009
+ } & {
1010
+ "/totp/verify": {
1011
+ $post: {
1012
+ input: {
1013
+ json: {
1014
+ code: string;
1015
+ };
1016
+ };
1017
+ output: {
1018
+ type: string;
1019
+ title: string;
1020
+ status: number;
1021
+ detail?: string | undefined;
1022
+ instance?: string | undefined;
1023
+ traceId?: string | undefined;
1024
+ requestId?: string | undefined;
1025
+ };
1026
+ outputFormat: "json";
1027
+ status: 401;
1028
+ } | {
1029
+ input: {
1030
+ json: {
1031
+ code: string;
1032
+ };
1033
+ };
1034
+ output: {
1035
+ type: string;
1036
+ title: string;
1037
+ status: number;
1038
+ detail?: string | undefined;
1039
+ instance?: string | undefined;
1040
+ traceId?: string | undefined;
1041
+ requestId?: string | undefined;
1042
+ };
1043
+ outputFormat: "json";
1044
+ status: 400;
1045
+ } | {
1046
+ input: {
1047
+ json: {
1048
+ code: string;
1049
+ };
1050
+ };
1051
+ output: {
1052
+ type: string;
1053
+ title: string;
1054
+ status: number;
1055
+ detail?: string | undefined;
1056
+ instance?: string | undefined;
1057
+ traceId?: string | undefined;
1058
+ requestId?: string | undefined;
1059
+ };
1060
+ outputFormat: "json";
1061
+ status: 500;
1062
+ } | {
1063
+ input: {
1064
+ json: {
1065
+ code: string;
1066
+ };
1067
+ };
1068
+ output: {
1069
+ success: boolean;
1070
+ backupCodes?: string[] | undefined;
1071
+ };
1072
+ outputFormat: "json";
1073
+ status: 200;
1074
+ };
1075
+ };
1076
+ } & {
1077
+ "/totp/disable": {
1078
+ $post: {
1079
+ input: {
1080
+ json: {
1081
+ code: string;
1082
+ method: "email" | "totp" | "backup";
1083
+ };
1084
+ };
1085
+ output: {
1086
+ type: string;
1087
+ title: string;
1088
+ status: number;
1089
+ detail?: string | undefined;
1090
+ instance?: string | undefined;
1091
+ traceId?: string | undefined;
1092
+ requestId?: string | undefined;
1093
+ };
1094
+ outputFormat: "json";
1095
+ status: 401;
1096
+ } | {
1097
+ input: {
1098
+ json: {
1099
+ code: string;
1100
+ method: "email" | "totp" | "backup";
1101
+ };
1102
+ };
1103
+ output: {
1104
+ type: string;
1105
+ title: string;
1106
+ status: number;
1107
+ detail?: string | undefined;
1108
+ instance?: string | undefined;
1109
+ traceId?: string | undefined;
1110
+ requestId?: string | undefined;
1111
+ };
1112
+ outputFormat: "json";
1113
+ status: 400;
1114
+ } | {
1115
+ input: {
1116
+ json: {
1117
+ code: string;
1118
+ method: "email" | "totp" | "backup";
1119
+ };
1120
+ };
1121
+ output: {
1122
+ success: boolean;
1123
+ sessionInvalidated?: boolean | undefined;
1124
+ };
1125
+ outputFormat: "json";
1126
+ status: 200;
1127
+ };
1128
+ };
1129
+ } & {
1130
+ "/email/setup": {
1131
+ $post: {
1132
+ input: {};
1133
+ output: {
1134
+ type: string;
1135
+ title: string;
1136
+ status: number;
1137
+ detail?: string | undefined;
1138
+ instance?: string | undefined;
1139
+ traceId?: string | undefined;
1140
+ requestId?: string | undefined;
1141
+ };
1142
+ outputFormat: "json";
1143
+ status: 401;
1144
+ } | {
1145
+ input: {};
1146
+ output: {
1147
+ type: string;
1148
+ title: string;
1149
+ status: number;
1150
+ detail?: string | undefined;
1151
+ instance?: string | undefined;
1152
+ traceId?: string | undefined;
1153
+ requestId?: string | undefined;
1154
+ };
1155
+ outputFormat: "json";
1156
+ status: 400;
1157
+ } | {
1158
+ input: {};
1159
+ output: {
1160
+ type: string;
1161
+ title: string;
1162
+ status: number;
1163
+ detail?: string | undefined;
1164
+ instance?: string | undefined;
1165
+ traceId?: string | undefined;
1166
+ requestId?: string | undefined;
1167
+ };
1168
+ outputFormat: "json";
1169
+ status: 404;
1170
+ } | {
1171
+ input: {};
1172
+ output: {
1173
+ success: boolean;
1174
+ };
1175
+ outputFormat: "json";
1176
+ status: 200;
1177
+ };
1178
+ };
1179
+ } & {
1180
+ "/email/verify": {
1181
+ $post: {
1182
+ input: {
1183
+ json: {
1184
+ code: string;
1185
+ };
1186
+ };
1187
+ output: {
1188
+ type: string;
1189
+ title: string;
1190
+ status: number;
1191
+ detail?: string | undefined;
1192
+ instance?: string | undefined;
1193
+ traceId?: string | undefined;
1194
+ requestId?: string | undefined;
1195
+ };
1196
+ outputFormat: "json";
1197
+ status: 401;
1198
+ } | {
1199
+ input: {
1200
+ json: {
1201
+ code: string;
1202
+ };
1203
+ };
1204
+ output: {
1205
+ type: string;
1206
+ title: string;
1207
+ status: number;
1208
+ detail?: string | undefined;
1209
+ instance?: string | undefined;
1210
+ traceId?: string | undefined;
1211
+ requestId?: string | undefined;
1212
+ };
1213
+ outputFormat: "json";
1214
+ status: 400;
1215
+ } | {
1216
+ input: {
1217
+ json: {
1218
+ code: string;
1219
+ };
1220
+ };
1221
+ output: {
1222
+ success: boolean;
1223
+ backupCodes?: string[] | undefined;
1224
+ };
1225
+ outputFormat: "json";
1226
+ status: 200;
1227
+ };
1228
+ };
1229
+ } & {
1230
+ "/email/send-code": {
1231
+ $post: {
1232
+ input: {};
1233
+ output: {
1234
+ type: string;
1235
+ title: string;
1236
+ status: number;
1237
+ detail?: string | undefined;
1238
+ instance?: string | undefined;
1239
+ traceId?: string | undefined;
1240
+ requestId?: string | undefined;
1241
+ };
1242
+ outputFormat: "json";
1243
+ status: 401;
1244
+ } | {
1245
+ input: {};
1246
+ output: {
1247
+ type: string;
1248
+ title: string;
1249
+ status: number;
1250
+ detail?: string | undefined;
1251
+ instance?: string | undefined;
1252
+ traceId?: string | undefined;
1253
+ requestId?: string | undefined;
1254
+ };
1255
+ outputFormat: "json";
1256
+ status: 400;
1257
+ } | {
1258
+ input: {};
1259
+ output: {
1260
+ type: string;
1261
+ title: string;
1262
+ status: number;
1263
+ detail?: string | undefined;
1264
+ instance?: string | undefined;
1265
+ traceId?: string | undefined;
1266
+ requestId?: string | undefined;
1267
+ };
1268
+ outputFormat: "json";
1269
+ status: 404;
1270
+ } | {
1271
+ input: {};
1272
+ output: {
1273
+ success: boolean;
1274
+ };
1275
+ outputFormat: "json";
1276
+ status: 200;
1277
+ };
1278
+ };
1279
+ } & {
1280
+ "/email/disable": {
1281
+ $post: {
1282
+ input: {
1283
+ json: {
1284
+ code: string;
1285
+ method: "email" | "totp" | "backup";
1286
+ };
1287
+ };
1288
+ output: {
1289
+ type: string;
1290
+ title: string;
1291
+ status: number;
1292
+ detail?: string | undefined;
1293
+ instance?: string | undefined;
1294
+ traceId?: string | undefined;
1295
+ requestId?: string | undefined;
1296
+ };
1297
+ outputFormat: "json";
1298
+ status: 401;
1299
+ } | {
1300
+ input: {
1301
+ json: {
1302
+ code: string;
1303
+ method: "email" | "totp" | "backup";
1304
+ };
1305
+ };
1306
+ output: {
1307
+ type: string;
1308
+ title: string;
1309
+ status: number;
1310
+ detail?: string | undefined;
1311
+ instance?: string | undefined;
1312
+ traceId?: string | undefined;
1313
+ requestId?: string | undefined;
1314
+ };
1315
+ outputFormat: "json";
1316
+ status: 400;
1317
+ } | {
1318
+ input: {
1319
+ json: {
1320
+ code: string;
1321
+ method: "email" | "totp" | "backup";
1322
+ };
1323
+ };
1324
+ output: {
1325
+ success: boolean;
1326
+ sessionInvalidated?: boolean | undefined;
1327
+ };
1328
+ outputFormat: "json";
1329
+ status: 200;
1330
+ };
1331
+ };
1332
+ } & {
1333
+ "/trusted-devices": {
1334
+ $get: {
1335
+ input: {};
1336
+ output: {
1337
+ type: string;
1338
+ title: string;
1339
+ status: number;
1340
+ detail?: string | undefined;
1341
+ instance?: string | undefined;
1342
+ traceId?: string | undefined;
1343
+ requestId?: string | undefined;
1344
+ };
1345
+ outputFormat: "json";
1346
+ status: 401;
1347
+ } | {
1348
+ input: {};
1349
+ output: {
1350
+ devices: {
1351
+ id: string;
1352
+ deviceName: string;
1353
+ deviceType: "desktop" | "mobile" | "tablet";
1354
+ ipAddress: string;
1355
+ lastUsedAt: number;
1356
+ createdAt: number;
1357
+ }[];
1358
+ };
1359
+ outputFormat: "json";
1360
+ status: 200;
1361
+ };
1362
+ };
1363
+ } & {
1364
+ "/trusted-devices/:id": {
1365
+ $delete: {
1366
+ input: {
1367
+ param: {
1368
+ id: string;
1369
+ };
1370
+ };
1371
+ output: {
1372
+ type: string;
1373
+ title: string;
1374
+ status: number;
1375
+ detail?: string | undefined;
1376
+ instance?: string | undefined;
1377
+ traceId?: string | undefined;
1378
+ requestId?: string | undefined;
1379
+ };
1380
+ outputFormat: "json";
1381
+ status: 401;
1382
+ } | {
1383
+ input: {
1384
+ param: {
1385
+ id: string;
1386
+ };
1387
+ };
1388
+ output: {
1389
+ type: string;
1390
+ title: string;
1391
+ status: number;
1392
+ detail?: string | undefined;
1393
+ instance?: string | undefined;
1394
+ traceId?: string | undefined;
1395
+ requestId?: string | undefined;
1396
+ };
1397
+ outputFormat: "json";
1398
+ status: 404;
1399
+ } | {
1400
+ input: {
1401
+ param: {
1402
+ id: string;
1403
+ };
1404
+ };
1405
+ output: {
1406
+ success: boolean;
1407
+ };
1408
+ outputFormat: "json";
1409
+ status: 200;
1410
+ };
1411
+ };
1412
+ } & {
1413
+ "/backup-codes/regenerate": {
1414
+ $post: {
1415
+ input: {
1416
+ json: {
1417
+ code: string;
1418
+ method: "email" | "totp" | "backup";
1419
+ };
1420
+ };
1421
+ output: {
1422
+ type: string;
1423
+ title: string;
1424
+ status: number;
1425
+ detail?: string | undefined;
1426
+ instance?: string | undefined;
1427
+ traceId?: string | undefined;
1428
+ requestId?: string | undefined;
1429
+ };
1430
+ outputFormat: "json";
1431
+ status: 401;
1432
+ } | {
1433
+ input: {
1434
+ json: {
1435
+ code: string;
1436
+ method: "email" | "totp" | "backup";
1437
+ };
1438
+ };
1439
+ output: {
1440
+ type: string;
1441
+ title: string;
1442
+ status: number;
1443
+ detail?: string | undefined;
1444
+ instance?: string | undefined;
1445
+ traceId?: string | undefined;
1446
+ requestId?: string | undefined;
1447
+ };
1448
+ outputFormat: "json";
1449
+ status: 400;
1450
+ } | {
1451
+ input: {
1452
+ json: {
1453
+ code: string;
1454
+ method: "email" | "totp" | "backup";
1455
+ };
1456
+ };
1457
+ output: {
1458
+ success: boolean;
1459
+ backupCodes: string[];
1460
+ };
1461
+ outputFormat: "json";
1462
+ status: 200;
1463
+ };
1464
+ };
1465
+ } & {
1466
+ "/challenge": {
1467
+ $post: {
1468
+ input: {
1469
+ json: {
1470
+ code: string;
1471
+ method: "email" | "totp" | "backup";
1472
+ rememberDevice?: boolean | undefined;
1473
+ };
1474
+ };
1475
+ output: {
1476
+ type: string;
1477
+ title: string;
1478
+ status: number;
1479
+ detail?: string | undefined;
1480
+ instance?: string | undefined;
1481
+ traceId?: string | undefined;
1482
+ requestId?: string | undefined;
1483
+ };
1484
+ outputFormat: "json";
1485
+ status: 400;
1486
+ } | {
1487
+ input: {
1488
+ json: {
1489
+ code: string;
1490
+ method: "email" | "totp" | "backup";
1491
+ rememberDevice?: boolean | undefined;
1492
+ };
1493
+ };
1494
+ output: {
1495
+ type: string;
1496
+ title: string;
1497
+ status: number;
1498
+ detail?: string | undefined;
1499
+ instance?: string | undefined;
1500
+ traceId?: string | undefined;
1501
+ requestId?: string | undefined;
1502
+ };
1503
+ outputFormat: "json";
1504
+ status: 404;
1505
+ } | {
1506
+ input: {
1507
+ json: {
1508
+ code: string;
1509
+ method: "email" | "totp" | "backup";
1510
+ rememberDevice?: boolean | undefined;
1511
+ };
1512
+ };
1513
+ output: {
1514
+ user: {
1515
+ id: string;
1516
+ email: string;
1517
+ name: string | null;
1518
+ };
1519
+ };
1520
+ outputFormat: "json";
1521
+ status: 200;
1522
+ };
1523
+ };
1524
+ } & {
1525
+ "/challenge/resend": {
1526
+ $post: {
1527
+ input: {};
1528
+ output: {
1529
+ type: string;
1530
+ title: string;
1531
+ status: number;
1532
+ detail?: string | undefined;
1533
+ instance?: string | undefined;
1534
+ traceId?: string | undefined;
1535
+ requestId?: string | undefined;
1536
+ };
1537
+ outputFormat: "json";
1538
+ status: 400;
1539
+ } | {
1540
+ input: {};
1541
+ output: {
1542
+ type: string;
1543
+ title: string;
1544
+ status: number;
1545
+ detail?: string | undefined;
1546
+ instance?: string | undefined;
1547
+ traceId?: string | undefined;
1548
+ requestId?: string | undefined;
1549
+ };
1550
+ outputFormat: "json";
1551
+ status: 404;
1552
+ } | {
1553
+ input: {};
1554
+ output: {
1555
+ success: boolean;
1556
+ };
1557
+ outputFormat: "json";
1558
+ status: 200;
1559
+ };
1560
+ };
1561
+ }, "/2fa"> & {
1562
+ "/signup": {
1563
+ $post: {
1564
+ input: {
1565
+ json: {
1566
+ email: string;
1567
+ password?: string | undefined;
1568
+ name?: string | undefined;
1569
+ turnstileToken?: string | undefined;
1570
+ oauthToken?: string | undefined;
1571
+ };
1572
+ };
1573
+ output: {
1574
+ type: string;
1575
+ title: string;
1576
+ status: number;
1577
+ detail?: string | undefined;
1578
+ instance?: string | undefined;
1579
+ traceId?: string | undefined;
1580
+ requestId?: string | undefined;
1581
+ };
1582
+ outputFormat: "json";
1583
+ status: 400;
1584
+ } | {
1585
+ input: {
1586
+ json: {
1587
+ email: string;
1588
+ password?: string | undefined;
1589
+ name?: string | undefined;
1590
+ turnstileToken?: string | undefined;
1591
+ oauthToken?: string | undefined;
1592
+ };
1593
+ };
1594
+ output: {
1595
+ type: string;
1596
+ title: string;
1597
+ status: number;
1598
+ detail?: string | undefined;
1599
+ instance?: string | undefined;
1600
+ traceId?: string | undefined;
1601
+ requestId?: string | undefined;
1602
+ };
1603
+ outputFormat: "json";
1604
+ status: 409;
1605
+ } | {
1606
+ input: {
1607
+ json: {
1608
+ email: string;
1609
+ password?: string | undefined;
1610
+ name?: string | undefined;
1611
+ turnstileToken?: string | undefined;
1612
+ oauthToken?: string | undefined;
1613
+ };
1614
+ };
1615
+ output: {
1616
+ user: {
1617
+ id: string;
1618
+ email: string;
1619
+ name: string | null;
1620
+ emailVerified: boolean;
1621
+ avatarUrl?: string | null | undefined;
1622
+ theme?: "light" | "dark" | "system" | null | undefined;
1623
+ timezone?: string | null | undefined;
1624
+ createdAt?: string | undefined;
1625
+ };
1626
+ redirect: string;
1627
+ };
1628
+ outputFormat: "json";
1629
+ status: 200;
1630
+ };
1631
+ };
1632
+ } & {
1633
+ "/login": {
1634
+ $post: {
1635
+ input: {
1636
+ json: {
1637
+ email: string;
1638
+ password: string;
1639
+ turnstileToken?: string | undefined;
1640
+ };
1641
+ };
1642
+ output: {
1643
+ type: string;
1644
+ title: string;
1645
+ status: number;
1646
+ detail?: string | undefined;
1647
+ instance?: string | undefined;
1648
+ traceId?: string | undefined;
1649
+ requestId?: string | undefined;
1650
+ };
1651
+ outputFormat: "json";
1652
+ status: 400;
1653
+ } | {
1654
+ input: {
1655
+ json: {
1656
+ email: string;
1657
+ password: string;
1658
+ turnstileToken?: string | undefined;
1659
+ };
1660
+ };
1661
+ output: {
1662
+ type: string;
1663
+ title: string;
1664
+ status: number;
1665
+ detail?: string | undefined;
1666
+ instance?: string | undefined;
1667
+ traceId?: string | undefined;
1668
+ requestId?: string | undefined;
1669
+ };
1670
+ outputFormat: "json";
1671
+ status: 401;
1672
+ } | {
1673
+ input: {
1674
+ json: {
1675
+ email: string;
1676
+ password: string;
1677
+ turnstileToken?: string | undefined;
1678
+ };
1679
+ };
1680
+ output: {
1681
+ type: string;
1682
+ title: string;
1683
+ status: number;
1684
+ detail?: string | undefined;
1685
+ instance?: string | undefined;
1686
+ traceId?: string | undefined;
1687
+ requestId?: string | undefined;
1688
+ };
1689
+ outputFormat: "json";
1690
+ status: 429;
1691
+ } | {
1692
+ input: {
1693
+ json: {
1694
+ email: string;
1695
+ password: string;
1696
+ turnstileToken?: string | undefined;
1697
+ };
1698
+ };
1699
+ output: {
1700
+ user?: {
1701
+ id: string;
1702
+ email: string;
1703
+ name: string | null;
1704
+ emailVerified: boolean;
1705
+ avatarUrl?: string | null | undefined;
1706
+ theme?: "light" | "dark" | "system" | null | undefined;
1707
+ timezone?: string | null | undefined;
1708
+ createdAt?: string | undefined;
1709
+ } | undefined;
1710
+ redirect?: string | undefined;
1711
+ requires2fa?: boolean | undefined;
1712
+ methods?: ("email" | "totp")[] | undefined;
1713
+ };
1714
+ outputFormat: "json";
1715
+ status: 200;
1716
+ };
1717
+ };
1718
+ } & {
1719
+ "/logout": {
1720
+ $post: {
1721
+ input: {};
1722
+ output: {
1723
+ success: boolean;
1724
+ };
1725
+ outputFormat: "json";
1726
+ status: 200;
1727
+ };
1728
+ };
1729
+ } & {
1730
+ "/me": {
1731
+ $get: {
1732
+ input: {};
1733
+ output: {
1734
+ type: string;
1735
+ title: string;
1736
+ status: number;
1737
+ detail?: string | undefined;
1738
+ instance?: string | undefined;
1739
+ traceId?: string | undefined;
1740
+ requestId?: string | undefined;
1741
+ };
1742
+ outputFormat: "json";
1743
+ status: 401;
1744
+ } | {
1745
+ input: {};
1746
+ output: {
1747
+ type: string;
1748
+ title: string;
1749
+ status: number;
1750
+ detail?: string | undefined;
1751
+ instance?: string | undefined;
1752
+ traceId?: string | undefined;
1753
+ requestId?: string | undefined;
1754
+ };
1755
+ outputFormat: "json";
1756
+ status: 404;
1757
+ } | {
1758
+ input: {};
1759
+ output: {
1760
+ user: {
1761
+ id: string;
1762
+ email: string;
1763
+ name: string | null;
1764
+ emailVerified: boolean;
1765
+ avatarUrl?: string | null | undefined;
1766
+ theme?: "light" | "dark" | "system" | null | undefined;
1767
+ timezone?: string | null | undefined;
1768
+ createdAt?: string | undefined;
1769
+ };
1770
+ twoFactorEnabled: boolean;
1771
+ twoFactorMethods: ("email" | "totp")[];
1772
+ emailBounced: boolean;
1773
+ };
1774
+ outputFormat: "json";
1775
+ status: 200;
1776
+ };
1777
+ };
1778
+ } & {
1779
+ "/verify-email": {
1780
+ $post: {
1781
+ input: {
1782
+ json: {
1783
+ token: string;
1784
+ };
1785
+ };
1786
+ output: {
1787
+ type: string;
1788
+ title: string;
1789
+ status: number;
1790
+ detail?: string | undefined;
1791
+ instance?: string | undefined;
1792
+ traceId?: string | undefined;
1793
+ requestId?: string | undefined;
1794
+ };
1795
+ outputFormat: "json";
1796
+ status: 400;
1797
+ } | {
1798
+ input: {
1799
+ json: {
1800
+ token: string;
1801
+ };
1802
+ };
1803
+ output: {
1804
+ success: boolean;
1805
+ redirect: string;
1806
+ };
1807
+ outputFormat: "json";
1808
+ status: 200;
1809
+ };
1810
+ };
1811
+ } & {
1812
+ "/forgot-password": {
1813
+ $post: {
1814
+ input: {
1815
+ json: {
1816
+ email: string;
1817
+ turnstileToken?: string | undefined;
1818
+ };
1819
+ };
1820
+ output: {
1821
+ type: string;
1822
+ title: string;
1823
+ status: number;
1824
+ detail?: string | undefined;
1825
+ instance?: string | undefined;
1826
+ traceId?: string | undefined;
1827
+ requestId?: string | undefined;
1828
+ };
1829
+ outputFormat: "json";
1830
+ status: 400;
1831
+ } | {
1832
+ input: {
1833
+ json: {
1834
+ email: string;
1835
+ turnstileToken?: string | undefined;
1836
+ };
1837
+ };
1838
+ output: {
1839
+ success: boolean;
1840
+ };
1841
+ outputFormat: "json";
1842
+ status: 200;
1843
+ };
1844
+ };
1845
+ } & {
1846
+ "/reset-password": {
1847
+ $post: {
1848
+ input: {
1849
+ json: {
1850
+ token: string;
1851
+ password: string;
1852
+ turnstileToken?: string | undefined;
1853
+ };
1854
+ };
1855
+ output: {
1856
+ type: string;
1857
+ title: string;
1858
+ status: number;
1859
+ detail?: string | undefined;
1860
+ instance?: string | undefined;
1861
+ traceId?: string | undefined;
1862
+ requestId?: string | undefined;
1863
+ };
1864
+ outputFormat: "json";
1865
+ status: 400;
1866
+ } | {
1867
+ input: {
1868
+ json: {
1869
+ token: string;
1870
+ password: string;
1871
+ turnstileToken?: string | undefined;
1872
+ };
1873
+ };
1874
+ output: {
1875
+ success: boolean;
1876
+ redirect: string;
1877
+ };
1878
+ outputFormat: "json";
1879
+ status: 200;
1880
+ };
1881
+ };
1882
+ } & {
1883
+ "/change-password": {
1884
+ $post: {
1885
+ input: {
1886
+ json: {
1887
+ currentPassword: string;
1888
+ newPassword: string;
1889
+ };
1890
+ };
1891
+ output: {
1892
+ type: string;
1893
+ title: string;
1894
+ status: number;
1895
+ detail?: string | undefined;
1896
+ instance?: string | undefined;
1897
+ traceId?: string | undefined;
1898
+ requestId?: string | undefined;
1899
+ };
1900
+ outputFormat: "json";
1901
+ status: 400;
1902
+ } | {
1903
+ input: {
1904
+ json: {
1905
+ currentPassword: string;
1906
+ newPassword: string;
1907
+ };
1908
+ };
1909
+ output: {
1910
+ type: string;
1911
+ title: string;
1912
+ status: number;
1913
+ detail?: string | undefined;
1914
+ instance?: string | undefined;
1915
+ traceId?: string | undefined;
1916
+ requestId?: string | undefined;
1917
+ };
1918
+ outputFormat: "json";
1919
+ status: 401;
1920
+ } | {
1921
+ input: {
1922
+ json: {
1923
+ currentPassword: string;
1924
+ newPassword: string;
1925
+ };
1926
+ };
1927
+ output: {
1928
+ success: boolean;
1929
+ };
1930
+ outputFormat: "json";
1931
+ status: 200;
1932
+ };
1933
+ };
1934
+ } & {
1935
+ "/heartbeat": {
1936
+ $post: {
1937
+ input: {};
1938
+ output: {
1939
+ type: string;
1940
+ title: string;
1941
+ status: number;
1942
+ detail?: string | undefined;
1943
+ instance?: string | undefined;
1944
+ traceId?: string | undefined;
1945
+ requestId?: string | undefined;
1946
+ };
1947
+ outputFormat: "json";
1948
+ status: 401;
1949
+ } | {
1950
+ input: {};
1951
+ output: {
1952
+ success: boolean;
1953
+ timestamp: number;
1954
+ };
1955
+ outputFormat: "json";
1956
+ status: 200;
1957
+ };
1958
+ };
1959
+ } & {
1960
+ "/change-email": {
1961
+ $post: {
1962
+ input: {
1963
+ json: {
1964
+ password: string;
1965
+ newEmail: string;
1966
+ };
1967
+ };
1968
+ output: {
1969
+ type: string;
1970
+ title: string;
1971
+ status: number;
1972
+ detail?: string | undefined;
1973
+ instance?: string | undefined;
1974
+ traceId?: string | undefined;
1975
+ requestId?: string | undefined;
1976
+ };
1977
+ outputFormat: "json";
1978
+ status: 400;
1979
+ } | {
1980
+ input: {
1981
+ json: {
1982
+ password: string;
1983
+ newEmail: string;
1984
+ };
1985
+ };
1986
+ output: {
1987
+ type: string;
1988
+ title: string;
1989
+ status: number;
1990
+ detail?: string | undefined;
1991
+ instance?: string | undefined;
1992
+ traceId?: string | undefined;
1993
+ requestId?: string | undefined;
1994
+ };
1995
+ outputFormat: "json";
1996
+ status: 401;
1997
+ } | {
1998
+ input: {
1999
+ json: {
2000
+ password: string;
2001
+ newEmail: string;
2002
+ };
2003
+ };
2004
+ output: {
2005
+ success: boolean;
2006
+ };
2007
+ outputFormat: "json";
2008
+ status: 200;
2009
+ };
2010
+ };
2011
+ } & {
2012
+ "/confirm-email-change": {
2013
+ $post: {
2014
+ input: {
2015
+ json: {
2016
+ token: string;
2017
+ };
2018
+ };
2019
+ output: {
2020
+ type: string;
2021
+ title: string;
2022
+ status: number;
2023
+ detail?: string | undefined;
2024
+ instance?: string | undefined;
2025
+ traceId?: string | undefined;
2026
+ requestId?: string | undefined;
2027
+ };
2028
+ outputFormat: "json";
2029
+ status: 400;
2030
+ } | {
2031
+ input: {
2032
+ json: {
2033
+ token: string;
2034
+ };
2035
+ };
2036
+ output: {
2037
+ success: boolean;
2038
+ };
2039
+ outputFormat: "json";
2040
+ status: 200;
2041
+ };
2042
+ };
2043
+ } & {
2044
+ "/cancel-email-change": {
2045
+ $post: {
2046
+ input: {
2047
+ json: {
2048
+ token: string;
2049
+ };
2050
+ };
2051
+ output: {
2052
+ type: string;
2053
+ title: string;
2054
+ status: number;
2055
+ detail?: string | undefined;
2056
+ instance?: string | undefined;
2057
+ traceId?: string | undefined;
2058
+ requestId?: string | undefined;
2059
+ };
2060
+ outputFormat: "json";
2061
+ status: 400;
2062
+ } | {
2063
+ input: {
2064
+ json: {
2065
+ token: string;
2066
+ };
2067
+ };
2068
+ output: {
2069
+ success: boolean;
2070
+ };
2071
+ outputFormat: "json";
2072
+ status: 200;
2073
+ };
2074
+ };
2075
+ } & {
2076
+ "/account": {
2077
+ $delete: {
2078
+ input: {
2079
+ json: {
2080
+ password: string;
2081
+ };
2082
+ };
2083
+ output: {
2084
+ type: string;
2085
+ title: string;
2086
+ status: number;
2087
+ detail?: string | undefined;
2088
+ instance?: string | undefined;
2089
+ traceId?: string | undefined;
2090
+ requestId?: string | undefined;
2091
+ };
2092
+ outputFormat: "json";
2093
+ status: 400;
2094
+ } | {
2095
+ input: {
2096
+ json: {
2097
+ password: string;
2098
+ };
2099
+ };
2100
+ output: {
2101
+ type: string;
2102
+ title: string;
2103
+ status: number;
2104
+ detail?: string | undefined;
2105
+ instance?: string | undefined;
2106
+ traceId?: string | undefined;
2107
+ requestId?: string | undefined;
2108
+ };
2109
+ outputFormat: "json";
2110
+ status: 401;
2111
+ } | {
2112
+ input: {
2113
+ json: {
2114
+ password: string;
2115
+ };
2116
+ };
2117
+ output: {
2118
+ message: string;
2119
+ purgeAt: string;
2120
+ recoveryWindowDays: number;
2121
+ };
2122
+ outputFormat: "json";
2123
+ status: 200;
2124
+ };
2125
+ };
2126
+ } & {
2127
+ "/refresh": {
2128
+ $post: {
2129
+ input: {
2130
+ json: {
2131
+ refreshToken: string;
2132
+ };
2133
+ };
2134
+ output: {
2135
+ type: string;
2136
+ title: string;
2137
+ status: number;
2138
+ detail?: string | undefined;
2139
+ instance?: string | undefined;
2140
+ traceId?: string | undefined;
2141
+ requestId?: string | undefined;
2142
+ };
2143
+ outputFormat: "json";
2144
+ status: 401;
2145
+ } | {
2146
+ input: {
2147
+ json: {
2148
+ refreshToken: string;
2149
+ };
2150
+ };
2151
+ output: {
2152
+ accessToken: string;
2153
+ expiresIn: number;
2154
+ };
2155
+ outputFormat: "json";
2156
+ status: 200;
2157
+ };
2158
+ };
2159
+ } & {
2160
+ "/resend-verification": {
2161
+ $post: {
2162
+ input: {};
2163
+ output: {
2164
+ type: string;
2165
+ title: string;
2166
+ status: number;
2167
+ detail?: string | undefined;
2168
+ };
2169
+ outputFormat: "json";
2170
+ status: 400;
2171
+ } | {
2172
+ input: {};
2173
+ output: {
2174
+ type: string;
2175
+ title: string;
2176
+ status: number;
2177
+ detail?: string | undefined;
2178
+ };
2179
+ outputFormat: "json";
2180
+ status: 401;
2181
+ } | {
2182
+ input: {};
2183
+ output: {
2184
+ type: string;
2185
+ title: string;
2186
+ status: number;
2187
+ detail?: string | undefined;
2188
+ };
2189
+ outputFormat: "json";
2190
+ status: 429;
2191
+ } | {
2192
+ input: {};
2193
+ output: {
2194
+ success: boolean;
2195
+ message: string;
2196
+ };
2197
+ outputFormat: "json";
2198
+ status: 200;
2199
+ };
2200
+ };
2201
+ }, "/">;
857
2202
 
858
2203
  /**
859
2204
  * RFC 9457 Problem Details interface
@@ -1336,4 +2681,4 @@ declare function calculateBounceRate(db: PostgresJsDatabase<Record<string, unkno
1336
2681
  */
1337
2682
  declare function calculateComplaintRate(db: PostgresJsDatabase<Record<string, unknown>>, emailEventsTable: EmailEventsTable, hoursAgo?: number): Promise<number>;
1338
2683
 
1339
- export { AUTH_DEFAULTS, type AccountLockoutTables, type Auth, type AuthConfig, type AuthContext, type AuthDatabase, type AuthSchema, CHALLENGE_TTL_MS, type ChallengePayload, type DeviceType, type EmailAdapter, type EmailChangeConfirmationData, type EmailChangeNotificationData, type EmailChangeTables, type EmailSendOptions, type EmailSendResult, EmailService, type EmailTemplate, type EmailType, type Env, type InferNewSession, type InferNewUser, type InferSession, type InferUser, MAX_CHALLENGE_ATTEMPTS, type PasswordResetEmailData, type ProblemDetails, ProblemTypes, ResendAdapter, type ResendEventType, type ResendWebhookPayload, type SendEmailResult, type SessionData, type SessionTables, TRUSTED_DEVICE_COOKIE_BASE, TRUSTED_DEVICE_TTL_MS, type TotpVerifyResult, type TwoFactorCodeEmailData, type TwoFactorDisabledEmailData, type TwoFactorEnabledEmailData, type ValidationResult, type Variables, type VerificationEmailData, auth as authRoutes, calculateBounceRate, calculateComplaintRate, cancelEmailChange, checkAccountLocked, checkBreachedPassword, clearAccountLockout, clearChallengeCookie, clearSessionCookie, clearTrustedDeviceCookie, confirmEmailChange, createAuth, createAuthMiddleware, createChallengeToken, createDeviceToken, createEmailAdapter, createProblemDetails, createSession, csrf, decryptTotpSecret, deleteAllUserSessions, deleteChallengeToken, deleteSession, encryptTotpSecret, extractAppUrl, formatBackupCode, generate2faCodeEmail, generate2faDisabledEmail, generate2faEnabledEmail, generateApiKey, generateBackupCodes, generateCodeChallenge, generateCodeVerifier, generateEmailChangeConfirmation, generateEmailChangeNotification, generateFingerprint, generatePasswordResetEmail, generateQrCodeUri, generateSecureToken, generateTotpSecret, generateTraceId, generateVerificationEmail, getAllowedOrigins, getAuthContext, getChallengeCookieName, getClientIp, getKeyPrefix, getMinutesUntilUnlock, getSessionCookieName, getTotpCounter, getTrustedDeviceCookieName, handleWebhookEvent, hashApiKey, hashBackupCode, hashPassword, hashToken, incrementFailedAttempts, invalidateAllUserSessions, isCapacitorApp, isCloudflarePreviewUrl, isDeepLinkUri, isValidApiKeyFormat, logError, logSecurityEvent, logger, normalizeBackupCode, optionalAuth, parseDeviceName, parseDeviceType, problemJson, problems, rateLimit, refreshSession, requestEmailChange, requireAuth, requireVerifiedEmail, retrieveChallengeToken, setChallengeCookie, setSessionCookie, setTrustedDeviceCookie, storeChallengeToken, updateChallengeAttempts, validateChallengePayload, validateOrigin, validatePassword, validatePasswordWithBreachCheck, validateSession, validateTrustedDevice, verifyBackupCode, verifyCodeChallenge, verifyPassword, verifyPasswordWithRotation, verifyTotpCode, verifyTurnstileToken, verifyWebhookSignature };
2684
+ export { AUTH_DEFAULTS, type AccountLockoutTables, type Auth, type AuthConfig, type AuthContext, type AuthDatabase, type AuthSchema, CHALLENGE_TTL_MS, type ChallengePayload, type DeviceType, type EmailAdapter, type EmailChangeConfirmationData, type EmailChangeNotificationData, type EmailChangeTables, type EmailSendOptions, type EmailSendResult, EmailService, type EmailTemplate, type EmailType, type Env, type InferNewSession, type InferNewUser, type InferSession, type InferUser, MAX_CHALLENGE_ATTEMPTS, type PasswordResetEmailData, type ProblemDetails, ProblemTypes, ResendAdapter, type ResendEventType, type ResendWebhookPayload, type SendEmailResult, type SessionData, type SessionTables, TRUSTED_DEVICE_COOKIE_BASE, TRUSTED_DEVICE_TTL_MS, type TotpVerifyResult, type TwoFactorCodeEmailData, type TwoFactorDisabledEmailData, type TwoFactorEnabledEmailData, type ValidationResult, type Variables, type VerificationEmailData, authRoutes, calculateBounceRate, calculateComplaintRate, cancelEmailChange, checkAccountLocked, checkBreachedPassword, clearAccountLockout, clearChallengeCookie, clearSessionCookie, clearTrustedDeviceCookie, confirmEmailChange, createAuth, createAuthMiddleware, createChallengeToken, createDeviceToken, createEmailAdapter, createProblemDetails, createSession, csrf, decryptTotpSecret, deleteAllUserSessions, deleteChallengeToken, deleteSession, encryptTotpSecret, extractAppUrl, formatBackupCode, generate2faCodeEmail, generate2faDisabledEmail, generate2faEnabledEmail, generateApiKey, generateBackupCodes, generateCodeChallenge, generateCodeVerifier, generateEmailChangeConfirmation, generateEmailChangeNotification, generateFingerprint, generatePasswordResetEmail, generateQrCodeUri, generateSecureToken, generateTotpSecret, generateTraceId, generateVerificationEmail, getAllowedOrigins, getAuthContext, getChallengeCookieName, getClientIp, getKeyPrefix, getMinutesUntilUnlock, getSessionCookieName, getTotpCounter, getTrustedDeviceCookieName, handleWebhookEvent, hashApiKey, hashBackupCode, hashPassword, hashToken, incrementFailedAttempts, invalidateAllUserSessions, isCapacitorApp, isCloudflarePreviewUrl, isDeepLinkUri, isValidApiKeyFormat, logError, logSecurityEvent, logger, normalizeBackupCode, optionalAuth, parseDeviceName, parseDeviceType, problemJson, problems, rateLimit, refreshSession, requestEmailChange, requireAuth, requireVerifiedEmail, retrieveChallengeToken, setChallengeCookie, setSessionCookie, setTrustedDeviceCookie, storeChallengeToken, updateChallengeAttempts, validateChallengePayload, validateOrigin, validatePassword, validatePasswordWithBreachCheck, validateSession, validateTrustedDevice, verifyBackupCode, verifyCodeChallenge, verifyPassword, verifyPasswordWithRotation, verifyTotpCode, verifyTurnstileToken, verifyWebhookSignature };