@delmaredigital/payload-better-auth 0.5.1 → 0.5.3

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.
@@ -1,25 +1,27 @@
1
1
  /**
2
2
  * Client-side auth utilities
3
- * Re-exports createAuthClient from better-auth/react and common plugins
3
+ * Re-exports createAuthClient from better-auth/react and core plugins
4
+ *
5
+ * NOTE: Only plugins from the core `better-auth` package are statically imported here.
6
+ * Optional peer dep plugins (passkey, apiKey, etc.) must NOT be statically imported
7
+ * because webpack resolves all static imports at build time, breaking consumers
8
+ * who don't have those packages installed.
4
9
  */
5
10
  export { createAuthClient } from 'better-auth/react';
6
11
  export { twoFactorClient } from 'better-auth/client/plugins';
7
- export { apiKeyClient } from '@better-auth/api-key/client';
8
- export { passkeyClient } from '@better-auth/passkey/client';
9
12
  /**
10
- * Default plugins included with Payload Better Auth.
11
- * Use this with createAuthClient when you need custom plugins with full type safety.
13
+ * Default plugins included with Payload Better Auth (core only).
14
+ * Add optional plugins (passkeyClient, apiKeyClient) from their own packages.
12
15
  *
13
- * @example With custom plugins (full type safety)
16
+ * @example
14
17
  * ```typescript
15
18
  * import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
16
- * import { stripeClient } from '@better-auth/stripe/client'
19
+ * import { passkeyClient } from '@better-auth/passkey/client'
20
+ * import { apiKeyClient } from '@better-auth/api-key/client'
17
21
  *
18
22
  * export const authClient = createAuthClient({
19
- * plugins: [...payloadAuthPlugins, stripeClient({ subscription: true })],
23
+ * plugins: [...payloadAuthPlugins, passkeyClient(), apiKeyClient()],
20
24
  * })
21
- *
22
- * // authClient.subscription is fully typed!
23
25
  * ```
24
26
  */
