Members
EncryptionFormat
Encryption Format
EncryptionFormat[undefined]
Generic format without header information, compatible with other AES-256 CTR libraries.
EncryptionFormat[undefined]
Salmon format with header (embedded nonce and integrity support).
EncryptionMode
Encryption Mode
- Source:
- See:
EncryptionMode[undefined]
Encryption Mode used with a base stream as a target.
EncryptionMode[undefined]
Decryption Mode used with a base stream as a source.
(constant) PBKDF_SHA256
Java Cipher key for SHA256. See javax.crypto.SecretKeyFactory.
PbkdfAlgo
Pbkdf algorithm implementation type.
PbkdfAlgo[undefined]
SHA256 hashing.
PbkdfType
Pbkdf implementation type.
PbkdfType[undefined]
Default Java pbkdf implementation.
ProviderType
AES provider types. List of AES implementations that currently supported.
ProviderType[undefined]
Default JS AES cipher.
ProviderType[undefined]
Salmon builtin AES intrinsics. This needs the SalmonNative library to be loaded. @see Salmon README.md
ProviderType[undefined]
Salmon AES implementation. This needs the SalmonNative library to be loaded. @see Salmon README.md
ProviderType[undefined]
Salmon AES GPU implementation. This needs OpenCL, a compatible graphics card, and the SalmonNative library to be loaded. @see Salmon README.md
SearchEvent
Event status types.
SearchEvent[undefined]
Search files
SearchEvent[undefined]
Search is complete
SeekOrigin
Used to identify the start offset for seeking to a stream.
SeekOrigin[undefined]
Start from the beginning of the stream.
SeekOrigin[undefined]
Start from the current position of the stream.
SeekOrigin[undefined]
Start from the end of the stream.
Status
Sequencer status.
- Source:
- See:
Status[undefined]
Newly created sequence.
Status[undefined]
Currently active sequence used to provide nonces for data encryption ie: file contents and filenames.
Status[undefined]
Revoked sequence. This cannot be reused you need to re-authorize the device.
Methods
autoRename(filename) → {string}
Get an auto generated copy of a file name
Parameters:
Name | Type | Description |
---|---|---|
filename |
string | The current file name |
- Source:
Returns:
The new file name
- Type
- string
autoRename(file) → {Promise.<string>}
Default autorename.
Parameters:
Name | Type | Description |
---|---|---|
file |
AesFile | The file to be renamed |
Returns:
The new file name
- Type
- Promise.<string>
autoRenameFile(file) → {Promise.<string>}
Get an auto generated copy of the name for a file.
Parameters:
Name | Type | Description |
---|---|---|
file |
IFile | The file |
- Source:
Returns:
The new file name
- Type
- Promise.<string>
autoRenameFile(file) → {Promise.<string>}
Default autorename.
Parameters:
Name | Type | Description |
---|---|---|
file |
AesFile | The file to be renamed |
Returns:
The new file name
- Type
- Promise.<string>
copyFileContents(src, dest, optionsopt) → {Promise.<boolean>}
Copy contents of a file to another file.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
src |
IFile | The source directory | |
dest |
IFile | The target directory | |
options |
CopyContentOptions |
<optional> |
The options |
- Source:
Throws:
IOException Thrown if there is an IO error.
Returns:
True if files are copied successfully
- Type
- Promise.<boolean>
copyRecursively(src, destDir, optionsopt)
Copy a directory recursively
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
src |
IFile | Source directory | |
destDir |
IFile | Destination directory to copy into. | |
options |
RecursiveCopyOptions |
<optional> |
The options. |
- Source:
Throws:
IOException Thrown if there is an IO error.
decryptData(data, start, count, outData, key, nonce, format, 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 | null | The nonce to be used. |
format |
EncryptionFormat | The format to use, see EncryptionFormat |
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. |
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(optionsopt)
Delete a directory recursively
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
RecursiveDeleteOptions |
<optional> |
The options |
- Source:
encryptData(data, start, count, outData, key, nonce, format, 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. |
format |
EncryptionFormat | The format to use, see EncryptionFormat |
integrity |
boolean | True to apply integrity. |
hashKey |
Uint8Array | null | The key to be used for integrity application. |
chunkSize |
number | The chunk size. Thrown if there is an error with the stream. |
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, onProgressChanged)
Export a file part from the drive. Do not use this directly, use FileExporter instead.
Parameters:
Name | Type | Description |
---|---|---|
fileToExport |
IVirtualFile | The file the part belongs to |
exportFile |
IFile | The file to copy the exported part to |
start |
number | The start position on the file |
count |
number | The length of the bytes to be decrypted |
totalBytesWritten |
Array.<number> | The total bytes that were written to the external file |
onProgressChanged |
OnFileExportProgressChanged | The file progress |
fillBufferPart(cacheBuffer, bufferSize, aesStream)
Fills a cache buffer with the decrypted data from a part of an encrypted file
Parameters:
Name | Type | Description |
---|---|---|
cacheBuffer |
CacheBuffer | The cache buffer that will store the decrypted contents |
bufferSize |
Uint8Array | The length of the data requested |
aesStream |
AesStream | The stream that will be used to read from |
getExtension(fileName) → {string}
Get extension from file name
Parameters:
Name | Type | Description |
---|---|---|
fileName |
string | The file name |
- Source:
Returns:
The extension
- Type
- string
getPbkdfAlgoString(pbkdfAlgo) → {string}
Get the PBKDF java cipher algorigthm string.
Parameters:
Name | Type | Description |
---|---|---|
pbkdfAlgo |
PbkdfAlgo.SHA256 | The PBKDF algorithm to be used |
Returns:
The java cipher algorithm string. See javax.crypto.SecretKeyFactory.
- Type
- string
importFilePart(fileToImport, aesFile, start, count, totalBytesRead, onProgressChanged)
Import a file part into a file in the drive. Do not use this directly, use FileImporter instead.
Parameters:
Name | Type | Description |
---|---|---|
fileToImport |
IFile | The external file that will be imported |
aesFile |
IVirtualFile | The file that will be imported to |
start |
number | The start position of the byte data that will be imported |
count |
number | The length of the file content that will be imported |
totalBytesRead |
number | The total bytes read from the external file |
onProgressChanged |
OnFileImportProgressChanged | Progress observer |
moveRecursively(file, destDir, optionsopt)
Move a directory recursively
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
file |
IFile | Source directory | |
destDir |
IFile | Destination directory to move into. | |
options |
RecursiveMoveOptions |
<optional> |
The options |
- Source:
Type Definitions
OnFileExportProgressChanged(position, length)
Progress Callback
Parameters:
Name | Type | Description |
---|---|---|
position |
number | The current position |
length |
number | The total length |
OnFileImportProgressChanged(position, length)
Progress Callback
Parameters:
Name | Type | Description |
---|---|---|
position |
number | The current position |
length |
number | The total length |