Class: SalmonDrive

SalmonDrive()

Class provides an abstract virtual drive that can be extended for use with any filesystem ie disk, net, cloud, etc. Each drive implementation needs a corresponding implementation of IRealFile.

Constructor

new SalmonDrive()

Source:

Classes

SalmonDrive

Methods

close()

Close the drive and associated resources.
Source:

(async) createSequence(driveId, authId)

Create a nonce sequence for the drive id and the authorization id provided. Should be called once per driveId/authId combination.
Parameters:
Name Type Description
driveId The driveId
authId The authId
Source:
Throws:
Exception

(async) getAuthId()

Get the authorization ID for the current device.
Source:
Throws:
  • SequenceException Thrown if error with the nonce sequence
  • SalmonAuthException Thrown when error during authorization
Returns:

(async) getAuthIdBytes()

Get the device authorization byte array for the current drive.
Source:
Throws:
Exception
Returns:

(async) getBytesFromRealFile(file, bufferSize)

Get the byte contents of a file from the real filesystem.
Parameters:
Name Type Description
file The file
bufferSize The buffer to be used when reading
Source:

getDefaultFileChunkSize()

Return the default file chunk size
Source:
Returns:
The default chunk size.

(async) getDriveConfig()

Return the configuration properties of this drive.
Source:

getDriveId()

Get the drive ID.
Source:
Returns:

(async) getExportDir()

Return the default external export dir that all file can be exported to.
Source:
Returns:
The file on the real filesystem.

getKey()

Return the encryption key that is used for encryption / decryption
Source:
Returns:

(async) getNextNonce()

Get the next nonce from the sequencer. This advanced the sequencer so unique nonce are used.
Source:
Throws:
Exception
Returns:

(async) getRoot()

Return the virtual root directory of the drive.
Source:
Throws:
SalmonAuthException Thrown when error during authorization
Returns:

getSequencer()

Get the nonce sequencer used for the current drive.
Source:
Returns:
The nonce sequencer

(async) hasConfig()

Return true if the drive is already created and has a configuration file.
Source:

(async) initFS()

Initialize the drive virtual filesystem.
Source:

(async) initializeSequence(driveId, authId)

Initialize the nonce sequencer with the current drive nonce range. Should be called once per driveId/authId combination.
Parameters:
Name Type Description
driveId Drive ID.
authId Authorization ID.
Source:
Throws:
Exception

(async) revokeAuthorization()

Revoke authorization for this device. This will effectively terminate write operations on the current disk by the current device. Warning: If you need to authorize write operations to the device again you will need to have another device to export an authorization config file and reimport it.
Source:
See:
Throws:
Exception

setDefaultFileChunkSize(fileChunkSize)

Set the default file chunk size to be used with hash integrity.
Parameters:
Name Type Description
fileChunkSize
Source:

setKey(masterKey, driveKey, hashKey, iterations)

Sets the key properties.
Parameters:
Name Type Description
masterKey The master key.
driveKey The drive key used for enc/dec of files and filenames.
hashKey The hash key used for data integrity.
iterations The iterations
Source:

(async) setPassword(pass)

Change the user password.
Parameters:
Name Type Description
pass The new password.
Source:
Throws:
  • IOException Thrown if there is an IO error.
  • SalmonAuthException Thrown when error during authorization
  • SalmonSecurityException Thrown when error with security
  • IntegrityException Thrown if the data are corrupt or tampered with.
  • SequenceException Thrown if error with the nonce sequence

setSequencer(The)

Set the nonce sequencer used for the current drive.
Parameters:
Name Type Description
The nonce sequencer
Source:

(async, static) createDrive(dir, driveClassType, password, sequencer)

Create a new drive in the provided location.
Parameters:
Name Type Description
dir Directory to store the drive configuration and virtual filesystem.
driveClassType The driver class type (ie JsDrive).
password Text password to encrypt the drive configuration.
sequencer The sequencer to use.
Source:
Throws:
  • IntegrityException Thrown if the data are corrupt or tampered with.
  • SequenceException Thrown if error with the nonce sequence
Returns:
The newly created drive.

(static) getDefaultAuthConfigFilename()

Get the default auth config filename.
Source:
Returns:

(async, static) openDrive(dir, driveClassType, password, sequencer)

Set the drive location to an external directory. This requires you previously use SetDriveClass() to provide a class for the drive
Parameters:
Name Type Default Description
dir The directory path that will be used for storing the contents of the drive
driveClassType The driver class type (ie JsDrive).
password Text password to encrypt the drive configuration.
sequencer null The sequencer to use.
Source: