Skip to content

Commit a44264f

Browse files
committed
hdkey docs
1 parent af463df commit a44264f

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ const sig = hdkey3.sign(hash);
221221
hdkey3.verify(hash, sig);
222222
```
223223

224-
Note: do not set `privateKey` and `publicKey` directly, you will get wrong keys.
224+
Note: `chainCode` property is essentially a private part
225+
of a secret "master" key, it should be guarded from unauthorized access.
225226

226227
The full API is:
227228

@@ -232,26 +233,25 @@ class HDKey {
232233
public static fromExtendedKey(base58key: string, versions: Versions): HDKey;
233234
public static fromJSON(json: { xpriv: string }): HDKey;
234235

235-
public versions: Versions;
236-
public depth: number;
237-
public index: number;
238-
public chainCode: Uint8Array | null;
239-
public privateKey: Uint8Array | null;
240-
public publicKey: Uint8Array | null;
241-
public fingerprint: number;
242-
public parentFingerprint: number;
243-
public pubKeyHash: Uint8Array | undefined;
244-
public identifier: Uint8Array | undefined;
245-
public privateExtendedKey: string;
246-
public publicExtendedKey: string;
247-
248-
private constructor(versios: Versions);
249-
public derive(path: string): HDKey;
250-
public deriveChild(index: number): HDKey;
251-
public sign(hash: Uint8Array): Uint8Array;
252-
public verify(hash: Uint8Array, signature: Uint8Array): boolean;
253-
public wipePrivateData(): this;
254-
public toJSON(): { xpriv: string; xpub: string };
236+
readonly versions: Versions;
237+
readonly depth: number = 0;
238+
readonly index: number = 0;
239+
readonly chainCode: Uint8Array | null = null;
240+
readonly parentFingerprint: number = 0;
241+
242+
get fingerprint(): number;
243+
get identifier(): Uint8Array | undefined;
244+
get pubKeyHash(): Uint8Array | undefined;
245+
get privateKey(): Uint8Array | null;
246+
get publicKey(): Uint8Array | null;
247+
get privateExtendedKey(): string;
248+
get publicExtendedKey(): string;
249+
250+
derive(path: string): HDKey;
251+
deriveChild(index: number): HDKey;
252+
sign(hash: Uint8Array): Uint8Array;
253+
verify(hash: Uint8Array, signature: Uint8Array): boolean;
254+
wipePrivateData(): this;
255255
}
256256

257257
interface Versions {

0 commit comments

Comments
 (0)