25
27
  export declare const payloadAuthPlugins: readonly [{
@@ -601,771 +603,78 @@ export declare const payloadAuthPlugins: readonly [{
601
603
  };
602
604
  twoFactor: {
603
605
  fields: {
604
- secret: {
605
- type: "string";
606
- required: true;
607
- returned: false;
608
- index: true;
609
- };
610
- backupCodes: {
611
- type: "string";
612
- required: true;
613
- returned: false;
614
- };
615
- userId: {
616
- type: "string";
617
- required: true;
618
- returned: false;
619
- references: {
620
- model: string;
621
- field: string;
622
- };
623
- index: true;
624
- };
625
- };
626
- };
627
- };
628
- rateLimit: {
629
- pathMatcher(path: string): boolean;
630
- window: number;
631
- max: number;
632
- }[];
633
- $ERROR_CODES: {
634
- OTP_NOT_ENABLED: import("better-auth").RawError<"OTP_NOT_ENABLED">;
635
- OTP_HAS_EXPIRED: import("better-auth").RawError<"OTP_HAS_EXPIRED">;
636
- TOTP_NOT_ENABLED: import("better-auth").RawError<"TOTP_NOT_ENABLED">;
637
- TWO_FACTOR_NOT_ENABLED: import("better-auth").RawError<"TWO_FACTOR_NOT_ENABLED">;
638
- BACKUP_CODES_NOT_ENABLED: import("better-auth").RawError<"BACKUP_CODES_NOT_ENABLED">;
639
- INVALID_BACKUP_CODE: import("better-auth").RawError<"INVALID_BACKUP_CODE">;
640
- INVALID_CODE: import("better-auth").RawError<"INVALID_CODE">;
641
- TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("better-auth").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
642
- INVALID_TWO_FACTOR_COOKIE: import("better-auth").RawError<"INVALID_TWO_FACTOR_COOKIE">;
643
- };
644
- })>;
645
- atomListeners: {
646
- matcher: (path: string) => boolean;
647
- signal: "$sessionSignal";
648
- }[];
649
- pathMethods: {
650
- "/two-factor/disable": "POST";
651
- "/two-factor/enable": "POST";
652
- "/two-factor/send-otp": "POST";
653
- "/two-factor/generate-backup-codes": "POST";
654
- "/two-factor/get-totp-uri": "POST";
655
- "/two-factor/verify-totp": "POST";
656
- "/two-factor/verify-otp": "POST";
657
- "/two-factor/verify-backup-code": "POST";
658
- };
659
- fetchPlugins: {
660
- id: string;
661
- name: string;
662
- hooks: {
663
- onSuccess(context: import("better-auth/react").SuccessContext<any>): Promise<void>;
664
- };
665
- }[];
666
- $ERROR_CODES: {
667
- OTP_NOT_ENABLED: import("better-auth").RawError<"OTP_NOT_ENABLED">;
668
- OTP_HAS_EXPIRED: import("better-auth").RawError<"OTP_HAS_EXPIRED">;
669
- TOTP_NOT_ENABLED: import("better-auth").RawError<"TOTP_NOT_ENABLED">;
670
- TWO_FACTOR_NOT_ENABLED: import("better-auth").RawError<"TWO_FACTOR_NOT_ENABLED">;
671
- BACKUP_CODES_NOT_ENABLED: import("better-auth").RawError<"BACKUP_CODES_NOT_ENABLED">;
672
- INVALID_BACKUP_CODE: import("better-auth").RawError<"INVALID_BACKUP_CODE">;
673
- INVALID_CODE: import("better-auth").RawError<"INVALID_CODE">;
674
- TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("better-auth").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
675
- INVALID_TWO_FACTOR_COOKIE: import("better-auth").RawError<"INVALID_TWO_FACTOR_COOKIE">;
676
- };
677
- }, {
678
- id: "api-key";
679
- $InferServerPlugin: ReturnType<typeof import("@better-auth/api-key").apiKey>;
680
- pathMethods: {
681
- "/api-key/create": "POST";
682
- "/api-key/delete": "POST";
683
- "/api-key/delete-all-expired-api-keys": "POST";
684
- };
685
- $ERROR_CODES: {
686
- INVALID_METADATA_TYPE: import("better-auth").RawError<"INVALID_METADATA_TYPE">;
687
- REFILL_AMOUNT_AND_INTERVAL_REQUIRED: import("better-auth").RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
688
- REFILL_INTERVAL_AND_AMOUNT_REQUIRED: import("better-auth").RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
689
- USER_BANNED: import("better-auth").RawError<"USER_BANNED">;
690
- UNAUTHORIZED_SESSION: import("better-auth").RawError<"UNAUTHORIZED_SESSION">;
691
- KEY_NOT_FOUND: import("better-auth").RawError<"KEY_NOT_FOUND">;
692
- KEY_DISABLED: import("better-auth").RawError<"KEY_DISABLED">;
693
- KEY_EXPIRED: import("better-auth").RawError<"KEY_EXPIRED">;
694
- USAGE_EXCEEDED: import("better-auth").RawError<"USAGE_EXCEEDED">;
695
- KEY_NOT_RECOVERABLE: import("better-auth").RawError<"KEY_NOT_RECOVERABLE">;
696
- EXPIRES_IN_IS_TOO_SMALL: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_SMALL">;
697
- EXPIRES_IN_IS_TOO_LARGE: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_LARGE">;
698
- INVALID_REMAINING: import("better-auth").RawError<"INVALID_REMAINING">;
699
- INVALID_PREFIX_LENGTH: import("better-auth").RawError<"INVALID_PREFIX_LENGTH">;
700
- INVALID_NAME_LENGTH: import("better-auth").RawError<"INVALID_NAME_LENGTH">;
701
- METADATA_DISABLED: import("better-auth").RawError<"METADATA_DISABLED">;
702
- RATE_LIMIT_EXCEEDED: import("better-auth").RawError<"RATE_LIMIT_EXCEEDED">;
703
- NO_VALUES_TO_UPDATE: import("better-auth").RawError<"NO_VALUES_TO_UPDATE">;
704
- KEY_DISABLED_EXPIRATION: import("better-auth").RawError<"KEY_DISABLED_EXPIRATION">;
705
- INVALID_API_KEY: import("better-auth").RawError<"INVALID_API_KEY">;
706
- INVALID_USER_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_USER_ID_FROM_API_KEY">;
707
- INVALID_REFERENCE_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
708
- INVALID_API_KEY_GETTER_RETURN_TYPE: import("better-auth").RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
709
- SERVER_ONLY_PROPERTY: import("better-auth").RawError<"SERVER_ONLY_PROPERTY">;
710
- FAILED_TO_UPDATE_API_KEY: import("better-auth").RawError<"FAILED_TO_UPDATE_API_KEY">;
711
- NAME_REQUIRED: import("better-auth").RawError<"NAME_REQUIRED">;
712
- ORGANIZATION_ID_REQUIRED: import("better-auth").RawError<"ORGANIZATION_ID_REQUIRED">;
713
- USER_NOT_MEMBER_OF_ORGANIZATION: import("better-auth").RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
714
- INSUFFICIENT_API_KEY_PERMISSIONS: import("better-auth").RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
715
- NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: import("better-auth").RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
716
- ORGANIZATION_PLUGIN_REQUIRED: import("better-auth").RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
717
- };
718
- }, {
719
- id: "passkey";
720
- $InferServerPlugin: ReturnType<(options?: import("@better-auth/passkey").PasskeyOptions | undefined) => {
721
- id: "passkey";
722
- endpoints: {
723
- generatePasskeyRegistrationOptions: import("better-auth").StrictEndpoint<"/passkey/generate-register-options", {
724
- method: "GET";
725
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
726
- session: {
727
- session: Record<string, any> & {
728
- id: string;
729
- createdAt: Date;
730
- updatedAt: Date;
731
- userId: string;
732
- expiresAt: Date;
733
- token: string;
734
- ipAddress?: string | null | undefined;
735
- userAgent?: string | null | undefined;
736
- };
737
- user: Record<string, any> & {
738
- id: string;
739
- createdAt: Date;
740
- updatedAt: Date;
741
- email: string;
742
- emailVerified: boolean;
743
- name: string;
744
- image? /** Base URL for auth endpoints (defaults to window.location.origin) */: string | null | undefined;
745
- };
746
- };
747
- }>)[];
748
- query: import("better-auth").ZodOptional<import("better-auth").ZodObject<{
749
- authenticatorAttachment: import("better-auth").ZodOptional<import("better-auth").ZodEnum<{
750
- platform: "platform";
751
- "cross-platform": "cross-platform";
752
- }>>;
753
- name: import("better-auth").ZodOptional<import("better-auth").ZodString>;
754
- }, import("better-auth").$strip>>;
755
- metadata: {
756
- openapi: {
757
- operationId: string;
758
- description: string;
759
- responses: {
760
- 200: {
761
- description: string;
762
- parameters: {
763
- query: {
764
- authenticatorAttachment: {
765
- description: string;
766
- required: boolean;
767
- };
768
- name: {
769
- description: string;
770
- required: boolean;
771
- };
772
- };
773
- };
774
- content: {
775
- "application/json": {
776
- schema: {
777
- type: "object";
778
- properties: {
779
- challenge: {
780
- type: string;
781
- };
782
- rp: {
783
- type: string;
784
- properties: {
785
- name: {
786
- type: string;
787
- };
788
- id: {
789
- type: string;
790
- };
791
- };
792
- };
793
- user: {
794
- type: string;
795
- properties: {
796
- id: {
797
- type: string;
798
- };
799
- name: {
800
- type: string;
801
- };
802
- displayName: {
803
- type: string;
804
- };
805
- };
806
- };
807
- pubKeyCredParams: {
808
- type: string;
809
- items: {
810
- type: string;
811
- properties: {
812
- type: {
813
- type: string;
814
- };
815
- alg: {
816
- type: string;
817
- };
818
- };
819
- };
820
- };
821
- timeout: {
822
- type: string;
823
- };
824
- excludeCredentials: {
825
- type: string;
826
- items: {
827
- type: string;
828
- properties: {
829
- id: {
830
- type: string;
831
- };
832
- type: {
833
- type: string;
834
- };
835
- transports: {
836
- type: string;
837
- items: {
838
- type: string;
839
- };
840
- };
841
- };
842
- };
843
- };
844
- authenticatorSelection: {
845
- type: string;
846
- properties: {
847
- authenticatorAttachment: {
848
- type: string;
849
- };
850
- requireResidentKey: {
851
- type: string;
852
- };
853
- userVerification: {
854
- type: string;
855
- };
856
- };
857
- };
858
- attestation: {
859
- type: string;
860
- };
861
- extensions: {
862
- type: string;
863
- };
864
- };
865
- };
866
- };
867
- };
868
- };
869
- };
870
- };
871
- };
872
- }, import("@better-auth/passkey/client").PublicKeyCredentialCreationOptionsJSON>;
873
- generatePasskeyAuthenticationOptions: import("better-auth").StrictEndpoint<"/passkey/generate-authenticate-options", {
874
- method: "GET";
875
- metadata: {
876
- openapi: {
877
- operationId: string;
878
- description: string;
879
- responses: {
880
- 200: {
881
- description: string;
882
- content: {
883
- "application/json": {
884
- schema: {
885
- type: "object";
886
- properties: {
887
- challenge: {
888
- type: string;
889
- };
890
- rp: {
891
- type: string;
892
- properties: {
893
- name: {
894
- type: string;
895
- };
896
- id: {
897
- type: string;
898
- };
899
- };
900
- };
901
- user: {
902
- type: string;
903
- properties: {
904
- id: {
905
- type: string;
906
- };
907
- name: {
908
- type: string;
909
- };
910
- displayName: {
911
- type: string;
912
- };
913
- };
914
- };
915
- timeout: {
916
- type: string;
917
- };
918
- allowCredentials: {
919
- type: string;
920
- items: {
921
- type: string;
922
- properties: {
923
- id: {
924
- type: string;
925
- };
926
- type: {
927
- type: string;
928
- };
929
- transports: {
930
- type: string;
931
- items: {
932
- type: string;
933
- };
934
- };
935
- };
936
- };
937
- };
938
- userVerification: {
939
- type: string;
940
- };
941
- authenticatorSelection: {
942
- type: string;
943
- properties: {
944
- authenticatorAttachment: {
945
- type: string;
946
- };
947
- requireResidentKey: {
948
- type: string;
949
- };
950
- userVerification: {
951
- type: string;
952
- };
953
- };
954
- };
955
- extensions: {
956
- type: string;
957
- };
958
- };
959
- };
960
- };
961
- };
962
- };
963
- };
964
- };
965
- };
966
- }, import("@better-auth/passkey/client").PublicKeyCredentialRequestOptionsJSON>;
967
- verifyPasskeyRegistration: import("better-auth").StrictEndpoint<"/passkey/verify-registration", {
968
- method: "POST";
969
- body: import("better-auth").ZodObject<{
970
- response: import("better-auth").ZodAny;
971
- name: import("better-auth").ZodOptional<import("better-auth").ZodString>;
972
- }, import("better-auth").$strip>;
973
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
974
- session: {
975
- session: Record<string, any> & {
976
- id: string;
977
- createdAt: Date;
978
- updatedAt: Date;
979
- userId: string;
980
- expiresAt: Date;
981
- token: string;
982
- ipAddress?: string | null | undefined;
983
- userAgent?: string | null | undefined;
984
- };
985
- user: Record<string, any> & {
986
- id: string;
987
- createdAt: Date;
988
- updatedAt: Date;
989
- email: string;
990
- emailVerified: boolean;
991
- name: string;
992
- image?: string | null | undefined;
993
- };
994
- };
995
- }>)[];
996
- metadata: {
997
- openapi: {
998
- operationId: string;
999
- description: string;
1000
- responses: {
1001
- 200: {
1002
- description: string;
1003
- content: {
1004
- "application/json": {
1005
- schema: {
1006
- $ref: string;
1007
- };
1008
- };
1009
- };
1010
- };
1011
- 400: {
1012
- description: string;
1013
- };
1014
- };
1015
- };
1016
- };
1017
- }, import("@better-auth/passkey").Passkey>;
1018
- verifyPasskeyAuthentication: import("better-auth").StrictEndpoint<"/passkey/verify-authentication", {
1019
- method: "POST";
1020
- body: import("better-auth").ZodObject<{
1021
- response: import("better-auth").ZodRecord<import("better-auth").ZodAny, import("better-auth").ZodAny>;
1022
- }, import("better-auth").$strip>;
1023
- metadata: {
1024
- openapi: {
1025
- operationId: string;
1026
- description: string;
1027
- responses: {
1028
- 200: {
1029
- description: string;
1030
- content: {
1031
- "application/json": {
1032
- schema: {
1033
- type: "object";
1034
- properties: {
1035
- session: {
1036
- $ref: string;
1037
- };
1038
- user: {
1039
- $ref: string;
1040
- };
1041
- };
1042
- };
1043
- };
1044
- };
1045
- };
1046
- };
1047
- };
1048
- $Infer: {
1049
- body: {
1050
- response: import("@better-auth/passkey/client").AuthenticationResponseJSON;
1051
- };
1052
- };
1053
- };
1054
- }, {
1055
- session: {
1056
- id: string;
1057
- createdAt: Date;
1058
- updatedAt: Date;
1059
- userId: string;
1060
- expiresAt: Date;
1061
- token: string;
1062
- ipAddress?: string | null | undefined;
1063
- userAgent?: string | null | undefined;
1064
- };
1065
- }>;
1066
- listPasskeys: import("better-auth").StrictEndpoint<"/passkey/list-user-passkeys", {
1067
- method: "GET";
1068
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1069
- session: {
1070
- session: Record<string, any> & {
1071
- id: string;
1072
- createdAt: Date;
1073
- updatedAt: Date;
1074
- userId: string;
1075
- expiresAt: Date;
1076
- token: string;
1077
- ipAddress?: string | null | undefined;
1078
- userAgent?: string | null | undefined;
1079
- };
1080
- user: Record<string, any> & {
1081
- id: string;
1082
- createdAt: Date;
1083
- updatedAt: Date;
1084
- email: string;
1085
- emailVerified: boolean;
1086
- name: string;
1087
- image?: string | null | undefined;
1088
- };
1089
- };
1090
- }>)[];
1091
- metadata: {
1092
- openapi: {
1093
- description: string;
1094
- responses: {
1095
- "200": {
1096
- description: string;
1097
- content: {
1098
- "application/json": {
1099
- schema: {
1100
- type: "array";
1101
- items: {
1102
- $ref: string;
1103
- required: string[];
1104
- };
1105
- description: string;
1106
- };
1107
- };
1108
- };
1109
- };
1110
- };
1111
- };
1112
- };
1113
- }, import("@better-auth/passkey").Passkey[]>;
1114
- deletePasskey: import("better-auth").StrictEndpoint<"/passkey/delete-passkey", {
1115
- method: "POST";
1116
- body: import("better-auth").ZodObject<{
1117
- id: import("better-auth").ZodString;
1118
- }, import("better-auth").$strip>;
1119
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1120
- session: {
1121
- session: Record<string, any> & {
1122
- id: string;
1123
- createdAt: Date;
1124
- updatedAt: Date;
1125
- userId: string;
1126
- expiresAt: Date;
1127
- token: string;
1128
- ipAddress?: string | null | undefined;
1129
- userAgent?: string | null | undefined;
1130
- };
1131
- user: Record<string, any> & {
1132
- id: string;
1133
- createdAt: Date;
1134
- updatedAt: Date;
1135
- email: string;
1136
- emailVerified: boolean;
1137
- name: string;
1138
- image?: string | null | undefined;
1139
- };
1140
- };
1141
- }>)[];
1142
- metadata: {
1143
- openapi: {
1144
- description: string;
1145
- responses: {
1146
- "200": {
1147
- description: string;
1148
- content: {
1149
- "application/json": {
1150
- schema: {
1151
- type: "object";
1152
- properties: {
1153
- status: {
1154
- type: string;
1155
- description: string;
1156
- };
1157
- };
1158
- required: string[];
1159
- };
1160
- };
1161
- };
1162
- };
1163
- };
1164
- };
1165
- };
1166
- }, {
1167
- status: boolean;
1168
- }>;
1169
- updatePasskey: import("better-auth").StrictEndpoint<"/passkey/update-passkey", {
1170
- method: "POST";
1171
- body: import("better-auth").ZodObject<{
1172
- id: import("better-auth").ZodString;
1173
- name: import("better-auth").ZodString;
1174
- }, import("better-auth").$strip>;
1175
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1176
- session: {
1177
- session: Record<string, any> & {
1178
- id: string;
1179
- createdAt: Date;
1180
- updatedAt: Date;
1181
- userId: string;
1182
- expiresAt: Date;
1183
- token: string;
1184
- ipAddress?: string | null | undefined;
1185
- userAgent?: string | null | undefined;
1186
- };
1187
- user: Record<string, any> & {
1188
- id: string;
1189
- createdAt: Date;
1190
- updatedAt: Date;
1191
- email: string;
1192
- emailVerified: boolean;
1193
- name: string;
1194
- image?: string | null | undefined;
1195
- };
1196
- };
1197
- }>)[];
1198
- metadata: {
1199
- openapi: {
1200
- description: string;
1201
- responses: {
1202
- "200": {
1203
- description: string;
1204
- content: {
1205
- "application/json": {
1206
- schema: {
1207
- type: "object";
1208
- properties: {
1209
- passkey: {
1210
- $ref: string;
1211
- };
1212
- };
1213
- required: string[];
1214
- };
1215
- };
1216
- };
1217
- };
1218
- };
1219
- };
1220
- };
1221
- }, {
1222
- passkey: import("@better-auth/passkey").Passkey;
1223
- }>;
1224
- };
1225
- schema: {
1226
- passkey: {
1227
- fields: {
1228
- name: {
1229
- type: "string";
1230
- required: false;
1231
- };
1232
- publicKey: {
1233
- type: "string";
1234
- required: true;
1235
- };
1236
- userId: {
1237
- type: "string";
1238
- references: {
1239
- model: string;
1240
- field: string;
1241
- };
1242
- required: true;
1243
- index: true;
1244
- };
1245
- credentialID: {
1246
- type: "string";
1247
- required: true;
1248
- index: true;
1249
- };
1250
- counter: {
1251
- type: "number";
1252
- required: true;
1253
- };
1254
- deviceType: {
1255
- type: "string";
1256
- required: true;
1257
- };
1258
- backedUp: {
1259
- type: "boolean";
606
+ secret: {
607
+ type: "string";
1260
608
  required: true;
609
+ returned: false;
610
+ index: true;
1261
611
  };
1262
- transports: {
612
+ backupCodes: {
1263
613
  type: "string";
1264
- required: false;
1265
- };
1266
- createdAt: {
1267
- type: "date";
1268
- required: false;
614
+ required: true;
615
+ returned: false;
1269
616
  };
1270
- aaguid: {
617
+ userId: {
1271
618
  type: "string";
1272
- required: false;
619
+ required: true;
620
+ returned: false;
621
+ references: {
622
+ model: string;
623
+ field: string;
624
+ };
625
+ index: true;
1273
626
  };
1274
627
  };
1275
628
  };
1276
629
  };
630
+ rateLimit: {
631
+ pathMatcher(path: string): boolean;
632
+ window: number;
633
+ max: number;
634
+ }[];
1277
635
  $ERROR_CODES: {
1278
- CHALLENGE_NOT_FOUND: import("better-auth").RawError<"CHALLENGE_NOT_FOUND">;
1279
- YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY">;
1280
- FAILED_TO_VERIFY_REGISTRATION: import("better-auth").RawError<"FAILED_TO_VERIFY_REGISTRATION">;
1281
- PASSKEY_NOT_FOUND: import("better-auth").RawError<"PASSKEY_NOT_FOUND">;
1282
- AUTHENTICATION_FAILED: import("better-auth").RawError<"AUTHENTICATION_FAILED">;
1283
- UNABLE_TO_CREATE_SESSION: import("better-auth").RawError<"UNABLE_TO_CREATE_SESSION">;
1284
- FAILED_TO_UPDATE_PASSKEY: import("better-auth").RawError<"FAILED_TO_UPDATE_PASSKEY">;
1285
- };
1286
- options: import("@better-auth/passkey").PasskeyOptions | undefined;
1287
- }>;
1288
- getActions: ($fetch: import("better-auth/react").BetterFetch, $store: import("better-auth").ClientStore) => {
1289
- signIn: {
1290
- passkey: (opts?: {
1291
- autoFill?: boolean;
1292
- fetchOptions?: import("better-auth").ClientFetchOption;
1293
- } | undefined, options?: import("better-auth").ClientFetchOption | undefined) => Promise<{
1294
- data: null;
1295
- error: {
1296
- message?: string | undefined;
1297
- status: number;
1298
- statusText: string;
1299
- };
1300
- } | {
1301
- data: {
1302
- session: import("better-auth").Session;
1303
- user: import("better-auth").User;
1304
- };
1305
- error: null;
1306
- } | {
1307
- data: null;
1308
- error: {
1309
- code: string;
1310
- message: string;
1311
- status: number;
1312
- statusText: string;
1313
- };
1314
- }>;
1315
- };
1316
- passkey: {
1317
- addPasskey: (opts?: {
1318
- fetchOptions?: import("better-auth").ClientFetchOption;
1319
- name?: string;
1320
- authenticatorAttachment?: "platform" | "cross-platform";
1321
- useAutoRegister?: boolean;
1322
- } | undefined, fetchOpts?: import("better-auth").ClientFetchOption | undefined) => Promise<{
1323
- data: null;
1324
- error: {
1325
- message?: string | undefined;
1326
- status: number;
1327
- statusText: string;
1328
- };
1329
- } | {
1330
- data: import("@better-auth/passkey").Passkey;
1331
- error: null;
1332
- } | {
1333
- data: null;
1334
- error: {
1335
- code: string;
1336
- message: string;
1337
- status: number;
1338
- statusText: string;
1339
- };
1340
- }>;
1341
- };
1342
- $Infer: {
1343
- Passkey: import("@better-auth/passkey").Passkey;
636
+ OTP_NOT_ENABLED: import("better-auth").RawError<"OTP_NOT_ENABLED">;
637
+ OTP_HAS_EXPIRED: import("better-auth").RawError<"OTP_HAS_EXPIRED">;
638
+ TOTP_NOT_ENABLED: import("better-auth").RawError<"TOTP_NOT_ENABLED">;
639
+ TWO_FACTOR_NOT_ENABLED: import("better-auth").RawError<"TWO_FACTOR_NOT_ENABLED">;
640
+ BACKUP_CODES_NOT_ENABLED: import("better-auth").RawError<"BACKUP_CODES_NOT_ENABLED">;
641
+ INVALID_BACKUP_CODE: import("better-auth").RawError<"INVALID_BACKUP_CODE">;
642
+ INVALID_CODE: import("better-auth").RawError<"INVALID_CODE">;
643
+ TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("better-auth").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
644
+ INVALID_TWO_FACTOR_COOKIE: import("better-auth").RawError<"INVALID_TWO_FACTOR_COOKIE">;
1344
645
  };
1345
- };
1346
- getAtoms($fetch: import("better-auth/react").BetterFetch): {
1347
- listPasskeys: import("better-auth/client").AuthQueryAtom<import("@better-auth/passkey").Passkey[]>;
1348
- $listPasskeys: import("better-auth/react").PreinitializedWritableAtom<any> & object;
1349
- };
646
+ })>;
647
+ atomListeners: {
648
+ matcher: (path: string) => boolean;
649
+ signal: "$sessionSignal";
650
+ }[];
1350
651
  pathMethods: {
1351
- "/passkey/register": "POST";
1352
- "/passkey/authenticate": "POST";
652
+ "/two-factor/disable": "POST";
653
+ "/two-factor/enable": "POST";
654
+ "/two-factor/send-otp": "POST";
655
+ "/two-factor/generate-backup-codes": "POST";
656
+ "/two-factor/get-totp-uri": "POST";
657
+ "/two-factor/verify-totp": "POST";
658
+ "/two-factor/verify-otp": "POST";
659
+ "/two-factor/verify-backup-code": "POST";
1353
660
  };
1354
- atomListeners: ({
1355
- matcher(path: string): path is "/passkey/delete-passkey" | "/passkey/update-passkey" | "/passkey/verify-registration" | "/sign-out";
1356
- signal: "$listPasskeys";
1357
- } | {
1358
- matcher: (path: string) => path is "/passkey/verify-authentication";
1359
- signal: "$sessionSignal";
1360
- })[];
661
+ fetchPlugins: {
662
+ id: string;
663
+ name: string;
664
+ hooks: {
665
+ onSuccess(context: import("better-auth/react").SuccessContext<any>): Promise<void>;
666
+ };
667
+ }[];
1361
668
  $ERROR_CODES: {
1362
- CHALLENGE_NOT_FOUND: import("better-auth").RawError<"CHALLENGE_NOT_FOUND">;
1363
- YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY">;
1364
- FAILED_TO_VERIFY_REGISTRATION: import("better-auth").RawError<"FAILED_TO_VERIFY_REGISTRATION">;
1365
- PASSKEY_NOT_FOUND: import("better-auth").RawError<"PASSKEY_NOT_FOUND">;
1366
- AUTHENTICATION_FAILED: import("better-auth").RawError<"AUTHENTICATION_FAILED">;
1367
- UNABLE_TO_CREATE_SESSION: import("better-auth").RawError<"UNABLE_TO_CREATE_SESSION">;
1368
- FAILED_TO_UPDATE_PASSKEY: import("better-auth").RawError<"FAILED_TO_UPDATE_PASSKEY">;
669
+ OTP_NOT_ENABLED: import("better-auth").RawError<"OTP_NOT_ENABLED">;
670
+ OTP_HAS_EXPIRED: import("better-auth").RawError<"OTP_HAS_EXPIRED">;
671
+ TOTP_NOT_ENABLED: import("better-auth").RawError<"TOTP_NOT_ENABLED">;
672
+ TWO_FACTOR_NOT_ENABLED: import("better-auth").RawError<"TWO_FACTOR_NOT_ENABLED">;
673
+ BACKUP_CODES_NOT_ENABLED: import("better-auth").RawError<"BACKUP_CODES_NOT_ENABLED">;
674
+ INVALID_BACKUP_CODE: import("better-auth").RawError<"INVALID_BACKUP_CODE">;
675
+ INVALID_CODE: import("better-auth").RawError<"INVALID_CODE">;
676
+ TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("better-auth").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
677
+ INVALID_TWO_FACTOR_COOKIE: import("better-auth").RawError<"INVALID_TWO_FACTOR_COOKIE">;
1369
678
  };
