Coding period update - Week 10

Repository: GitHub - khuongduy354/joplin-sync-lib

Progress

  • Download blob: getBlob(id, outputDirPath) download resource blob to specified path,

  • Update blob data: updateItem() will update blob data if flagged and provided local blob path

  • Enhances features:

    • Remove pagination
    • Items of type note must have a parent_id
    • Manual set fields: item.overrideItemId, item.overrideCreatedTime allows users to set these fields (ids, timestamps) instead of auto-generated ones in createItems()
    • getItemsWithMetadata(): return ids, and also deleted remote items are returned if provided allIdsItemsHandler()
    • Typing: items types for API and tests
  • Encryption:

    • I decided to split the E2E check method, and verifySyncInfo method, also exposes all functions to receive a e2eInfo object for different uses.

    • Synchronizer.e2eInfo saves all local E2E states, user can set it with setupE2EInfo(). This method checks for remote E2E setup, and only allow setting if client & remote matches (in terms of on/off, ppk). Before running every operations, this method is run by verifySyncInfo(); therefore, E2E must be setup properly or else the operations will be aborted.

    • If encryption is enabled (e2eeInfo.e2ee === true), Synchronizer will encrypt automatically in CREATE, UPDATE operations.

    • For decryption, there's a masterkey in e2eeInfo, that users can use with DecryptionWorker for decryption

  • Unit tests added:

    • Encryption setup tests (divided in 4 cases)
    • Encryption in CREATE, UPDATE tests
    • Blobs CREATE, READ, UPDATE tests
  • How data is currently encrypted by Joplin

    • Given an item, encrypt all of its data into a string, and insert it into item.encryption_ciphertext field. item.id, item.type_ are visible fields (unencrypted), to extract full data, users must use DecryptionWorker with correct password to decrypt the ciphertext

Plan

  • Expose Sync API initialization method for sync target to work without client application.
  • Add default helpers to quickly create common used objects: notes, folders, resources,...
  • Fix: types error when build, blob data encryption
  • Implement Joplin Server sync target
  • Provide better documentations

Problem

  • Locks currently not release when thrown: in unit test, if previous test failed, lock isn't released, causing the next test fail to acquire lock.
2 Likes