function encrypt(keyBundle) {
    if (!keyBundle) {
      throw new Error("A key bundle must be supplied to encrypt.");
    }

    this.IV = Svc.Crypto.generateRandomIV();
    this.ciphertext = Svc.Crypto.encrypt(JSON.stringify(this.cleartext),
                                         keyBundle.encryptionKeyB64, this.IV);
    this.hmac = this.ciphertextHMAC(keyBundle);
    this.cleartext = null;
  }
/*
   * Don't directly use the sync key. Instead, grab a key for this
   * collection, which is decrypted with the sync key.
   *
   * Cache those keys; invalidate the cache if the time on the keys collection
   * changes, or other auth events occur.
   *
   * Optional key bundle overrides the collection key lookup.
   */
Don't directly use the sync key. Instead, grab a key for this
collection, which is decrypted with the sync key.

Cache those keys; invalidate the cache if the time on the keys collection
changes, or other auth events occur.

Optional key bundle overrides the collection key lookup.
Don ' t directly use the sync key . Instead grab a key for this collection which is decrypted with the sync key . Cache those keys ; invalidate the cache if the time on the keys collection changes or other auth events occur . Optional key bundle overrides the collection key lookup .
function encrypt(keyBundle) {
    if (!keyBundle) {
      throw new Error("A key bundle must be supplied to encrypt.");
    }
    this.IV = Svc.Crypto.generateRandomIV();
    this.ciphertext = Svc.Crypto.encrypt(JSON.stringify(this.cleartext),
                                         keyBundle.encryptionKeyB64, this.IV);
    this.hmac = this.ciphertextHMAC(keyBundle);
    this.cleartext = null;
  }
function encrypt ( keyBundle ) { if ( ! keyBundle ) { throw new Error ( "A key bundle must be supplied to encrypt." ) ; } this . IV = Svc . Crypto . generateRandomIV ( ) ; this . ciphertext = Svc . Crypto . encrypt ( JSON . stringify ( this . cleartext ) , keyBundle . encryptionKeyB64 , this . IV ) ; this . hmac = this . ciphertextHMAC ( keyBundle ) ; this . cleartext = null ; }
Don't directly use the sync key.
Don ' t directly use the sync key .