# lockme

> Encrypt any text file with a password (CLI)

Latest version **2.0.1** (published 2015-10-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install lockme
pnpm add lockme
yarn add lockme
bun add lockme
```

Provides the command `lockme`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2015-10-12 |
| First published | 2015-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.12 |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ricardo Matias |
| Maintainers | ricardomatias |
| Keywords | lockme, encrypt, decrypt, lock, unlock |

## Links

- npm: https://www.npmjs.com/package/lockme
- Repository: https://github.com/ricardomatias/lockme
- Issues: https://github.com/ricardomatias/lockme/issues
- npm.io page: https://npm.io/package/lockme

## Dependencies (4)

- [meow](https://npm.io/package/meow.md) ^3.3.0
- [chalk](https://npm.io/package/chalk.md) ^1.1.0
- [promptly](https://npm.io/package/promptly.md) ^0.2.1
- [get-stdin](https://npm.io/package/get-stdin.md) ^4.0.1

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2015-10-12
- 2.0.0 — 2015-07-14
- 1.1.0 — 2015-05-30
- 1.0.1 — 2015-04-04
- 1.0.0 — 2015-04-04

## README

# lockme [![Build Status](https://travis-ci.org/ricardomatias/lockme.svg)](https://travis-ci.org/ricardomatias/lockme)

> Encrypt any text file with a password (CLI)
> 
> **Use with caution. There's no way of unlocking a file without the original secret.**

## Requirements

* node.js

## CLI

```
npm install -g lockme
```

```cli
lockme account.txt
Write the secret you want to encrypt with:
> ****
Please confirm the secret
> ****
File locked!

lockme account.txt
What's the secret ?
> ****
File unlocked!
```

## Usage

```
npm install lockme
```

```
var Lockme = require('lockme');
var lm = new Lockme({ token: '\u2603', encoding: 'base64' });

lm.decrypt('foo', 'hello world!', function(err, decryptedText) {
    if(err) {
        // do something
    }

    console.log(decryptedText); // 'hello world'
});

```

## API

The encryption is done with the use of a special *Unicode* character to identify that the text was encrypted with **lockme**.

This character is assigned to the **token** property, so you can change it to another character.

The **decrypt** method expects exactly **one** character, so it will throw an error in case this changes.

### new Lockme(opts)
opts.token => the token to encrypt the file with
opts.encoding => what is the string encoding used to encrypt the file

### encrypt (secret, text, callback)

Encrypts the **text** with the given **secret**.

returns => error, encrypted text (String)

---

### decrypt (secret, string, callback)

Decrypts the **text** with the given **secret**.

returns => error, decrypted text (String)

---


### promptEncryption (message, text, callback)

Asks the user to write the secret to **encrypt** the file.

returns => error, secret (String)

---

### promptDecryption(message, text, callback)

Asks the user to write the secret to **decrypt** the file.
Uses `decrypt` to verify the secret.

returns => error, secret (String)

---

### isEncrypted(text)

Checks if the **file** is encrypted (by looking for the token).

returns => Boolean


## License

MIT © Ricardo Matias

---
_Source: https://npm.io/package/lockme · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
