From 94799aacc9688e9b03a45ae8c54c5ae624218b6c Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Wed, 27 Dec 2023 14:40:28 +0700 Subject: [PATCH 1/2] fix: properly print key class Signed-off-by: Timo Glastra --- packages/core/src/crypto/Key.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/core/src/crypto/Key.ts b/packages/core/src/crypto/Key.ts index 2ebe3651f2..29d91f2c65 100644 --- a/packages/core/src/crypto/Key.ts +++ b/packages/core/src/crypto/Key.ts @@ -59,4 +59,10 @@ export class Key { public get supportsSigning() { return isSigningSupportedForKeyType(this.keyType) } + + // We return the fingerprint when this object is serialized to JSON + // This means it's nicely formatted when printing to the console + private toJSON() { + return this.fingerprint + } } From 9d73219374b47e9aaa0387cc9b2312c3fcb5c8ab Mon Sep 17 00:00:00 2001 From: Timo Glastra Date: Tue, 9 Jan 2024 08:44:43 +0700 Subject: [PATCH 2/2] updates Signed-off-by: Timo Glastra --- packages/core/src/crypto/Key.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/src/crypto/Key.ts b/packages/core/src/crypto/Key.ts index 29d91f2c65..ec44eead24 100644 --- a/packages/core/src/crypto/Key.ts +++ b/packages/core/src/crypto/Key.ts @@ -60,9 +60,12 @@ export class Key { return isSigningSupportedForKeyType(this.keyType) } - // We return the fingerprint when this object is serialized to JSON - // This means it's nicely formatted when printing to the console + // We return an object structure based on the key, so that when this object is + // serialized to JSON it will be nicely formatted instead of the bytes printed private toJSON() { - return this.fingerprint + return { + keyType: this.keyType, + publicKeyBase58: this.publicKeyBase58, + } } }