Class: Bridge

Bridge

Bridge exposes a simple API for administering an ORC node, uploading, and downloading objects.

new Bridge(node, options)

Parameters:
Name Type Description
node Node
options object
Properties
Name Type Argument Default Description
privateKeyPath string Path the the node's private key
cryptParams object Crypto params
Properties
Name Type Description
salt buffer
iv buffer
logFilePath string Path to read logs from
otpSecretFilePath string Path to file where 2FA secret is kept
storage object LevelUp compatible storage adapter
secret Secret Initialized secret for decryption
passphraseFile string <optional>
Sync passphrase reset with file
syncPassphraseToKeychain boolean <optional>
false
Source:

Methods


authenticate()

Handles request authentication if defined
Source:

changePassphrase()

Changes the authentication passphrase
Source:

disableTotpSecret()

Disables TOTP two-factor-authentication
Source:

downloadObject()

Downloads the object from the network
Source:

error()

Responds to requests with error code and message
Source:

forgetObject()

Drops the local pointer reference
Source:

generateTotpSecret()

Generates a TOTP secret code
Source:

getBridgeSettings()

Returns this bridge's settings
Source:

getNodeStatus()

Returns status information about the running node
Source:

getObjectInfo()

Gets object information by unique ID
Source:

getProfile()

Returns the profile given the peer fingerprint
Source:

listen(port, hostname, callback)

Listens on the given port and hostname
Parameters:
Name Type Description
port number
hostname string
callback function
Source:

listObjects()

Scans the object database and returns all index entries
Source:

listProfiles()

Returns all recorded peers in the cache
Source:

login()

Checks the passphrase against the local salted hash and sets a session cookie
Source:

logout()

Invalidates the authentication token supplied
Source:

resolveObject()

Accepts a body containing a magnet link, resolves the pointer and creates a local object pointer record, then returns it. Clients can follow with a GET /objects/:id to download the object
Source:

setupTotpSecret()

Sets up TOTP secret
Source:

uploadObject()

Creates a blob mapping, uploads it to the network, saves an entry into the local database, returns the object details
Source: