@@ -107,10 +107,9 @@ export class ABlockWallet {
107107 /**
108108 * Initialize an instance of the client with a provided master key
109109 *
110- * @param {IClientConfig } config - Additional configuration parameters
111110 * @param {IMasterKeyEncrypted } masterKey - Master key
111+ * @param {IClientConfig } config - Additional configuration parameters
112112 * @param initOffline - Optionally initialize the client without initializing network settings
113- *
114113 * @return {* } {IClientResponse}
115114 * @memberof ABlockWallet
116115 */
@@ -144,11 +143,10 @@ export class ABlockWallet {
144143 /**
145144 * Initialize an instance of the wallet with a provided seed phrase
146145 *
147- * @param {IClientConfig } config - Additional configuration parameters
148146 * @param {string } seedPhrase - Seed phrase
147+ * @param {IClientConfig } config - Additional configuration parameters
148+ * @param initOffline - Optionally initialize the client without initializing network settings
149149 * @return {* } {IClientResponse}
150- * @param initOffline - Optionally initialize the client without initializing network settings
151- *
152150 * @memberof ABlockWallet
153151 */
154152 public async fromSeed (
@@ -157,7 +155,7 @@ export class ABlockWallet {
157155 initOffline = false ,
158156 ) : Promise < IClientResponse > {
159157 this . keyMgmt = new mgmtClient ( ) ;
160- const initIResult = this . keyMgmt . fromSeed ( config . passphrase , seedPhrase ) ;
158+ const initIResult = this . keyMgmt . fromSeed ( seedPhrase , config . passphrase ) ;
161159 if ( ! initOffline ) {
162160 const initNetworkIResult = await this . initNetwork ( config ) ;
163161 if ( initNetworkIResult . status === 'error' ) {
@@ -184,7 +182,7 @@ export class ABlockWallet {
184182 * Common network initialization (retrieval of PoW list for compute and storage)
185183 *
186184 * @param {IClientConfig } config - Configuration parameters
187- *
185+ * @return { * } {IClientResponse}
188186 * @memberof ABlockWallet
189187 */
190188 public async initNetwork ( config : IClientConfig ) : Promise < IClientResponse > {
@@ -239,6 +237,7 @@ export class ABlockWallet {
239237 *
240238 * @private
241239 * @param {IClientConfig } config - Additional configuration parameters
240+ * @return {* } {IClientResponse}
242241 * @memberof ABlockWallet
243242 */
244243 private async initNetworkForHost (
@@ -601,10 +600,10 @@ export class ABlockWallet {
601600 * @return {* } {Promise<IClientResponse>}
602601 * @memberof ABlockWallet
603602 */
604- async signMessage (
603+ signMessage (
605604 keyPairsToSignWith : IKeypairEncrypted [ ] ,
606605 message : string ,
607- ) : Promise < IClientResponse > {
606+ ) : IClientResponse {
608607 try {
609608 if ( this . keyMgmt === undefined ) throw new Error ( IErrorInternal . ClientNotInitialized ) ;
610609 const keyPairs = throwIfErr ( this . keyMgmt . decryptKeypairs ( keyPairsToSignWith ) ) ;
@@ -624,6 +623,28 @@ export class ABlockWallet {
624623 }
625624 }
626625
626+ verifyMessage (
627+ message : string ,
628+ signatures : IGenericKeyPair < string > ,
629+ keyPairs : IKeypairEncrypted [ ] ,
630+ ) : IClientResponse {
631+ try {
632+ if ( this . keyMgmt === undefined ) throw new Error ( IErrorInternal . ClientNotInitialized ) ;
633+ const keyPairsUnencrypted = throwIfErr ( this . keyMgmt . decryptKeypairs ( keyPairs ) ) ;
634+ throwIfErr ( this . keyMgmt . verifyMessage ( message , signatures , keyPairsUnencrypted ) ) ;
635+ return {
636+ status : 'success' ,
637+ reason : ISuccessInternal . MessageVirified ,
638+ } as IClientResponse ;
639+ } catch ( error ) {
640+ return {
641+ status : 'error' ,
642+ reason : `${ error } ` ,
643+ } as IClientResponse ;
644+ }
645+ }
646+
647+
627648 /**
628649 * Make a payment of a specified token amount to a payment address
629650 *
0 commit comments