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

@element-ts/krypton

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@element-ts/krypton

A simple crypto library that wraps node and bcrypt.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

krypton

A very light weight package written in Typescript combining node/crypto and bcrypt for some helpful methods.

NOTE, I am not using my own crypto with this project, it is using recommend crypto from node and bcrypt.

Import

Import what you need. You will most likely not need to import all of these.

import {
    KrBcrypt,
    KrHash,
    KrHashAlgorithm,
    KrRSA,
    KrRSAKeyPair
} from "element-ts/krypton";

Examples

KrBcrypt

const password: string = "1234";
const createdPassword: Buffer = await KrBcrypt.createPassword(password);
const checkPassword: boolean = await KrBcrypt.verifyPassword(password, createdPassword);

KrHash

const hashedData: Buffer = KrHash.hash(Buffer.from("Hello, world!");
const hashedData: Buffer = KrHash.hash(Buffer.from("Hello, world!", KrHashAlgorithm.sha512));

const hasher: KrHash = new KrHash()
hasher.append(Buffer.from("Hello"));
hasher.append(Buffer.from("World"));
const hashedData: Buffer = hasher.hash();

KrRSA


const keys: KrRSAKeyPair = KrRSA.generateKeys();

const message: string = "Hello, world!";
const dataUnEncrypted: Buffer = Buffer.from(message);
const dataEncrypted: Buffer = KrRSA.encrypt(dataUnEncrypted, keys.publicKey);
const dataDecrypted: Buffer = KrRSA.decrypt(dataEncrypted, keys.privateKey);

const messageDecrypted: string = dataDecrypted.toString("utf8");

Documentation

You can view the declaration files or even the source code on GitHub.

Bugs

If you find any bugs please create an issue on GitHub or if you are old fashioned email me at elijah@elijahcobb.com.

Keywords

FAQs

Package last updated on 20 Feb 2020

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