Class: FileSequencer

FileSequencer(sequenceFile, serializer)

Generates nonces based on a sequencer backed by a file.

Constructor

new FileSequencer(sequenceFile, serializer)

Instantiate a nonce file sequencer.
Parameters:
Name Type Description
sequenceFile IFile The sequence file (json format).
serializer INonceSequenceSerializer The serializer to be used.
Source:
Throws:
  • IOException Thrown if there is an IO error.
  • SequenceException Thrown if error with the nonce sequence

Classes

FileSequencer

Methods

close()

Close this file sequencer.
Source:

(async) createSequence(driveId, authId)

Create a sequence for the drive ID and auth ID provided.
Parameters:
Name Type Description
driveId string The drive ID.
authId string The authorization ID of the drive.
Source:
Throws:
SequenceException Thrown if error with the nonce sequence

(async) getContents() → {Promise.<string>}

Get the contents of a sequence file.
Source:
Throws:
SequenceException Thrown if error with the nonce sequence
Returns:
The file contents.
Type
Promise.<string>

(async) getSequence(driveId) → {Promise.<(NonceSequence|null)>}

Get the sequence by the drive ID.
Parameters:
Name Type Description
driveId string The drive ID.
Source:
Throws:
SequenceException Thrown if error with the nonce sequence
Returns:
The sequence
Type
Promise.<(NonceSequence|null)>

getSequenceFile() → {IFile}

Get the sequence file
Source:
Returns:
The sequence file
Type
IFile

(async) initialize()

Initialize the file sequencer
Source:

(async) initializeSequence(driveId, authId, startNonce, maxNonce)

Initialize the sequence.
Parameters:
Name Type Description
driveId string The drive ID.
authId string The auth ID of the device for the drive.
startNonce Uint8Array The starting nonce.
maxNonce Uint8Array The maximum nonce.
Source:
Throws:
  • SequenceException Thrown if error with the nonce sequence
  • IOException Thrown if there is an IO error.

(async) nextNonce(driveId) → {Promise.<(Uint8Array|null)>}

Get the next nonce.
Parameters:
Name Type Description
driveId string The drive ID.
Source:
Throws:
  • SequenceException Thrown if error with the nonce sequence
  • SalmonRangeExceededException Thrown if nonce has exceeded range
Returns:
The next nonce
Type
Promise.<(Uint8Array|null)>

(async) revokeSequence(driveId)

Revoke the current sequence for a specific drive.
Parameters:
Name Type Description
driveId string The drive ID.
Source:
Throws:
SequenceException Thrown if error with the nonce sequence

(async) saveContents(contents)

Save the contents of the file
Parameters:
Name Type Description
contents string The contents
Source:

(async) saveSequenceFile(sequences)

Save the sequence file.
Parameters:
Name Type Description
sequences Map.<string, NonceSequence> The sequences.
Source:
Throws:
SequenceException Thrown if error with the nonce sequence

(async) setMaxNonce(driveId, authId, maxNonce)

Set the maximum nonce.
Parameters:
Name Type Description
driveId string The drive ID.
authId string The auth ID of the device for the drive.
maxNonce Uint8Array The maximum nonce.
Source:
Throws:
SequenceException Thrown if error with the nonce sequence