1370
679
  }];
1371
680
  export interface PayloadAuthClientOptions {
@@ -1373,41 +682,30 @@ export interface PayloadAuthClientOptions {
1373
682
  baseURL?: string;
1374
683
  }
1375
684
  /**
1376
- * Create a pre-configured auth client with default plugins (twoFactor, apiKey, passkey).
1377
- *
1378
- * This is a convenience wrapper for simple setups. For custom plugins with full type
1379
- * safety, use `createAuthClient` with `payloadAuthPlugins` instead.
685
+ * Create a pre-configured auth client with default core plugins (twoFactor).
1380
686
  *
1381
- * @param options - Optional configuration
1382
- * @param options.baseURL - Base URL for auth endpoints (defaults to window.location.origin)
687
+ * For passkeys, API keys, or other optional plugins, use `createAuthClient` directly:
1383
688
  *
1384
- * @example Basic usage (no custom plugins)
689
+ * @example Basic usage
1385
690
  * ```typescript
1386
691
  * import { createPayloadAuthClient } from '@delmaredigital/payload-better-auth/client'
1387
- *
1388
692
  * export const authClient = createPayloadAuthClient()
1389
693
  * ```
1390
694
  *
1391
- * @example With custom plugins (use createAuthClient for full type safety)
695
+ * @example With optional plugins
1392
696
  * ```typescript
1393
697
  * import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
1394
- * import { stripeClient } from '@better-auth/stripe/client'
698
+ * import { passkeyClient } from '@better-auth/passkey/client'
1395
699
  *
1396
700
  * export const authClient = createAuthClient({
1397
- * plugins: [...payloadAuthPlugins, stripeClient({ subscription: true })],
701
+ * plugins: [...payloadAuthPlugins, passkeyClient()],
1398
702
  * })
1399
703
  * ```
1400
704
  */
1401
705
  export declare function createPayloadAuthClient(options?: PayloadAuthClientOptions): {
1402
- useListPasskeys: () => {
1403
- data: import("@better-auth/passkey").Passkey[] | null;
1404
- error: null | import("better-auth/react").BetterFetchError;
1405
- isPending: boolean;
1406
- isRefetching: boolean;
1407
- refetch: (queryParams?: {
1408
- query?: import("better-auth").SessionQueryParams;
1409
- } | undefined) => Promise<void>;
1410
- };
706
+ updateSession: any;
707
+ } & {
708
+ updateUser: any;
1411
709
  } & {
1412
710
  signOut: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
1413
711
  query?: Record<string, any> | undefined;
@@ -1941,10 +1239,6 @@ export declare function createPayloadAuthClient(options?: PayloadAuthClientOptio
1941
1239
  message?: string | undefined;
1942
1240
  }, FetchOptions["throw"] extends true ? true : false>>;
1943
1241
  };
1944
- } & {
1945
- updateSession: any;
1946
- } & {
1947
- updateUser: any;
1948
1242
  } & {
1949
1243
  listSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
1950
1244
  query?: Record<string, any> | undefined;
@@ -2222,405 +1516,6 @@ export declare function createPayloadAuthClient(options?: PayloadAuthClientOptio
2222
1516
  message?: string | undefined;
2223
1517
  }, FetchOptions["throw"] extends true ? true : false>>;
2224
1518
  };
2225
- } & {
2226
- apiKey: {
2227
- create: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
2228
- configId?: string | undefined;
2229
- name?: string | undefined;
2230
- expiresIn?: number | null | undefined;
2231
- prefix?: string | undefined;
2232
- remaining?: number | null | undefined;
2233
- metadata?: any;
2234
- refillAmount?: number | undefined;
2235
- refillInterval?: number | undefined;
2236
- rateLimitTimeWindow?: number | undefined;
2237
- rateLimitMax?: number | undefined;
2238
- rateLimitEnabled?: boolean | undefined;
2239
- permissions?: Record<string, string[]> | undefined;
2240
- userId?: unknown;
2241
- organizationId?: unknown;
2242
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
2243
- configId?: string | undefined;
2244
- name?: string | undefined;
2245
- expiresIn?: number | null | undefined;
2246
- prefix?: string | undefined;
2247
- remaining?: number | null | undefined;
2248
- metadata?: any;
2249
- refillAmount?: number | undefined;
2250
- refillInterval?: number | undefined;
2251
- rateLimitTimeWindow?: number | undefined;
2252
- rateLimitMax?: number | undefined;
2253
- rateLimitEnabled?: boolean | undefined;
2254
- permissions?: Record<string, string[]> | undefined;
2255
- userId?: unknown;
2256
- organizationId?: unknown;
2257
- } & {
2258
- fetchOptions?: FetchOptions | undefined;
2259
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
2260
- key: string;
2261
- metadata: any;
2262
- permissions: any;
2263
- id: string;
2264
- configId: string;
2265
- name: string | null;
2266
- start: string | null;
2267
- prefix: string | null;
2268
- referenceId: string;
2269
- refillInterval: number | null;
2270
- refillAmount: number | null;
2271
- lastRefillAt: Date | null;
2272
- enabled: boolean;
2273
- rateLimitEnabled: boolean;
2274
- rateLimitTimeWindow: number | null;
2275
- rateLimitMax: number | null;
2276
- requestCount: number;
2277
- remaining: number | null;
2278
- lastRequest: Date | null;
2279
- expiresAt: Date | null;
2280
- createdAt: Date;
2281
- updatedAt: Date;
2282
- }, {
2283
- code?: string | undefined;
2284
- message?: string | undefined;
2285
- }, FetchOptions["throw"] extends true ? true : false>>;
2286
- };
2287
- } & {
2288
- apiKey: {
2289
- get: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
2290
- id: string;
2291
- configId?: string | undefined;
2292
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
2293
- query: {
2294
- id: string;
2295
- configId?: string | undefined;
2296
- };
2297
- fetchOptions?: FetchOptions | undefined;
2298
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
2299
- metadata: Record<string, any> | null;
2300
- permissions: {
2301
- [key: string]: string[];
2302
- } | null;
2303
- id: string;
2304
- configId: string;
2305
- name: string | null;
2306
- start: string | null;
2307
- prefix: string | null;
2308
- referenceId: string;
2309
- refillInterval: number | null;
2310
- refillAmount: number | null;
2311
- lastRefillAt: Date | null;
2312
- enabled: boolean;
2313
- rateLimitEnabled: boolean;
2314
- rateLimitTimeWindow: number | null;
2315
- rateLimitMax: number | null;
2316
- requestCount: number;
2317
- remaining: number | null;
2318
- lastRequest: Date | null;
2319
- expiresAt: Date | null;
2320
- createdAt: Date;
2321
- updatedAt: Date;
2322
- }, {
2323
- code?: string | undefined;
2324
- message?: string | undefined;
2325
- }, FetchOptions["throw"] extends true ? true : false>>;
2326
- };
2327
- } & {
2328
- apiKey: {
2329
- update: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
2330
- keyId: string;
2331
- configId?: string | undefined;
2332
- userId?: unknown;
2333
- name?: string | undefined;
2334
- enabled?: boolean | undefined;
2335
- remaining?: number | undefined;
2336
- refillAmount?: number | undefined;
2337
- refillInterval?: number | undefined;
2338
- metadata?: any;
2339
- expiresIn?: number | null | undefined;
2340
- rateLimitEnabled?: boolean | undefined;
2341
- rateLimitTimeWindow?: number | undefined;
2342
- rateLimitMax?: number | undefined;
2343
- permissions?: Record<string, string[]> | null | undefined;
2344
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
2345
- keyId: string;
2346
- configId?: string | undefined;
2347
- userId?: unknown;
2348
- name?: string | undefined;
2349
- enabled?: boolean | undefined;
2350
- remaining?: number | undefined;
2351
- refillAmount?: number | undefined;
2352
- refillInterval?: number | undefined;
2353
- metadata?: any;
2354
- expiresIn?: number | null | undefined;
2355
- rateLimitEnabled?: boolean | undefined;
2356
- rateLimitTimeWindow?: number | undefined;
2357
- rateLimitMax?: number | undefined;
2358
- permissions?: Record<string, string[]> | null | undefined;
2359
- } & {
2360
- fetchOptions?: FetchOptions | undefined;
2361
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
2362
- metadata: Record<string, any> | null;
2363
- permissions: {
2364
- [key: string]: string[];
2365
- } | null;
2366
- id: string;
2367
- configId: string;
2368
- name: string | null;
2369
- start: string | null;
2370
- prefix: string | null;
2371
- referenceId: string;
2372
- refillInterval: number | null;
2373
- refillAmount: number | null;
2374
- lastRefillAt: Date | null;
2375
- enabled: boolean;
2376
- rateLimitEnabled: boolean;
2377
- rateLimitTimeWindow: number | null;
2378
- rateLimitMax: number | null;
2379
- requestCount: number;
2380
- remaining: number | null;
2381
- lastRequest: Date | null;
2382
- expiresAt: Date | null;
2383
- createdAt: Date;
2384
- updatedAt: Date;
2385
- }, {
2386
- code?: string | undefined;
2387
- message?: string | undefined;
2388
- }, FetchOptions["throw"] extends true ? true : false>>;
2389
- };
2390
- } & {
2391
- apiKey: {
2392
- delete: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
2393
- keyId: string;
2394
- configId?: string | undefined;
2395
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
2396
- keyId: string;
2397
- configId?: string | undefined;
2398
- } & {
2399
- fetchOptions?: FetchOptions | undefined;
2400
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
2401
- success: boolean;
2402
- }, {
2403
- code?: string | undefined;
2404
- message?: string | undefined;
2405
- }, FetchOptions["throw"] extends true ? true : false>>;
2406
- };
2407
- } & {
2408
- apiKey: {
2409
- list: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
2410
- configId?: string | undefined;
2411
- organizationId?: string | undefined;
2412
- limit?: unknown;
2413
- offset?: unknown;
2414
- sortBy?: string | undefined;
2415
- sortDirection?: "asc" | "desc" | undefined;
2416
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
2417
- query?: {
2418
- configId?: string | undefined;
2419
- organizationId?: string | undefined;
2420
- limit?: unknown;
2421
- offset?: unknown;
2422
- sortBy?: string | undefined;
2423
- sortDirection?: "asc" | "desc" | undefined;
2424
- } | undefined;
2425
- fetchOptions?: FetchOptions | undefined;
2426
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
2427
- apiKeys: {
2428
- metadata: Record<string, any> | null;
2429
- permissions: {
2430
- [key: string]: string[];
2431
- } | null;
2432
- id: string;
2433
- configId: string;
2434
- name: string | null;
2435
- start: string | null;
2436
- prefix: string | null;
2437
- referenceId: string;
2438
- refillInterval: number | null;
2439
- refillAmount: number | null;
2440
- lastRefillAt: Date | null;
2441
- enabled: boolean;
2442
- rateLimitEnabled: boolean;
2443
- rateLimitTimeWindow: number | null;
2444
- rateLimitMax: number | null;
2445
- requestCount: number;
2446
- remaining: number | null;
2447
- lastRequest: Date | null;
2448
- expiresAt: Date | null;
2449
- createdAt: Date;
2450
- updatedAt: Date;
2451
- }[];
2452
- total: number;
2453
- limit: number | undefined;
2454
- offset: number | undefined;
2455
- }, {
2456
- code?: string | undefined;
2457
- message?: string | undefined;
2458
- }, FetchOptions["throw"] extends true ? true : false>>;
2459
- };
2460
- } & {
2461
- passkey: {
2462
- generateRegisterOptions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
2463
- authenticatorAttachment?: "platform" | "cross-platform" | undefined;
2464
- name?: string | undefined;
2465
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
2466
- query?: {
2467
- authenticatorAttachment?: "platform" | "cross-platform" | undefined;
2468
- name?: string | undefined;
2469
- } | undefined;
2470
- fetchOptions?: FetchOptions | undefined;
2471
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<import("@better-auth/passkey/client").PublicKeyCredentialCreationOptionsJSON, {
2472
- code?: string | undefined;
2473
- message?: string | undefined;
2474
- }, FetchOptions["throw"] extends true ? true : false>>;
2475
- };
2476
- } & {
2477
- passkey: {
2478
- generateAuthenticateOptions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
2479
- query?: Record<string, any> | undefined;
2480
- fetchOptions?: FetchOptions | undefined;
2481
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<import("@better-auth/passkey/client").PublicKeyCredentialRequestOptionsJSON, {
2482
- code?: string | undefined;
2483
- message?: string | undefined;
2484
- }, FetchOptions["throw"] extends true ? true : false>>;
2485
- };
2486
- } & {
2487
- passkey: {
2488
- verifyRegistration: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
2489
- response: any;
2490
- name?: string | undefined;
2491
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
2492
- response: any;
2493
- name?: string | undefined;
2494
- } & {
2495
- fetchOptions?: FetchOptions | undefined;
2496
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<import("@better-auth/passkey").Passkey, {
2497
- code?: string | undefined;
2498
- message?: string | undefined;
2499
- }, FetchOptions["throw"] extends true ? true : false>>;
2500
- };
2501
- } & {
2502
- passkey: {
2503
- verifyAuthentication: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
2504
- response: import("@better-auth/passkey/client").AuthenticationResponseJSON;
2505
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
2506
- response: import("@better-auth/passkey/client").AuthenticationResponseJSON;
2507
- } & {
2508
- fetchOptions?: FetchOptions | undefined;
2509
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
2510
- session: {
2511
- id: string;
2512
- createdAt: Date;
2513
- updatedAt: Date;
2514
- userId: string;
2515
- expiresAt: Date;
2516
- token: string;
2517
- ipAddress?: string | null | undefined;
2518
- userAgent?: string | null | undefined;
2519
- };
2520
- }, {
2521
- code?: string | undefined;
2522
- message?: string | undefined;
2523
- }, FetchOptions["throw"] extends true ? true : false>>;
2524
- };
2525
- } & {
2526
- passkey: {
2527
- listUserPasskeys: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
2528
- query?: Record<string, any> | undefined;
2529
- fetchOptions?: FetchOptions | undefined;
2530
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<import("@better-auth/passkey").Passkey[], {
2531
- code?: string | undefined;
2532
- message?: string | undefined;
2533
- }, FetchOptions["throw"] extends true ? true : false>>;
2534
- };
2535
- } & {
2536
- passkey: {
2537
- deletePasskey: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
2538
- id: string;
2539
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
2540
- id: string;
2541
- } & {
2542
- fetchOptions?: FetchOptions | undefined;
2543
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
2544
- status: boolean;
2545
- }, {
2546
- code?: string | undefined;
2547
- message?: string | undefined;
2548
- }, FetchOptions["throw"] extends true ? true : false>>;
2549
- };
2550
- } & {
2551
- passkey: {
2552
- updatePasskey: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
2553
- id: string;
2554
- name: string;
2555
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
2556
- id: string;
2557
- name: string;
2558
- } & {
2559
- fetchOptions?: FetchOptions | undefined;
2560
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
2561
- passkey: import("@better-auth/passkey").Passkey;
2562
- }, {
2563
- code?: string | undefined;
2564
- message?: string | undefined;
2565
- }, FetchOptions["throw"] extends true ? true : false>>;
2566
- };
2567
- } & {
2568
- signIn: {
2569
- passkey: (opts?: {
2570
- autoFill?: boolean;
2571
- fetchOptions?: import("better-auth").ClientFetchOption;
2572
- } | undefined, options?: import("better-auth").ClientFetchOption | undefined) => Promise<{
2573
- data: null;
2574
- error: {
2575
- message?: string | undefined;
2576
- status: number;
2577
- statusText: string;
2578
- };
2579
- } | {
2580
- data: {
2581
- session: import("better-auth").Session;
2582
- user: import("better-auth").User;
2583
- };
2584
- error: null;
2585
- } | {
2586
- data: null;
2587
- error: {
2588
- code: string;
2589
- message: string;
2590
- status: number;
2591
- statusText: string;
2592
- };
2593
- }>;
2594
- };
2595
- passkey: {
2596
- addPasskey: (opts?: {
2597
- fetchOptions?: import("better-auth").ClientFetchOption;
2598
- name?: string;
2599
- authenticatorAttachment?: "platform" | "cross-platform";
2600
- useAutoRegister?: boolean;
2601
- } | undefined, fetchOpts?: import("better-auth").ClientFetchOption | undefined) => Promise<{
2602
- data: null;
2603
- error: {
2604
- message?: string | undefined;
2605
- status: number;
2606
- statusText: string;
2607
- };
2608
- } | {
2609
- data: import("@better-auth/passkey").Passkey;
2610
- error: null;
2611
- } | {
2612
- data: null;
2613
- error: {
2614
- code: string;
2615
- message: string;
2616
- status: number;
2617
- statusText: string;
2618
- };
2619
- }>;
2620
- };
2621
- $Infer: {
2622
- Passkey: import("@better-auth/passkey").Passkey;
2623
- };
2624
1519
  } & {
2625
1520
  useSession: () => {
2626
1521
  data: {
@@ -2759,46 +1654,6 @@ export declare function createPayloadAuthClient(options?: PayloadAuthClientOptio
2759
1654
  INVALID_CODE: import("better-auth").RawError<"INVALID_CODE">;
2760
1655
  TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("better-auth").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
2761
1656
  INVALID_TWO_FACTOR_COOKIE: import("better-auth").RawError<"INVALID_TWO_FACTOR_COOKIE">;
2762
- } & {
2763
- INVALID_METADATA_TYPE: import("better-auth").RawError<"INVALID_METADATA_TYPE">;
2764
- REFILL_AMOUNT_AND_INTERVAL_REQUIRED: import("better-auth").RawError<"REFILL_AMOUNT_AND_INTERVAL_REQUIRED">;
2765
- REFILL_INTERVAL_AND_AMOUNT_REQUIRED: import("better-auth").RawError<"REFILL_INTERVAL_AND_AMOUNT_REQUIRED">;
2766
- USER_BANNED: import("better-auth").RawError<"USER_BANNED">;
2767
- UNAUTHORIZED_SESSION: import("better-auth").RawError<"UNAUTHORIZED_SESSION">;
2768
- KEY_NOT_FOUND: import("better-auth").RawError<"KEY_NOT_FOUND">;
2769
- KEY_DISABLED: import("better-auth").RawError<"KEY_DISABLED">;
2770
- KEY_EXPIRED: import("better-auth").RawError<"KEY_EXPIRED">;
2771
- USAGE_EXCEEDED: import("better-auth").RawError<"USAGE_EXCEEDED">;
2772
- KEY_NOT_RECOVERABLE: import("better-auth").RawError<"KEY_NOT_RECOVERABLE">;
2773
- EXPIRES_IN_IS_TOO_SMALL: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_SMALL">;
2774
- EXPIRES_IN_IS_TOO_LARGE: import("better-auth").RawError<"EXPIRES_IN_IS_TOO_LARGE">;
2775
- INVALID_REMAINING: import("better-auth").RawError<"INVALID_REMAINING">;
2776
- INVALID_PREFIX_LENGTH: import("better-auth").RawError<"INVALID_PREFIX_LENGTH">;
2777
- INVALID_NAME_LENGTH: import("better-auth").RawError<"INVALID_NAME_LENGTH">;
2778
- METADATA_DISABLED: import("better-auth").RawError<"METADATA_DISABLED">;
2779
- RATE_LIMIT_EXCEEDED: import("better-auth").RawError<"RATE_LIMIT_EXCEEDED">;
2780
- NO_VALUES_TO_UPDATE: import("better-auth").RawError<"NO_VALUES_TO_UPDATE">;
2781
- KEY_DISABLED_EXPIRATION: import("better-auth").RawError<"KEY_DISABLED_EXPIRATION">;
2782
- INVALID_API_KEY: import("better-auth").RawError<"INVALID_API_KEY">;
2783
- INVALID_USER_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_USER_ID_FROM_API_KEY">;
2784
- INVALID_REFERENCE_ID_FROM_API_KEY: import("better-auth").RawError<"INVALID_REFERENCE_ID_FROM_API_KEY">;
2785
- INVALID_API_KEY_GETTER_RETURN_TYPE: import("better-auth").RawError<"INVALID_API_KEY_GETTER_RETURN_TYPE">;
2786
- SERVER_ONLY_PROPERTY: import("better-auth").RawError<"SERVER_ONLY_PROPERTY">;
2787
- FAILED_TO_UPDATE_API_KEY: import("better-auth").RawError<"FAILED_TO_UPDATE_API_KEY">;
2788
- NAME_REQUIRED: import("better-auth").RawError<"NAME_REQUIRED">;
2789
- ORGANIZATION_ID_REQUIRED: import("better-auth").RawError<"ORGANIZATION_ID_REQUIRED">;
2790
- USER_NOT_MEMBER_OF_ORGANIZATION: import("better-auth").RawError<"USER_NOT_MEMBER_OF_ORGANIZATION">;
2791
- INSUFFICIENT_API_KEY_PERMISSIONS: import("better-auth").RawError<"INSUFFICIENT_API_KEY_PERMISSIONS">;
2792
- NO_DEFAULT_API_KEY_CONFIGURATION_FOUND: import("better-auth").RawError<"NO_DEFAULT_API_KEY_CONFIGURATION_FOUND">;
2793
- ORGANIZATION_PLUGIN_REQUIRED: import("better-auth").RawError<"ORGANIZATION_PLUGIN_REQUIRED">;
2794
- } & {
2795
- CHALLENGE_NOT_FOUND: import("better-auth").RawError<"CHALLENGE_NOT_FOUND">;
2796
- YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY">;
2797
- FAILED_TO_VERIFY_REGISTRATION: import("better-auth").RawError<"FAILED_TO_VERIFY_REGISTRATION">;
2798
- PASSKEY_NOT_FOUND: import("better-auth").RawError<"PASSKEY_NOT_FOUND">;
2799
- AUTHENTICATION_FAILED: import("better-auth").RawError<"AUTHENTICATION_FAILED">;
2800
- UNABLE_TO_CREATE_SESSION: import("better-auth").RawError<"UNABLE_TO_CREATE_SESSION">;
2801
- FAILED_TO_UPDATE_PASSKEY: import("better-auth").RawError<"FAILED_TO_UPDATE_PASSKEY">;
2802
1657
  } & {
2803
1658
  USER_NOT_FOUND: import("better-auth").RawError<"USER_NOT_FOUND">;
2804
1659
  FAILED_TO_CREATE_USER: import("better-auth").RawError<"FAILED_TO_CREATE_USER">;