[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.
/ core Public archive

Completely erases files by making recovery impossible. (core library for secure-rm)

License

Notifications You must be signed in to change notification settings

secure-rm/core

Repository files navigation

secure-rm
Secure-rm

Data erasure solution for files and drives

Version Downloads/week License: MIT

GitHub Workflow Status (branch) GitHub Workflow Status (branch) Code coverage

❓ Why

Secure-rm is composed of two parts: a Node.js module with a straightforward API and a command line interface optimized to delete files on the fly.

When you delete a file using the rm UNIX command or fs.unlink in node, it only removes direct pointers to the data disk sectors and make the data recovery possible with common software tools.

Permanent data erasure goes beyond basic file deletion commands, which:

  1. Allow for selection of a specific standard, based on unique needs,
  2. Verify the overwriting method has been successful and removed data across the entire device.

πŸ”© How It Works

The basic principle is to write files before deletion in order to make recovery harder. With secure-rm, you get to choose the standard that follow your needs. Each one is composed of instructions about how many passes it should perform.

It goes from a simple pass of zeros to a 35 passes algorithm. Secure-rm comes with its own algorithm to ensure your data is safe:

  • A pass of cryptographically strong pseudo-random data,
  • The file is then renamed,
  • And finally truncated to hide the file size.

✨ Features

πŸ“š Documentation

πŸ“¦ Installation

Node and npm required.

$ yarn add secure-rm
# or
$ npm install secure-rm

πŸš€ Quick Start

If you want your application to delete specific files with a pass of cryptographically strong pseudo-random data, use one of these code snippets:

const srm = require('secure-rm')

srm.remove('./folder/file.js').result
  .then(() => console.log('Files successfully deleted !'))
  .catch(console.error)

// OR

srm.remove('./folder/file.js', (err) => {
  if (err) throw err
  console.log('Files successfully deleted !')
})

πŸ“‹ Examples

const options = {
  standard: srm.standards.gutmann,
  maxBusyTries: 5
}

srm.remove('./data/file.js', options).result
  .then(({count, index}) => console.log(`Successfully deleted ${count} files: ${index}`))
  .catch(console.error)

const events = srm.remove('./trash/dir/', { standard: srm.standards.schneier }, (err, {count, index}) => {
  if (err) throw err
  console.log(`Successfully deleted ${count} files: ${index}`))
})

event.on('removed', (fileName) => console.log(fileName))

πŸ“œ Changelog / History

See the changelog or releases.

πŸ—οΈ Contributing

Dependencies Contributors Last commit npm collaborators

Tested with Jest Node version language

See contributing guidelines

Todo

[] Fix wipeDrive (removed from 5.0)

Licensing

Icon library by Icons8.

This project is under MIT License.