Skip to content
Snippets Groups Projects

Fix memo encryption

Merged Mahdi Yari requested to merge fix-memo-encryption into master
All threads resolved!
Files
16
+ 9
34
@@ -517,7 +517,6 @@ declare module 'dhive/chain/misc' {
}
declare module 'dhive/chain/serializer' {
/// <reference types="node" />
/**
* @file Hive protocol serialization.
* @author Johan Nordberg <code@johan-nordberg.com>
@@ -552,6 +551,7 @@ declare module 'dhive/chain/serializer' {
* You acknowledge that this software is not designed, licensed or intended for use
* in the design, construction, operation or maintenance of any military facility.
*/
/// <reference types="node" />
import * as ByteBuffer from 'bytebuffer';
import { PublicKey } from 'dhive/crypto';
import { Asset } from 'dhive/chain/asset';
@@ -593,7 +593,7 @@ declare module 'dhive/chain/serializer' {
UInt32: (buffer: ByteBuffer, data: number) => void;
UInt64: (buffer: ByteBuffer, data: number) => void;
UInt8: (buffer: ByteBuffer, data: number) => void;
Void: () => never;
Void: (buffer: ByteBuffer) => never;
};
}
@@ -2939,50 +2939,26 @@ declare module 'dhive/client' {
}
declare module 'dhive/chain/deserializer' {
/// <reference types="node" />
import * as ByteBuffer from 'bytebuffer';
export type Deserializer = (buffer: ByteBuffer) => void;
export const types: {
EncryptedMemoD: (buf: Buffer | ByteBuffer) => {};
EncryptedMemoD: any;
};
}
declare module 'dhive/helpers/aes' {
/// <reference types="node" />
import { PrivateKey, PublicKey } from 'dhive/crypto';
/**
* Spec: http://peakd.com/steem/@dantheman/how-to-encrypt-a-memo-when-transferring-steem
* @throws {Error|TypeError} - "Invalid Key, ..."
* @param {PrivateKey} private_key - required and used for decryption
* @param {PublicKey} public_key - required and used to calcualte the shared secret
* @param message - message to be encrypted
* @param {string} [nonce = uniqueNonce()] - assigned a random unique uint64
*
* @return {object}
* @property {string} nonce - random or unique uint64, provides entropy when re-using the same private/public keys.
* @property {Buffer} message - Plain text message
* @property {number} checksum - shared secret checksum
*/
export function encrypt(private_key: PrivateKey, public_key: PublicKey, message: any, nonce: any): any;
/**
* Spec: http://peakd.com/steem/@dantheman/how-to-encrypt-a-memo-when-transferring-steem
* @arg {PrivateKey} private_key - required and used for decryption
* @arg {PublicKey} public_key - required and used to calcualte the shared secret
* @arg {string} nonce - random or unique uint64, provides entropy when re-using the same private/public keys.
* @arg {Buffer} message - Encrypted or plain text message
* @arg {number} checksum - shared secret checksum
* @throws {Error|TypeError} - "Invalid Key, ..."
* @return {Buffer} - message
*/
export function decrypt(private_key: PrivateKey, public_key: PublicKey, nonce: any, message: any, checksum: number): string;
export const encrypt: (private_key: PrivateKey, public_key: PublicKey, message: Buffer, nonce?: string) => any;
export const decrypt: (private_key: PrivateKey, public_key: PublicKey, nonce: any, message: any, checksum: number) => any;
}
declare module 'dhive/memo' {
import { PrivateKey, PublicKey } from 'dhive/crypto'; function encode(private_key: PrivateKey | string, public_key: PublicKey | string, memo: string, testNonce?: number): string; function decode(private_key: PrivateKey | string, memo: any): any;
import { PrivateKey, PublicKey } from 'dhive/crypto';
export const Memo: {
decode: typeof decode;
encode: typeof encode;
decode: (private_key: string | PrivateKey, memo: string) => string;
encode: (private_key: string | PrivateKey, public_key: string | PublicKey, memo: string, testNonce?: string | undefined) => string;
};
export {};
}
declare module 'dhive' {
@@ -3034,7 +3010,6 @@ declare module 'dhive' {
export * from 'dhive/chain/misc';
export * from 'dhive/chain/operation';
export * from 'dhive/chain/serializer';
export * from 'dhive/chain/deserializer';
export * from 'dhive/chain/transaction';
export * from 'dhive/chain/hivemind';
export * from 'dhive/client';
Loading