@@ -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
*
@@ -5711,8 +5786,15 @@ declare namespace firebase.database {
5711
5786
*
5712
5787
* @param host the emulator host (ex: localhost)
5713
5788
* @param port the emulator port (ex: 8080)
5789
+ * @param options.mockUserToken - the mock auth token to use for unit testing Security Rules
5714
5790
*/
5715
- useEmulator ( host : string , port : number ) : void ;
5791
+ useEmulator (
5792
+ host : string ,
5793
+ port : number ,
5794
+ options ?: {
5795
+ mockUserToken ?: EmulatorMockTokenOptions ;
5796
+ }
5797
+ ) : void ;
5716
5798
/**
5717
5799
* Disconnects from the server (all Database operations will be completed
5718
5800
* offline).
@@ -7054,6 +7136,8 @@ declare namespace firebase.database {
7054
7136
logger ?: boolean | ( ( a : string ) => any ) ,
7055
7137
persistent ?: boolean
7056
7138
) : any ;
7139
+
7140
+ export type EmulatorMockTokenOptions = firebase . EmulatorMockTokenOptions ;
7057
7141
}
7058
7142
7059
7143
declare namespace firebase . database . ServerValue {
@@ -9985,80 +10069,7 @@ declare namespace firebase.firestore {
9985
10069
stack ?: string ;
9986
10070
}
9987
10071
9988
- type FirebaseSignInProvider =
9989
- | 'custom'
9990
- | 'email'
9991
- | 'password'
9992
- | 'phone'
9993
- | 'anonymous'
9994
- | 'google.com'
9995
- | 'facebook.com'
9996
- | 'github.com'
9997
- | 'twitter.com'
9998
- | 'microsoft.com'
9999
- | 'apple.com' ;
10000
-
10001
- interface FirebaseIdToken {
10002
- /** Always set to https://securetoken.google.com/PROJECT_ID */
10003
- iss : string ;
10004
-
10005
- /** Always set to PROJECT_ID */
10006
- aud : string ;
10007
-
10008
- /** The user's unique id */
10009
- sub : string ;
10010
-
10011
- /** The token issue time, in seconds since epoch */
10012
- iat : number ;
10013
-
10014
- /** The token expiry time, normally 'iat' + 3600 */
10015
- exp : number ;
10016
-
10017
- /** The user's unique id, must be equal to 'sub' */
10018
- user_id : string ;
10019
-
10020
- /** The time the user authenticated, normally 'iat' */
10021
- auth_time : number ;
10022
-
10023
- /** The sign in provider, only set when the provider is 'anonymous' */
10024
- provider_id ?: 'anonymous' ;
10025
-
10026
- /** The user's primary email */
10027
- email ?: string ;
10028
-
10029
- /** The user's email verification status */
10030
- email_verified ?: boolean ;
10031
-
10032
- /** The user's primary phone number */
10033
- phone_number ?: string ;
10034
-
10035
- /** The user's display name */
10036
- name ?: string ;
10037
-
10038
- /** The user's profile photo URL */
10039
- picture ?: string ;
10040
-
10041
- /** Information on all identities linked to this user */
10042
- firebase : {
10043
- /** The primary sign-in provider */
10044
- sign_in_provider : FirebaseSignInProvider ;
10045
-
10046
- /** A map of providers to the user's list of unique identifiers from each provider */
10047
- identities ?: { [ provider in FirebaseSignInProvider ] ?: string [ ] } ;
10048
- } ;
10049
-
10050
- /** Custom claims set by the developer */
10051
- [ claim : string ] : unknown ;
10052
-
10053
- // NO LONGER SUPPORTED. Use "sub" instead. (Not a jsdoc comment to avoid generating docs.)
10054
- uid ?: never ;
10055
- }
10056
-
10057
- export type EmulatorMockTokenOptions = (
10058
- | { user_id : string }
10059
- | { sub : string }
10060
- ) &
10061
- Partial < FirebaseIdToken > ;
10072
+ export type EmulatorMockTokenOptions = firebase . EmulatorMockTokenOptions ;
10062
10073
}
10063
10074
10064
10075
export default firebase ;
0 commit comments