@@ -8179,8 +8179,16 @@ declare namespace firebase.firestore {
81798179 *
81808180 * @param host the emulator host (ex: localhost).
81818181 * @param port the emulator port (ex: 9000).
8182+ * @param options.mockUserToken - the mock auth token to use for unit
8183+ * testing Security Rules.
81828184 */
8183- useEmulator ( host : string , port : number ) : void ;
8185+ useEmulator (
8186+ host : string ,
8187+ port : number ,
8188+ options ?: {
8189+ mockUserToken ?: EmulatorMockTokenOptions ;
8190+ }
8191+ ) : void ;
81848192
81858193 /**
81868194 * Attempts to enable persistent storage, if possible.
@@ -9976,6 +9984,81 @@ declare namespace firebase.firestore {
99769984 name : string ;
99779985 stack ?: string ;
99789986 }
9987+
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 > ;
997910062}
998010063
998110064export default firebase ;
0 commit comments