Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

feathers-encryption-hook

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers-encryption-hook

[![Build Status](https://app.travis-ci.com/ydeshayes/feathers-encryption-hook.svg?branch=main)](https://app.travis-ci.com/ydeshayes/feathers-encryption-hook) # Feathers encryption hook

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

Feathers encryption hook

This feathers hook is handling encryption in database for selected fields. It can encrypt before and decrypt data after.

Importing library

You can import the generated bundle to use the whole library generated by this starter:

import encryptionHook from 'feathers-encryption-hook'

Additionally, you can import the transpiled modules from dist/lib in case you have a modular library:

import encryptionHook from 'feathers-encryption-hook/dist/lib/feathers-hook-encrypt'

Usage

Configuration

You can use the authentication configuration:

app.set("authentication", {
    secret: "secret",
    algorithm: "aes-256-cfb"
});

Create an encryption object in your configuation:

"encryption", {
    key: "key",
    algorithm: "aes-256-cbc"
}

or give the key and algorithm at the hook init:

import encryptionHookInit from 'feathers-encryption-hook';

const encryptionHook = encryptionHookInit({
    algorithm: "aes-256-cbc",
    key: "*F-JaNdRgUkXp2r5u8x/A?D(G+KbPeSh",
    fields: ["foo"]
});
app.service('messages').hooks({
    before: {
        create: [encryptionHook]
    },
    after: {
        create: [encryptionHook]
    }
});

Used in a before hook it will encrypt the fields in fields. Used in a after hook it will decrypt the fields in fields.

Development

NPM scripts

  • npm t: Run test suite
  • npm start: Run npm run build in watch mode
  • npm run test:watch: Run test suite in interactive watch mode
  • npm run test:prod: Run linting and generate coverage
  • npm run build: Generate bundles and typings, create docs
  • npm run lint: Lints code
  • npm run commit: Commit using conventional commit style husky

Keywords

FAQs

Package last updated on 21 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc