@delmaredigital/payload-better-auth 0.5.2 → 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,24 +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 { passkeyClient } from '@better-auth/passkey/client';
8
12
  /**
9
- * Default plugins included with Payload Better Auth.
10
- * 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.
11
15
  *
12
- * @example With custom plugins (full type safety)
16
+ * @example
13
17
  * ```typescript
14
18
  * import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
15
- * import { stripeClient } from '@better-auth/stripe/client'
19
+ * import { passkeyClient } from '@better-auth/passkey/client'
20
+ * import { apiKeyClient } from '@better-auth/api-key/client'
16
21
  *
17
22
  * export const authClient = createAuthClient({
18
- * plugins: [...payloadAuthPlugins, stripeClient({ subscription: true })],
23
+ * plugins: [...payloadAuthPlugins, passkeyClient(), apiKeyClient()],
19
24
  * })
20
- *
21
- * // authClient.subscription is fully typed!
22
25
  * ```
23
26
  */
24
27
  export declare const payloadAuthPlugins: readonly [{
@@ -521,654 +524,40 @@ export declare const payloadAuthPlugins: readonly [{
521
524
  properties: {
522
525
  totpURI: {
523
526
  type: string;
524
- };
525
- };
526
- };
527
- };
528
- };
529
- };
530
- };
531
- };
532
- };
533
- }, {
534
- totpURI: string;
535
- }>;
536
- verifyTOTP: import("better-auth").StrictEndpoint<"/two-factor/verify-totp", {
537
- method: "POST";
538
- body: import("better-auth").ZodObject<{
539
- code: import("better-auth").ZodString;
540
- trustDevice: import("better-auth").ZodOptional<import("better-auth").ZodBoolean>;
541
- }, import("better-auth").$strip>;
542
- metadata: {
543
- openapi: {
544
- summary: string;
545
- description: string;
546
- responses: {
547
- 200: {
548
- description: string;
549
- content: {
550
- "application/json": {
551
- schema: {
552
- type: "object";
553
- properties: {
554
- status: {
555
- type: string;
556
- };
557
- };
558
- };
559
- };
560
- };
561
- };
562
- };
563
- };
564
- };
565
- }, {
566
- token: string;
567
- user: import("better-auth/plugins").UserWithTwoFactor;
568
- } | {
569
- token: string;
570
- user: Record<string, any> & {
571
- id: string;
572
- createdAt: Date;
573
- updatedAt: Date;
574
- email: string;
575
- emailVerified: boolean;
576
- name: string;
577
- image?: string | null | undefined;
578
- };
579
- }>;
580
- };
581
- options: NoInfer<O>;
582
- hooks: {
583
- after: {
584
- matcher(context: import("better-auth").HookEndpointContext): boolean;
585
- handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
586
- twoFactorRedirect: boolean;
587
- } | undefined>;
588
- }[];
589
- };
590
- schema: {
591
- user: {
592
- fields: {
593
- twoFactorEnabled: {
594
- type: "boolean";
595
- required: false;
596
- defaultValue: false;
597
- input: false;
598
- };
599
- };
600
- };
601
- twoFactor: {
602
- fields: {
603
- secret: {
604
- type: "string";
605
- required: true;
606
- returned: false;
607
- index: true;
608
- };
609
- backupCodes: {
610
- type: "string";
611
- required: true;
612
- returned: false;
613
- };
614
- userId: {
615
- type: "string";
616
- required: true;
617
- returned: false;
618
- references: {
619
- model: string;
620
- field: string;
621
- };
622
- index: true;
623
- };
624
- };
625
- };
626
- };
627
- rateLimit: {
628
- pathMatcher(path: string): boolean;
629
- window: number;
630
- max: number;
631
- }[];
632
- $ERROR_CODES: {
633
- OTP_NOT_ENABLED: import("better-auth").RawError<"OTP_NOT_ENABLED">;
634
- OTP_HAS_EXPIRED: import("better-auth").RawError<"OTP_HAS_EXPIRED">;
635
- TOTP_NOT_ENABLED: import("better-auth").RawError<"TOTP_NOT_ENABLED">;
636
- TWO_FACTOR_NOT_ENABLED: import("better-auth").RawError<"TWO_FACTOR_NOT_ENABLED">;
637
- BACKUP_CODES_NOT_ENABLED: import("better-auth").RawError<"BACKUP_CODES_NOT_ENABLED">;
638
- INVALID_BACKUP_CODE: import("better-auth").RawError<"INVALID_BACKUP_CODE">;
639
- INVALID_CODE: import("better-auth").RawError<"INVALID_CODE">;
640
- TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("better-auth").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
641
- INVALID_TWO_FACTOR_COOKIE: import("better-auth").RawError<"INVALID_TWO_FACTOR_COOKIE">;
642
- };
643
- })>;
644
- atomListeners: {
645
- matcher: (path: string) => boolean;
646
- signal: "$sessionSignal";
647
- }[];
648
- pathMethods: {
649
- "/two-factor/disable": "POST";
650
- "/two-factor/enable": "POST";
651
- "/two-factor/send-otp": "POST";
652
- "/two-factor/generate-backup-codes": "POST";
653
- "/two-factor/get-totp-uri": "POST";
654
- "/two-factor/verify-totp": "POST";
655
- "/two-factor/verify-otp": "POST";
656
- "/two-factor/verify-backup-code": "POST";
657
- };
658
- fetchPlugins: {
659
- id: string;
660
- name: string;
661
- hooks: {
662
- onSuccess(context: import("better-auth/react").SuccessContext<any>): Promise<void>;
663
- };
664
- }[];
665
- $ERROR_CODES: {
666
- OTP_NOT_ENABLED: import("better-auth").RawError<"OTP_NOT_ENABLED">;
667
- OTP_HAS_EXPIRED: import("better-auth").RawError<"OTP_HAS_EXPIRED">;
668
- TOTP_NOT_ENABLED: import("better-auth").RawError<"TOTP_NOT_ENABLED">;
669
- TWO_FACTOR_NOT_ENABLED: import("better-auth").RawError<"TWO_FACTOR_NOT_ENABLED">;
670
- BACKUP_CODES_NOT_ENABLED: import("better-auth").RawError<"BACKUP_CODES_NOT_ENABLED">;
671
- INVALID_BACKUP_CODE: import("better-auth").RawError<"INVALID_BACKUP_CODE">;
672
- INVALID_CODE: import("better-auth").RawError<"INVALID_CODE">;
673
- TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("better-auth").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
674
- INVALID_TWO_FACTOR_COOKIE: import("better-auth").RawError<"INVALID_TWO_FACTOR_COOKIE">;
675
- };
676
- }, {
677
- id: "passkey";
678
- $InferServerPlugin: ReturnType<(options?: import("@better-auth/passkey").PasskeyOptions | undefined) => {
679
- id: "passkey";
680
- endpoints: {
681
- generatePasskeyRegistrationOptions: import("better-auth").StrictEndpoint<"/passkey/generate-register-options", {
682
- method: "GET";
683
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
684
- session: {
685
- session: Record<string, any> & {
686
- id: string;
687
- createdAt: Date;
688
- updatedAt: Date;
689
- userId: string;
690
- expiresAt: Date;
691
- token: string;
692
- ipAddress?: string | null | undefined;
693
- userAgent?: string | null | undefined;
694
- };
695
- user: Record<string, any> & {
696
- id: string;
697
- createdAt: Date;
698
- updatedAt: Date;
699
- email: string;
700
- emailVerified: boolean;
701
- name: string;
702
- image?: string | null | undefined;
703
- };
704
- };
705
- }>)[];
706
- query: import("better-auth").ZodOptional<import("better-auth").ZodObject<{
707
- authenticatorAttachment: import("better-auth").ZodOptional<import("better-auth").ZodEnum<{
708
- platform: "platform";
709
- "cross-platform": "cross-platform";
710
- }>>;
711
- name: import("better-auth").ZodOptional<import("better-auth").ZodString>;
712
- }, import("better-auth").$strip>>;
713
- metadata: {
714
- openapi: {
715
- operationId: string;
716
- description: string;
717
- responses: {
718
- 200: {
719
- description: string;
720
- parameters: {
721
- query: {
722
- authenticatorAttachment: {
723
- description: string;
724
- required: boolean;
725
- };
726
- name: {
727
- description: string;
728
- required: boolean;
729
- };
730
- };
731
- };
732
- content: {
733
- "application/json": {
734
- schema: {
735
- type: "object";
736
- properties: {
737
- challenge: {
738
- type: string;
739
- };
740
- rp: {
741
- type: string;
742
- properties: {
743
- name: {
744
- type: string;
745
- };
746
- id: {
747
- type: string;
748
- };
749
- };
750
- };
751
- user: {
752
- type: string;
753
- properties: {
754
- id: {
755
- type: string;
756
- };
757
- name: {
758
- type: string;
759
- };
760
- displayName: {
761
- type: string;
762
- };
763
- };
764
- };
765
- pubKeyCredParams: {
766
- type: string;
767
- items: {
768
- type: string;
769
- properties: {
770
- type: {
771
- type: string;
772
- };
773
- alg: {
774
- type: string;
775
- };
776
- };
777
- };
778
- };
779
- timeout: {
780
- type: string;
781
- };
782
- excludeCredentials: {
783
- type: string;
784
- items: {
785
- type: string;
786
- properties: {
787
- id: {
788
- type: string;
789
- };
790
- type: {
791
- type: string;
792
- };
793
- transports: {
794
- type: string;
795
- items: {
796
- type: string;
797
- };
798
- };
799
- };
800
- };
801
- };
802
- authenticatorSelection: {
803
- type: string;
804
- properties: {
805
- authenticatorAttachment: {
806
- type: string;
807
- };
808
- requireResidentKey: {
809
- type: string;
810
- };
811
- userVerification: {
812
- type: string;
813
- };
814
- };
815
- };
816
- attestation: {
817
- type: string;
818
- };
819
- extensions: {
820
- type: string;
821
- };
822
- };
823
- };
824
- };
825
- };
826
- };
827
- };
828
- };
829
- };
830
- }, import("@better-auth/passkey/client").PublicKeyCredentialCreationOptionsJSON>;
831
- generatePasskeyAuthenticationOptions: import("better-auth").StrictEndpoint<"/passkey/generate-authenticate-options", {
832
- method: "GET";
833
- metadata: {
834
- openapi: {
835
- operationId: string;
836
- description: string;
837
- responses: {
838
- 200: {
839
- description: string;
840
- content: {
841
- "application/json": {
842
- schema: {
843
- type: "object";
844
- properties: {
845
- challenge: {
846
- type: string;
847
- };
848
- rp: {
849
- type: string;
850
- properties: {
851
- name: {
852
- type: string;
853
- };
854
- id: {
855
- type: string;
856
- };
857
- };
858
- };
859
- user: {
860
- type: string;
861
- properties: {
862
- id: {
863
- type: string;
864
- };
865
- name: {
866
- type: string;
867
- };
868
- displayName: {
869
- type: string;
870
- };
871
- };
872
- };
873
- timeout: {
874
- type: string;
875
- };
876
- allowCredentials: {
877
- type: string;
878
- items: {
879
- type: string;
880
- properties: {
881
- id: {
882
- type: string;
883
- };
884
- type: {
885
- type: string;
886
- };
887
- transports: {
888
- type: string;
889
- items: {
890
- type: string;
891
- };
892
- };
893
- };
894
- };
895
- };
896
- userVerification: {
897
- type: string;
898
- };
899
- authenticatorSelection: {
900
- type: string;
901
- properties: {
902
- authenticatorAttachment: {
903
- type: string;
904
- };
905
- requireResidentKey: {
906
- type: string;
907
- };
908
- userVerification: {
909
- type: string;
910
- };
911
- };
912
- };
913
- extensions: {
914
- type: string;
915
- };
916
- };
917
- };
918
- };
919
- };
920
- };
921
- };
922
- };
923
- };
924
- }, import("@better-auth/passkey/client").PublicKeyCredentialRequestOptionsJSON>;
925
- verifyPasskeyRegistration: import("better-auth").StrictEndpoint<"/passkey/verify-registration", {
926
- method: "POST";
927
- body: import("better-auth").ZodObject<{
928
- response: import("better-auth").ZodAny;
929
- name: import("better-auth").ZodOptional<import("better-auth").ZodString>;
930
- }, import("better-auth").$strip>;
931
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
932
- session: {
933
- session: Record<string, any> & {
934
- id: string;
935
- createdAt: Date;
936
- updatedAt: Date;
937
- userId: string;
938
- expiresAt: Date;
939
- token: string;
940
- ipAddress?: string | null | undefined;
941
- userAgent?: string | null | undefined;
942
- };
943
- user: Record<string, any> & {
944
- id: string;
945
- createdAt: Date;
946
- updatedAt: Date;
947
- email: string;
948
- emailVerified: boolean;
949
- name: string;
950
- image?: string | null | undefined;
951
- };
952
- };
953
- }>)[];
954
- metadata: {
955
- openapi: {
956
- operationId: string;
957
- description: string;
958
- responses: {
959
- 200: {
960
- description: string;
961
- content: {
962
- "application/json": {
963
- schema: {
964
- $ref: string;
965
- };
966
- };
967
- };
968
- };
969
- 400: {
970
- description: string;
971
- };
972
- };
973
- };
974
- };
975
- }, import("@better-auth/passkey").Passkey>;
976
- verifyPasskeyAuthentication: import("better-auth").StrictEndpoint<"/passkey/verify-authentication", {
977
- method: "POST";
978
- body: import("better-auth").ZodObject<{
979
- response: import("better-auth").ZodRecord<import("better-auth").ZodAny, import("better-auth").ZodAny>;
980
- }, import("better-auth").$strip>;
981
- metadata: {
982
- openapi: {
983
- operationId: string;
984
- description: string;
985
- responses: {
986
- 200: {
987
- description: string;
988
- content: {
989
- "application/json": {
990
- schema: {
991
- type: "object";
992
- properties: {
993
- session: {
994
- $ref: string;
995
- };
996
- user: {
997
- $ref: string;
998
- };
999
- };
1000
- };
1001
- };
1002
- };
1003
- };
1004
- };
1005
- };
1006
- $Infer: {
1007
- body: {
1008
- response: import("@better-auth/passkey/client").AuthenticationResponseJSON;
1009
- };
1010
- };
1011
- };
1012
- }, {
1013
- session: {
1014
- id: string;
1015
- createdAt: Date;
1016
- updatedAt: Date;
1017
- userId: string;
1018
- expiresAt: Date;
1019
- token: string;
1020
- ipAddress?: string | null | undefined;
1021
- userAgent?: string | null | undefined;
1022
- };
1023
- }>;
1024
- listPasskeys: import("better-auth").StrictEndpoint<"/passkey/list-user-passkeys", {
1025
- method: "GET";
1026
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1027
- session: {
1028
- session: Record<string, any> & {
1029
- id: string;
1030
- createdAt: Date;
1031
- updatedAt: Date;
1032
- userId: string;
1033
- expiresAt: Date;
1034
- token: string;
1035
- ipAddress?: string | null | undefined;
1036
- userAgent?: string | null | undefined;
1037
- };
1038
- user: Record<string, any> & {
1039
- id: string;
1040
- createdAt: Date;
1041
- updatedAt: Date;
1042
- email: string;
1043
- emailVerified: boolean;
1044
- name: string;
1045
- image?: string | null | undefined;
1046
- };
1047
- };
1048
- }>)[];
1049
- metadata: {
1050
- openapi: {
1051
- description: string;
1052
- responses: {
1053
- "200": {
1054
- description: string;
1055
- content: {
1056
- "application/json": {
1057
- schema: {
1058
- type: "array";
1059
- items: {
1060
- $ref: string;
1061
- required: string[];
1062
- };
1063
- description: string;
1064
- };
1065
- };
1066
- };
1067
- };
1068
- };
1069
- };
1070
- };
1071
- }, import("@better-auth/passkey").Passkey[]>;
1072
- deletePasskey: import("better-auth").StrictEndpoint<"/passkey/delete-passkey", {
1073
- method: "POST";
1074
- body: import("better-auth").ZodObject<{
1075
- id: import("better-auth").ZodString;
1076
- }, import("better-auth").$strip>;
1077
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1078
- session: {
1079
- session: Record<string, any> & {
1080
- id: string;
1081
- createdAt: Date;
1082
- updatedAt: Date;
1083
- userId: string;
1084
- expiresAt: Date;
1085
- token: string;
1086
- ipAddress?: string | null | undefined;
1087
- userAgent?: string | null | undefined;
1088
- };
1089
- user: Record<string, any> & {
1090
- id: string;
1091
- createdAt: Date;
1092
- updatedAt: Date;
1093
- email: string;
1094
- emailVerified: boolean;
1095
- name: string;
1096
- image?: string | null | undefined;
1097
- };
1098
- };
1099
- }>)[];
1100
- metadata: {
1101
- openapi: {
1102
- description: string;
1103
- responses: {
1104
- "200": {
1105
- description: string;
1106
- content: {
1107
- "application/json": {
1108
- schema: {
1109
- type: "object";
1110
- properties: {
1111
- status: {
1112
- type: string;
1113
- description: string;
1114
- };
1115
- };
1116
- required: string[];
1117
- };
1118
- };
1119
- };
1120
- };
1121
- };
1122
- };
1123
- };
1124
- }, {
1125
- status: boolean;
1126
- }>;
1127
- updatePasskey: import("better-auth").StrictEndpoint<"/passkey/update-passkey", {
1128
- method: "POST";
1129
- body: import("better-auth").ZodObject<{
1130
- id: import("better-auth").ZodString;
1131
- name: import("better-auth").ZodString;
1132
- }, import("better-auth").$strip>;
1133
- use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1134
- session: {
1135
- session: Record<string, any> & {
1136
- id: string;
1137
- createdAt: Date;
1138
- updatedAt: Date;
1139
- userId: string;
1140
- expiresAt: Date;
1141
- token: string;
1142
- ipAddress?: string | null | undefined;
1143
- userAgent?: string | null | undefined;
1144
- };
1145
- user: Record<string, any> & {
1146
- id: string;
1147
- createdAt: Date;
1148
- updatedAt: Date;
1149
- email: string;
1150
- emailVerified: boolean;
1151
- name: string;
1152
- image?: string | null | undefined;
527
+ };
528
+ };
529
+ };
530
+ };
531
+ };
532
+ };
1153
533
  };
