all files / firebase/modules/auth/ ConfirmationResult.js

0% Statements 0/5
100% Branches 0/0
0% Functions 0/4
0% Lines 0/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38                                                                           
/**
 * @flow
 * ConfirmationResult representation wrapper
 */
import { getNativeModule } from '../../utils/native';
import type Auth from './';
import type User from './User';
 
export default class ConfirmationResult {
  _auth: Auth;
  _verificationId: string;
 
  /**
   *
   * @param auth
   * @param verificationId The phone number authentication operation's verification ID.
   */
  constructor(auth: Auth, verificationId: string) {
    this._auth = auth;
    this._verificationId = verificationId;
  }
 
  /**
   *
   * @param verificationCode
   * @return {*}
   */
  confirm(verificationCode: string): Promise<User> {
    return getNativeModule(this._auth)
      ._confirmVerificationCode(verificationCode)
      .then(user => this._auth._setUser(user));
  }
 
  get verificationId(): string | null {
    return this._verificationId;
  }
}