Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SecureVault

Class representing a SecureVault.

Hierarchy

  • SecureVault

Index

Constructors

constructor

  • new SecureVault(publicKey?: undefined | string, privateKey?: undefined | string): SecureVault
  • Create a SecureVault.

    Parameters

    • Optional publicKey: undefined | string

      Path to public key.

    • Optional privateKey: undefined | string

      Path to private key.

    Returns SecureVault

Properties

Optional privPath

privPath: undefined | string

Path to private key

Optional pubPath

pubPath: undefined | string

Path to public key

safe

Safe object

storage

storage: StorageItem[]

Array of unencrypted items

Methods

clearVault

  • clearVault(): void
  • Clears all encrypted items from safe.

    Returns void

decryptData

  • Decrypts safe data. Requires specified and loaded private key. Prints data to console.

    Returns Promise<SecureVaultItem[]>

    Resolves promise after decrypted

findStorage

  • Gets list of UUIDs matching the tag.

    Parameters

    • tag: string

      tag to search for

    Returns StorageItem[]

    UUID from item.

getAllStorage

  • Gets all unencrypted data as array.

    Returns StorageItem[]

    Data from item.

getStorage

  • getStorage(suuid: string): any
  • Gets unencrypted data of item specified by suuid.

    Parameters

    • suuid: string

      UUID for item

    Returns any

    Data from item.

loadData

  • loadData(path: string): Promise<void>
  • Loads safe from file and check compatibility

    Parameters

    • path: string

      Path to safefile.

    Returns Promise<void>

    Resolves promise after loaded

pushData

  • pushData(data: any): Promise<string>
  • Encrypts and appends data to SecureVault. Also writes data to transaction log using @function writeTransaction

    Parameters

    • data: any

      Path to public key.

    Returns Promise<string>

    Returns the uuid of the added object as promise

pushStorage

  • pushStorage(tag: string, data: any): void
  • Appends unencrypted data to safe.

    Parameters

    • tag: string

      Tag for item

    • data: any

      Data to store.

    Returns void

saveData

  • saveData(path: string): Promise<void>
  • Saves safe to file

    Parameters

    • path: string

      Path to safefile.

    Returns Promise<void>

    Resolves promise after loaded

setStorage

  • setStorage(suuid: string, data: any): void
  • Sets unencrypted data for item specified by suuid.

    Parameters

    • suuid: string

      UUID for item

    • data: any

      Data to store.

    Returns void

writeTransaction

  • writeTransaction(payload: string): void
  • Writes data to the vault log file located at ./vault.log

    Parameters

    • payload: string

      Text to append

    Returns void

Static genKey

  • genKey(publicKeyDir: string, privateKeyDir: string): void
  • Generates RSA keypair.

    Parameters

    • publicKeyDir: string
    • privateKeyDir: string

    Returns void

Generated using TypeDoc