1154
534
  };
1155
- }>)[];
535
+ };
536
+ }, {
537
+ totpURI: string;
538
+ }>;
539
+ verifyTOTP: import("better-auth").StrictEndpoint<"/two-factor/verify-totp", {
540
+ method: "POST";
541
+ body: import("better-auth").ZodObject<{
542
+ code: import("better-auth").ZodString;
543
+ trustDevice: import("better-auth").ZodOptional<import("better-auth").ZodBoolean>;
544
+ }, import("better-auth").$strip>;
1156
545
  metadata: {
1157
546
  openapi: {
547
+ summary: string;
1158
548
  description: string;
1159
549
  responses: {
1160
- "200": {
550
+ 200: {
1161
551
  description: string;
1162
552
  content: {
1163
553
  "application/json": {
1164
554
  schema: {
1165
555
  type: "object";
1166
556
  properties: {
1167
- passkey: {
1168
- $ref: string;
557
+ status: {
558
+ type: string;
1169
559
  };
1170
560
  };
1171
- required: string[];
1172
561
  };
1173
562
  };
1174
563
  };
@@ -1177,153 +566,115 @@ export declare const payloadAuthPlugins: readonly [{
1177
566
  };
1178
567
  };
1179
568
  }, {
1180
- passkey: import("@better-auth/passkey").Passkey;
569
+ token: string;
570
+ user: import("better-auth/plugins").UserWithTwoFactor;
571
+ } | {
572
+ token: string;
573
+ user: Record<string, any> & {
574
+ id: string;
575
+ createdAt: Date;
576
+ updatedAt: Date;
577
+ email: string;
578
+ emailVerified: boolean;
579
+ name: string;
580
+ image?: string | null | undefined;
581
+ };
1181
582
  }>;
1182
583
  };
584
+ options: NoInfer<O>;
585
+ hooks: {
586
+ after: {
587
+ matcher(context: import("better-auth").HookEndpointContext): boolean;
588
+ handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
589
+ twoFactorRedirect: boolean;
590
+ } | undefined>;
591
+ }[];
592
+ };
1183
593
  schema: {
1184
- passkey: {
594
+ user: {
1185
595
  fields: {
1186
- name: {
1187
- type: "string";
596
+ twoFactorEnabled: {
597
+ type: "boolean";
1188
598
  required: false;
599
+ defaultValue: false;
600
+ input: false;
601
+ };
602
+ };
603
+ };
604
+ twoFactor: {
605
+ fields: {
606
+ secret: {
607
+ type: "string";
608
+ required: true;
609
+ returned: false;
610
+ index: true;
1189
611
  };
1190
- publicKey: {
612
+ backupCodes: {
1191
613
  type: "string";
1192
614
  required: true;
615
+ returned: false;
1193
616
  };
1194
617
  userId: {
1195
618
  type: "string";
619
+ required: true;
620
+ returned: false;
1196
621
  references: {
1197
622
  model: string;
1198
623
  field: string;
1199
624
  };
1200
- required: true;
1201
- index: true;
1202
- };
1203
- credentialID: {
1204
- type: "string";
1205
- required: true;
1206
625
  index: true;
1207
626
  };
1208
- counter: {
1209
- type: "number";
1210
- required: true;
1211
- };
1212
- deviceType: {
1213
- type: "string";
1214
- required: true;
1215
- };
1216
- backedUp: {
1217
- type: "boolean";
1218
- required: true;
1219
- };
1220
- transports: {
1221
- type: "string";
1222
- required: false;
1223
- };
1224
- createdAt: {
1225
- type: "date";
1226
- required: false;
1227
- };
1228
- aaguid: {
1229
- type: "string";
1230
- required: false;
1231
- };
1232
627
  };
1233
628
  };
1234
629
  };
630
+ rateLimit: {
631
+ pathMatcher(path: string): boolean;
632
+ window: number;
633
+ max: number;
634
+ }[];
1235
635
  $ERROR_CODES: {
1236
- CHALLENGE_NOT_FOUND: import("better-auth").RawError<"CHALLENGE_NOT_FOUND">;
1237
- YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY">;
1238
- FAILED_TO_VERIFY_REGISTRATION: import("better-auth").RawError<"FAILED_TO_VERIFY_REGISTRATION">;
1239
- PASSKEY_NOT_FOUND: import("better-auth").RawError<"PASSKEY_NOT_FOUND">;
1240
- AUTHENTICATION_FAILED: import("better-auth").RawError<"AUTHENTICATION_FAILED">;
1241
- UNABLE_TO_CREATE_SESSION: import("better-auth").RawError<"UNABLE_TO_CREATE_SESSION">;
1242
- FAILED_TO_UPDATE_PASSKEY: import("better-auth").RawError<"FAILED_TO_UPDATE_PASSKEY">;
1243
- };
1244
- options: import("@better-auth/passkey").PasskeyOptions | undefined;
1245
- }>;
1246
- getActions: ($fetch: import("better-auth/react").BetterFetch, $store: import("better-auth").ClientStore) => {
1247
- signIn: {
1248
- passkey: (opts?: {
1249
- autoFill?: boolean;
1250
- fetchOptions?: import("better-auth").ClientFetchOption;
1251
- } | undefined, options?: import("better-auth").ClientFetchOption | undefined) => Promise<{
1252
- data: null;
1253
- error: {
1254
- message?: string | undefined;
1255
- status: number;
1256
- statusText: string;
1257
- };
1258
- } | {
1259
- data: {
1260
- session: import("better-auth").Session;
1261
- user: import("better-auth").User;
1262
- };
1263
- error: null;
1264
- } | {
1265
- data: null;
1266
- error: {
1267
- code: string;
1268
- message: string;
1269
- status: number;
1270
- statusText: string;
1271
- };
1272
- }>;
1273
- };
1274
- passkey: {
1275
- addPasskey: (opts?: {
1276
- fetchOptions?: import("better-auth").ClientFetchOption;
1277
- name?: string;
1278
- authenticatorAttachment?: "platform" | "cross-platform";
1279
- useAutoRegister?: boolean;
1280
- } | undefined, fetchOpts?: import("better-auth").ClientFetchOption | undefined) => Promise<{
1281
- data: null;
1282
- error: {
1283
- message?: string | undefined;
1284
- status: number;
1285
- statusText: string;
1286
- };
1287
- } | {
1288
- data: import("@better-auth/passkey").Passkey;
1289
- error: null;
1290
- } | {
1291
- data: null;
1292
- error: {
1293
- code: string;
1294
- message: string;
1295
- status: number;
1296
- statusText: string;
1297
- };
1298
- }>;
1299
- };
1300
- $Infer: {
1301
- 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">;
1302
645
  };
1303
- };
1304
- getAtoms($fetch: import("better-auth/react").BetterFetch): {
1305
- listPasskeys: import("better-auth/client").AuthQueryAtom<import("@better-auth/passkey").Passkey[]>;
1306
- $listPasskeys: import("better-auth/react").PreinitializedWritableAtom<any> & object;
1307
- };
646
+ })>;
647
+ atomListeners: {
648
+ matcher: (path: string) => boolean;
649
+ signal: "$sessionSignal";
650
+ }[];
1308
651
  pathMethods: {
1309
- "/passkey/register": "POST";
1310
- "/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";
1311
660
  };
1312
- atomListeners: ({
1313
- matcher(path: string): path is "/passkey/delete-passkey" | "/passkey/update-passkey" | "/passkey/verify-registration" | "/sign-out";
1314
- signal: "$listPasskeys";
1315
- } | {
1316
- matcher: (path: string) => path is "/passkey/verify-authentication";
1317
- signal: "$sessionSignal";
1318
- })[];
661
+ fetchPlugins: {
662
+ id: string;
663
+ name: string;
664
+ hooks: {
665
+ onSuccess(context: import("better-auth/react").SuccessContext<any>): Promise<void>;
666
+ };
667
+ }[];
1319
668
  $ERROR_CODES: {
1320
- CHALLENGE_NOT_FOUND: import("better-auth").RawError<"CHALLENGE_NOT_FOUND">;
1321
- YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY">;
1322
- FAILED_TO_VERIFY_REGISTRATION: import("better-auth").RawError<"FAILED_TO_VERIFY_REGISTRATION">;
1323
- PASSKEY_NOT_FOUND: import("better-auth").RawError<"PASSKEY_NOT_FOUND">;
1324
- AUTHENTICATION_FAILED: import("better-auth").RawError<"AUTHENTICATION_FAILED">;
1325
- UNABLE_TO_CREATE_SESSION: import("better-auth").RawError<"UNABLE_TO_CREATE_SESSION">;
1326
- 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">;
1327
678
  };
1328
679
  }];
1329
680
  export interface PayloadAuthClientOptions {
@@ -1331,41 +682,30 @@ export interface PayloadAuthClientOptions {
1331
682
  baseURL?: string;
1332
683
  }
1333
684
  /**
1334
- * Create a pre-configured auth client with default plugins (twoFactor, passkey).
685
+ * Create a pre-configured auth client with default core plugins (twoFactor).
1335
686
  *
1336
- * This is a convenience wrapper for simple setups. For custom plugins with full type
1337
- * safety, use `createAuthClient` with `payloadAuthPlugins` instead.
687
+ * For passkeys, API keys, or other optional plugins, use `createAuthClient` directly:
1338
688
  *
1339
- * @param options - Optional configuration
1340
- * @param options.baseURL - Base URL for auth endpoints (defaults to window.location.origin)
1341
- *
1342
- * @example Basic usage (no custom plugins)
689
+ * @example Basic usage
1343
690
  * ```typescript
1344
691
  * import { createPayloadAuthClient } from '@delmaredigital/payload-better-auth/client'
1345
- *
1346
692
  * export const authClient = createPayloadAuthClient()
1347
693
  * ```
1348
694
  *
1349
- * @example With custom plugins (use createAuthClient for full type safety)
695
+ * @example With optional plugins
1350
696
  * ```typescript
1351
697
  * import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
1352
- * import { stripeClient } from '@better-auth/stripe/client'
698
+ * import { passkeyClient } from '@better-auth/passkey/client'
1353
699
  *
1354
700
  * export const authClient = createAuthClient({
1355
- * plugins: [...payloadAuthPlugins, stripeClient({ subscription: true })],
701
+ * plugins: [...payloadAuthPlugins, passkeyClient()],
1356
702
  * })
1357
703
  * ```
1358
704
  */
1359
705
  export declare function createPayloadAuthClient(options?: PayloadAuthClientOptions): {
1360
- useListPasskeys: () => {
1361
- data: import("@better-auth/passkey").Passkey[] | null;
1362
- error: null | import("better-auth/react").BetterFetchError;
1363
- isPending: boolean;
1364
- isRefetching: boolean;
1365
- refetch: (queryParams?: {
1366
- query?: import("better-auth").SessionQueryParams;
1367
- } | undefined) => Promise<void>;
1368
- };
706
+ updateSession: any;
707
+ } & {
708
+ updateUser: any;
1369
709
  } & {
1370
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<{
1371
711
  query?: Record<string, any> | undefined;
@@ -1899,10 +1239,6 @@ export declare function createPayloadAuthClient(options?: PayloadAuthClientOptio
1899
1239
  message?: string | undefined;
1900
1240
  }, FetchOptions["throw"] extends true ? true : false>>;
1901
1241
  };
1902
- } & {
1903
- updateSession: any;
1904
- } & {
1905
- updateUser: any;
1906
1242
  } & {
1907
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<{
1908
1244
  query?: Record<string, any> | undefined;
@@ -2180,170 +1516,6 @@ export declare function createPayloadAuthClient(options?: PayloadAuthClientOptio
2180
1516
  message?: string | undefined;
2181
1517
  }, FetchOptions["throw"] extends true ? true : false>>;
2182
1518
  };
2183
- } & {
2184
- passkey: {
2185
- generateRegisterOptions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<{
2186
- authenticatorAttachment?: "platform" | "cross-platform" | undefined;
2187
- name?: string | undefined;
2188
- }> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
2189
- query?: {
2190
- authenticatorAttachment?: "platform" | "cross-platform" | undefined;
2191
- name?: string | undefined;
2192
- } | undefined;
2193
- fetchOptions?: FetchOptions | undefined;
2194
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<import("@better-auth/passkey/client").PublicKeyCredentialCreationOptionsJSON, {
2195
- code?: string | undefined;
2196
- message?: string | undefined;
2197
- }, FetchOptions["throw"] extends true ? true : false>>;
2198
- };
2199
- } & {
2200
- passkey: {
2201
- 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<{
2202
- query?: Record<string, any> | undefined;
2203
- fetchOptions?: FetchOptions | undefined;
2204
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<import("@better-auth/passkey/client").PublicKeyCredentialRequestOptionsJSON, {
2205
- code?: string | undefined;
2206
- message?: string | undefined;
2207
- }, FetchOptions["throw"] extends true ? true : false>>;
2208
- };
2209
- } & {
2210
- passkey: {
2211
- verifyRegistration: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
2212
- response: any;
2213
- name?: string | undefined;
2214
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
2215
- response: any;
2216
- name?: string | undefined;
2217
- } & {
2218
- fetchOptions?: FetchOptions | undefined;
2219
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<import("@better-auth/passkey").Passkey, {
2220
- code?: string | undefined;
2221
- message?: string | undefined;
2222
- }, FetchOptions["throw"] extends true ? true : false>>;
2223
- };
2224
- } & {
2225
- passkey: {
2226
- verifyAuthentication: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
2227
- response: import("@better-auth/passkey/client").AuthenticationResponseJSON;
2228
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
2229
- response: import("@better-auth/passkey/client").AuthenticationResponseJSON;
2230
- } & {
2231
- fetchOptions?: FetchOptions | undefined;
2232
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
2233
- session: {
2234
- id: string;
2235
- createdAt: Date;
2236
- updatedAt: Date;
2237
- userId: string;
2238
- expiresAt: Date;
2239
- token: string;
2240
- ipAddress?: string | null | undefined;
2241
- userAgent?: string | null | undefined;
2242
- };
2243
- }, {
2244
- code?: string | undefined;
2245
- message?: string | undefined;
2246
- }, FetchOptions["throw"] extends true ? true : false>>;
2247
- };
2248
- } & {
2249
- passkey: {
2250
- 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<{
2251
- query?: Record<string, any> | undefined;
2252
- fetchOptions?: FetchOptions | undefined;
2253
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<import("@better-auth/passkey").Passkey[], {
2254
- code?: string | undefined;
2255
- message?: string | undefined;
2256
- }, FetchOptions["throw"] extends true ? true : false>>;
2257
- };
2258
- } & {
2259
- passkey: {
2260
- deletePasskey: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
2261
- id: string;
2262
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
2263
- id: string;
2264
- } & {
2265
- fetchOptions?: FetchOptions | undefined;
2266
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
2267
- status: boolean;
2268
- }, {
2269
- code?: string | undefined;
2270
- message?: string | undefined;
2271
- }, FetchOptions["throw"] extends true ? true : false>>;
2272
- };
2273
- } & {
2274
- passkey: {
2275
- updatePasskey: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
2276
- id: string;
2277
- name: string;
2278
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
2279
- id: string;
2280
- name: string;
2281
- } & {
2282
- fetchOptions?: FetchOptions | undefined;
2283
- }>, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
2284
- passkey: import("@better-auth/passkey").Passkey;
2285
- }, {
2286
- code?: string | undefined;
2287
- message?: string | undefined;
2288
- }, FetchOptions["throw"] extends true ? true : false>>;
2289
- };
2290
- } & {
2291
- signIn: {
2292
- passkey: (opts?: {
2293
- autoFill?: boolean;
2294
- fetchOptions?: import("better-auth").ClientFetchOption;
2295
- } | undefined, options?: import("better-auth").ClientFetchOption | undefined) => Promise<{
2296
- data: null;
2297
- error: {
2298
- message?: string | undefined;
2299
- status: number;
2300
- statusText: string;
2301
- };
2302
- } | {
2303
- data: {
2304
- session: import("better-auth").Session;
2305
- user: import("better-auth").User;
2306
- };
2307
- error: null;
2308
- } | {
2309
- data: null;
2310
- error: {
2311
- code: string;
2312
- message: string;
2313
- status: number;
2314
- statusText: string;
2315
- };
2316
- }>;
2317
- };
2318
- passkey: {
2319
- addPasskey: (opts?: {
2320
- fetchOptions?: import("better-auth").ClientFetchOption;
2321
- name?: string;
2322
- authenticatorAttachment?: "platform" | "cross-platform";
2323
- useAutoRegister?: boolean;
2324
- } | undefined, fetchOpts?: import("better-auth").ClientFetchOption | undefined) => Promise<{
2325
- data: null;
2326
- error: {
2327
- message?: string | undefined;
2328
- status: number;
2329
- statusText: string;
2330
- };
2331
- } | {
2332
- data: import("@better-auth/passkey").Passkey;
2333
- error: null;
2334
- } | {
2335
- data: null;
2336
- error: {
2337
- code: string;
2338
- message: string;
2339
- status: number;
2340
- statusText: string;
2341
- };
2342
- }>;
2343
- };
2344
- $Infer: {
2345
- Passkey: import("@better-auth/passkey").Passkey;
2346
- };
2347
1519
  } & {
2348
1520
  useSession: () => {
2349
1521
  data: {
@@ -2482,14 +1654,6 @@ export declare function createPayloadAuthClient(options?: PayloadAuthClientOptio
2482
1654
  INVALID_CODE: import("better-auth").RawError<"INVALID_CODE">;
2483
1655
  TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("better-auth").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
2484
1656
  INVALID_TWO_FACTOR_COOKIE: import("better-auth").RawError<"INVALID_TWO_FACTOR_COOKIE">;
2485
- } & {
2486
- CHALLENGE_NOT_FOUND: import("better-auth").RawError<"CHALLENGE_NOT_FOUND">;
2487
- YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REGISTER_THIS_PASSKEY">;
2488
- FAILED_TO_VERIFY_REGISTRATION: import("better-auth").RawError<"FAILED_TO_VERIFY_REGISTRATION">;
2489
- PASSKEY_NOT_FOUND: import("better-auth").RawError<"PASSKEY_NOT_FOUND">;
2490
- AUTHENTICATION_FAILED: import("better-auth").RawError<"AUTHENTICATION_FAILED">;
2491
- UNABLE_TO_CREATE_SESSION: import("better-auth").RawError<"UNABLE_TO_CREATE_SESSION">;
2492
- FAILED_TO_UPDATE_PASSKEY: import("better-auth").RawError<"FAILED_TO_UPDATE_PASSKEY">;
2493
1657
  } & {
2494
1658
  USER_NOT_FOUND: import("better-auth").RawError<"USER_NOT_FOUND">;
2495
1659
  FAILED_TO_CREATE_USER: import("better-auth").RawError<"FAILED_TO_CREATE_USER">;