npm package: @fnet/filenet
Description: This project is a command-line interface (CLI) tool designed to facilitate secure storage and retrieval of digital files using filenet.pro services. The core functionality allows users to encrypt and upload files (push) or download and decrypt files (pull
Latest version: 0.1.15

# @fnet/filenet

This project is a command-line interface (CLI) tool designed to facilitate secure storage and retrieval of digital files using filenet.pro services. The core functionality allows users to encrypt and upload files (push) or download and decrypt files (pull) from the filenet.pro storage platform, offering a simple method for managing file security and access.

## How It Works

The tool operates through a series of interactive prompts or user-specified arguments to gather necessary information for file operations. For encryption and uploads, users provide an input file or directory, and for decryption and downloads, specify an output location. Users must provide a mnemonic seed phrase or a private key for cryptographic operations, which is essential for key generation and access rights.

## Key Features

- **File Encryption and Upload**: Securely encrypt files and upload them to filenet.pro, using a private key or derived key from a seed phrase.
- **File Decryption and Download**: Retrieve encrypted files and decrypt them locally, ensuring access to your data when needed.
- **Secure Key Management**: Optionally derive cryptographic keys from a mnemonic seed phrase, allowing for flexible access configurations.
- **User Interaction**: Provides an interactive experience to guide users through the process, with options to bypass prompts using command-line arguments.

## Conclusion

@fnet/filenet provides a straightforward solution for securely storing and accessing files with the filenet.pro service. By focusing on fundamental operations—file encryption, upload, retrieval, and decryption—it offers essential functionality for users who need a reliable method for managing sensitive information in a digital format.


# Developer Guide for @fnet/filenet

## Overview

The `@fnet/filenet` library provides a toolset for interacting with Filenet services, allowing developers to securely push (encrypt and store) and pull (retrieve and decrypt) content. Using a mnemonic seed phrase or private key, developers can generate cryptographic keys to perform operations with enhanced security, making it particularly suitable for managing encrypted data storage and retrieval.

## Installation

To install `@fnet/filenet`, use npm or yarn:

```bash
npm install @fnet/filenet
```

or

```bash
yarn add @fnet/filenet
```

## Usage

To utilize the `@fnet/filenet` library, you will typically interact with its primary exported function, which handles both pushing and pulling operations to and from Filenet services. The function requires specific parameters to define the operation type, keys for encryption, and input/output file paths.

### Push Operation
This involves encrypting your content and safely storing it on Filenet.

```javascript
import filenet from '@fnet/filenet';

async function pushContent() {
  try {
    const result = await filenet({
      operation: 'push',
      phrase: 'your mnemonic seed phrase here',
      input: './path/to/directory-or-file',
      no_prompt: true
    });
    console.log(result.message);
  } catch (error) {
    console.error(error);
  }
}

pushContent();
```

### Pull Operation
This retrieves and decrypts your content from Filenet.

```javascript
import filenet from '@fnet/filenet';

async function pullContent() {
  try {
    const result = await filenet({
      operation: 'pull',
      phrase: 'your mnemonic seed phrase here',
      output: './path/to/output/directory',
      no_prompt: true
    });
    console.log(result.message);
  } catch (error) {
    console.error(error);
  }
}

pullContent();
```

## Examples

### Example: Encrypting and Storing Data
```javascript
// Assuming you have the seed phrase and the data path
await filenet({
  operation: 'push',
  phrase: 'your-mnemonic-seed-phrase',
  input: '/path/to/data'
});
```

### Example: Retrieving and Decrypting Data
```javascript
// Use the same seed phrase to retrieve the data back
await filenet({
  operation: 'pull',
  phrase: 'your-mnemonic-seed-phrase',
  output: '/path/to/save/decrypted-data'
});
```

## Acknowledgement

This library utilizes various cryptographic and file-handling modules to ensure data integrity and security during transfer and storage.



# Input Schema
```yaml
$schema: https://json-schema.org/draft/2020-12/schema
title: Filenet CLI Operation Input Schema
description: Main handler for @fnet/filenet CLI operations with dynamic
  prompt-based input gathering. Handles push (encrypt & store) and pull
  (retrieve & decrypt) interactions with filenet.pro services.
type: object
properties:
  operation:
    type: string
    description: The operation to perform ('push' or 'pull').
  phrase:
    type: string
    description: The mnemonic seed phrase for key generation.
  private_key:
    type: string
    description: The private key for encryption/decryption.
  input:
    type: string
    description: The input directory or file path for encryption (used in push).
    default: .
  output:
    type: string
    description: The output path for decryption results (used in pull).
    default: .
  no_prompt:
    type: boolean
    description: If true, prompts are skipped and defaults or provided arguments are used.
    default: false
  organization:
    type: number
    description: The organization index for key derivation (used with phrase).
    default: 0
  scope:
    type: number
    description: The scope index for key derivation (used with phrase).
    default: 0
  account:
    type: number
    description: The account index for key derivation (used with phrase).
    default: 0
  index:
    type: number
    description: The index for key derivation (used with phrase).
    default: 0

```