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

@burstjs/crypto

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@burstjs/crypto - npm Package Compare versions

Comparing version 0.5.0-beta.5 to 0.5.0-beta.6

4

package.json
{
"name": "@burstjs/crypto",
"version": "0.5.0-beta.5",
"version": "0.5.0-beta.6",
"description": "Cryptographic functions for building Burstcoin apps.",

@@ -59,3 +59,3 @@ "contributors": [

},
"gitHead": "e3a4b63ad6dd058eead59517c464d60511f02c0a",
"gitHead": "94e3134dab092607729232ca4afeda92c8b22a0e",
"publishConfig": {

@@ -62,0 +62,0 @@ "access": "public"

/* tslint:disable */
/** @module crypto */
/** @ignore */ // internal - shouldn't be used externally
/** @internal */ // internal - shouldn't be used externally

@@ -5,0 +5,0 @@ /**

/** @ignore */
/** @module crypto */
/** @internal */

@@ -4,0 +4,0 @@ /* tslint:disable */

@@ -1,3 +0,1 @@

/** @module crypto */
import * as CryptoJS from 'crypto-js';

@@ -7,5 +5,7 @@

* Decrypt an encrypted message
* @see [[encryptAES]]
* @param encryptedBase64 encrypted data in base64 format
* @param key The secret key
* @return The decrypted content
* @module crypto
*/

@@ -12,0 +12,0 @@ export const decryptAES = (encryptedBase64: string, key: string): string => {

@@ -1,3 +0,1 @@

/** @module crypto */
/**

@@ -53,2 +51,3 @@ * Original work Copyright (c) 2018 PoC-Consortium

* @return The original plain text
* @module crypto
*/

@@ -55,0 +54,0 @@ export function decryptData(

@@ -1,3 +0,1 @@

/** @module crypto */
/**

@@ -17,2 +15,3 @@ * Original work Copyright (c) 2019 Burst Apps Team

* @return The original message
* @module crypto
*/

@@ -19,0 +18,0 @@ export function decryptMessage(

/** @ignore */
/** @module crypto */
/** @internal*/
/* tslint:disable */

@@ -4,0 +4,0 @@

@@ -1,10 +0,13 @@

/** @module crypto */
import * as CryptoJS from 'crypto-js';
/*
* Encrypt a derived hd private key with a given pin and return it in Base64 form
*/
/**
* Symmetrically encrypts a text using an arbitrary key
* @see [[decryptAES]]
* @param text The message/text to be encrypted
* @param key The key used
* @return The encrypted message as Base64 string
* @module crypto
*/
export const encryptAES = (text: string, key: string): string => {
return CryptoJS.AES.encrypt(text, key).toString();
};

@@ -1,3 +0,1 @@

/** @module crypto */
/**

@@ -40,3 +38,5 @@ * Original work Copyright (c) 2018 PoC-Consortium

/**
* Encrypts arbitrary data
* Encrypts arbitrary data for P2P message/data exchange using asymmetric encryption
*
* @see [[decryptData]]
* @param plaintext Data to be encrypted

@@ -46,2 +46,3 @@ * @param recipientPublicKeyHex The recipients public key in hexadecimal format

* @return The encrypted Data
* @module crypto
*/

@@ -48,0 +49,0 @@ export function encryptData(

@@ -1,3 +0,1 @@

/** @module crypto */
/**

@@ -12,3 +10,4 @@ * Original work Copyright (c) 2019 Burst Apps Team

/**
* Encrypts a message (UTF-8 compatible)
* Encrypts arbitrary message (UTF-8 compatible) for P2P message/data exchange using asymmetric encryption
* @see [[decryptMessage]]
* @param plaintext Message to be encrypted

@@ -18,2 +17,3 @@ * @param recipientPublicKeyHex The recipients public key hexadecimal format

* @return The encrypted Message
* @module crypto
*/

@@ -20,0 +20,0 @@ export function encryptMessage(plaintext: string, recipientPublicKeyHex: string, senderPrivateKeyHex: string): EncryptedMessage {

@@ -1,3 +0,1 @@

/** @module crypto */
import * as CryptoJS from 'crypto-js';

@@ -9,5 +7,6 @@ import { Keys } from './typings/keys';

/**
* Generate the Master Public Key and Master Private Key for a new passphrase
* Generate the Master Public Key and Master Private Keys for a new passphrase
* @param passPhrase The passphrase
* @return EC-KCDSA sign key pair + agreement key
* @module crypto
*/

@@ -14,0 +13,0 @@ export const generateMasterKeys = (passPhrase: string): Keys => {

@@ -1,3 +0,1 @@

/** @module crypto */
import {Converter} from './converter';

@@ -8,3 +6,3 @@ import {ECKCDSA} from './ec-kcdsa';

/**
* Generate a signature for the transaction
* Generate a signature for a transaction
*

@@ -20,2 +18,4 @@ * Method:

* @param privateKey The private key for signing
* @return The signature in hexadecimal format
* @module crypto
*/

@@ -22,0 +22,0 @@ export const generateSignature = (messageHex: string, privateKey: string): string => {

@@ -1,8 +0,7 @@

/** @module crypto */
/**
* Generates a signed message digest
* Generates a signed message digest, which can be sent to BRS API then
* @param unsignedTransactionHex The unsigned message
* @param signature The signature
* @return The signed message digest
* @module crypto
*/

@@ -9,0 +8,0 @@ export const generateSignedTransactionBytes = (unsignedTransactionHex: string, signature: string): string =>

@@ -1,3 +0,1 @@

/** @module crypto */
import {Converter} from './converter';

@@ -10,2 +8,3 @@ import * as CryptoJS from 'crypto-js';

* @return The numeric account Id
* @module crypto
*/

@@ -18,3 +17,5 @@ export const getAccountIdFromPublicKey = (publicKey: string): string => {

let byte = bytes[i].toString(16);
if (byte.length < 2) { byte = '0' + byte; }
if (byte.length < 2) {
byte = '0' + byte;
}
result = byte + result;

@@ -26,2 +27,3 @@ }

/**
* @internal
* Arbitrary length hexadecimal to decimal conversion

@@ -31,2 +33,3 @@ * https://stackoverflow.com/questions/21667377/javascript-hexadecimal-string-to-decimal-string

* @return A decimal string
* @module crypto
*/

@@ -33,0 +36,0 @@ function hexToDec(s) {

@@ -1,10 +0,11 @@

/** @module crypto */
import * as CryptoJS from 'crypto-js';
/*
* Hash string into hex string
*/
/**
* Hash string into hex string
* @param input An arbitrary text
* @return the hash for that string in hex format
* @module crypto
*/
export const hashSHA256 = (input: string): string => {
return CryptoJS.SHA256(input).toString();
};

@@ -1,4 +0,8 @@

/** @module crypto */
/**
* This package contains all cryptographic functions
* needed for Burstcoin.
*
* @moduledefinition crypto
* */
// export * from './converter';
export * from './encryptAES';

@@ -5,0 +9,0 @@ export * from './decryptAES';

/* tslint:disable */
/** @module crypto */
/**

@@ -14,2 +12,9 @@ * Original work Copyright (c) 2018 PoC-Consortium

/**
* A secure random passphrase generator
*
* @note For secure randomization [seedrandom](https://www.npmjs.com/package/seedrandom) is used.
*
* @module crypto
*/
export class PassPhraseGenerator {

@@ -26,2 +31,6 @@

/**
* Generates a passphrase based on priory set
* @return The _secret_ twelve-worded passphrase
*/
public generate(): string[] {

@@ -41,2 +50,6 @@ // seed with given seed if seed was given, yep

/**
* Sets a new seed for generation
* @param seed
*/
public reSeed(seed) {

@@ -46,6 +59,7 @@ this.seed = seed;

/*
* Generate a passphrase with the help of the PassPhraseGenerator
* pass optional seed for seeding generation
*/
/**
* Creates a secure randomized passphrase
* @param seed An arbitrary array of elements used for seeding
* @return The _secret_ twelve-worded passphrase
*/
public generatePassPhrase(seed: any[] = []): Promise<string[]> {

@@ -52,0 +66,0 @@ return new Promise((resolve, reject) => {

@@ -1,3 +0,1 @@

/** @module crypto */
/**

@@ -7,2 +5,7 @@ * Original work Copyright (c) 2019 Burst Apps Team

/**
* The interface for encrypted raw data
* @see [[encryptData]]
* @module crypto
*/
export interface EncryptedData {

@@ -9,0 +12,0 @@ data: Uint8Array;

@@ -1,3 +0,1 @@

/** @module crypto */
/**

@@ -7,2 +5,7 @@ * Original work Copyright (c) 2019 Burst Apps Team

/**
* The interface for encrypted message
* @see [[encryptMessage]]
* @module crypto
*/
export interface EncryptedMessage {

@@ -9,0 +12,0 @@ data: string;

@@ -1,3 +0,1 @@

/** @module crypto */
/**

@@ -8,11 +6,22 @@ * Original work Copyright (c) 2018 PoC-Consortium

/*
* Keys interface
*
* The Keys class is used to encompass keys associated to an account.
*/
/**
* Keys interface
*
* The Keys class is used to encompass keys associated to an account.
*
* @module crypto
*/
export interface Keys {
/**
* The private key used for P2P message encryption
*/
agreementPrivateKey: string;
/**
* The public key
*/
publicKey: string;
/**
* The private key used for transaction signing
*/
signPrivateKey: string;
}

@@ -1,3 +0,1 @@

/** @module crypto */
import { Converter } from './converter';

@@ -16,5 +14,8 @@ import { ECKCDSA } from './ec-kcdsa';

* ```
* @see [[generateSignature]]
* @param signature The signature to be verified
* @param messageHex The message data in hexadecimal representation
* @param publicKey The public key
* @return _true_, if signature is valid, otherwise _false_
* @module crypto
*/

@@ -21,0 +22,0 @@ export const verifySignature = (signature: string, messageHex: string, publicKey: string): boolean => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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