function upgradeSyncKey(syncID) {
    let p = this.identity.syncKey;

    if (!p) {
      return false;
    }

    // Check whether it's already a key that we generated.
    if (Utils.isPassphrase(p)) {
      this._log.info("Sync key is up-to-date: no need to upgrade.");
      return true;
    }

    // Otherwise, let's upgrade it.
    // N.B., we persist the sync key without testing it first...

    let s = btoa(syncID);        // It's what WeaveCrypto expects. *sigh*
    let k = Utils.derivePresentableKeyFromPassphrase(p, s, PBKDF2_KEY_BYTES);   // Base 32.

    if (!k) {
      this._log.error("No key resulted from derivePresentableKeyFromPassphrase. Failing upgrade.");
      return false;
    }

    this._log.info("Upgrading sync key...");
    this.identity.syncKey = k;
    this._log.info("Saving upgraded sync key...");
    this.persistLogin();
    this._log.info("Done saving.");
    return true;
  }
/**
   * If we have a passphrase, rather than a 25-alphadigit sync key,
   * use the provided sync ID to bootstrap it using PBKDF2.
   *
   * Store the new 'passphrase' back into the identity manager.
   *
   * We can check this as often as we want, because once it's done the
   * check will no longer succeed. It only matters that it happens after
   * we decide to bump the server storage version.
   */
If we have a passphrase, rather than a 25-alphadigit sync key,
use the provided sync ID to bootstrap it using PBKDF2.

Store the new 'passphrase' back into the identity manager.

We can check this as often as we want, because once it's done the
check will no longer succeed. It only matters that it happens after
we decide to bump the server storage version.
If we have a passphrase rather than a 25 - alphadigit sync key use the provided sync ID to bootstrap it using PBKDF2 . Store the new ' passphrase ' back into the identity manager . We can check this as often as we want because once it ' s done the check will no longer succeed . It only matters that it happens after we decide to bump the server storage version .
function upgradeSyncKey(syncID) {
    let p = this.identity.syncKey;
    if (!p) {
      return false;
    }
    if (Utils.isPassphrase(p)) {
      this._log.info("Sync key is up-to-date: no need to upgrade.");
      return true;
    }
    let s = btoa(syncID);        
    let k = Utils.derivePresentableKeyFromPassphrase(p, s, PBKDF2_KEY_BYTES);   
    if (!k) {
      this._log.error("No key resulted from derivePresentableKeyFromPassphrase. Failing upgrade.");
      return false;
    }
    this._log.info("Upgrading sync key...");
    this.identity.syncKey = k;
    this._log.info("Saving upgraded sync key...");
    this.persistLogin();
    this._log.info("Done saving.");
    return true;
  }
function upgradeSyncKey ( syncID ) { let p = this . identity . syncKey ; if ( ! p ) { return false ; } if ( Utils . isPassphrase ( p ) ) { this . _log . info ( "Sync key is up-to-date: no need to upgrade." ) ; return true ; } let s = btoa ( syncID ) ; let k = Utils . derivePresentableKeyFromPassphrase ( p , s , PBKDF2_KEY_BYTES ) ; if ( ! k ) { this . _log . error ( "No key resulted from derivePresentableKeyFromPassphrase. Failing upgrade." ) ; return false ; } this . _log . info ( "Upgrading sync key..." ) ; this . identity . syncKey = k ; this . _log . info ( "Saving upgraded sync key..." ) ; this . persistLogin ( ) ; this . _log . info ( "Done saving." ) ; return true ; }
If we have a passphrase, rather than a 25-alphadigit sync key,
 use the provided sync ID to bootstrap it using PBKDF2.
If we have a passphrase rather than a 25 - alphadigit sync key use the provided sync ID to bootstrap it using PBKDF2 .
// Check whether it's already a key that we generated. // Otherwise, let's upgrade it. // N.B., we persist the sync key without testing it first... // It's what WeaveCrypto expects. *sigh* // Base 32.