From e9dcde5f70ddb7bf72c047c23402c7cdfdb693ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kalvis=20Kalni=C5=86=C5=A1?= Date: Tue, 5 Feb 2019 14:39:38 +0200 Subject: [PATCH] fix(keypair): Keypair.type and sign/verify --- types/stellar-base/index.d.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/types/stellar-base/index.d.ts b/types/stellar-base/index.d.ts index a230c36942..6e9acfaa94 100644 --- a/types/stellar-base/index.d.ts +++ b/types/stellar-base/index.d.ts @@ -49,6 +49,8 @@ export class Asset { export const FastSigning: boolean; +export type KeypairType = 'ed25519'; + export class Keypair { static fromRawEd25519Seed(secretSeed: Buffer): Keypair; static fromBase58Seed(secretSeed: string): Keypair; @@ -57,17 +59,18 @@ export class Keypair { static fromPublicKey(publicKey: string): Keypair; static random(): Keypair; - constructor(keys: { type: 'ed25519', secretKey: string } | { type: 'ed25519', Key: string }) + constructor(keys: { type: KeypairType, secretKey: string, publicKey?: string } | { type: KeypairType, publicKey: string }) + readonly type: KeypairType; publicKey(): string; secret(): string; rawPublicKey(): Buffer; rawSecretKey(): Buffer; canSign(): boolean; - sign(data: Buffer): Buffer; + sign(data: Buffer): xdr.Signature; signDecorated(data: Buffer): xdr.DecoratedSignature; signatureHint(): xdr.SignatureHint; - verify(data: Buffer, signature: Buffer): boolean; + verify(data: Buffer, signature: xdr.Signature): boolean; } export const MemoNone = 'none'; @@ -498,5 +501,5 @@ export namespace xdr { } export function hash(data: Buffer): Buffer; -export function sign(data: Buffer, rawSecret: Buffer): Buffer; -export function verify(data: Buffer, signature: Buffer, rawPublicKey: Buffer): boolean; +export function sign(data: Buffer, rawSecret: Buffer): xdr.Signature; +export function verify(data: Buffer, signature: xdr.Signature, rawPublicKey: Buffer): boolean;