@@ -1006,6 +1006,81 @@ declare namespace firebase {
1006
1006
uid : string ;
1007
1007
}
1008
1008
1009
+ type FirebaseSignInProvider =
1010
+ | 'custom'
1011
+ | 'email'
1012
+ | 'password'
1013
+ | 'phone'
1014
+ | 'anonymous'
1015
+ | 'google.com'
1016
+ | 'facebook.com'
1017
+ | 'github.com'
1018
+ | 'twitter.com'
1019
+ | 'microsoft.com'
1020
+ | 'apple.com' ;
1021
+
1022
+ interface FirebaseIdToken {
1023
+ /** Always set to https://securetoken.google.com/PROJECT_ID */
1024
+ iss : string ;
1025
+
1026
+ /** Always set to PROJECT_ID */
1027
+ aud : string ;
1028
+
1029
+ /** The user's unique id */
1030
+ sub : string ;
1031
+
1032
+ /** The token issue time, in seconds since epoch */
1033
+ iat : number ;
1034
+
1035
+ /** The token expiry time, normally 'iat' + 3600 */
1036
+ exp : number ;
1037
+
1038
+ /** The user's unique id, must be equal to 'sub' */
1039
+ user_id : string ;
1040
+
1041
+ /** The time the user authenticated, normally 'iat' */
1042
+ auth_time : number ;
1043
+
1044
+ /** The sign in provider, only set when the provider is 'anonymous' */
1045
+ provider_id ?: 'anonymous' ;
1046
+
1047
+ /** The user's primary email */
1048
+ email ?: string ;
1049
+
1050
+ /** The user's email verification status */
1051
+ email_verified ?: boolean ;
1052
+
1053
+ /** The user's primary phone number */
1054
+ phone_number ?: string ;
1055
+
1056
+ /** The user's display name */
1057
+ name ?: string ;
1058
+
1059
+ /** The user's profile photo URL */
1060
+ picture ?: string ;
1061
+
1062
+ /** Information on all identities linked to this user */
1063
+ firebase : {
1064
+ /** The primary sign-in provider */
1065
+ sign_in_provider : FirebaseSignInProvider ;
1066
+
1067
+ /** A map of providers to the user's list of unique identifiers from each provider */
1068
+ identities ?: { [ provider in FirebaseSignInProvider ] ?: string [ ] } ;
1069
+ } ;
1070
+
1071
+ /** Custom claims set by the developer */
1072
+ [ claim : string ] : unknown ;
1073
+
1074
+ // NO LONGER SUPPORTED. Use "sub" instead. (Not a jsdoc comment to avoid generating docs.)
1075
+ uid ?: never ;
1076
+ }
1077
+
1078
+ export type EmulatorMockTokenOptions = (
1079
+ | { user_id : string }
1080
+ | { sub : string }
1081
+ ) &
1082
+ Partial < FirebaseIdToken > ;
1083
+
1009
1084
/**
1010
1085
* Retrieves a Firebase {@link firebase.app.App app} instance.
1011
1086
*
@@ -5738,8 +5813,15 @@ declare namespace firebase.database {
5738
5813
*
5739
5814
* @param host the emulator host (ex: localhost)
5740
5815
* @param port the emulator port (ex: 8080)
5816
+ * @param options.mockUserToken the mock auth token to use for unit testing Security Rules
5741
5817
*/
5742
- useEmulator ( host : string , port : number ) : void ;
5818
+ useEmulator (
5819
+ host : string ,
5820
+ port : number ,
5821
+ options ?: {
5822
+ mockUserToken ?: EmulatorMockTokenOptions ;
5823
+ }
5824
+ ) : void ;
5743
5825
/**
5744
5826
* Disconnects from the server (all Database operations will be completed
5745
5827
* offline).
@@ -7081,6 +7163,8 @@ declare namespace firebase.database {
7081
7163
logger ?: boolean | ( ( a : string ) => any ) ,
7082
7164
persistent ?: boolean
7083
7165
) : any ;
7166
+
7167
+ export type EmulatorMockTokenOptions = firebase . EmulatorMockTokenOptions ;
7084
7168
}
7085
7169
7086
7170
declare namespace firebase . database . ServerValue {
@@ -10012,80 +10096,7 @@ declare namespace firebase.firestore {
10012
10096
stack ?: string ;
10013
10097
}
10014
10098
10015
- type FirebaseSignInProvider =
10016
- | 'custom'
10017
- | 'email'
10018
- | 'password'
10019
- | 'phone'
10020
- | 'anonymous'
10021
- | 'google.com'
10022
- | 'facebook.com'
10023
- | 'github.com'
10024
- | 'twitter.com'
10025
- | 'microsoft.com'
10026
- | 'apple.com' ;
10027
-
10028
- interface FirebaseIdToken {
10029
- /** Always set to https://securetoken.google.com/PROJECT_ID */
10030
- iss : string ;
10031
-
10032
- /** Always set to PROJECT_ID */
10033
- aud : string ;
10034
-
10035
- /** The user's unique id */
10036
- sub : string ;
10037
-
10038
- /** The token issue time, in seconds since epoch */
10039
- iat : number ;
10040
-
10041
- /** The token expiry time, normally 'iat' + 3600 */
10042
- exp : number ;
10043
-
10044
- /** The user's unique id, must be equal to 'sub' */
10045
- user_id : string ;
10046
-
10047
- /** The time the user authenticated, normally 'iat' */
10048
- auth_time : number ;
10049
-
10050
- /** The sign in provider, only set when the provider is 'anonymous' */
10051
- provider_id ?: 'anonymous' ;
10052
-
10053
- /** The user's primary email */
10054
- email ?: string ;
10055
-
10056
- /** The user's email verification status */
10057
- email_verified ?: boolean ;
10058
-
10059
- /** The user's primary phone number */
10060
- phone_number ?: string ;
10061
-
10062
- /** The user's display name */
10063
- name ?: string ;
10064
-
10065
- /** The user's profile photo URL */
10066
- picture ?: string ;
10067
-
10068
- /** Information on all identities linked to this user */
10069
- firebase : {
10070
- /** The primary sign-in provider */
10071
- sign_in_provider : FirebaseSignInProvider ;
10072
-
10073
- /** A map of providers to the user's list of unique identifiers from each provider */
10074
- identities ?: { [ provider in FirebaseSignInProvider ] ?: string [ ] } ;
10075
- } ;
10076
-
10077
- /** Custom claims set by the developer */
10078
- [ claim : string ] : unknown ;
10079
-
10080
- // NO LONGER SUPPORTED. Use "sub" instead. (Not a jsdoc comment to avoid generating docs.)
10081
- uid ?: never ;
10082
- }
10083
-
10084
- export type EmulatorMockTokenOptions = (
10085
- | { user_id : string }
10086
- | { sub : string }
10087
- ) &
10088
- Partial < FirebaseIdToken > ;
10099
+ export type EmulatorMockTokenOptions = firebase . EmulatorMockTokenOptions ;
10089
10100
}
10090
10101
10091
10102
export default firebase ;
0 commit comments