   class StorageClient
 
     constructor : ->
-      @objectApi = new ObjectApi()
+      @objectApi           = new ObjectApi()
+      @cryptoServiceLoader = new CryptoServiceLoader()
 
     getObjectIds : ->
       return @objectApi.getObjectIds()


      pendingPromise
      .then (id) =>
        logger.info('pending id', id)

        kryptnosticObject = KryptnosticObject.createFromDecrypted({id, body})

        if kryptnosticObject.isEncrypted()
          throw new Error('expected object to be in a decrypted state')

        logger.info('object', kryptnosticObject)

        cryptoServiceLoader = new CryptoServiceLoader()

        logger.info('made crypto service loader')

        cryptoServiceLoader.getObjectCryptoService(id, {expectMiss: true})
        .then (cryptoService) =>
          encryptedObject = kryptnosticObject.encrypt(cryptoService)
          logger.info('encrypted object', encryptedObject)
          @submitObjectBlocks(encryptedObject)
        .then ->
          return id


          @objectApi.updateObject(objectId, encryptableBlock)

      deferred.resolve()
      return promise

    deleteObject : (id) ->
      Promise.resolve()
      .then =>
        validateId(id)
        return @objectApi.deleteObject(id)

    appendObject : (id, body) ->
      Promise.resolve()
      .then =>
        validateId(id)
        validateBody(body)
      .then =>
        @objectApi.createPendingObjectFromExisting(id)
      .then =>
        kryptnosticObject = KryptnosticObject.createFromDecrypted({id, body})
        validateDecrypted(kryptnosticObject)

        @cryptoServiceLoader.getObjectCryptoService(id, {expectMiss: false})
        .then (cryptoService) =>
          encrypted = kryptnosticObject.encrypt(cryptoService)
          @submitObjectBlocks(encrypted)
        .then ->
          return id

    uploadObject : (storageRequest) ->
      storageRequest.validate()
