Global

Members

EncryptionMode

Encryption Mode
Source:
See:

EncryptionMode[undefined]

Encryption Mode used with a base stream as a target.
Source:

EncryptionMode[undefined]

Decryption Mode used with a base stream as a source.
Source:

(constant) PBKDF_SHA1

Java Cipher key for SHA1. See javax.crypto.SecretKeyFactory. WARNING! SHA1 is considered insecure! Use PBKDF_SHA256 instead.
Source:

(constant) PBKDF_SHA256

Java Cipher key for SHA256. See javax.crypto.SecretKeyFactory.
Source:

PbkdfAlgo

Pbkdf algorithm implementation type.
Source:

PbkdfAlgo[undefined]

SHA1 hashing. DO NOT USE.
Source:

PbkdfAlgo[undefined]

SHA256 hashing.
Source:

PbkdfType

Pbkdf implementation type.
Source:

PbkdfType[undefined]

Default Java pbkdf implementation.
Source:

ProviderType

AES provider types. List of AES implementations that currently supported.
Source:
See:

ProviderType[undefined]

Default Java AES cipher.
Source:

ProviderType[undefined]

Salmon builtin AES intrinsics. This needs the SalmonNative library to be loaded. @see Salmon README.md
Source:

ProviderType[undefined]

Tiny AES implementation. This needs the SalmonNative library to be loaded. @see Salmon README.md
Source:

SearchEvent

Event status types.
Source:

SearchEvent[undefined]

Search files
Source:

SearchEvent[undefined]

Search is complete
Source:

SeekOrigin

Used to identify the start offset for seeking to a stream.
Source:

SeekOrigin[undefined]

Start from the beginning of the stream.
Source:

SeekOrigin[undefined]

Start from the current position of the stream.
Source:

SeekOrigin[undefined]

Start from the end of the stream.
Source:

Status

Sequencer status.
Source:
See:

Status[undefined]

Newly created sequence.
Source:

Status[undefined]

Currently active sequence used to provide nonces for data encryption ie: file contents and filenames.
Source:

Status[undefined]

Revoked sequence. This cannot be reused you need to re-authorize the device.
Source:

_FileExporter_DEFAULT_THREADS

The global default threads to use.
Source:

_FileExporter_enableMultiThread

True if multithreading is enabled.
Source:

_FileImporter_DEFAULT_BUFFER_SIZE

The global default buffer size to use when reading/writing on the SalmonStream.
Source:

_FileImporter_DEFAULT_THREADS

The global default threads to use.
Source:

_FileImporter_enableMultiThread

True if multithreading is enabled.
Source:

_MemoryStream_INITIAL_CAPACITY

Increment to resize to when capacity is exhausted.
Source:

_SalmonDriveGenerator_iterations

Global default iterations that will be used for the master key derivation.
Source:

_SalmonEncoder_base64

Current global Base64 implementation for encrypting/decrypting text strings. To change use setBase64().
Source:

_SalmonGenerator_MAGIC_BYTES

Magic bytes.
Source:

_SalmonNativeProxy_libraryName

The dll name for the salmon library.
Source:

_SalmonPassword_ENABLE_SHA1

WARNING! SHA1 is not secure anymore enable only if you know what you're doing!
Source:

_SalmonPassword_pbkdfAlgo

Global PBKDF algorithm option that will be used for the master key derivation.
Source:

_SalmonPassword_provider

Pbkdf provider.
Source:

_SalmonStream_providerType

Current global AES provider type.
Source:

Methods

autoRename(filename)

Get an auto generated copy of a filename
Parameters:
Name Type Description
filename
Source:
Returns:

autoRenameFile()

Get an auto generated copy of the name for a file.
Source:

copyFileContents(src, dest, delete, progressListener)

Copy contents of a file to another file.
Parameters:
Name Type Description
src The source directory
dest The target directory
delete True to delete the source files when complete
progressListener The progress listener
Source:
Throws:
IOException Thrown if there is an IO error.
Returns:

copyRecursively(src, destDir, progressListener, autoRename, autoRenameFolders, onFailed)

