Crypted WebDAV Server
Start a preconfigured WebDAV server (based on webdav-server), which store files in a folder, encrypt and compress them. The encryption is AES256 CBC using a master password.
Install
npm i -g cwdav
Usage
cwdav [<config-file-json>]cwdav2 [<config-file-v2-json>] # Load the file './cwdav.json' or, if it doesn't exist, # load a default configuration (store all in the './data' # folder, creates it if it doesn't exist). cwdav # Create a crypted webdav server for local use, using # default settings. cwdav2 # Load a specific configuration file cwdav "/home/dev/path/config/.cwdav.json"cwdav .cwdav.json cwdav2 "/home/dev/path/config/.cwdav.json"cwdav2 .cwdav.json
Configuration
Verison 1
The default configuration file name is cwdav.json
.
The string values can refer to another value with the $(...)
pattern.
Key | Default value | Description |
---|---|---|
hostname | '::' |
Scope of the server (localhost , 0.0.0.0 , :: , etc...) |
port | 1900 |
Port of the server |
container | './data' |
Folder to store the crypted data |
treeFile | '$(container)/tree' |
File path in which store the resource tree |
tempTreeFile | '$(container)/tree.tmp' |
File path to the temporary resource tree |
treeSeed | 'tree' |
Seed to use to mix with the global IV to encrypt/decrypt the resource tree file |
salt | 'this is the salt of the world' |
The salt to use to encrypt/decrypt |
cipher | 'aes-256-cbc' |
Cipher to use to encrypt/decrypt |
cipherIvSize | 16 |
IV size of the cipher |
hash | 'sha256' |
Hash algorithm to use for password derivation |
masterNbIteration | 80000 |
Number of hash iteration to get the master key/IV |
minorNbIteration | 1000 |
Number of hash iteration to get the file-specific IV |
keyLen | 256 |
Encryption/descryption key size |
isVerbose | false |
Tell the server to display some information on its own |
Here is an example of a configuration file :
Version 2
Key | Default value | Description |
---|---|---|
webdavServerOptions | undefined |
Settings of the webdav-server package |
dataFolderPath | '.data' |
Folder to store the crypted data |
masterFilePath | 'data.json' |
File path in which store the resource tree |
masterKeyIteration | 100000 |
Number of hash iteration to get the master key/IV |
fileKeyIteration | 1000 |
Number of hash iteration to get the file-specific key/IV |
keySize | 32 |
Encryption/descryption key size |
ivSize | 16 |
Encryption/descryption IV size |
cipherAlgorithm | 'aes-256-cbc' |
Algorithm to use for encryption/decryption |
hashAlgorithm | 'sha256' |
Algorithm to use for the hashes |
multiUser | false |
Define if the system must use a multi user system |
Here is an example of a configuration file :
Note
For an unkown reason yet, if you set the hostname to 'localhost'
or '127.0.0.1'
, the Windows embedded WebDAV client will be slower requesting to this server.
As a module
cwdav.execute
cwdav.execute(callback : (webDAVServer, httpServer) => void)
Execute is a simple macro to start, quickly, from your code, a webdav server.
const cwdav = ; cwdav
Is equivalent to :
const cwdav = readline = ; { // Load the configuration from the argument file, from the local 'cwdav.json' file or from the default values cwdavconfig}
What to do with a WebDAV Server?
You can use it as a virtual repository to store data and allow other softwares to access to it.
For instance (Windows uses \\localhost@<port>\DavWWWRoot\
to connect to the server ; Linux will need to mount the server or to use a webdav client) :
const cwdav = fs = ; cwdav