Skip to content

tetherto/pearpass-lib-vault-core

Repository files navigation

pearpass-lib-vault-core

A bare runtime focused library for managing encrypted password vaults for Pearpass. This library provides a secure way to store, encrypt, and manage password vaults.

Table of Contents

Features

  • Secure password vault creation and management
  • Local encryption and decryption
  • Event-based updates
  • Vault sharing via invite codes
  • Debug mode for development

Security Notice

  1. To ensure the security and integrity of your projects, please note that official PearPass packages are distributed exclusively through our GitHub organization.
  2. Any packages with similar names found on the npm registry or other third-party package managers are not affiliated with PearPass and should be strictly avoided. We recommend installing directly from this repository to ensure you are using the verified, open-source version.

Installation

npm install git+https://github.com/tetherto/pearpass-lib-vault-core.git

Usage Examples

Initialize a vault client

import { createPearpassVaultClient } from '@tetherto/pearpass-lib-vault-core';

// Create a new client with a storage path
const client = createPearpassVaultClient('/path/to/storage', {
    debugMode: false // Set to true for verbose logging
});

Encryption for vault key

const password = 'my-secure-password';

// hashing the password 
const { hashedPassword, salt } = await client.hashPassword(password);

// Generate a random encryption key
const { ciphertext, nonce } = await client.encryptVaultKeyWithHashedPassword(hashedPassword);

// Encrypt existing vault key 
const { ciphertext, nonce } = await client.encryptVaultWithKey(hashedPassword, key);

Decryption for vault key

// Get hashed password from user input
const hashedPassword = await client.getDecryptionKey({salt, password});

// Decrypt the vault key
const key = await client.decryptVaultKey({ciphertext, nonce, hashedPassword});

Working with vaults

// Initialize encryption
await client.encryptionInit();

// Initialize vaults storage
await client.vaultsInit();


// Store vault info
await client.vaultsAdd('vault/my-vault', {
    id: 'my-vault',
    name: 'My Password Vault',
    hashedPassword,
    ciphertext,
    nonce,
    salt,
});

// Initialize active vault
await client.activeVaultInit({
    id: vaultId,
    encryptionKey: key
});

// Add an entry to the vault
await client.activeVaultAdd(`record/${vaultId}`, {
    name: 'GitHub',
    username: '[email protected]',
    password: 'secure-password'
});

// Retrieve passwords
const github = await client.activeVaultGet(`vault/${vaultId}`);
console.log(githubPassword);

// Close connections when done
await client.closeAllInstances();

Dependencies

Related Projects

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.

About

PearPass is an open-source, privacy-first password manager with peer-to-peer syncing and end-to-end encryption. This repository contains shared core components used across the PearPass apps.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors