Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#45376 [bitcore-lib] added Message class by @…
Browse files Browse the repository at this point in the history
  • Loading branch information
hoonsubin authored Jun 16, 2020
1 parent d5ecb91 commit 86a5308
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions types/bitcore-lib/bitcore-lib-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ tx.verify();
new bitcore.Unit(2, 'BTC').toSatoshis();

bitcore.Unit.fromMilis(1000).toBTC();

const message = new bitcore.Message('sign this message');

const signedMessageSig = message.sign(privateKey);

message.verify(privateKey.toAddress(), signedMessageSig);
14 changes: 14 additions & 0 deletions types/bitcore-lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,20 @@ export class Script {
toAddress(): Address;
}

export class Message {
constructor(message: string);

magicHash(): Buffer;
sign(privateKey: PrivateKey): string;
verify(bitcoinAddress: Address | string, signatureString: string): boolean;
fromString(str: string): Message;
fromJSON(json: string): Message;
toObject(): { message: string };
toJSON(): string;
toString(): string;
inspect(): string;
}

export interface Util {
readonly buffer: {
reverse(a: any): any;
Expand Down

0 comments on commit 86a5308

Please sign in to comment.