@radically-straightforward/cryptography
v1.0.0
Published
🔐 Secure and easy to use cryptographic utilities
Readme
Radically Straightforward · Cryptography
🔐 Secure and easy to use cryptographic utilities
Installation
$ npm install @radically-straightforward/cryptographyUsage
import * as cryptography from "@radically-straightforward/cryptography";SymmetricEncryption
export class SymmetricEncryption;SymmetricEncryption.generateKey()
static async generateKey(): Promise<crypto.KeyObject>;SymmetricEncryption.exportKey()
static exportKey(key: crypto.KeyObject): string;SymmetricEncryption.importKey()
static importKey(keyString: string): crypto.KeyObject;SymmetricEncryption.encrypt()
static encrypt(key: crypto.KeyObject, plainText: string): string;SymmetricEncryption.decrypt()
static decrypt(key: crypto.KeyObject, encryptedText: string): string;AsymmetricEncryption
export class AsymmetricEncryption;AsymmetricEncryption.generateKeyPair()
static async generateKeyPair(): Promise<{
privateKey: string;
publicKey: string;
}>;TokenHash
export class TokenHash;TokenHash.hash()
static hash(token: string): string;TokenHash.verify()
static verify(hash: string, token: string): boolean;PasswordHash
export class PasswordHash;PasswordHash.hash()
static async hash(password: string): Promise<string>;PasswordHash.verify()
static async verify(
hashedPassword: string,
password: string,
): Promise<boolean>;