Sync

Sync your local variables with the authority.

$   nv sync
Syncing my-awesome-project (1)
 
✔ Found 2 files
    .env
    packages/app/.env
 
✔ Encrypted data
 
⠴ Sending data to server...

Modes

Diagram comparing sync modes: Merge keeps both local and stored vars with local priority; Overwrite replaces stored with local; Pull replaces local with stored; Pull & Merge keeps both with
stored priority.

Process

  1. The agent compiles the envdata into a JSON object with the following structure:
{
    [`${filepath}`]: `${filecontent}`
}
  1. The agent stringifies the object and splits it into chunks of 255 characters.
  2. The agent encrypts each chunk with the authority's public key.
  3. The agent joins the encrypted chunks into a single string with a delimiter of ::, postfixed with a \n\r\n sequence followed by the user's public key.
  4. The agent contacts POST:/api/projects/:project_id/sync?strategy=<?SyncStrategy>, authenticated with the bearer key, and with the encrypted chunks as the body.
  5. The authority responds with a body in the same format, containing updated values. At the end of the body, a \n\r\n sequence followed by newline-terminated strings contains messages which may be shown to the user.
  6. The agent decrypts the chunks with the user's private key and joins them into a single string.
  7. The agent parses the string into a JSON object.
  8. The agent writes the new envdata.

Example Response

mK6iBcLL+bhoZFfvILAWHzF2xa7JrpERInsseftZEZPABvOF8n1MVryxDO7Y3/E00znHWbtFW3XXKpYKcKTF3VUOjJfV4FXiRTIO6H7C/SQxWADRFAyS7rj50xzUkeY9Pceg1mxeTZ3NymVXLgCj38oIyuT6Fici1Kk/G+M6pM9YioCVUE0I3sLmwoI7bZSTK8SAlV3KA5wyxASs9gdCx22BHcQobcRT/yjvWcUSx0wcI2pftjSspDcS5ki98242lQHvHJ9T0m1t18RJrl+DfSlkkbIhnRkR211VqxBvzAZ4mVdLFcZrG9IzYZYkl6H+kdIGVoA/xWXcBjvmx+zIzsFWz0g/aI8SuJRjpxbk2GQC/ssv8DnpJAek0m1tdG06ThEgN+Dk2sKMPSL/3AYXYKZD23hL7gzpZNTgw8GHU2HPExXqCCeE1hPhBjMZsQcxmXo8I+gxIp4GlrFwRWpJUnbWMiMJdiZMX5pttcgZ6Qxu2V5qK81TTJ6HZmXx+rvlgnJzAItD2jhkrdZrSvGEq/UQAHAjoWsaDlQPlfnnREr3+ShzPOINz3lNgdPtWizSydRz/i4mNhkgUSt1olm/6qstoeaZJB7A/xplyU+Y1ATsmwQ6vcPVGtm0fIMc4WDzks7xlJfpoJjf1AN1HOikWxG1h4n1jlOAgXvEnDW02Nc=
<\n\r\n>
Updated GitHub repository

On this page