Copy a directory recursively
Parameters:
Name Type Description
src IRealFile Source directory
destDir IRealFile Destination directory to copy into.
progressListener
autoRename
autoRenameFolders boolean Apply autorename to folders also (default is true)
onFailed
Source:
Throws:
IOException Thrown if there is an IO error.

decryptData(data, start, count, outData, key, nonce, headerData, integrity, hashKey, chunkSize) → {Promise.<{startPos: number, endPos: number}>}

Decrypt the data.
Parameters:
Name Type Description
data Uint8Array The data to be decrypted.
start number The start position of the stream to be decrypted.
count number The number of bytes to be decrypted.
outData Uint8Array The buffer with the decrypted data.
key Uint8Array The AES key to be used.
nonce Uint8Array The nonce to be used.
headerData Uint8Array | null The header data to be used.
integrity boolean True to verify integrity.
hashKey Uint8Array | null The hash key to be used for integrity verification.
chunkSize number The chunk size. Thrown if there is an error with the stream.
Source:
Throws:
  • SalmonSecurityException Thrown if there is a security exception with the stream.
  • IntegrityException Thrown if the stream is corrupt or tampered with.
Returns:
The number of bytes decrypted.
Type
Promise.<{startPos: number, endPos: number}>

deleteRecursively(progressListener, onFailed)

Delete a directory recursively
Parameters:
Name Type Description
progressListener The progress listener
onFailed Callback when delete fails
Source:

encryptData(data, start, count, outData, key, nonce, headerData, integrity, hashKey, chunkSize) → {Promise.<{startPos: number, endPos: number}>}

Encrypt the data.
Parameters:
Name Type Description
data Uint8Array The data to be encrypted.
start number The start position of the stream to be encrypted.
count number The number of bytes to be encrypted.
outData Uint8Array The buffer with the encrypted data.
key Uint8Array The AES key to be used.
nonce Uint8Array The nonce to be used.
headerData Uint8Array | null The header data to be used.
integrity boolean True to apply integrity.
hashKey Uint8Array | null The key to be used for integrity application.
chunkSize number | null The chunk size. Thrown if there is an error with the stream.
Source:
Throws:
  • SalmonSecurityException Thrown if there is a security exception with the stream.
  • IntegrityException Thrown if integrity cannot be applied.
Returns:
The number of bytes encrypted.
Type
Promise.<{startPos: number, endPos: number}>

exportFilePart(fileToExport, exportFile, start, count, totalBytesWritten)

Export a file part from the drive.
Parameters:
Name Type Description
fileToExport The file the part belongs to
exportFile The file to copy the exported part to
start The start position on the file
count The length of the bytes to be decrypted
totalBytesWritten The total bytes that were written to the external file
Source:

fillBufferPart(cacheBuffer, bufferSize, salmonStream)

Fills a cache buffer with the decrypted data from a part of an encrypted file served as a salmon stream
Parameters:
Name Type Description
cacheBuffer The cache buffer that will store the decrypted contents
bufferSize The length of the data requested
salmonStream The stream that will be used to read from
Source:

getPbkdfAlgoString(pbkdfAlgo) → {string}

Get the PBKDF java cipher algorigthm string.
Parameters:
Name Type Description
pbkdfAlgo PbkdfAlgo.SHA256 The PBKDF algorithm to be used
Source:
Returns:
The java cipher algorithm string. See javax.crypto.SecretKeyFactory.
Type
string

importFilePart(fileToImport, salmonFile, start, count, totalBytesRead, onProgress)

Import a file part into a file in the drive.
Parameters:
Name Type Description
fileToImport The external file that will be imported
salmonFile The file that will be imported to
start The start position of the byte data that will be imported
count The length of the file content that will be imported
totalBytesRead The total bytes read from the external file
onProgress Progress observer
Source:

moveRecursively(src, destDir, progressListener, autoRename, autoRenameFolders, onFailed)

Move a directory recursively
Parameters:
Name Type Description
src IRealFile Source directory
destDir IRealFile Destination directory to move into.
progressListener
autoRename
autoRenameFolders boolean Apply autorename to folders also (default is true)
onFailed
Source:

Type Definitions

onProgress(position, length)

Progress listener
Parameters:
Name Type Description
position number The current position
length number The total length
Source: