diff --git a/wallet/manager.go b/wallet/manager.go
index a96f5f8ab..eef29ea88 100644
--- a/wallet/manager.go
+++ b/wallet/manager.go
@@ -191,3 +191,12 @@ func (wm *Manager) AddressHistory(
return wlt.GetHistory(address), nil
}
+
+func (wm *Manager) SignMessage(walletName, password, addr, msg string) (string, error) {
+ wlt, ok := wm.wallets[walletName]
+ if !ok {
+ return "", status.Errorf(codes.NotFound, "wallet is not loaded")
+ }
+
+ return wlt.SignMessage(password, addr, msg)
+}
diff --git a/wallet/wallet.go b/wallet/wallet.go
index 0ae20e2a0..ed54e7c71 100644
--- a/wallet/wallet.go
+++ b/wallet/wallet.go
@@ -476,3 +476,12 @@ func (w *Wallet) AddTransaction(id tx.ID) error {
func (w *Wallet) GetHistory(addr string) []HistoryInfo {
return w.store.History.getAddrHistory(addr)
}
+
+func (w *Wallet) SignMessage(password, addr, msg string) (string, error) {
+ prv, err := w.PrivateKey(password, addr)
+ if err != nil {
+ return "", err
+ }
+
+ return prv.Sign([]byte(msg)).String(), nil
+}
diff --git a/wallet/wallet_test.go b/wallet/wallet_test.go
index 7cb629a54..fae4ccbc8 100644
--- a/wallet/wallet_test.go
+++ b/wallet/wallet_test.go
@@ -5,6 +5,7 @@ import (
"testing"
"github.com/pactus-project/pactus/crypto"
+ "github.com/pactus-project/pactus/crypto/bls"
"github.com/pactus-project/pactus/genesis"
"github.com/pactus-project/pactus/state"
"github.com/pactus-project/pactus/types/account"
@@ -15,6 +16,7 @@ import (
"github.com/pactus-project/pactus/wallet"
"github.com/pactus-project/pactus/www/grpc"
"github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
)
type testData struct {
@@ -178,6 +180,24 @@ func TestImportPrivateKey(t *testing.T) {
assert.Equal(t, pub.String(), valAddrInfo.PublicKey)
}
+func TestSignMessage(t *testing.T) {
+ td := setup(t)
+ defer td.Close()
+
+ msg := "pactus"
+ expectedSig := "923d67a8624cbb7972b29328e15ec76cc846076ccf00a9e94d991c677846f334ae4ba4551396fbcd6d1cab7593baf3b7"
+ prv, err := bls.PrivateKeyFromString("SECRET1PDRWTLP5PX0FAHDX39GXZJP7FKZFALML0D5U9TT9KVQHDUC99CMGQQJVK67")
+
+ require.NoError(t, err)
+
+ err = td.wallet.ImportPrivateKey(td.password, prv)
+ assert.NoError(t, err)
+
+ sig, err := td.wallet.SignMessage(td.password, td.wallet.AllAccountAddresses()[0].Address, msg)
+ assert.NoError(t, err)
+ assert.Equal(t, sig, expectedSig)
+}
+
func TestKeyInfo(t *testing.T) {
td := setup(t)
defer td.Close()
diff --git a/www/grpc/buf/grpc-gateway.config.yaml b/www/grpc/buf/grpc-gateway.config.yaml
index 96f12a306..dae652890 100644
--- a/www/grpc/buf/grpc-gateway.config.yaml
+++ b/www/grpc/buf/grpc-gateway.config.yaml
@@ -87,3 +87,13 @@ http:
- selector: pactus.Wallet.GetTotalBalance
get: "/pactus/wallet/get_total_balance"
+
+ - selector: pactus.Wallet.SignMessage
+ get: "/pactus/wallet/sign_message"
+
+ # Util APIs
+ - selector: pactus.Utils.SignMessageWithPrivateKey
+ get: "/pactus/Utils/sign_message_with_private_key"
+
+ - selector: pactus.Utils.VerifyMessage
+ get: "/pactus/Utils/verify_message"
diff --git a/www/grpc/gateway.go b/www/grpc/gateway.go
index 02ac5c179..842d416a0 100644
--- a/www/grpc/gateway.go
+++ b/www/grpc/gateway.go
@@ -68,6 +68,10 @@ func (s *Server) startGateway(grpcAddr string) error {
if err != nil {
return err
}
+ err = pactus.RegisterUtilsHandler(s.ctx, gwMux, conn)
+ if err != nil {
+ return err
+ }
oa, err := s.getOpenAPIHandler()
if err != nil {
diff --git a/www/grpc/gen/dart/utils.pb.dart b/www/grpc/gen/dart/utils.pb.dart
new file mode 100644
index 000000000..b44ff7e68
--- /dev/null
+++ b/www/grpc/gen/dart/utils.pb.dart
@@ -0,0 +1,256 @@
+///
+// Generated code. Do not modify.
+// source: utils.proto
+//
+// @dart = 2.12
+// ignore_for_file: annotate_overrides,camel_case_types,constant_identifier_names,directives_ordering,library_prefixes,non_constant_identifier_names,prefer_final_fields,return_of_invalid_type,unnecessary_const,unnecessary_import,unnecessary_this,unused_import,unused_shown_name
+
+import 'dart:async' as $async;
+import 'dart:core' as $core;
+
+import 'package:protobuf/protobuf.dart' as $pb;
+
+class SignMessageWithPrivateKeyRequest extends $pb.GeneratedMessage {
+ static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignMessageWithPrivateKeyRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pactus'), createEmptyInstance: create)
+ ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'privateKey')
+ ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'message')
+ ..hasRequiredFields = false
+ ;
+
+ SignMessageWithPrivateKeyRequest._() : super();
+ factory SignMessageWithPrivateKeyRequest({
+ $core.String? privateKey,
+ $core.String? message,
+ }) {
+ final _result = create();
+ if (privateKey != null) {
+ _result.privateKey = privateKey;
+ }
+ if (message != null) {
+ _result.message = message;
+ }
+ return _result;
+ }
+ factory SignMessageWithPrivateKeyRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
+ factory SignMessageWithPrivateKeyRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
+ 'Will be removed in next major version')
+ SignMessageWithPrivateKeyRequest clone() => SignMessageWithPrivateKeyRequest()..mergeFromMessage(this);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
+ 'Will be removed in next major version')
+ SignMessageWithPrivateKeyRequest copyWith(void Function(SignMessageWithPrivateKeyRequest) updates) => super.copyWith((message) => updates(message as SignMessageWithPrivateKeyRequest)) as SignMessageWithPrivateKeyRequest; // ignore: deprecated_member_use
+ $pb.BuilderInfo get info_ => _i;
+ @$core.pragma('dart2js:noInline')
+ static SignMessageWithPrivateKeyRequest create() => SignMessageWithPrivateKeyRequest._();
+ SignMessageWithPrivateKeyRequest createEmptyInstance() => create();
+ static $pb.PbList createRepeated() => $pb.PbList();
+ @$core.pragma('dart2js:noInline')
+ static SignMessageWithPrivateKeyRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create);
+ static SignMessageWithPrivateKeyRequest? _defaultInstance;
+
+ @$pb.TagNumber(1)
+ $core.String get privateKey => $_getSZ(0);
+ @$pb.TagNumber(1)
+ set privateKey($core.String v) { $_setString(0, v); }
+ @$pb.TagNumber(1)
+ $core.bool hasPrivateKey() => $_has(0);
+ @$pb.TagNumber(1)
+ void clearPrivateKey() => clearField(1);
+
+ @$pb.TagNumber(2)
+ $core.String get message => $_getSZ(1);
+ @$pb.TagNumber(2)
+ set message($core.String v) { $_setString(1, v); }
+ @$pb.TagNumber(2)
+ $core.bool hasMessage() => $_has(1);
+ @$pb.TagNumber(2)
+ void clearMessage() => clearField(2);
+}
+
+class SignMessageWithPrivateKeyResponse extends $pb.GeneratedMessage {
+ static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignMessageWithPrivateKeyResponse', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pactus'), createEmptyInstance: create)
+ ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'signature')
+ ..hasRequiredFields = false
+ ;
+
+ SignMessageWithPrivateKeyResponse._() : super();
+ factory SignMessageWithPrivateKeyResponse({
+ $core.String? signature,
+ }) {
+ final _result = create();
+ if (signature != null) {
+ _result.signature = signature;
+ }
+ return _result;
+ }
+ factory SignMessageWithPrivateKeyResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
+ factory SignMessageWithPrivateKeyResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
+ 'Will be removed in next major version')
+ SignMessageWithPrivateKeyResponse clone() => SignMessageWithPrivateKeyResponse()..mergeFromMessage(this);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
+ 'Will be removed in next major version')
+ SignMessageWithPrivateKeyResponse copyWith(void Function(SignMessageWithPrivateKeyResponse) updates) => super.copyWith((message) => updates(message as SignMessageWithPrivateKeyResponse)) as SignMessageWithPrivateKeyResponse; // ignore: deprecated_member_use
+ $pb.BuilderInfo get info_ => _i;
+ @$core.pragma('dart2js:noInline')
+ static SignMessageWithPrivateKeyResponse create() => SignMessageWithPrivateKeyResponse._();
+ SignMessageWithPrivateKeyResponse createEmptyInstance() => create();
+ static $pb.PbList createRepeated() => $pb.PbList();
+ @$core.pragma('dart2js:noInline')
+ static SignMessageWithPrivateKeyResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create);
+ static SignMessageWithPrivateKeyResponse? _defaultInstance;
+
+ @$pb.TagNumber(1)
+ $core.String get signature => $_getSZ(0);
+ @$pb.TagNumber(1)
+ set signature($core.String v) { $_setString(0, v); }
+ @$pb.TagNumber(1)
+ $core.bool hasSignature() => $_has(0);
+ @$pb.TagNumber(1)
+ void clearSignature() => clearField(1);
+}
+
+class VerifyMessageRequest extends $pb.GeneratedMessage {
+ static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'VerifyMessageRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pactus'), createEmptyInstance: create)
+ ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'message')
+ ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'signature')
+ ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'publicKey')
+ ..hasRequiredFields = false
+ ;
+
+ VerifyMessageRequest._() : super();
+ factory VerifyMessageRequest({
+ $core.String? message,
+ $core.String? signature,
+ $core.String? publicKey,
+ }) {
+ final _result = create();
+ if (message != null) {
+ _result.message = message;
+ }
+ if (signature != null) {
+ _result.signature = signature;
+ }
+ if (publicKey != null) {
+ _result.publicKey = publicKey;
+ }
+ return _result;
+ }
+ factory VerifyMessageRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
+ factory VerifyMessageRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
+ 'Will be removed in next major version')
+ VerifyMessageRequest clone() => VerifyMessageRequest()..mergeFromMessage(this);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
+ 'Will be removed in next major version')
+ VerifyMessageRequest copyWith(void Function(VerifyMessageRequest) updates) => super.copyWith((message) => updates(message as VerifyMessageRequest)) as VerifyMessageRequest; // ignore: deprecated_member_use
+ $pb.BuilderInfo get info_ => _i;
+ @$core.pragma('dart2js:noInline')
+ static VerifyMessageRequest create() => VerifyMessageRequest._();
+ VerifyMessageRequest createEmptyInstance() => create();
+ static $pb.PbList createRepeated() => $pb.PbList();
+ @$core.pragma('dart2js:noInline')
+ static VerifyMessageRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create);
+ static VerifyMessageRequest? _defaultInstance;
+
+ @$pb.TagNumber(1)
+ $core.String get message => $_getSZ(0);
+ @$pb.TagNumber(1)
+ set message($core.String v) { $_setString(0, v); }
+ @$pb.TagNumber(1)
+ $core.bool hasMessage() => $_has(0);
+ @$pb.TagNumber(1)
+ void clearMessage() => clearField(1);
+
+ @$pb.TagNumber(2)
+ $core.String get signature => $_getSZ(1);
+ @$pb.TagNumber(2)
+ set signature($core.String v) { $_setString(1, v); }
+ @$pb.TagNumber(2)
+ $core.bool hasSignature() => $_has(1);
+ @$pb.TagNumber(2)
+ void clearSignature() => clearField(2);
+
+ @$pb.TagNumber(3)
+ $core.String get publicKey => $_getSZ(2);
+ @$pb.TagNumber(3)
+ set publicKey($core.String v) { $_setString(2, v); }
+ @$pb.TagNumber(3)
+ $core.bool hasPublicKey() => $_has(2);
+ @$pb.TagNumber(3)
+ void clearPublicKey() => clearField(3);
+}
+
+class VerifyMessageResponse extends $pb.GeneratedMessage {
+ static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'VerifyMessageResponse', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pactus'), createEmptyInstance: create)
+ ..aOB(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isValid')
+ ..hasRequiredFields = false
+ ;
+
+ VerifyMessageResponse._() : super();
+ factory VerifyMessageResponse({
+ $core.bool? isValid,
+ }) {
+ final _result = create();
+ if (isValid != null) {
+ _result.isValid = isValid;
+ }
+ return _result;
+ }
+ factory VerifyMessageResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
+ factory VerifyMessageResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
+ 'Will be removed in next major version')
+ VerifyMessageResponse clone() => VerifyMessageResponse()..mergeFromMessage(this);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
+ 'Will be removed in next major version')
+ VerifyMessageResponse copyWith(void Function(VerifyMessageResponse) updates) => super.copyWith((message) => updates(message as VerifyMessageResponse)) as VerifyMessageResponse; // ignore: deprecated_member_use
+ $pb.BuilderInfo get info_ => _i;
+ @$core.pragma('dart2js:noInline')
+ static VerifyMessageResponse create() => VerifyMessageResponse._();
+ VerifyMessageResponse createEmptyInstance() => create();
+ static $pb.PbList createRepeated() => $pb.PbList();
+ @$core.pragma('dart2js:noInline')
+ static VerifyMessageResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create);
+ static VerifyMessageResponse? _defaultInstance;
+
+ @$pb.TagNumber(1)
+ $core.bool get isValid => $_getBF(0);
+ @$pb.TagNumber(1)
+ set isValid($core.bool v) { $_setBool(0, v); }
+ @$pb.TagNumber(1)
+ $core.bool hasIsValid() => $_has(0);
+ @$pb.TagNumber(1)
+ void clearIsValid() => clearField(1);
+}
+
+class UtilsApi {
+ $pb.RpcClient _client;
+ UtilsApi(this._client);
+
+ $async.Future signMessageWithPrivateKey($pb.ClientContext? ctx, SignMessageWithPrivateKeyRequest request) {
+ var emptyResponse = SignMessageWithPrivateKeyResponse();
+ return _client.invoke(ctx, 'Utils', 'SignMessageWithPrivateKey', request, emptyResponse);
+ }
+ $async.Future verifyMessage($pb.ClientContext? ctx, VerifyMessageRequest request) {
+ var emptyResponse = VerifyMessageResponse();
+ return _client.invoke(ctx, 'Utils', 'VerifyMessage', request, emptyResponse);
+ }
+}
+
diff --git a/www/grpc/gen/dart/utils.pbenum.dart b/www/grpc/gen/dart/utils.pbenum.dart
new file mode 100644
index 000000000..e5fa14ccf
--- /dev/null
+++ b/www/grpc/gen/dart/utils.pbenum.dart
@@ -0,0 +1,7 @@
+///
+// Generated code. Do not modify.
+// source: utils.proto
+//
+// @dart = 2.12
+// ignore_for_file: annotate_overrides,camel_case_types,constant_identifier_names,directives_ordering,library_prefixes,non_constant_identifier_names,prefer_final_fields,return_of_invalid_type,unnecessary_const,unnecessary_import,unnecessary_this,unused_import,unused_shown_name
+
diff --git a/www/grpc/gen/dart/utils.pbjson.dart b/www/grpc/gen/dart/utils.pbjson.dart
new file mode 100644
index 000000000..1ce27d7a4
--- /dev/null
+++ b/www/grpc/gen/dart/utils.pbjson.dart
@@ -0,0 +1,71 @@
+///
+// Generated code. Do not modify.
+// source: utils.proto
+//
+// @dart = 2.12
+// ignore_for_file: annotate_overrides,camel_case_types,constant_identifier_names,deprecated_member_use_from_same_package,directives_ordering,library_prefixes,non_constant_identifier_names,prefer_final_fields,return_of_invalid_type,unnecessary_const,unnecessary_import,unnecessary_this,unused_import,unused_shown_name
+
+import 'dart:core' as $core;
+import 'dart:convert' as $convert;
+import 'dart:typed_data' as $typed_data;
+@$core.Deprecated('Use signMessageWithPrivateKeyRequestDescriptor instead')
+const SignMessageWithPrivateKeyRequest$json = const {
+ '1': 'SignMessageWithPrivateKeyRequest',
+ '2': const [
+ const {'1': 'private_key', '3': 1, '4': 1, '5': 9, '10': 'privateKey'},
+ const {'1': 'message', '3': 2, '4': 1, '5': 9, '10': 'message'},
+ ],
+};
+
+/// Descriptor for `SignMessageWithPrivateKeyRequest`. Decode as a `google.protobuf.DescriptorProto`.
+final $typed_data.Uint8List signMessageWithPrivateKeyRequestDescriptor = $convert.base64Decode('CiBTaWduTWVzc2FnZVdpdGhQcml2YXRlS2V5UmVxdWVzdBIfCgtwcml2YXRlX2tleRgBIAEoCVIKcHJpdmF0ZUtleRIYCgdtZXNzYWdlGAIgASgJUgdtZXNzYWdl');
+@$core.Deprecated('Use signMessageWithPrivateKeyResponseDescriptor instead')
+const SignMessageWithPrivateKeyResponse$json = const {
+ '1': 'SignMessageWithPrivateKeyResponse',
+ '2': const [
+ const {'1': 'signature', '3': 1, '4': 1, '5': 9, '10': 'signature'},
+ ],
+};
+
+/// Descriptor for `SignMessageWithPrivateKeyResponse`. Decode as a `google.protobuf.DescriptorProto`.
+final $typed_data.Uint8List signMessageWithPrivateKeyResponseDescriptor = $convert.base64Decode('CiFTaWduTWVzc2FnZVdpdGhQcml2YXRlS2V5UmVzcG9uc2USHAoJc2lnbmF0dXJlGAEgASgJUglzaWduYXR1cmU=');
+@$core.Deprecated('Use verifyMessageRequestDescriptor instead')
+const VerifyMessageRequest$json = const {
+ '1': 'VerifyMessageRequest',
+ '2': const [
+ const {'1': 'message', '3': 1, '4': 1, '5': 9, '10': 'message'},
+ const {'1': 'signature', '3': 2, '4': 1, '5': 9, '10': 'signature'},
+ const {'1': 'public_key', '3': 3, '4': 1, '5': 9, '10': 'publicKey'},
+ ],
+};
+
+/// Descriptor for `VerifyMessageRequest`. Decode as a `google.protobuf.DescriptorProto`.
+final $typed_data.Uint8List verifyMessageRequestDescriptor = $convert.base64Decode('ChRWZXJpZnlNZXNzYWdlUmVxdWVzdBIYCgdtZXNzYWdlGAEgASgJUgdtZXNzYWdlEhwKCXNpZ25hdHVyZRgCIAEoCVIJc2lnbmF0dXJlEh0KCnB1YmxpY19rZXkYAyABKAlSCXB1YmxpY0tleQ==');
+@$core.Deprecated('Use verifyMessageResponseDescriptor instead')
+const VerifyMessageResponse$json = const {
+ '1': 'VerifyMessageResponse',
+ '2': const [
+ const {'1': 'is_valid', '3': 1, '4': 1, '5': 8, '10': 'isValid'},
+ ],
+};
+
+/// Descriptor for `VerifyMessageResponse`. Decode as a `google.protobuf.DescriptorProto`.
+final $typed_data.Uint8List verifyMessageResponseDescriptor = $convert.base64Decode('ChVWZXJpZnlNZXNzYWdlUmVzcG9uc2USGQoIaXNfdmFsaWQYASABKAhSB2lzVmFsaWQ=');
+const $core.Map<$core.String, $core.dynamic> UtilsServiceBase$json = const {
+ '1': 'Utils',
+ '2': const [
+ const {'1': 'SignMessageWithPrivateKey', '2': '.pactus.SignMessageWithPrivateKeyRequest', '3': '.pactus.SignMessageWithPrivateKeyResponse'},
+ const {'1': 'VerifyMessage', '2': '.pactus.VerifyMessageRequest', '3': '.pactus.VerifyMessageResponse'},
+ ],
+};
+
+@$core.Deprecated('Use utilsServiceDescriptor instead')
+const $core.Map<$core.String, $core.Map<$core.String, $core.dynamic>> UtilsServiceBase$messageJson = const {
+ '.pactus.SignMessageWithPrivateKeyRequest': SignMessageWithPrivateKeyRequest$json,
+ '.pactus.SignMessageWithPrivateKeyResponse': SignMessageWithPrivateKeyResponse$json,
+ '.pactus.VerifyMessageRequest': VerifyMessageRequest$json,
+ '.pactus.VerifyMessageResponse': VerifyMessageResponse$json,
+};
+
+/// Descriptor for `Utils`. Decode as a `google.protobuf.ServiceDescriptorProto`.
+final $typed_data.Uint8List utilsServiceDescriptor = $convert.base64Decode('CgVVdGlscxJwChlTaWduTWVzc2FnZVdpdGhQcml2YXRlS2V5EigucGFjdHVzLlNpZ25NZXNzYWdlV2l0aFByaXZhdGVLZXlSZXF1ZXN0GikucGFjdHVzLlNpZ25NZXNzYWdlV2l0aFByaXZhdGVLZXlSZXNwb25zZRJMCg1WZXJpZnlNZXNzYWdlEhwucGFjdHVzLlZlcmlmeU1lc3NhZ2VSZXF1ZXN0Gh0ucGFjdHVzLlZlcmlmeU1lc3NhZ2VSZXNwb25zZQ==');
diff --git a/www/grpc/gen/dart/utils.pbserver.dart b/www/grpc/gen/dart/utils.pbserver.dart
new file mode 100644
index 000000000..083835287
--- /dev/null
+++ b/www/grpc/gen/dart/utils.pbserver.dart
@@ -0,0 +1,41 @@
+///
+// Generated code. Do not modify.
+// source: utils.proto
+//
+// @dart = 2.12
+// ignore_for_file: annotate_overrides,camel_case_types,constant_identifier_names,deprecated_member_use_from_same_package,directives_ordering,library_prefixes,non_constant_identifier_names,prefer_final_fields,return_of_invalid_type,unnecessary_const,unnecessary_import,unnecessary_this,unused_import,unused_shown_name
+
+import 'dart:async' as $async;
+
+import 'package:protobuf/protobuf.dart' as $pb;
+
+import 'dart:core' as $core;
+import 'utils.pb.dart' as $3;
+import 'utils.pbjson.dart';
+
+export 'utils.pb.dart';
+
+abstract class UtilsServiceBase extends $pb.GeneratedService {
+ $async.Future<$3.SignMessageWithPrivateKeyResponse> signMessageWithPrivateKey($pb.ServerContext ctx, $3.SignMessageWithPrivateKeyRequest request);
+ $async.Future<$3.VerifyMessageResponse> verifyMessage($pb.ServerContext ctx, $3.VerifyMessageRequest request);
+
+ $pb.GeneratedMessage createRequest($core.String method) {
+ switch (method) {
+ case 'SignMessageWithPrivateKey': return $3.SignMessageWithPrivateKeyRequest();
+ case 'VerifyMessage': return $3.VerifyMessageRequest();
+ default: throw $core.ArgumentError('Unknown method: $method');
+ }
+ }
+
+ $async.Future<$pb.GeneratedMessage> handleCall($pb.ServerContext ctx, $core.String method, $pb.GeneratedMessage request) {
+ switch (method) {
+ case 'SignMessageWithPrivateKey': return this.signMessageWithPrivateKey(ctx, request as $3.SignMessageWithPrivateKeyRequest);
+ case 'VerifyMessage': return this.verifyMessage(ctx, request as $3.VerifyMessageRequest);
+ default: throw $core.ArgumentError('Unknown method: $method');
+ }
+ }
+
+ $core.Map<$core.String, $core.dynamic> get $json => UtilsServiceBase$json;
+ $core.Map<$core.String, $core.Map<$core.String, $core.dynamic>> get $messageJson => UtilsServiceBase$messageJson;
+}
+
diff --git a/www/grpc/gen/dart/wallet.pb.dart b/www/grpc/gen/dart/wallet.pb.dart
index 70ed5cdbe..38dc533d8 100644
--- a/www/grpc/gen/dart/wallet.pb.dart
+++ b/www/grpc/gen/dart/wallet.pb.dart
@@ -1203,6 +1203,142 @@ class GetTotalBalanceResponse extends $pb.GeneratedMessage {
void clearTotalBalance() => clearField(2);
}
+class SignMessageRequest extends $pb.GeneratedMessage {
+ static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignMessageRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pactus'), createEmptyInstance: create)
+ ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'walletName')
+ ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'password')
+ ..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'address')
+ ..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'message')
+ ..hasRequiredFields = false
+ ;
+
+ SignMessageRequest._() : super();
+ factory SignMessageRequest({
+ $core.String? walletName,
+ $core.String? password,
+ $core.String? address,
+ $core.String? message,
+ }) {
+ final _result = create();
+ if (walletName != null) {
+ _result.walletName = walletName;
+ }
+ if (password != null) {
+ _result.password = password;
+ }
+ if (address != null) {
+ _result.address = address;
+ }
+ if (message != null) {
+ _result.message = message;
+ }
+ return _result;
+ }
+ factory SignMessageRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
+ factory SignMessageRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
+ 'Will be removed in next major version')
+ SignMessageRequest clone() => SignMessageRequest()..mergeFromMessage(this);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
+ 'Will be removed in next major version')
+ SignMessageRequest copyWith(void Function(SignMessageRequest) updates) => super.copyWith((message) => updates(message as SignMessageRequest)) as SignMessageRequest; // ignore: deprecated_member_use
+ $pb.BuilderInfo get info_ => _i;
+ @$core.pragma('dart2js:noInline')
+ static SignMessageRequest create() => SignMessageRequest._();
+ SignMessageRequest createEmptyInstance() => create();
+ static $pb.PbList createRepeated() => $pb.PbList();
+ @$core.pragma('dart2js:noInline')
+ static SignMessageRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create);
+ static SignMessageRequest? _defaultInstance;
+
+ @$pb.TagNumber(1)
+ $core.String get walletName => $_getSZ(0);
+ @$pb.TagNumber(1)
+ set walletName($core.String v) { $_setString(0, v); }
+ @$pb.TagNumber(1)
+ $core.bool hasWalletName() => $_has(0);
+ @$pb.TagNumber(1)
+ void clearWalletName() => clearField(1);
+
+ @$pb.TagNumber(2)
+ $core.String get password => $_getSZ(1);
+ @$pb.TagNumber(2)
+ set password($core.String v) { $_setString(1, v); }
+ @$pb.TagNumber(2)
+ $core.bool hasPassword() => $_has(1);
+ @$pb.TagNumber(2)
+ void clearPassword() => clearField(2);
+
+ @$pb.TagNumber(3)
+ $core.String get address => $_getSZ(2);
+ @$pb.TagNumber(3)
+ set address($core.String v) { $_setString(2, v); }
+ @$pb.TagNumber(3)
+ $core.bool hasAddress() => $_has(2);
+ @$pb.TagNumber(3)
+ void clearAddress() => clearField(3);
+
+ @$pb.TagNumber(4)
+ $core.String get message => $_getSZ(3);
+ @$pb.TagNumber(4)
+ set message($core.String v) { $_setString(3, v); }
+ @$pb.TagNumber(4)
+ $core.bool hasMessage() => $_has(3);
+ @$pb.TagNumber(4)
+ void clearMessage() => clearField(4);
+}
+
+class SignMessageResponse extends $pb.GeneratedMessage {
+ static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignMessageResponse', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'pactus'), createEmptyInstance: create)
+ ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'signature')
+ ..hasRequiredFields = false
+ ;
+
+ SignMessageResponse._() : super();
+ factory SignMessageResponse({
+ $core.String? signature,
+ }) {
+ final _result = create();
+ if (signature != null) {
+ _result.signature = signature;
+ }
+ return _result;
+ }
+ factory SignMessageResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
+ factory SignMessageResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
+ 'Will be removed in next major version')
+ SignMessageResponse clone() => SignMessageResponse()..mergeFromMessage(this);
+ @$core.Deprecated(
+ 'Using this can add significant overhead to your binary. '
+ 'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
+ 'Will be removed in next major version')
+ SignMessageResponse copyWith(void Function(SignMessageResponse) updates) => super.copyWith((message) => updates(message as SignMessageResponse)) as SignMessageResponse; // ignore: deprecated_member_use
+ $pb.BuilderInfo get info_ => _i;
+ @$core.pragma('dart2js:noInline')
+ static SignMessageResponse create() => SignMessageResponse._();
+ SignMessageResponse createEmptyInstance() => create();
+ static $pb.PbList createRepeated() => $pb.PbList();
+ @$core.pragma('dart2js:noInline')
+ static SignMessageResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create);
+ static SignMessageResponse? _defaultInstance;
+
+ @$pb.TagNumber(1)
+ $core.String get signature => $_getSZ(0);
+ @$pb.TagNumber(1)
+ set signature($core.String v) { $_setString(0, v); }
+ @$pb.TagNumber(1)
+ $core.bool hasSignature() => $_has(0);
+ @$pb.TagNumber(1)
+ void clearSignature() => clearField(1);
+}
+
class WalletApi {
$pb.RpcClient _client;
WalletApi(this._client);
@@ -1243,5 +1379,9 @@ class WalletApi {
var emptyResponse = GetAddressHistoryResponse();
return _client.invoke(ctx, 'Wallet', 'GetAddressHistory', request, emptyResponse);
}
+ $async.Future signMessage($pb.ClientContext? ctx, SignMessageRequest request) {
+ var emptyResponse = SignMessageResponse();
+ return _client.invoke(ctx, 'Wallet', 'SignMessage', request, emptyResponse);
+ }
}
diff --git a/www/grpc/gen/dart/wallet.pbjson.dart b/www/grpc/gen/dart/wallet.pbjson.dart
index 1b25e34ef..25e84a7fc 100644
--- a/www/grpc/gen/dart/wallet.pbjson.dart
+++ b/www/grpc/gen/dart/wallet.pbjson.dart
@@ -238,6 +238,29 @@ const GetTotalBalanceResponse$json = const {
/// Descriptor for `GetTotalBalanceResponse`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List getTotalBalanceResponseDescriptor = $convert.base64Decode('ChdHZXRUb3RhbEJhbGFuY2VSZXNwb25zZRIfCgt3YWxsZXRfbmFtZRgBIAEoCVIKd2FsbGV0TmFtZRIjCg10b3RhbF9iYWxhbmNlGAIgASgDUgx0b3RhbEJhbGFuY2U=');
+@$core.Deprecated('Use signMessageRequestDescriptor instead')
+const SignMessageRequest$json = const {
+ '1': 'SignMessageRequest',
+ '2': const [
+ const {'1': 'wallet_name', '3': 1, '4': 1, '5': 9, '10': 'walletName'},
+ const {'1': 'password', '3': 2, '4': 1, '5': 9, '10': 'password'},
+ const {'1': 'address', '3': 3, '4': 1, '5': 9, '10': 'address'},
+ const {'1': 'message', '3': 4, '4': 1, '5': 9, '10': 'message'},
+ ],
+};
+
+/// Descriptor for `SignMessageRequest`. Decode as a `google.protobuf.DescriptorProto`.
+final $typed_data.Uint8List signMessageRequestDescriptor = $convert.base64Decode('ChJTaWduTWVzc2FnZVJlcXVlc3QSHwoLd2FsbGV0X25hbWUYASABKAlSCndhbGxldE5hbWUSGgoIcGFzc3dvcmQYAiABKAlSCHBhc3N3b3JkEhgKB2FkZHJlc3MYAyABKAlSB2FkZHJlc3MSGAoHbWVzc2FnZRgEIAEoCVIHbWVzc2FnZQ==');
+@$core.Deprecated('Use signMessageResponseDescriptor instead')
+const SignMessageResponse$json = const {
+ '1': 'SignMessageResponse',
+ '2': const [
+ const {'1': 'signature', '3': 1, '4': 1, '5': 9, '10': 'signature'},
+ ],
+};
+
+/// Descriptor for `SignMessageResponse`. Decode as a `google.protobuf.DescriptorProto`.
+final $typed_data.Uint8List signMessageResponseDescriptor = $convert.base64Decode('ChNTaWduTWVzc2FnZVJlc3BvbnNlEhwKCXNpZ25hdHVyZRgBIAEoCVIJc2lnbmF0dXJl');
const $core.Map<$core.String, $core.dynamic> WalletServiceBase$json = const {
'1': 'Wallet',
'2': const [
@@ -250,6 +273,7 @@ const $core.Map<$core.String, $core.dynamic> WalletServiceBase$json = const {
const {'1': 'GetValidatorAddress', '2': '.pactus.GetValidatorAddressRequest', '3': '.pactus.GetValidatorAddressResponse'},
const {'1': 'GetNewAddress', '2': '.pactus.GetNewAddressRequest', '3': '.pactus.GetNewAddressResponse'},
const {'1': 'GetAddressHistory', '2': '.pactus.GetAddressHistoryRequest', '3': '.pactus.GetAddressHistoryResponse'},
+ const {'1': 'SignMessage', '2': '.pactus.SignMessageRequest', '3': '.pactus.SignMessageResponse'},
],
};
@@ -275,7 +299,9 @@ const $core.Map<$core.String, $core.Map<$core.String, $core.dynamic>> WalletServ
'.pactus.GetAddressHistoryRequest': GetAddressHistoryRequest$json,
'.pactus.GetAddressHistoryResponse': GetAddressHistoryResponse$json,
'.pactus.HistoryInfo': HistoryInfo$json,
+ '.pactus.SignMessageRequest': SignMessageRequest$json,
+ '.pactus.SignMessageResponse': SignMessageResponse$json,
};
/// Descriptor for `Wallet`. Decode as a `google.protobuf.ServiceDescriptorProto`.
-final $typed_data.Uint8List walletServiceDescriptor = $convert.base64Decode('CgZXYWxsZXQSSQoMQ3JlYXRlV2FsbGV0EhsucGFjdHVzLkNyZWF0ZVdhbGxldFJlcXVlc3QaHC5wYWN0dXMuQ3JlYXRlV2FsbGV0UmVzcG9uc2USTAoNUmVzdG9yZVdhbGxldBIcLnBhY3R1cy5SZXN0b3JlV2FsbGV0UmVxdWVzdBodLnBhY3R1cy5SZXN0b3JlV2FsbGV0UmVzcG9uc2USQwoKTG9hZFdhbGxldBIZLnBhY3R1cy5Mb2FkV2FsbGV0UmVxdWVzdBoaLnBhY3R1cy5Mb2FkV2FsbGV0UmVzcG9uc2USSQoMVW5sb2FkV2FsbGV0EhsucGFjdHVzLlVubG9hZFdhbGxldFJlcXVlc3QaHC5wYWN0dXMuVW5sb2FkV2FsbGV0UmVzcG9uc2USUgoPR2V0VG90YWxCYWxhbmNlEh4ucGFjdHVzLkdldFRvdGFsQmFsYW5jZVJlcXVlc3QaHy5wYWN0dXMuR2V0VG90YWxCYWxhbmNlUmVzcG9uc2USWwoSU2lnblJhd1RyYW5zYWN0aW9uEiEucGFjdHVzLlNpZ25SYXdUcmFuc2FjdGlvblJlcXVlc3QaIi5wYWN0dXMuU2lnblJhd1RyYW5zYWN0aW9uUmVzcG9uc2USXgoTR2V0VmFsaWRhdG9yQWRkcmVzcxIiLnBhY3R1cy5HZXRWYWxpZGF0b3JBZGRyZXNzUmVxdWVzdBojLnBhY3R1cy5HZXRWYWxpZGF0b3JBZGRyZXNzUmVzcG9uc2USTAoNR2V0TmV3QWRkcmVzcxIcLnBhY3R1cy5HZXROZXdBZGRyZXNzUmVxdWVzdBodLnBhY3R1cy5HZXROZXdBZGRyZXNzUmVzcG9uc2USWAoRR2V0QWRkcmVzc0hpc3RvcnkSIC5wYWN0dXMuR2V0QWRkcmVzc0hpc3RvcnlSZXF1ZXN0GiEucGFjdHVzLkdldEFkZHJlc3NIaXN0b3J5UmVzcG9uc2U=');
+final $typed_data.Uint8List walletServiceDescriptor = $convert.base64Decode('CgZXYWxsZXQSSQoMQ3JlYXRlV2FsbGV0EhsucGFjdHVzLkNyZWF0ZVdhbGxldFJlcXVlc3QaHC5wYWN0dXMuQ3JlYXRlV2FsbGV0UmVzcG9uc2USTAoNUmVzdG9yZVdhbGxldBIcLnBhY3R1cy5SZXN0b3JlV2FsbGV0UmVxdWVzdBodLnBhY3R1cy5SZXN0b3JlV2FsbGV0UmVzcG9uc2USQwoKTG9hZFdhbGxldBIZLnBhY3R1cy5Mb2FkV2FsbGV0UmVxdWVzdBoaLnBhY3R1cy5Mb2FkV2FsbGV0UmVzcG9uc2USSQoMVW5sb2FkV2FsbGV0EhsucGFjdHVzLlVubG9hZFdhbGxldFJlcXVlc3QaHC5wYWN0dXMuVW5sb2FkV2FsbGV0UmVzcG9uc2USUgoPR2V0VG90YWxCYWxhbmNlEh4ucGFjdHVzLkdldFRvdGFsQmFsYW5jZVJlcXVlc3QaHy5wYWN0dXMuR2V0VG90YWxCYWxhbmNlUmVzcG9uc2USWwoSU2lnblJhd1RyYW5zYWN0aW9uEiEucGFjdHVzLlNpZ25SYXdUcmFuc2FjdGlvblJlcXVlc3QaIi5wYWN0dXMuU2lnblJhd1RyYW5zYWN0aW9uUmVzcG9uc2USXgoTR2V0VmFsaWRhdG9yQWRkcmVzcxIiLnBhY3R1cy5HZXRWYWxpZGF0b3JBZGRyZXNzUmVxdWVzdBojLnBhY3R1cy5HZXRWYWxpZGF0b3JBZGRyZXNzUmVzcG9uc2USTAoNR2V0TmV3QWRkcmVzcxIcLnBhY3R1cy5HZXROZXdBZGRyZXNzUmVxdWVzdBodLnBhY3R1cy5HZXROZXdBZGRyZXNzUmVzcG9uc2USWAoRR2V0QWRkcmVzc0hpc3RvcnkSIC5wYWN0dXMuR2V0QWRkcmVzc0hpc3RvcnlSZXF1ZXN0GiEucGFjdHVzLkdldEFkZHJlc3NIaXN0b3J5UmVzcG9uc2USRgoLU2lnbk1lc3NhZ2USGi5wYWN0dXMuU2lnbk1lc3NhZ2VSZXF1ZXN0GhsucGFjdHVzLlNpZ25NZXNzYWdlUmVzcG9uc2U=');
diff --git a/www/grpc/gen/dart/wallet.pbserver.dart b/www/grpc/gen/dart/wallet.pbserver.dart
index f23a0c287..dd38d8997 100644
--- a/www/grpc/gen/dart/wallet.pbserver.dart
+++ b/www/grpc/gen/dart/wallet.pbserver.dart
@@ -10,48 +10,51 @@ import 'dart:async' as $async;
import 'package:protobuf/protobuf.dart' as $pb;
import 'dart:core' as $core;
-import 'wallet.pb.dart' as $3;
+import 'wallet.pb.dart' as $4;
import 'wallet.pbjson.dart';
export 'wallet.pb.dart';
abstract class WalletServiceBase extends $pb.GeneratedService {
- $async.Future<$3.CreateWalletResponse> createWallet($pb.ServerContext ctx, $3.CreateWalletRequest request);
- $async.Future<$3.RestoreWalletResponse> restoreWallet($pb.ServerContext ctx, $3.RestoreWalletRequest request);
- $async.Future<$3.LoadWalletResponse> loadWallet($pb.ServerContext ctx, $3.LoadWalletRequest request);
- $async.Future<$3.UnloadWalletResponse> unloadWallet($pb.ServerContext ctx, $3.UnloadWalletRequest request);
- $async.Future<$3.GetTotalBalanceResponse> getTotalBalance($pb.ServerContext ctx, $3.GetTotalBalanceRequest request);
- $async.Future<$3.SignRawTransactionResponse> signRawTransaction($pb.ServerContext ctx, $3.SignRawTransactionRequest request);
- $async.Future<$3.GetValidatorAddressResponse> getValidatorAddress($pb.ServerContext ctx, $3.GetValidatorAddressRequest request);
- $async.Future<$3.GetNewAddressResponse> getNewAddress($pb.ServerContext ctx, $3.GetNewAddressRequest request);
- $async.Future<$3.GetAddressHistoryResponse> getAddressHistory($pb.ServerContext ctx, $3.GetAddressHistoryRequest request);
+ $async.Future<$4.CreateWalletResponse> createWallet($pb.ServerContext ctx, $4.CreateWalletRequest request);
+ $async.Future<$4.RestoreWalletResponse> restoreWallet($pb.ServerContext ctx, $4.RestoreWalletRequest request);
+ $async.Future<$4.LoadWalletResponse> loadWallet($pb.ServerContext ctx, $4.LoadWalletRequest request);
+ $async.Future<$4.UnloadWalletResponse> unloadWallet($pb.ServerContext ctx, $4.UnloadWalletRequest request);
+ $async.Future<$4.GetTotalBalanceResponse> getTotalBalance($pb.ServerContext ctx, $4.GetTotalBalanceRequest request);
+ $async.Future<$4.SignRawTransactionResponse> signRawTransaction($pb.ServerContext ctx, $4.SignRawTransactionRequest request);
+ $async.Future<$4.GetValidatorAddressResponse> getValidatorAddress($pb.ServerContext ctx, $4.GetValidatorAddressRequest request);
+ $async.Future<$4.GetNewAddressResponse> getNewAddress($pb.ServerContext ctx, $4.GetNewAddressRequest request);
+ $async.Future<$4.GetAddressHistoryResponse> getAddressHistory($pb.ServerContext ctx, $4.GetAddressHistoryRequest request);
+ $async.Future<$4.SignMessageResponse> signMessage($pb.ServerContext ctx, $4.SignMessageRequest request);
$pb.GeneratedMessage createRequest($core.String method) {
switch (method) {
- case 'CreateWallet': return $3.CreateWalletRequest();
- case 'RestoreWallet': return $3.RestoreWalletRequest();
- case 'LoadWallet': return $3.LoadWalletRequest();
- case 'UnloadWallet': return $3.UnloadWalletRequest();
- case 'GetTotalBalance': return $3.GetTotalBalanceRequest();
- case 'SignRawTransaction': return $3.SignRawTransactionRequest();
- case 'GetValidatorAddress': return $3.GetValidatorAddressRequest();
- case 'GetNewAddress': return $3.GetNewAddressRequest();
- case 'GetAddressHistory': return $3.GetAddressHistoryRequest();
+ case 'CreateWallet': return $4.CreateWalletRequest();
+ case 'RestoreWallet': return $4.RestoreWalletRequest();
+ case 'LoadWallet': return $4.LoadWalletRequest();
+ case 'UnloadWallet': return $4.UnloadWalletRequest();
+ case 'GetTotalBalance': return $4.GetTotalBalanceRequest();
+ case 'SignRawTransaction': return $4.SignRawTransactionRequest();
+ case 'GetValidatorAddress': return $4.GetValidatorAddressRequest();
+ case 'GetNewAddress': return $4.GetNewAddressRequest();
+ case 'GetAddressHistory': return $4.GetAddressHistoryRequest();
+ case 'SignMessage': return $4.SignMessageRequest();
default: throw $core.ArgumentError('Unknown method: $method');
}
}
$async.Future<$pb.GeneratedMessage> handleCall($pb.ServerContext ctx, $core.String method, $pb.GeneratedMessage request) {
switch (method) {
- case 'CreateWallet': return this.createWallet(ctx, request as $3.CreateWalletRequest);
- case 'RestoreWallet': return this.restoreWallet(ctx, request as $3.RestoreWalletRequest);
- case 'LoadWallet': return this.loadWallet(ctx, request as $3.LoadWalletRequest);
- case 'UnloadWallet': return this.unloadWallet(ctx, request as $3.UnloadWalletRequest);
- case 'GetTotalBalance': return this.getTotalBalance(ctx, request as $3.GetTotalBalanceRequest);
- case 'SignRawTransaction': return this.signRawTransaction(ctx, request as $3.SignRawTransactionRequest);
- case 'GetValidatorAddress': return this.getValidatorAddress(ctx, request as $3.GetValidatorAddressRequest);
- case 'GetNewAddress': return this.getNewAddress(ctx, request as $3.GetNewAddressRequest);
- case 'GetAddressHistory': return this.getAddressHistory(ctx, request as $3.GetAddressHistoryRequest);
+ case 'CreateWallet': return this.createWallet(ctx, request as $4.CreateWalletRequest);
+ case 'RestoreWallet': return this.restoreWallet(ctx, request as $4.RestoreWalletRequest);
+ case 'LoadWallet': return this.loadWallet(ctx, request as $4.LoadWalletRequest);
+ case 'UnloadWallet': return this.unloadWallet(ctx, request as $4.UnloadWalletRequest);
+ case 'GetTotalBalance': return this.getTotalBalance(ctx, request as $4.GetTotalBalanceRequest);
+ case 'SignRawTransaction': return this.signRawTransaction(ctx, request as $4.SignRawTransactionRequest);
+ case 'GetValidatorAddress': return this.getValidatorAddress(ctx, request as $4.GetValidatorAddressRequest);
+ case 'GetNewAddress': return this.getNewAddress(ctx, request as $4.GetNewAddressRequest);
+ case 'GetAddressHistory': return this.getAddressHistory(ctx, request as $4.GetAddressHistoryRequest);
+ case 'SignMessage': return this.signMessage(ctx, request as $4.SignMessageRequest);
default: throw $core.ArgumentError('Unknown method: $method');
}
}
diff --git a/www/grpc/gen/docs/grpc.md b/www/grpc/gen/docs/grpc.md
index 8b687e2aa..8e11dd6e3 100644
--- a/www/grpc/gen/docs/grpc.md
+++ b/www/grpc/gen/docs/grpc.md
@@ -105,6 +105,18 @@ Each PAC is equivalent to 1,000,000,000 or 109 NanoPACs.
+ Utils Service
+
+
Wallet Service
@@ -2411,6 +2427,106 @@ Message has no fields.
+## Utils Service
+
+Utils service defines RPC methods for utility functions such as message
+signing and verification.
+
+### SignMessageWithPrivateKey
+
+SignMessageWithPrivateKey sign message with provided private key.
+
+SignMessageWithPrivateKeyRequest Request
+
+
+
+ Field | Type | Description |
+
+
+
+ private_key |
+ string |
+
+ The private key to sign the message.
+ |
+
+
+ message |
+ string |
+
+ The message to sign.
+ |
+
+
+
+ SignMessageWithPrivateKeyResponse Response
+
+
+
+ Field | Type | Description |
+
+
+
+ signature |
+ string |
+
+ The signature of the message.
+ |
+
+
+
+
+### VerifyMessage
+
+VerifyMessage verify signature with public key and message
+
+VerifyMessageRequest Request
+
+
+
+ Field | Type | Description |
+
+
+
+ message |
+ string |
+
+ The signed message.
+ |
+
+
+ signature |
+ string |
+
+ The signature of the message.
+ |
+
+
+ public_key |
+ string |
+
+ The public key of the signer.
+ |
+
+
+
+ VerifyMessageResponse Response
+
+
+
+ Field | Type | Description |
+
+
+
+ is_valid |
+ bool |
+
+ Indicates if the signature is valid (true) or not (false).
+ |
+
+
+
+
## Wallet Service
Define the Wallet service with various RPC methods for wallet management.
@@ -2894,6 +3010,64 @@ public key.
+### SignMessage
+
+SignMessage signs an arbitrary message.
+
+SignMessageRequest Request
+
+
+
+ Field | Type | Description |
+
+
+
+ wallet_name |
+ string |
+
+ The name of the wallet.
+ |
+
+
+ password |
+ string |
+
+ The password for unlocking the wallet for signing.
+ |
+
+
+ address |
+ string |
+
+ The account address associated with the private key.
+ |
+
+
+ message |
+ string |
+
+ The arbitrary message to be signed.
+ |
+
+
+
+ SignMessageResponse Response
+
+
+
+ Field | Type | Description |
+
+
+
+ signature |
+ string |
+
+ Signature of the message.
+ |
+
+
+
+
## Scalar Value Types
diff --git a/www/grpc/gen/docs/json-rpc.md b/www/grpc/gen/docs/json-rpc.md
index 3109afa25..4592fcd9a 100644
--- a/www/grpc/gen/docs/json-rpc.md
+++ b/www/grpc/gen/docs/json-rpc.md
@@ -106,6 +106,18 @@ Each PAC is equivalent to 1,000,000,000 or 109 NanoPACs.
+ Utils Service
+
+
Wallet Service
@@ -2412,6 +2428,106 @@ Parameters has no fields.
+## Utils Service
+
+Utils service defines RPC methods for utility functions such as message
+signing and verification.
+
+### pactus.utils.sign_message_with_private_key
+
+SignMessageWithPrivateKey sign message with provided private key.
+
+Parameters
+
+
+
+ Field | Type | Description |
+
+
+
+ private_key |
+ string |
+
+ The private key to sign the message.
+ |
+
+
+ message |
+ string |
+
+ The message to sign.
+ |
+
+
+
+ Result
+
+
+
+ Field | Type | Description |
+
+
+
+ signature |
+ string |
+
+ The signature of the message.
+ |
+
+
+
+
+### pactus.utils.verify_message
+
+VerifyMessage verify signature with public key and message
+
+Parameters
+
+
+
+ Field | Type | Description |
+
+
+
+ message |
+ string |
+
+ The signed message.
+ |
+
+
+ signature |
+ string |
+
+ The signature of the message.
+ |
+
+
+ public_key |
+ string |
+
+ The public key of the signer.
+ |
+
+
+
+ Result
+
+
+
+ Field | Type | Description |
+
+
+
+ is_valid |
+ boolean |
+
+ Indicates if the signature is valid (true) or not (false).
+ |
+
+
+
+
## Wallet Service
Define the Wallet service with various RPC methods for wallet management.
@@ -2894,3 +3010,61 @@ public key.
+
+### pactus.wallet.sign_message
+
+SignMessage signs an arbitrary message.
+
+Parameters
+
+
+
+ Field | Type | Description |
+
+
+
+ wallet_name |
+ string |
+
+ The name of the wallet.
+ |
+
+
+ password |
+ string |
+
+ The password for unlocking the wallet for signing.
+ |
+
+
+ address |
+ string |
+
+ The account address associated with the private key.
+ |
+
+
+ message |
+ string |
+
+ The arbitrary message to be signed.
+ |
+
+
+
+ Result
+
+
+
+ Field | Type | Description |
+
+
+
+ signature |
+ string |
+
+ Signature of the message.
+ |
+
+
+
diff --git a/www/grpc/gen/go/utils.cobra.pb.go b/www/grpc/gen/go/utils.cobra.pb.go
new file mode 100644
index 000000000..bfda94e23
--- /dev/null
+++ b/www/grpc/gen/go/utils.cobra.pb.go
@@ -0,0 +1,114 @@
+// Code generated by protoc-gen-cobra. DO NOT EDIT.
+
+package pactus
+
+import (
+ client "github.com/NathanBaulch/protoc-gen-cobra/client"
+ flag "github.com/NathanBaulch/protoc-gen-cobra/flag"
+ iocodec "github.com/NathanBaulch/protoc-gen-cobra/iocodec"
+ cobra "github.com/spf13/cobra"
+ grpc "google.golang.org/grpc"
+ proto "google.golang.org/protobuf/proto"
+)
+
+func UtilsClientCommand(options ...client.Option) *cobra.Command {
+ cfg := client.NewConfig(options...)
+ cmd := &cobra.Command{
+ Use: cfg.CommandNamer("Utils"),
+ Short: "Utils service client",
+ Long: "Utils service defines RPC methods for utility functions such as message\n signing and verification.",
+ }
+ cfg.BindFlags(cmd.PersistentFlags())
+ cmd.AddCommand(
+ _UtilsSignMessageWithPrivateKeyCommand(cfg),
+ _UtilsVerifyMessageCommand(cfg),
+ )
+ return cmd
+}
+
+func _UtilsSignMessageWithPrivateKeyCommand(cfg *client.Config) *cobra.Command {
+ req := &SignMessageWithPrivateKeyRequest{}
+
+ cmd := &cobra.Command{
+ Use: cfg.CommandNamer("SignMessageWithPrivateKey"),
+ Short: "SignMessageWithPrivateKey RPC client",
+ Long: "SignMessageWithPrivateKey sign message with provided private key.",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ if cfg.UseEnvVars {
+ if err := flag.SetFlagsFromEnv(cmd.Parent().PersistentFlags(), true, cfg.EnvVarNamer, cfg.EnvVarPrefix, "Utils"); err != nil {
+ return err
+ }
+ if err := flag.SetFlagsFromEnv(cmd.PersistentFlags(), false, cfg.EnvVarNamer, cfg.EnvVarPrefix, "Utils", "SignMessageWithPrivateKey"); err != nil {
+ return err
+ }
+ }
+ return client.RoundTrip(cmd.Context(), cfg, func(cc grpc.ClientConnInterface, in iocodec.Decoder, out iocodec.Encoder) error {
+ cli := NewUtilsClient(cc)
+ v := &SignMessageWithPrivateKeyRequest{}
+
+ if err := in(v); err != nil {
+ return err
+ }
+ proto.Merge(v, req)
+
+ res, err := cli.SignMessageWithPrivateKey(cmd.Context(), v)
+
+ if err != nil {
+ return err
+ }
+
+ return out(res)
+
+ })
+ },
+ }
+
+ cmd.PersistentFlags().StringVar(&req.PrivateKey, cfg.FlagNamer("PrivateKey"), "", "The private key to sign the message.")
+ cmd.PersistentFlags().StringVar(&req.Message, cfg.FlagNamer("Message"), "", "The message to sign.")
+
+ return cmd
+}
+
+func _UtilsVerifyMessageCommand(cfg *client.Config) *cobra.Command {
+ req := &VerifyMessageRequest{}
+
+ cmd := &cobra.Command{
+ Use: cfg.CommandNamer("VerifyMessage"),
+ Short: "VerifyMessage RPC client",
+ Long: "VerifyMessage verify signature with public key and message",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ if cfg.UseEnvVars {
+ if err := flag.SetFlagsFromEnv(cmd.Parent().PersistentFlags(), true, cfg.EnvVarNamer, cfg.EnvVarPrefix, "Utils"); err != nil {
+ return err
+ }
+ if err := flag.SetFlagsFromEnv(cmd.PersistentFlags(), false, cfg.EnvVarNamer, cfg.EnvVarPrefix, "Utils", "VerifyMessage"); err != nil {
+ return err
+ }
+ }
+ return client.RoundTrip(cmd.Context(), cfg, func(cc grpc.ClientConnInterface, in iocodec.Decoder, out iocodec.Encoder) error {
+ cli := NewUtilsClient(cc)
+ v := &VerifyMessageRequest{}
+
+ if err := in(v); err != nil {
+ return err
+ }
+ proto.Merge(v, req)
+
+ res, err := cli.VerifyMessage(cmd.Context(), v)
+
+ if err != nil {
+ return err
+ }
+
+ return out(res)
+
+ })
+ },
+ }
+
+ cmd.PersistentFlags().StringVar(&req.Message, cfg.FlagNamer("Message"), "", "The signed message.")
+ cmd.PersistentFlags().StringVar(&req.Signature, cfg.FlagNamer("Signature"), "", "The signature of the message.")
+ cmd.PersistentFlags().StringVar(&req.PublicKey, cfg.FlagNamer("PublicKey"), "", "The public key of the signer.")
+
+ return cmd
+}
diff --git a/www/grpc/gen/go/utils.pb.go b/www/grpc/gen/go/utils.pb.go
new file mode 100644
index 000000000..4f38cd6b0
--- /dev/null
+++ b/www/grpc/gen/go/utils.pb.go
@@ -0,0 +1,394 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.34.2
+// protoc (unknown)
+// source: utils.proto
+
+package pactus
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// Request message for sign message with private key.
+type SignMessageWithPrivateKeyRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The private key to sign the message.
+ PrivateKey string `protobuf:"bytes,1,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"`
+ // The message to sign.
+ Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
+}
+
+func (x *SignMessageWithPrivateKeyRequest) Reset() {
+ *x = SignMessageWithPrivateKeyRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_utils_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SignMessageWithPrivateKeyRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SignMessageWithPrivateKeyRequest) ProtoMessage() {}
+
+func (x *SignMessageWithPrivateKeyRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_utils_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SignMessageWithPrivateKeyRequest.ProtoReflect.Descriptor instead.
+func (*SignMessageWithPrivateKeyRequest) Descriptor() ([]byte, []int) {
+ return file_utils_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *SignMessageWithPrivateKeyRequest) GetPrivateKey() string {
+ if x != nil {
+ return x.PrivateKey
+ }
+ return ""
+}
+
+func (x *SignMessageWithPrivateKeyRequest) GetMessage() string {
+ if x != nil {
+ return x.Message
+ }
+ return ""
+}
+
+// Response message containing the generated signature.
+type SignMessageWithPrivateKeyResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The signature of the message.
+ Signature string `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
+}
+
+func (x *SignMessageWithPrivateKeyResponse) Reset() {
+ *x = SignMessageWithPrivateKeyResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_utils_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SignMessageWithPrivateKeyResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SignMessageWithPrivateKeyResponse) ProtoMessage() {}
+
+func (x *SignMessageWithPrivateKeyResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_utils_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SignMessageWithPrivateKeyResponse.ProtoReflect.Descriptor instead.
+func (*SignMessageWithPrivateKeyResponse) Descriptor() ([]byte, []int) {
+ return file_utils_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *SignMessageWithPrivateKeyResponse) GetSignature() string {
+ if x != nil {
+ return x.Signature
+ }
+ return ""
+}
+
+// Request message for verifying a message signature.
+type VerifyMessageRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The signed message.
+ Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
+ // The signature of the message.
+ Signature string `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
+ // The public key of the signer.
+ PublicKey string `protobuf:"bytes,3,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
+}
+
+func (x *VerifyMessageRequest) Reset() {
+ *x = VerifyMessageRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_utils_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *VerifyMessageRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*VerifyMessageRequest) ProtoMessage() {}
+
+func (x *VerifyMessageRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_utils_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use VerifyMessageRequest.ProtoReflect.Descriptor instead.
+func (*VerifyMessageRequest) Descriptor() ([]byte, []int) {
+ return file_utils_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *VerifyMessageRequest) GetMessage() string {
+ if x != nil {
+ return x.Message
+ }
+ return ""
+}
+
+func (x *VerifyMessageRequest) GetSignature() string {
+ if x != nil {
+ return x.Signature
+ }
+ return ""
+}
+
+func (x *VerifyMessageRequest) GetPublicKey() string {
+ if x != nil {
+ return x.PublicKey
+ }
+ return ""
+}
+
+// Response message containing the resualt of validation of signature and message.
+type VerifyMessageResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Indicates if the signature is valid (true) or not (false).
+ IsValid bool `protobuf:"varint,1,opt,name=is_valid,json=isValid,proto3" json:"is_valid,omitempty"`
+}
+
+func (x *VerifyMessageResponse) Reset() {
+ *x = VerifyMessageResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_utils_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *VerifyMessageResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*VerifyMessageResponse) ProtoMessage() {}
+
+func (x *VerifyMessageResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_utils_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use VerifyMessageResponse.ProtoReflect.Descriptor instead.
+func (*VerifyMessageResponse) Descriptor() ([]byte, []int) {
+ return file_utils_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *VerifyMessageResponse) GetIsValid() bool {
+ if x != nil {
+ return x.IsValid
+ }
+ return false
+}
+
+var File_utils_proto protoreflect.FileDescriptor
+
+var file_utils_proto_rawDesc = []byte{
+ 0x0a, 0x0b, 0x75, 0x74, 0x69, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70,
+ 0x61, 0x63, 0x74, 0x75, 0x73, 0x22, 0x5d, 0x0a, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73,
+ 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b,
+ 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x69,
+ 0x76, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
+ 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65,
+ 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73,
+ 0x73, 0x61, 0x67, 0x65, 0x22, 0x41, 0x0a, 0x21, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73,
+ 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65,
+ 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67,
+ 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69,
+ 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x6d, 0x0a, 0x14, 0x56, 0x65, 0x72, 0x69, 0x66,
+ 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
+ 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67,
+ 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69,
+ 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69,
+ 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x75, 0x62,
+ 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x22, 0x32, 0x0a, 0x15, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79,
+ 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x19, 0x0a, 0x08, 0x69, 0x73, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x08, 0x52, 0x07, 0x69, 0x73, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x32, 0xc7, 0x01, 0x0a, 0x05, 0x55,
+ 0x74, 0x69, 0x6c, 0x73, 0x12, 0x70, 0x0a, 0x19, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73,
+ 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65,
+ 0x79, 0x12, 0x28, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4d,
+ 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x57, 0x69, 0x74, 0x68, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74,
+ 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x61,
+ 0x63, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
+ 0x57, 0x69, 0x74, 0x68, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79,
+ 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73,
+ 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x56,
+ 0x65, 0x72, 0x69, 0x66, 0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x40, 0x0a, 0x0c, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x75,
+ 0x74, 0x69, 0x6c, 0x73, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
+ 0x2f, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f,
+ 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2f, 0x77, 0x77, 0x77, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f,
+ 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_utils_proto_rawDescOnce sync.Once
+ file_utils_proto_rawDescData = file_utils_proto_rawDesc
+)
+
+func file_utils_proto_rawDescGZIP() []byte {
+ file_utils_proto_rawDescOnce.Do(func() {
+ file_utils_proto_rawDescData = protoimpl.X.CompressGZIP(file_utils_proto_rawDescData)
+ })
+ return file_utils_proto_rawDescData
+}
+
+var file_utils_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
+var file_utils_proto_goTypes = []any{
+ (*SignMessageWithPrivateKeyRequest)(nil), // 0: pactus.SignMessageWithPrivateKeyRequest
+ (*SignMessageWithPrivateKeyResponse)(nil), // 1: pactus.SignMessageWithPrivateKeyResponse
+ (*VerifyMessageRequest)(nil), // 2: pactus.VerifyMessageRequest
+ (*VerifyMessageResponse)(nil), // 3: pactus.VerifyMessageResponse
+}
+var file_utils_proto_depIdxs = []int32{
+ 0, // 0: pactus.Utils.SignMessageWithPrivateKey:input_type -> pactus.SignMessageWithPrivateKeyRequest
+ 2, // 1: pactus.Utils.VerifyMessage:input_type -> pactus.VerifyMessageRequest
+ 1, // 2: pactus.Utils.SignMessageWithPrivateKey:output_type -> pactus.SignMessageWithPrivateKeyResponse
+ 3, // 3: pactus.Utils.VerifyMessage:output_type -> pactus.VerifyMessageResponse
+ 2, // [2:4] is the sub-list for method output_type
+ 0, // [0:2] is the sub-list for method input_type
+ 0, // [0:0] is the sub-list for extension type_name
+ 0, // [0:0] is the sub-list for extension extendee
+ 0, // [0:0] is the sub-list for field type_name
+}
+
+func init() { file_utils_proto_init() }
+func file_utils_proto_init() {
+ if File_utils_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_utils_proto_msgTypes[0].Exporter = func(v any, i int) any {
+ switch v := v.(*SignMessageWithPrivateKeyRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_utils_proto_msgTypes[1].Exporter = func(v any, i int) any {
+ switch v := v.(*SignMessageWithPrivateKeyResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_utils_proto_msgTypes[2].Exporter = func(v any, i int) any {
+ switch v := v.(*VerifyMessageRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_utils_proto_msgTypes[3].Exporter = func(v any, i int) any {
+ switch v := v.(*VerifyMessageResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_utils_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 4,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_utils_proto_goTypes,
+ DependencyIndexes: file_utils_proto_depIdxs,
+ MessageInfos: file_utils_proto_msgTypes,
+ }.Build()
+ File_utils_proto = out.File
+ file_utils_proto_rawDesc = nil
+ file_utils_proto_goTypes = nil
+ file_utils_proto_depIdxs = nil
+}
diff --git a/www/grpc/gen/go/utils.pb.gw.go b/www/grpc/gen/go/utils.pb.gw.go
new file mode 100644
index 000000000..b39071861
--- /dev/null
+++ b/www/grpc/gen/go/utils.pb.gw.go
@@ -0,0 +1,260 @@
+// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
+// source: utils.proto
+
+/*
+Package pactus is a reverse proxy.
+
+It translates gRPC into RESTful JSON APIs.
+*/
+package pactus
+
+import (
+ "context"
+ "io"
+ "net/http"
+
+ "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
+ "github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/grpclog"
+ "google.golang.org/grpc/metadata"
+ "google.golang.org/grpc/status"
+ "google.golang.org/protobuf/proto"
+)
+
+// Suppress "imported and not used" errors
+var _ codes.Code
+var _ io.Reader
+var _ status.Status
+var _ = runtime.String
+var _ = utilities.NewDoubleArray
+var _ = metadata.Join
+
+var (
+ filter_Utils_SignMessageWithPrivateKey_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
+)
+
+func request_Utils_SignMessageWithPrivateKey_0(ctx context.Context, marshaler runtime.Marshaler, client UtilsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq SignMessageWithPrivateKeyRequest
+ var metadata runtime.ServerMetadata
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Utils_SignMessageWithPrivateKey_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.SignMessageWithPrivateKey(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Utils_SignMessageWithPrivateKey_0(ctx context.Context, marshaler runtime.Marshaler, server UtilsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq SignMessageWithPrivateKeyRequest
+ var metadata runtime.ServerMetadata
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Utils_SignMessageWithPrivateKey_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.SignMessageWithPrivateKey(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
+var (
+ filter_Utils_VerifyMessage_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
+)
+
+func request_Utils_VerifyMessage_0(ctx context.Context, marshaler runtime.Marshaler, client UtilsClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq VerifyMessageRequest
+ var metadata runtime.ServerMetadata
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Utils_VerifyMessage_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.VerifyMessage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Utils_VerifyMessage_0(ctx context.Context, marshaler runtime.Marshaler, server UtilsServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq VerifyMessageRequest
+ var metadata runtime.ServerMetadata
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Utils_VerifyMessage_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.VerifyMessage(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
+// RegisterUtilsHandlerServer registers the http handlers for service Utils to "mux".
+// UnaryRPC :call UtilsServer directly.
+// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
+// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterUtilsHandlerFromEndpoint instead.
+func RegisterUtilsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server UtilsServer) error {
+
+ mux.Handle("GET", pattern_Utils_SignMessageWithPrivateKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pactus.Utils/SignMessageWithPrivateKey", runtime.WithHTTPPathPattern("/pactus/Utils/sign_message_with_private_key"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_Utils_SignMessageWithPrivateKey_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Utils_SignMessageWithPrivateKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ mux.Handle("GET", pattern_Utils_VerifyMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pactus.Utils/VerifyMessage", runtime.WithHTTPPathPattern("/pactus/Utils/verify_message"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_Utils_VerifyMessage_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Utils_VerifyMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ return nil
+}
+
+// RegisterUtilsHandlerFromEndpoint is same as RegisterUtilsHandler but
+// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
+func RegisterUtilsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
+ conn, err := grpc.NewClient(endpoint, opts...)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if err != nil {
+ if cerr := conn.Close(); cerr != nil {
+ grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
+ }
+ return
+ }
+ go func() {
+ <-ctx.Done()
+ if cerr := conn.Close(); cerr != nil {
+ grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr)
+ }
+ }()
+ }()
+
+ return RegisterUtilsHandler(ctx, mux, conn)
+}
+
+// RegisterUtilsHandler registers the http handlers for service Utils to "mux".
+// The handlers forward requests to the grpc endpoint over "conn".
+func RegisterUtilsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
+ return RegisterUtilsHandlerClient(ctx, mux, NewUtilsClient(conn))
+}
+
+// RegisterUtilsHandlerClient registers the http handlers for service Utils
+// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "UtilsClient".
+// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "UtilsClient"
+// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
+// "UtilsClient" to call the correct interceptors.
+func RegisterUtilsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client UtilsClient) error {
+
+ mux.Handle("GET", pattern_Utils_SignMessageWithPrivateKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/pactus.Utils/SignMessageWithPrivateKey", runtime.WithHTTPPathPattern("/pactus/Utils/sign_message_with_private_key"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_Utils_SignMessageWithPrivateKey_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Utils_SignMessageWithPrivateKey_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ mux.Handle("GET", pattern_Utils_VerifyMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/pactus.Utils/VerifyMessage", runtime.WithHTTPPathPattern("/pactus/Utils/verify_message"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_Utils_VerifyMessage_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Utils_VerifyMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
+ return nil
+}
+
+var (
+ pattern_Utils_SignMessageWithPrivateKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"pactus", "Utils", "sign_message_with_private_key"}, ""))
+
+ pattern_Utils_VerifyMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"pactus", "Utils", "verify_message"}, ""))
+)
+
+var (
+ forward_Utils_SignMessageWithPrivateKey_0 = runtime.ForwardResponseMessage
+
+ forward_Utils_VerifyMessage_0 = runtime.ForwardResponseMessage
+)
diff --git a/www/grpc/gen/go/utils_grpc.pb.go b/www/grpc/gen/go/utils_grpc.pb.go
new file mode 100644
index 000000000..623487c1a
--- /dev/null
+++ b/www/grpc/gen/go/utils_grpc.pb.go
@@ -0,0 +1,156 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.4.0
+// - protoc (unknown)
+// source: utils.proto
+
+package pactus
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.62.0 or later.
+const _ = grpc.SupportPackageIsVersion8
+
+const (
+ Utils_SignMessageWithPrivateKey_FullMethodName = "/pactus.Utils/SignMessageWithPrivateKey"
+ Utils_VerifyMessage_FullMethodName = "/pactus.Utils/VerifyMessage"
+)
+
+// UtilsClient is the client API for Utils service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+//
+// Utils service defines RPC methods for utility functions such as message
+// signing and verification.
+type UtilsClient interface {
+ // SignMessageWithPrivateKey sign message with provided private key.
+ SignMessageWithPrivateKey(ctx context.Context, in *SignMessageWithPrivateKeyRequest, opts ...grpc.CallOption) (*SignMessageWithPrivateKeyResponse, error)
+ // VerifyMessage verify signature with public key and message
+ VerifyMessage(ctx context.Context, in *VerifyMessageRequest, opts ...grpc.CallOption) (*VerifyMessageResponse, error)
+}
+
+type utilsClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewUtilsClient(cc grpc.ClientConnInterface) UtilsClient {
+ return &utilsClient{cc}
+}
+
+func (c *utilsClient) SignMessageWithPrivateKey(ctx context.Context, in *SignMessageWithPrivateKeyRequest, opts ...grpc.CallOption) (*SignMessageWithPrivateKeyResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(SignMessageWithPrivateKeyResponse)
+ err := c.cc.Invoke(ctx, Utils_SignMessageWithPrivateKey_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *utilsClient) VerifyMessage(ctx context.Context, in *VerifyMessageRequest, opts ...grpc.CallOption) (*VerifyMessageResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(VerifyMessageResponse)
+ err := c.cc.Invoke(ctx, Utils_VerifyMessage_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// UtilsServer is the server API for Utils service.
+// All implementations should embed UnimplementedUtilsServer
+// for forward compatibility
+//
+// Utils service defines RPC methods for utility functions such as message
+// signing and verification.
+type UtilsServer interface {
+ // SignMessageWithPrivateKey sign message with provided private key.
+ SignMessageWithPrivateKey(context.Context, *SignMessageWithPrivateKeyRequest) (*SignMessageWithPrivateKeyResponse, error)
+ // VerifyMessage verify signature with public key and message
+ VerifyMessage(context.Context, *VerifyMessageRequest) (*VerifyMessageResponse, error)
+}
+
+// UnimplementedUtilsServer should be embedded to have forward compatible implementations.
+type UnimplementedUtilsServer struct {
+}
+
+func (UnimplementedUtilsServer) SignMessageWithPrivateKey(context.Context, *SignMessageWithPrivateKeyRequest) (*SignMessageWithPrivateKeyResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SignMessageWithPrivateKey not implemented")
+}
+func (UnimplementedUtilsServer) VerifyMessage(context.Context, *VerifyMessageRequest) (*VerifyMessageResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method VerifyMessage not implemented")
+}
+
+// UnsafeUtilsServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to UtilsServer will
+// result in compilation errors.
+type UnsafeUtilsServer interface {
+ mustEmbedUnimplementedUtilsServer()
+}
+
+func RegisterUtilsServer(s grpc.ServiceRegistrar, srv UtilsServer) {
+ s.RegisterService(&Utils_ServiceDesc, srv)
+}
+
+func _Utils_SignMessageWithPrivateKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(SignMessageWithPrivateKeyRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UtilsServer).SignMessageWithPrivateKey(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Utils_SignMessageWithPrivateKey_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UtilsServer).SignMessageWithPrivateKey(ctx, req.(*SignMessageWithPrivateKeyRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Utils_VerifyMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(VerifyMessageRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(UtilsServer).VerifyMessage(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Utils_VerifyMessage_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(UtilsServer).VerifyMessage(ctx, req.(*VerifyMessageRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// Utils_ServiceDesc is the grpc.ServiceDesc for Utils service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var Utils_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "pactus.Utils",
+ HandlerType: (*UtilsServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "SignMessageWithPrivateKey",
+ Handler: _Utils_SignMessageWithPrivateKey_Handler,
+ },
+ {
+ MethodName: "VerifyMessage",
+ Handler: _Utils_VerifyMessage_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "utils.proto",
+}
diff --git a/www/grpc/gen/go/utils_jgw.pb.go b/www/grpc/gen/go/utils_jgw.pb.go
new file mode 100644
index 000000000..5ac60b199
--- /dev/null
+++ b/www/grpc/gen/go/utils_jgw.pb.go
@@ -0,0 +1,74 @@
+// Code generated by protoc-gen-jrpc-gateway. DO NOT EDIT.
+// source: utils.proto
+
+/*
+Package pactus is a reverse proxy.
+
+It translates gRPC into JSON-RPC 2.0
+*/
+package pactus
+
+import (
+ "context"
+ "encoding/json"
+
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/metadata"
+ "google.golang.org/protobuf/encoding/protojson"
+)
+
+type UtilsJsonRPC struct {
+ client UtilsClient
+}
+
+type paramsAndHeadersUtils struct {
+ Headers metadata.MD `json:"headers,omitempty"`
+ Params json.RawMessage `json:"params"`
+}
+
+// RegisterUtilsJsonRPC register the grpc client Utils for json-rpc.
+// The handlers forward requests to the grpc endpoint over "conn".
+func RegisterUtilsJsonRPC(conn *grpc.ClientConn) *UtilsJsonRPC {
+ return &UtilsJsonRPC{
+ client: NewUtilsClient(conn),
+ }
+}
+
+func (s *UtilsJsonRPC) Methods() map[string]func(ctx context.Context, message json.RawMessage) (any, error) {
+ return map[string]func(ctx context.Context, params json.RawMessage) (any, error){
+
+ "pactus.utils.sign_message_with_private_key": func(ctx context.Context, data json.RawMessage) (any, error) {
+ req := new(SignMessageWithPrivateKeyRequest)
+
+ var jrpcData paramsAndHeadersUtils
+
+ if err := json.Unmarshal(data, &jrpcData); err != nil {
+ return nil, err
+ }
+
+ err := protojson.Unmarshal(jrpcData.Params, req)
+ if err != nil {
+ return nil, err
+ }
+
+ return s.client.SignMessageWithPrivateKey(metadata.NewOutgoingContext(ctx, jrpcData.Headers), req)
+ },
+
+ "pactus.utils.verify_message": func(ctx context.Context, data json.RawMessage) (any, error) {
+ req := new(VerifyMessageRequest)
+
+ var jrpcData paramsAndHeadersUtils
+
+ if err := json.Unmarshal(data, &jrpcData); err != nil {
+ return nil, err
+ }
+
+ err := protojson.Unmarshal(jrpcData.Params, req)
+ if err != nil {
+ return nil, err
+ }
+
+ return s.client.VerifyMessage(metadata.NewOutgoingContext(ctx, jrpcData.Headers), req)
+ },
+ }
+}
diff --git a/www/grpc/gen/go/wallet.cobra.pb.go b/www/grpc/gen/go/wallet.cobra.pb.go
index b5b5d900e..c9b14d949 100644
--- a/www/grpc/gen/go/wallet.cobra.pb.go
+++ b/www/grpc/gen/go/wallet.cobra.pb.go
@@ -29,6 +29,7 @@ func WalletClientCommand(options ...client.Option) *cobra.Command {
_WalletGetValidatorAddressCommand(cfg),
_WalletGetNewAddressCommand(cfg),
_WalletGetAddressHistoryCommand(cfg),
+ _WalletSignMessageCommand(cfg),
)
return cmd
}
@@ -418,3 +419,48 @@ func _WalletGetAddressHistoryCommand(cfg *client.Config) *cobra.Command {
return cmd
}
+
+func _WalletSignMessageCommand(cfg *client.Config) *cobra.Command {
+ req := &SignMessageRequest{}
+
+ cmd := &cobra.Command{
+ Use: cfg.CommandNamer("SignMessage"),
+ Short: "SignMessage RPC client",
+ Long: "SignMessage signs an arbitrary message.",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ if cfg.UseEnvVars {
+ if err := flag.SetFlagsFromEnv(cmd.Parent().PersistentFlags(), true, cfg.EnvVarNamer, cfg.EnvVarPrefix, "Wallet"); err != nil {
+ return err
+ }
+ if err := flag.SetFlagsFromEnv(cmd.PersistentFlags(), false, cfg.EnvVarNamer, cfg.EnvVarPrefix, "Wallet", "SignMessage"); err != nil {
+ return err
+ }
+ }
+ return client.RoundTrip(cmd.Context(), cfg, func(cc grpc.ClientConnInterface, in iocodec.Decoder, out iocodec.Encoder) error {
+ cli := NewWalletClient(cc)
+ v := &SignMessageRequest{}
+
+ if err := in(v); err != nil {
+ return err
+ }
+ proto.Merge(v, req)
+
+ res, err := cli.SignMessage(cmd.Context(), v)
+
+ if err != nil {
+ return err
+ }
+
+ return out(res)
+
+ })
+ },
+ }
+
+ cmd.PersistentFlags().StringVar(&req.WalletName, cfg.FlagNamer("WalletName"), "", "The name of the wallet.")
+ cmd.PersistentFlags().StringVar(&req.Password, cfg.FlagNamer("Password"), "", "The password for unlocking the wallet for signing.")
+ cmd.PersistentFlags().StringVar(&req.Address, cfg.FlagNamer("Address"), "", "The account address associated with the private key.")
+ cmd.PersistentFlags().StringVar(&req.Message, cfg.FlagNamer("Message"), "", "The arbitrary message to be signed.")
+
+ return cmd
+}
diff --git a/www/grpc/gen/go/wallet.pb.go b/www/grpc/gen/go/wallet.pb.go
index 59ae55cd8..30c89c687 100644
--- a/www/grpc/gen/go/wallet.pb.go
+++ b/www/grpc/gen/go/wallet.pb.go
@@ -1216,6 +1216,131 @@ func (x *GetTotalBalanceResponse) GetTotalBalance() int64 {
return 0
}
+// Request message to sign an arbitrary message.
+type SignMessageRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The name of the wallet.
+ WalletName string `protobuf:"bytes,1,opt,name=wallet_name,json=walletName,proto3" json:"wallet_name,omitempty"`
+ // The password for unlocking the wallet for signing.
+ Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
+ // The account address associated with the private key.
+ Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
+ // The arbitrary message to be signed.
+ Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"`
+}
+
+func (x *SignMessageRequest) Reset() {
+ *x = SignMessageRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_wallet_proto_msgTypes[20]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SignMessageRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SignMessageRequest) ProtoMessage() {}
+
+func (x *SignMessageRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_wallet_proto_msgTypes[20]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SignMessageRequest.ProtoReflect.Descriptor instead.
+func (*SignMessageRequest) Descriptor() ([]byte, []int) {
+ return file_wallet_proto_rawDescGZIP(), []int{20}
+}
+
+func (x *SignMessageRequest) GetWalletName() string {
+ if x != nil {
+ return x.WalletName
+ }
+ return ""
+}
+
+func (x *SignMessageRequest) GetPassword() string {
+ if x != nil {
+ return x.Password
+ }
+ return ""
+}
+
+func (x *SignMessageRequest) GetAddress() string {
+ if x != nil {
+ return x.Address
+ }
+ return ""
+}
+
+func (x *SignMessageRequest) GetMessage() string {
+ if x != nil {
+ return x.Message
+ }
+ return ""
+}
+
+// Response message containing the available balance of the wallet.
+type SignMessageResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // Signature of the message.
+ Signature string `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
+}
+
+func (x *SignMessageResponse) Reset() {
+ *x = SignMessageResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_wallet_proto_msgTypes[21]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SignMessageResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SignMessageResponse) ProtoMessage() {}
+
+func (x *SignMessageResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_wallet_proto_msgTypes[21]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SignMessageResponse.ProtoReflect.Descriptor instead.
+func (*SignMessageResponse) Descriptor() ([]byte, []int) {
+ return file_wallet_proto_rawDescGZIP(), []int{21}
+}
+
+func (x *SignMessageResponse) GetSignature() string {
+ if x != nil {
+ return x.Signature
+ }
+ return ""
+}
+
var File_wallet_proto protoreflect.FileDescriptor
var file_wallet_proto_rawDesc = []byte{
@@ -1331,65 +1456,81 @@ var file_wallet_proto_rawDesc = []byte{
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x61, 0x6c, 0x6c,
0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f,
0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x74,
- 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x2a, 0x62, 0x0a, 0x0b, 0x41,
- 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x44,
- 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x45, 0x41, 0x53,
- 0x55, 0x52, 0x59, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53,
- 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x4f, 0x52, 0x10,
- 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59, 0x50,
- 0x45, 0x5f, 0x42, 0x4c, 0x53, 0x5f, 0x41, 0x43, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x02, 0x32,
- 0xea, 0x05, 0x0a, 0x06, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x49, 0x0a, 0x0c, 0x43, 0x72,
- 0x65, 0x61, 0x74, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x61, 0x63,
- 0x74, 0x75, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73,
- 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x73,
- 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65,
- 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e,
- 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x71,
- 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x52, 0x65,
- 0x73, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0a, 0x4c, 0x6f, 0x61, 0x64, 0x57, 0x61, 0x6c, 0x6c, 0x65,
- 0x74, 0x12, 0x19, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x57,
- 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70,
- 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74,
- 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x55, 0x6e, 0x6c, 0x6f,
- 0x61, 0x64, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75,
- 0x73, 0x2e, 0x55, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65,
- 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x55,
- 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x42,
- 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1e, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e,
- 0x47, 0x65, 0x74, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e,
- 0x47, 0x65, 0x74, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x12, 0x53, 0x69, 0x67, 0x6e, 0x52,
- 0x61, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e,
+ 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x12,
+ 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d,
+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x4e,
+ 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12,
+ 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73,
+ 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73,
+ 0x61, 0x67, 0x65, 0x22, 0x33, 0x0a, 0x13, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61,
+ 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69,
+ 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73,
+ 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2a, 0x62, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x72,
+ 0x65, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x44, 0x44, 0x52, 0x45,
+ 0x53, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x45, 0x41, 0x53, 0x55, 0x52, 0x59,
+ 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59,
+ 0x50, 0x45, 0x5f, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x4f, 0x52, 0x10, 0x01, 0x12, 0x1c,
+ 0x0a, 0x18, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x42,
+ 0x4c, 0x53, 0x5f, 0x41, 0x43, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x02, 0x32, 0xb2, 0x06, 0x0a,
+ 0x06, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x49, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74,
+ 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73,
+ 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x43, 0x72,
+ 0x65, 0x61, 0x74, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x61, 0x6c,
+ 0x6c, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x52, 0x65, 0x73,
+ 0x74, 0x6f, 0x72, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x74, 0x6f,
+ 0x72, 0x65, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x43, 0x0a, 0x0a, 0x4c, 0x6f, 0x61, 0x64, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x19,
+ 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x57, 0x61, 0x6c, 0x6c,
+ 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x61, 0x63, 0x74,
+ 0x75, 0x73, 0x2e, 0x4c, 0x6f, 0x61, 0x64, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0c, 0x55, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x57,
+ 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x12, 0x1b, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x55,
+ 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x55, 0x6e, 0x6c, 0x6f,
+ 0x61, 0x64, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x52, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x61, 0x6c, 0x61,
+ 0x6e, 0x63, 0x65, 0x12, 0x1e, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x47, 0x65, 0x74,
+ 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x47, 0x65, 0x74,
+ 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x12, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54,
+ 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x70, 0x61, 0x63,
+ 0x74, 0x75, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73,
+ 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e,
0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61, 0x77, 0x54, 0x72,
- 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
- 0x1a, 0x22, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x61,
- 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70,
- 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64,
- 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x22, 0x2e, 0x70, 0x61,
- 0x63, 0x74, 0x75, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f,
- 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
- 0x23, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x69,
- 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70,
- 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x77, 0x41, 0x64,
- 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1c, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x47,
- 0x65, 0x74, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x47, 0x65, 0x74,
- 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x12, 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
- 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x20, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73,
- 0x2e, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x69, 0x73, 0x74, 0x6f,
- 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x61, 0x63, 0x74,
- 0x75, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x69, 0x73,
- 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x41, 0x0a, 0x0d,
- 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x5a, 0x30, 0x67,
- 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73,
- 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2f,
- 0x77, 0x77, 0x77, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x62,
- 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x12, 0x5e, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f,
+ 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x22, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75,
+ 0x73, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x41, 0x64,
+ 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x70,
+ 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
+ 0x6f, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x12, 0x4c, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65,
+ 0x73, 0x73, 0x12, 0x1c, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4e,
+ 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x1d, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x47, 0x65, 0x74, 0x4e, 0x65, 0x77,
+ 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x58, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x69, 0x73,
+ 0x74, 0x6f, 0x72, 0x79, 0x12, 0x20, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x47, 0x65,
+ 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e,
+ 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72,
+ 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0b, 0x53, 0x69, 0x67,
+ 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75,
+ 0x73, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x53, 0x69,
+ 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x42, 0x41, 0x0a, 0x0d, 0x70, 0x61, 0x63, 0x74, 0x75, 0x73, 0x2e, 0x77, 0x61, 0x6c, 0x6c,
+ 0x65, 0x74, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70,
+ 0x61, 0x63, 0x74, 0x75, 0x73, 0x2d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x61,
+ 0x63, 0x74, 0x75, 0x73, 0x2f, 0x77, 0x77, 0x77, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x70, 0x61,
+ 0x63, 0x74, 0x75, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -1405,7 +1546,7 @@ func file_wallet_proto_rawDescGZIP() []byte {
}
var file_wallet_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_wallet_proto_msgTypes = make([]protoimpl.MessageInfo, 20)
+var file_wallet_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_wallet_proto_goTypes = []any{
(AddressType)(0), // 0: pactus.AddressType
(*AddressInfo)(nil), // 1: pactus.AddressInfo
@@ -1428,6 +1569,8 @@ var file_wallet_proto_goTypes = []any{
(*SignRawTransactionResponse)(nil), // 18: pactus.SignRawTransactionResponse
(*GetTotalBalanceRequest)(nil), // 19: pactus.GetTotalBalanceRequest
(*GetTotalBalanceResponse)(nil), // 20: pactus.GetTotalBalanceResponse
+ (*SignMessageRequest)(nil), // 21: pactus.SignMessageRequest
+ (*SignMessageResponse)(nil), // 22: pactus.SignMessageResponse
}
var file_wallet_proto_depIdxs = []int32{
2, // 0: pactus.GetAddressHistoryResponse.history_info:type_name -> pactus.HistoryInfo
@@ -1442,17 +1585,19 @@ var file_wallet_proto_depIdxs = []int32{
15, // 9: pactus.Wallet.GetValidatorAddress:input_type -> pactus.GetValidatorAddressRequest
5, // 10: pactus.Wallet.GetNewAddress:input_type -> pactus.GetNewAddressRequest
3, // 11: pactus.Wallet.GetAddressHistory:input_type -> pactus.GetAddressHistoryRequest
- 10, // 12: pactus.Wallet.CreateWallet:output_type -> pactus.CreateWalletResponse
- 8, // 13: pactus.Wallet.RestoreWallet:output_type -> pactus.RestoreWalletResponse
- 12, // 14: pactus.Wallet.LoadWallet:output_type -> pactus.LoadWalletResponse
- 14, // 15: pactus.Wallet.UnloadWallet:output_type -> pactus.UnloadWalletResponse
- 20, // 16: pactus.Wallet.GetTotalBalance:output_type -> pactus.GetTotalBalanceResponse
- 18, // 17: pactus.Wallet.SignRawTransaction:output_type -> pactus.SignRawTransactionResponse
- 16, // 18: pactus.Wallet.GetValidatorAddress:output_type -> pactus.GetValidatorAddressResponse
- 6, // 19: pactus.Wallet.GetNewAddress:output_type -> pactus.GetNewAddressResponse
- 4, // 20: pactus.Wallet.GetAddressHistory:output_type -> pactus.GetAddressHistoryResponse
- 12, // [12:21] is the sub-list for method output_type
- 3, // [3:12] is the sub-list for method input_type
+ 21, // 12: pactus.Wallet.SignMessage:input_type -> pactus.SignMessageRequest
+ 10, // 13: pactus.Wallet.CreateWallet:output_type -> pactus.CreateWalletResponse
+ 8, // 14: pactus.Wallet.RestoreWallet:output_type -> pactus.RestoreWalletResponse
+ 12, // 15: pactus.Wallet.LoadWallet:output_type -> pactus.LoadWalletResponse
+ 14, // 16: pactus.Wallet.UnloadWallet:output_type -> pactus.UnloadWalletResponse
+ 20, // 17: pactus.Wallet.GetTotalBalance:output_type -> pactus.GetTotalBalanceResponse
+ 18, // 18: pactus.Wallet.SignRawTransaction:output_type -> pactus.SignRawTransactionResponse
+ 16, // 19: pactus.Wallet.GetValidatorAddress:output_type -> pactus.GetValidatorAddressResponse
+ 6, // 20: pactus.Wallet.GetNewAddress:output_type -> pactus.GetNewAddressResponse
+ 4, // 21: pactus.Wallet.GetAddressHistory:output_type -> pactus.GetAddressHistoryResponse
+ 22, // 22: pactus.Wallet.SignMessage:output_type -> pactus.SignMessageResponse
+ 13, // [13:23] is the sub-list for method output_type
+ 3, // [3:13] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
@@ -1705,6 +1850,30 @@ func file_wallet_proto_init() {
return nil
}
}
+ file_wallet_proto_msgTypes[20].Exporter = func(v any, i int) any {
+ switch v := v.(*SignMessageRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_wallet_proto_msgTypes[21].Exporter = func(v any, i int) any {
+ switch v := v.(*SignMessageResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -1712,7 +1881,7 @@ func file_wallet_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_wallet_proto_rawDesc,
NumEnums: 1,
- NumMessages: 20,
+ NumMessages: 22,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/www/grpc/gen/go/wallet.pb.gw.go b/www/grpc/gen/go/wallet.pb.gw.go
index 917982457..67c180ab2 100644
--- a/www/grpc/gen/go/wallet.pb.gw.go
+++ b/www/grpc/gen/go/wallet.pb.gw.go
@@ -319,6 +319,42 @@ func local_request_Wallet_GetNewAddress_0(ctx context.Context, marshaler runtime
}
+var (
+ filter_Wallet_SignMessage_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
+)
+
+func request_Wallet_SignMessage_0(ctx context.Context, marshaler runtime.Marshaler, client WalletClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq SignMessageRequest
+ var metadata runtime.ServerMetadata
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Wallet_SignMessage_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.SignMessage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_Wallet_SignMessage_0(ctx context.Context, marshaler runtime.Marshaler, server WalletServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq SignMessageRequest
+ var metadata runtime.ServerMetadata
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Wallet_SignMessage_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.SignMessage(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
// RegisterWalletHandlerServer registers the http handlers for service Wallet to "mux".
// UnaryRPC :call WalletServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -525,6 +561,31 @@ func RegisterWalletHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser
})
+ mux.Handle("GET", pattern_Wallet_SignMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/pactus.Wallet/SignMessage", runtime.WithHTTPPathPattern("/pactus/wallet/sign_message"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_Wallet_SignMessage_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Wallet_SignMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -742,6 +803,28 @@ func RegisterWalletHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli
})
+ mux.Handle("GET", pattern_Wallet_SignMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/pactus.Wallet/SignMessage", runtime.WithHTTPPathPattern("/pactus/wallet/sign_message"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_Wallet_SignMessage_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_Wallet_SignMessage_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
return nil
}
@@ -761,6 +844,8 @@ var (
pattern_Wallet_GetValidatorAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"pactus", "wallet", "get_validator_address"}, ""))
pattern_Wallet_GetNewAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"pactus", "wallet", "get_new_address"}, ""))
+
+ pattern_Wallet_SignMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"pactus", "wallet", "sign_message"}, ""))
)
var (
@@ -779,4 +864,6 @@ var (
forward_Wallet_GetValidatorAddress_0 = runtime.ForwardResponseMessage
forward_Wallet_GetNewAddress_0 = runtime.ForwardResponseMessage
+
+ forward_Wallet_SignMessage_0 = runtime.ForwardResponseMessage
)
diff --git a/www/grpc/gen/go/wallet_grpc.pb.go b/www/grpc/gen/go/wallet_grpc.pb.go
index 10b5c3f75..31ecb5b83 100644
--- a/www/grpc/gen/go/wallet_grpc.pb.go
+++ b/www/grpc/gen/go/wallet_grpc.pb.go
@@ -30,6 +30,7 @@ const (
Wallet_GetValidatorAddress_FullMethodName = "/pactus.Wallet/GetValidatorAddress"
Wallet_GetNewAddress_FullMethodName = "/pactus.Wallet/GetNewAddress"
Wallet_GetAddressHistory_FullMethodName = "/pactus.Wallet/GetAddressHistory"
+ Wallet_SignMessage_FullMethodName = "/pactus.Wallet/SignMessage"
)
// WalletClient is the client API for Wallet service.
@@ -57,6 +58,8 @@ type WalletClient interface {
GetNewAddress(ctx context.Context, in *GetNewAddressRequest, opts ...grpc.CallOption) (*GetNewAddressResponse, error)
// GetAddressHistory retrieves the transaction history of an address.
GetAddressHistory(ctx context.Context, in *GetAddressHistoryRequest, opts ...grpc.CallOption) (*GetAddressHistoryResponse, error)
+ // SignMessage signs an arbitrary message.
+ SignMessage(ctx context.Context, in *SignMessageRequest, opts ...grpc.CallOption) (*SignMessageResponse, error)
}
type walletClient struct {
@@ -157,6 +160,16 @@ func (c *walletClient) GetAddressHistory(ctx context.Context, in *GetAddressHist
return out, nil
}
+func (c *walletClient) SignMessage(ctx context.Context, in *SignMessageRequest, opts ...grpc.CallOption) (*SignMessageResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(SignMessageResponse)
+ err := c.cc.Invoke(ctx, Wallet_SignMessage_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// WalletServer is the server API for Wallet service.
// All implementations should embed UnimplementedWalletServer
// for forward compatibility
@@ -182,6 +195,8 @@ type WalletServer interface {
GetNewAddress(context.Context, *GetNewAddressRequest) (*GetNewAddressResponse, error)
// GetAddressHistory retrieves the transaction history of an address.
GetAddressHistory(context.Context, *GetAddressHistoryRequest) (*GetAddressHistoryResponse, error)
+ // SignMessage signs an arbitrary message.
+ SignMessage(context.Context, *SignMessageRequest) (*SignMessageResponse, error)
}
// UnimplementedWalletServer should be embedded to have forward compatible implementations.
@@ -215,6 +230,9 @@ func (UnimplementedWalletServer) GetNewAddress(context.Context, *GetNewAddressRe
func (UnimplementedWalletServer) GetAddressHistory(context.Context, *GetAddressHistoryRequest) (*GetAddressHistoryResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAddressHistory not implemented")
}
+func (UnimplementedWalletServer) SignMessage(context.Context, *SignMessageRequest) (*SignMessageResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SignMessage not implemented")
+}
// UnsafeWalletServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to WalletServer will
@@ -389,6 +407,24 @@ func _Wallet_GetAddressHistory_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
+func _Wallet_SignMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(SignMessageRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(WalletServer).SignMessage(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Wallet_SignMessage_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(WalletServer).SignMessage(ctx, req.(*SignMessageRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
// Wallet_ServiceDesc is the grpc.ServiceDesc for Wallet service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -432,6 +468,10 @@ var Wallet_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetAddressHistory",
Handler: _Wallet_GetAddressHistory_Handler,
},
+ {
+ MethodName: "SignMessage",
+ Handler: _Wallet_SignMessage_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "wallet.proto",
diff --git a/www/grpc/gen/go/wallet_jgw.pb.go b/www/grpc/gen/go/wallet_jgw.pb.go
index 80c3f30ef..df3dcca9e 100644
--- a/www/grpc/gen/go/wallet_jgw.pb.go
+++ b/www/grpc/gen/go/wallet_jgw.pb.go
@@ -189,5 +189,22 @@ func (s *WalletJsonRPC) Methods() map[string]func(ctx context.Context, message j
return s.client.GetAddressHistory(metadata.NewOutgoingContext(ctx, jrpcData.Headers), req)
},
+
+ "pactus.wallet.sign_message": func(ctx context.Context, data json.RawMessage) (any, error) {
+ req := new(SignMessageRequest)
+
+ var jrpcData paramsAndHeadersWallet
+
+ if err := json.Unmarshal(data, &jrpcData); err != nil {
+ return nil, err
+ }
+
+ err := protojson.Unmarshal(jrpcData.Params, req)
+ if err != nil {
+ return nil, err
+ }
+
+ return s.client.SignMessage(metadata.NewOutgoingContext(ctx, jrpcData.Headers), req)
+ },
}
}
diff --git a/www/grpc/gen/java/pactus/utils/UtilsGrpc.java b/www/grpc/gen/java/pactus/utils/UtilsGrpc.java
new file mode 100644
index 000000000..450a6db65
--- /dev/null
+++ b/www/grpc/gen/java/pactus/utils/UtilsGrpc.java
@@ -0,0 +1,394 @@
+package pactus.utils;
+
+import static io.grpc.MethodDescriptor.generateFullMethodName;
+
+/**
+ *
+ * Utils service defines RPC methods for utility functions such as message
+ * signing and verification.
+ *
+ */
+@javax.annotation.Generated(
+ value = "by gRPC proto compiler (version 1.50.2)",
+ comments = "Source: utils.proto")
+@io.grpc.stub.annotations.GrpcGenerated
+public final class UtilsGrpc {
+
+ private UtilsGrpc() {}
+
+ public static final String SERVICE_NAME = "pactus.Utils";
+
+ // Static method descriptors that strictly reflect the proto.
+ private static volatile io.grpc.MethodDescriptor getSignMessageWithPrivateKeyMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "SignMessageWithPrivateKey",
+ requestType = pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest.class,
+ responseType = pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor getSignMessageWithPrivateKeyMethod() {
+ io.grpc.MethodDescriptor getSignMessageWithPrivateKeyMethod;
+ if ((getSignMessageWithPrivateKeyMethod = UtilsGrpc.getSignMessageWithPrivateKeyMethod) == null) {
+ synchronized (UtilsGrpc.class) {
+ if ((getSignMessageWithPrivateKeyMethod = UtilsGrpc.getSignMessageWithPrivateKeyMethod) == null) {
+ UtilsGrpc.getSignMessageWithPrivateKeyMethod = getSignMessageWithPrivateKeyMethod =
+ io.grpc.MethodDescriptor.newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SignMessageWithPrivateKey"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse.getDefaultInstance()))
+ .setSchemaDescriptor(new UtilsMethodDescriptorSupplier("SignMessageWithPrivateKey"))
+ .build();
+ }
+ }
+ }
+ return getSignMessageWithPrivateKeyMethod;
+ }
+
+ private static volatile io.grpc.MethodDescriptor getVerifyMessageMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "VerifyMessage",
+ requestType = pactus.utils.UtilsOuterClass.VerifyMessageRequest.class,
+ responseType = pactus.utils.UtilsOuterClass.VerifyMessageResponse.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor getVerifyMessageMethod() {
+ io.grpc.MethodDescriptor getVerifyMessageMethod;
+ if ((getVerifyMessageMethod = UtilsGrpc.getVerifyMessageMethod) == null) {
+ synchronized (UtilsGrpc.class) {
+ if ((getVerifyMessageMethod = UtilsGrpc.getVerifyMessageMethod) == null) {
+ UtilsGrpc.getVerifyMessageMethod = getVerifyMessageMethod =
+ io.grpc.MethodDescriptor.newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "VerifyMessage"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ pactus.utils.UtilsOuterClass.VerifyMessageRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ pactus.utils.UtilsOuterClass.VerifyMessageResponse.getDefaultInstance()))
+ .setSchemaDescriptor(new UtilsMethodDescriptorSupplier("VerifyMessage"))
+ .build();
+ }
+ }
+ }
+ return getVerifyMessageMethod;
+ }
+
+ /**
+ * Creates a new async stub that supports all call types for the service
+ */
+ public static UtilsStub newStub(io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public UtilsStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new UtilsStub(channel, callOptions);
+ }
+ };
+ return UtilsStub.newStub(factory, channel);
+ }
+
+ /**
+ * Creates a new blocking-style stub that supports unary and streaming output calls on the service
+ */
+ public static UtilsBlockingStub newBlockingStub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public UtilsBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new UtilsBlockingStub(channel, callOptions);
+ }
+ };
+ return UtilsBlockingStub.newStub(factory, channel);
+ }
+
+ /**
+ * Creates a new ListenableFuture-style stub that supports unary calls on the service
+ */
+ public static UtilsFutureStub newFutureStub(
+ io.grpc.Channel channel) {
+ io.grpc.stub.AbstractStub.StubFactory factory =
+ new io.grpc.stub.AbstractStub.StubFactory() {
+ @java.lang.Override
+ public UtilsFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new UtilsFutureStub(channel, callOptions);
+ }
+ };
+ return UtilsFutureStub.newStub(factory, channel);
+ }
+
+ /**
+ *
+ * Utils service defines RPC methods for utility functions such as message
+ * signing and verification.
+ *
+ */
+ public static abstract class UtilsImplBase implements io.grpc.BindableService {
+
+ /**
+ *
+ * SignMessageWithPrivateKey sign message with provided private key.
+ *
+ */
+ public void signMessageWithPrivateKey(pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSignMessageWithPrivateKeyMethod(), responseObserver);
+ }
+
+ /**
+ *
+ * VerifyMessage verify signature with public key and message
+ *
+ */
+ public void verifyMessage(pactus.utils.UtilsOuterClass.VerifyMessageRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getVerifyMessageMethod(), responseObserver);
+ }
+
+ @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
+ return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
+ .addMethod(
+ getSignMessageWithPrivateKeyMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest,
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse>(
+ this, METHODID_SIGN_MESSAGE_WITH_PRIVATE_KEY)))
+ .addMethod(
+ getVerifyMessageMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ pactus.utils.UtilsOuterClass.VerifyMessageRequest,
+ pactus.utils.UtilsOuterClass.VerifyMessageResponse>(
+ this, METHODID_VERIFY_MESSAGE)))
+ .build();
+ }
+ }
+
+ /**
+ *
+ * Utils service defines RPC methods for utility functions such as message
+ * signing and verification.
+ *
+ */
+ public static final class UtilsStub extends io.grpc.stub.AbstractAsyncStub {
+ private UtilsStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected UtilsStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new UtilsStub(channel, callOptions);
+ }
+
+ /**
+ *
+ * SignMessageWithPrivateKey sign message with provided private key.
+ *
+ */
+ public void signMessageWithPrivateKey(pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getSignMessageWithPrivateKeyMethod(), getCallOptions()), request, responseObserver);
+ }
+
+ /**
+ *
+ * VerifyMessage verify signature with public key and message
+ *
+ */
+ public void verifyMessage(pactus.utils.UtilsOuterClass.VerifyMessageRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getVerifyMessageMethod(), getCallOptions()), request, responseObserver);
+ }
+ }
+
+ /**
+ *
+ * Utils service defines RPC methods for utility functions such as message
+ * signing and verification.
+ *
+ */
+ public static final class UtilsBlockingStub extends io.grpc.stub.AbstractBlockingStub {
+ private UtilsBlockingStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected UtilsBlockingStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new UtilsBlockingStub(channel, callOptions);
+ }
+
+ /**
+ *
+ * SignMessageWithPrivateKey sign message with provided private key.
+ *
+ */
+ public pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse signMessageWithPrivateKey(pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getSignMessageWithPrivateKeyMethod(), getCallOptions(), request);
+ }
+
+ /**
+ *
+ * VerifyMessage verify signature with public key and message
+ *
+ */
+ public pactus.utils.UtilsOuterClass.VerifyMessageResponse verifyMessage(pactus.utils.UtilsOuterClass.VerifyMessageRequest request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getVerifyMessageMethod(), getCallOptions(), request);
+ }
+ }
+
+ /**
+ *
+ * Utils service defines RPC methods for utility functions such as message
+ * signing and verification.
+ *
+ */
+ public static final class UtilsFutureStub extends io.grpc.stub.AbstractFutureStub {
+ private UtilsFutureStub(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ super(channel, callOptions);
+ }
+
+ @java.lang.Override
+ protected UtilsFutureStub build(
+ io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
+ return new UtilsFutureStub(channel, callOptions);
+ }
+
+ /**
+ *
+ * SignMessageWithPrivateKey sign message with provided private key.
+ *
+ */
+ public com.google.common.util.concurrent.ListenableFuture signMessageWithPrivateKey(
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getSignMessageWithPrivateKeyMethod(), getCallOptions()), request);
+ }
+
+ /**
+ *
+ * VerifyMessage verify signature with public key and message
+ *
+ */
+ public com.google.common.util.concurrent.ListenableFuture verifyMessage(
+ pactus.utils.UtilsOuterClass.VerifyMessageRequest request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getVerifyMessageMethod(), getCallOptions()), request);
+ }
+ }
+
+ private static final int METHODID_SIGN_MESSAGE_WITH_PRIVATE_KEY = 0;
+ private static final int METHODID_VERIFY_MESSAGE = 1;
+
+ private static final class MethodHandlers implements
+ io.grpc.stub.ServerCalls.UnaryMethod,
+ io.grpc.stub.ServerCalls.ServerStreamingMethod,
+ io.grpc.stub.ServerCalls.ClientStreamingMethod,
+ io.grpc.stub.ServerCalls.BidiStreamingMethod {
+ private final UtilsImplBase serviceImpl;
+ private final int methodId;
+
+ MethodHandlers(UtilsImplBase serviceImpl, int methodId) {
+ this.serviceImpl = serviceImpl;
+ this.methodId = methodId;
+ }
+
+ @java.lang.Override
+ @java.lang.SuppressWarnings("unchecked")
+ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {
+ switch (methodId) {
+ case METHODID_SIGN_MESSAGE_WITH_PRIVATE_KEY:
+ serviceImpl.signMessageWithPrivateKey((pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest) request,
+ (io.grpc.stub.StreamObserver) responseObserver);
+ break;
+ case METHODID_VERIFY_MESSAGE:
+ serviceImpl.verifyMessage((pactus.utils.UtilsOuterClass.VerifyMessageRequest) request,
+ (io.grpc.stub.StreamObserver) responseObserver);
+ break;
+ default:
+ throw new AssertionError();
+ }
+ }
+
+ @java.lang.Override
+ @java.lang.SuppressWarnings("unchecked")
+ public io.grpc.stub.StreamObserver invoke(
+ io.grpc.stub.StreamObserver responseObserver) {
+ switch (methodId) {
+ default:
+ throw new AssertionError();
+ }
+ }
+ }
+
+ private static abstract class UtilsBaseDescriptorSupplier
+ implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
+ UtilsBaseDescriptorSupplier() {}
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
+ return pactus.utils.UtilsOuterClass.getDescriptor();
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
+ return getFileDescriptor().findServiceByName("Utils");
+ }
+ }
+
+ private static final class UtilsFileDescriptorSupplier
+ extends UtilsBaseDescriptorSupplier {
+ UtilsFileDescriptorSupplier() {}
+ }
+
+ private static final class UtilsMethodDescriptorSupplier
+ extends UtilsBaseDescriptorSupplier
+ implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
+ private final String methodName;
+
+ UtilsMethodDescriptorSupplier(String methodName) {
+ this.methodName = methodName;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
+ return getServiceDescriptor().findMethodByName(methodName);
+ }
+ }
+
+ private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
+
+ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
+ io.grpc.ServiceDescriptor result = serviceDescriptor;
+ if (result == null) {
+ synchronized (UtilsGrpc.class) {
+ result = serviceDescriptor;
+ if (result == null) {
+ serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
+ .setSchemaDescriptor(new UtilsFileDescriptorSupplier())
+ .addMethod(getSignMessageWithPrivateKeyMethod())
+ .addMethod(getVerifyMessageMethod())
+ .build();
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/www/grpc/gen/java/pactus/utils/UtilsOuterClass.java b/www/grpc/gen/java/pactus/utils/UtilsOuterClass.java
new file mode 100644
index 000000000..8d84758e5
--- /dev/null
+++ b/www/grpc/gen/java/pactus/utils/UtilsOuterClass.java
@@ -0,0 +1,2927 @@
+// Generated by the protocol buffer compiler. DO NOT EDIT!
+// source: utils.proto
+
+package pactus.utils;
+
+public final class UtilsOuterClass {
+ private UtilsOuterClass() {}
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistryLite registry) {
+ }
+
+ public static void registerAllExtensions(
+ com.google.protobuf.ExtensionRegistry registry) {
+ registerAllExtensions(
+ (com.google.protobuf.ExtensionRegistryLite) registry);
+ }
+ public interface SignMessageWithPrivateKeyRequestOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:pactus.SignMessageWithPrivateKeyRequest)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ *
+ * The private key to sign the message.
+ *
+ *
+ * string private_key = 1 [json_name = "privateKey"];
+ * @return The privateKey.
+ */
+ java.lang.String getPrivateKey();
+ /**
+ *
+ * The private key to sign the message.
+ *
+ *
+ * string private_key = 1 [json_name = "privateKey"];
+ * @return The bytes for privateKey.
+ */
+ com.google.protobuf.ByteString
+ getPrivateKeyBytes();
+
+ /**
+ *
+ * The message to sign.
+ *
+ *
+ * string message = 2 [json_name = "message"];
+ * @return The message.
+ */
+ java.lang.String getMessage();
+ /**
+ *
+ * The message to sign.
+ *
+ *
+ * string message = 2 [json_name = "message"];
+ * @return The bytes for message.
+ */
+ com.google.protobuf.ByteString
+ getMessageBytes();
+ }
+ /**
+ *
+ * Request message for sign message with private key.
+ *
+ *
+ * Protobuf type {@code pactus.SignMessageWithPrivateKeyRequest}
+ */
+ public static final class SignMessageWithPrivateKeyRequest extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:pactus.SignMessageWithPrivateKeyRequest)
+ SignMessageWithPrivateKeyRequestOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use SignMessageWithPrivateKeyRequest.newBuilder() to construct.
+ private SignMessageWithPrivateKeyRequest(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+ private SignMessageWithPrivateKeyRequest() {
+ privateKey_ = "";
+ message_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new SignMessageWithPrivateKeyRequest();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_SignMessageWithPrivateKeyRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_SignMessageWithPrivateKeyRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest.class, pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest.Builder.class);
+ }
+
+ public static final int PRIVATE_KEY_FIELD_NUMBER = 1;
+ private volatile java.lang.Object privateKey_;
+ /**
+ *
+ * The private key to sign the message.
+ *
+ *
+ * string private_key = 1 [json_name = "privateKey"];
+ * @return The privateKey.
+ */
+ @java.lang.Override
+ public java.lang.String getPrivateKey() {
+ java.lang.Object ref = privateKey_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ privateKey_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ * The private key to sign the message.
+ *
+ *
+ * string private_key = 1 [json_name = "privateKey"];
+ * @return The bytes for privateKey.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getPrivateKeyBytes() {
+ java.lang.Object ref = privateKey_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ privateKey_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int MESSAGE_FIELD_NUMBER = 2;
+ private volatile java.lang.Object message_;
+ /**
+ *
+ * The message to sign.
+ *
+ *
+ * string message = 2 [json_name = "message"];
+ * @return The message.
+ */
+ @java.lang.Override
+ public java.lang.String getMessage() {
+ java.lang.Object ref = message_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ * The message to sign.
+ *
+ *
+ * string message = 2 [json_name = "message"];
+ * @return The bytes for message.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ java.lang.Object ref = message_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(privateKey_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, privateKey_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 2, message_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(privateKey_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, privateKey_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, message_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest)) {
+ return super.equals(obj);
+ }
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest other = (pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest) obj;
+
+ if (!getPrivateKey()
+ .equals(other.getPrivateKey())) return false;
+ if (!getMessage()
+ .equals(other.getMessage())) return false;
+ if (!getUnknownFields().equals(other.getUnknownFields())) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + PRIVATE_KEY_FIELD_NUMBER;
+ hash = (53 * hash) + getPrivateKey().hashCode();
+ hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
+ hash = (53 * hash) + getMessage().hashCode();
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ *
+ * Request message for sign message with private key.
+ *
+ *
+ * Protobuf type {@code pactus.SignMessageWithPrivateKeyRequest}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder implements
+ // @@protoc_insertion_point(builder_implements:pactus.SignMessageWithPrivateKeyRequest)
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequestOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_SignMessageWithPrivateKeyRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_SignMessageWithPrivateKeyRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest.class, pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest.Builder.class);
+ }
+
+ // Construct using pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest.newBuilder()
+ private Builder() {
+
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ privateKey_ = "";
+
+ message_ = "";
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_SignMessageWithPrivateKeyRequest_descriptor;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest getDefaultInstanceForType() {
+ return pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest build() {
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest buildPartial() {
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest result = new pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest(this);
+ result.privateKey_ = privateKey_;
+ result.message_ = message_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest) {
+ return mergeFrom((pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest other) {
+ if (other == pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest.getDefaultInstance()) return this;
+ if (!other.getPrivateKey().isEmpty()) {
+ privateKey_ = other.privateKey_;
+ onChanged();
+ }
+ if (!other.getMessage().isEmpty()) {
+ message_ = other.message_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ privateKey_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 10
+ case 18: {
+ message_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 18
+ default: {
+ if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+ done = true; // was an endgroup tag
+ }
+ break;
+ } // default:
+ } // switch (tag)
+ } // while (!done)
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.unwrapIOException();
+ } finally {
+ onChanged();
+ } // finally
+ return this;
+ }
+
+ private java.lang.Object privateKey_ = "";
+ /**
+ *
+ * The private key to sign the message.
+ *
+ *
+ * string private_key = 1 [json_name = "privateKey"];
+ * @return The privateKey.
+ */
+ public java.lang.String getPrivateKey() {
+ java.lang.Object ref = privateKey_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ privateKey_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ * The private key to sign the message.
+ *
+ *
+ * string private_key = 1 [json_name = "privateKey"];
+ * @return The bytes for privateKey.
+ */
+ public com.google.protobuf.ByteString
+ getPrivateKeyBytes() {
+ java.lang.Object ref = privateKey_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ privateKey_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ * The private key to sign the message.
+ *
+ *
+ * string private_key = 1 [json_name = "privateKey"];
+ * @param value The privateKey to set.
+ * @return This builder for chaining.
+ */
+ public Builder setPrivateKey(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ privateKey_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The private key to sign the message.
+ *
+ *
+ * string private_key = 1 [json_name = "privateKey"];
+ * @return This builder for chaining.
+ */
+ public Builder clearPrivateKey() {
+
+ privateKey_ = getDefaultInstance().getPrivateKey();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The private key to sign the message.
+ *
+ *
+ * string private_key = 1 [json_name = "privateKey"];
+ * @param value The bytes for privateKey to set.
+ * @return This builder for chaining.
+ */
+ public Builder setPrivateKeyBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ privateKey_ = value;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object message_ = "";
+ /**
+ *
+ * The message to sign.
+ *
+ *
+ * string message = 2 [json_name = "message"];
+ * @return The message.
+ */
+ public java.lang.String getMessage() {
+ java.lang.Object ref = message_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ * The message to sign.
+ *
+ *
+ * string message = 2 [json_name = "message"];
+ * @return The bytes for message.
+ */
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ java.lang.Object ref = message_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ * The message to sign.
+ *
+ *
+ * string message = 2 [json_name = "message"];
+ * @param value The message to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMessage(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The message to sign.
+ *
+ *
+ * string message = 2 [json_name = "message"];
+ * @return This builder for chaining.
+ */
+ public Builder clearMessage() {
+
+ message_ = getDefaultInstance().getMessage();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The message to sign.
+ *
+ *
+ * string message = 2 [json_name = "message"];
+ * @param value The bytes for message to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMessageBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:pactus.SignMessageWithPrivateKeyRequest)
+ }
+
+ // @@protoc_insertion_point(class_scope:pactus.SignMessageWithPrivateKeyRequest)
+ private static final pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest();
+ }
+
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser
+ PARSER = new com.google.protobuf.AbstractParser() {
+ @java.lang.Override
+ public SignMessageWithPrivateKeyRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ Builder builder = newBuilder();
+ try {
+ builder.mergeFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(builder.buildPartial());
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(e)
+ .setUnfinishedMessage(builder.buildPartial());
+ }
+ return builder.buildPartial();
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyRequest getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+ }
+
+ public interface SignMessageWithPrivateKeyResponseOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:pactus.SignMessageWithPrivateKeyResponse)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The signature.
+ */
+ java.lang.String getSignature();
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The bytes for signature.
+ */
+ com.google.protobuf.ByteString
+ getSignatureBytes();
+ }
+ /**
+ *
+ * Response message containing the generated signature.
+ *
+ *
+ * Protobuf type {@code pactus.SignMessageWithPrivateKeyResponse}
+ */
+ public static final class SignMessageWithPrivateKeyResponse extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:pactus.SignMessageWithPrivateKeyResponse)
+ SignMessageWithPrivateKeyResponseOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use SignMessageWithPrivateKeyResponse.newBuilder() to construct.
+ private SignMessageWithPrivateKeyResponse(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+ private SignMessageWithPrivateKeyResponse() {
+ signature_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new SignMessageWithPrivateKeyResponse();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_SignMessageWithPrivateKeyResponse_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_SignMessageWithPrivateKeyResponse_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse.class, pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse.Builder.class);
+ }
+
+ public static final int SIGNATURE_FIELD_NUMBER = 1;
+ private volatile java.lang.Object signature_;
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The signature.
+ */
+ @java.lang.Override
+ public java.lang.String getSignature() {
+ java.lang.Object ref = signature_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ signature_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The bytes for signature.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getSignatureBytes() {
+ java.lang.Object ref = signature_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ signature_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(signature_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, signature_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(signature_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, signature_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse)) {
+ return super.equals(obj);
+ }
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse other = (pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse) obj;
+
+ if (!getSignature()
+ .equals(other.getSignature())) return false;
+ if (!getUnknownFields().equals(other.getUnknownFields())) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + SIGNATURE_FIELD_NUMBER;
+ hash = (53 * hash) + getSignature().hashCode();
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ *
+ * Response message containing the generated signature.
+ *
+ *
+ * Protobuf type {@code pactus.SignMessageWithPrivateKeyResponse}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder implements
+ // @@protoc_insertion_point(builder_implements:pactus.SignMessageWithPrivateKeyResponse)
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponseOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_SignMessageWithPrivateKeyResponse_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_SignMessageWithPrivateKeyResponse_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse.class, pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse.Builder.class);
+ }
+
+ // Construct using pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse.newBuilder()
+ private Builder() {
+
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ signature_ = "";
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_SignMessageWithPrivateKeyResponse_descriptor;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse getDefaultInstanceForType() {
+ return pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse build() {
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse buildPartial() {
+ pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse result = new pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse(this);
+ result.signature_ = signature_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse) {
+ return mergeFrom((pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse other) {
+ if (other == pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse.getDefaultInstance()) return this;
+ if (!other.getSignature().isEmpty()) {
+ signature_ = other.signature_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ signature_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 10
+ default: {
+ if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+ done = true; // was an endgroup tag
+ }
+ break;
+ } // default:
+ } // switch (tag)
+ } // while (!done)
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.unwrapIOException();
+ } finally {
+ onChanged();
+ } // finally
+ return this;
+ }
+
+ private java.lang.Object signature_ = "";
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The signature.
+ */
+ public java.lang.String getSignature() {
+ java.lang.Object ref = signature_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ signature_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The bytes for signature.
+ */
+ public com.google.protobuf.ByteString
+ getSignatureBytes() {
+ java.lang.Object ref = signature_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ signature_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @param value The signature to set.
+ * @return This builder for chaining.
+ */
+ public Builder setSignature(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ signature_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return This builder for chaining.
+ */
+ public Builder clearSignature() {
+
+ signature_ = getDefaultInstance().getSignature();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @param value The bytes for signature to set.
+ * @return This builder for chaining.
+ */
+ public Builder setSignatureBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ signature_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:pactus.SignMessageWithPrivateKeyResponse)
+ }
+
+ // @@protoc_insertion_point(class_scope:pactus.SignMessageWithPrivateKeyResponse)
+ private static final pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse();
+ }
+
+ public static pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser
+ PARSER = new com.google.protobuf.AbstractParser() {
+ @java.lang.Override
+ public SignMessageWithPrivateKeyResponse parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ Builder builder = newBuilder();
+ try {
+ builder.mergeFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(builder.buildPartial());
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(e)
+ .setUnfinishedMessage(builder.buildPartial());
+ }
+ return builder.buildPartial();
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.SignMessageWithPrivateKeyResponse getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+ }
+
+ public interface VerifyMessageRequestOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:pactus.VerifyMessageRequest)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ *
+ * The signed message.
+ *
+ *
+ * string message = 1 [json_name = "message"];
+ * @return The message.
+ */
+ java.lang.String getMessage();
+ /**
+ *
+ * The signed message.
+ *
+ *
+ * string message = 1 [json_name = "message"];
+ * @return The bytes for message.
+ */
+ com.google.protobuf.ByteString
+ getMessageBytes();
+
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 2 [json_name = "signature"];
+ * @return The signature.
+ */
+ java.lang.String getSignature();
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 2 [json_name = "signature"];
+ * @return The bytes for signature.
+ */
+ com.google.protobuf.ByteString
+ getSignatureBytes();
+
+ /**
+ *
+ * The public key of the signer.
+ *
+ *
+ * string public_key = 3 [json_name = "publicKey"];
+ * @return The publicKey.
+ */
+ java.lang.String getPublicKey();
+ /**
+ *
+ * The public key of the signer.
+ *
+ *
+ * string public_key = 3 [json_name = "publicKey"];
+ * @return The bytes for publicKey.
+ */
+ com.google.protobuf.ByteString
+ getPublicKeyBytes();
+ }
+ /**
+ *
+ * Request message for verifying a message signature.
+ *
+ *
+ * Protobuf type {@code pactus.VerifyMessageRequest}
+ */
+ public static final class VerifyMessageRequest extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:pactus.VerifyMessageRequest)
+ VerifyMessageRequestOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use VerifyMessageRequest.newBuilder() to construct.
+ private VerifyMessageRequest(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+ private VerifyMessageRequest() {
+ message_ = "";
+ signature_ = "";
+ publicKey_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new VerifyMessageRequest();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_VerifyMessageRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_VerifyMessageRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.utils.UtilsOuterClass.VerifyMessageRequest.class, pactus.utils.UtilsOuterClass.VerifyMessageRequest.Builder.class);
+ }
+
+ public static final int MESSAGE_FIELD_NUMBER = 1;
+ private volatile java.lang.Object message_;
+ /**
+ *
+ * The signed message.
+ *
+ *
+ * string message = 1 [json_name = "message"];
+ * @return The message.
+ */
+ @java.lang.Override
+ public java.lang.String getMessage() {
+ java.lang.Object ref = message_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ * The signed message.
+ *
+ *
+ * string message = 1 [json_name = "message"];
+ * @return The bytes for message.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ java.lang.Object ref = message_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int SIGNATURE_FIELD_NUMBER = 2;
+ private volatile java.lang.Object signature_;
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 2 [json_name = "signature"];
+ * @return The signature.
+ */
+ @java.lang.Override
+ public java.lang.String getSignature() {
+ java.lang.Object ref = signature_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ signature_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 2 [json_name = "signature"];
+ * @return The bytes for signature.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getSignatureBytes() {
+ java.lang.Object ref = signature_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ signature_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int PUBLIC_KEY_FIELD_NUMBER = 3;
+ private volatile java.lang.Object publicKey_;
+ /**
+ *
+ * The public key of the signer.
+ *
+ *
+ * string public_key = 3 [json_name = "publicKey"];
+ * @return The publicKey.
+ */
+ @java.lang.Override
+ public java.lang.String getPublicKey() {
+ java.lang.Object ref = publicKey_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ publicKey_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ * The public key of the signer.
+ *
+ *
+ * string public_key = 3 [json_name = "publicKey"];
+ * @return The bytes for publicKey.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getPublicKeyBytes() {
+ java.lang.Object ref = publicKey_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ publicKey_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, message_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(signature_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 2, signature_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(publicKey_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 3, publicKey_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, message_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(signature_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, signature_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(publicKey_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, publicKey_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof pactus.utils.UtilsOuterClass.VerifyMessageRequest)) {
+ return super.equals(obj);
+ }
+ pactus.utils.UtilsOuterClass.VerifyMessageRequest other = (pactus.utils.UtilsOuterClass.VerifyMessageRequest) obj;
+
+ if (!getMessage()
+ .equals(other.getMessage())) return false;
+ if (!getSignature()
+ .equals(other.getSignature())) return false;
+ if (!getPublicKey()
+ .equals(other.getPublicKey())) return false;
+ if (!getUnknownFields().equals(other.getUnknownFields())) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
+ hash = (53 * hash) + getMessage().hashCode();
+ hash = (37 * hash) + SIGNATURE_FIELD_NUMBER;
+ hash = (53 * hash) + getSignature().hashCode();
+ hash = (37 * hash) + PUBLIC_KEY_FIELD_NUMBER;
+ hash = (53 * hash) + getPublicKey().hashCode();
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(pactus.utils.UtilsOuterClass.VerifyMessageRequest prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ *
+ * Request message for verifying a message signature.
+ *
+ *
+ * Protobuf type {@code pactus.VerifyMessageRequest}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder implements
+ // @@protoc_insertion_point(builder_implements:pactus.VerifyMessageRequest)
+ pactus.utils.UtilsOuterClass.VerifyMessageRequestOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_VerifyMessageRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_VerifyMessageRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.utils.UtilsOuterClass.VerifyMessageRequest.class, pactus.utils.UtilsOuterClass.VerifyMessageRequest.Builder.class);
+ }
+
+ // Construct using pactus.utils.UtilsOuterClass.VerifyMessageRequest.newBuilder()
+ private Builder() {
+
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ message_ = "";
+
+ signature_ = "";
+
+ publicKey_ = "";
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_VerifyMessageRequest_descriptor;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.VerifyMessageRequest getDefaultInstanceForType() {
+ return pactus.utils.UtilsOuterClass.VerifyMessageRequest.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.VerifyMessageRequest build() {
+ pactus.utils.UtilsOuterClass.VerifyMessageRequest result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.VerifyMessageRequest buildPartial() {
+ pactus.utils.UtilsOuterClass.VerifyMessageRequest result = new pactus.utils.UtilsOuterClass.VerifyMessageRequest(this);
+ result.message_ = message_;
+ result.signature_ = signature_;
+ result.publicKey_ = publicKey_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof pactus.utils.UtilsOuterClass.VerifyMessageRequest) {
+ return mergeFrom((pactus.utils.UtilsOuterClass.VerifyMessageRequest)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(pactus.utils.UtilsOuterClass.VerifyMessageRequest other) {
+ if (other == pactus.utils.UtilsOuterClass.VerifyMessageRequest.getDefaultInstance()) return this;
+ if (!other.getMessage().isEmpty()) {
+ message_ = other.message_;
+ onChanged();
+ }
+ if (!other.getSignature().isEmpty()) {
+ signature_ = other.signature_;
+ onChanged();
+ }
+ if (!other.getPublicKey().isEmpty()) {
+ publicKey_ = other.publicKey_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ message_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 10
+ case 18: {
+ signature_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 18
+ case 26: {
+ publicKey_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 26
+ default: {
+ if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+ done = true; // was an endgroup tag
+ }
+ break;
+ } // default:
+ } // switch (tag)
+ } // while (!done)
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.unwrapIOException();
+ } finally {
+ onChanged();
+ } // finally
+ return this;
+ }
+
+ private java.lang.Object message_ = "";
+ /**
+ *
+ * The signed message.
+ *
+ *
+ * string message = 1 [json_name = "message"];
+ * @return The message.
+ */
+ public java.lang.String getMessage() {
+ java.lang.Object ref = message_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ * The signed message.
+ *
+ *
+ * string message = 1 [json_name = "message"];
+ * @return The bytes for message.
+ */
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ java.lang.Object ref = message_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ * The signed message.
+ *
+ *
+ * string message = 1 [json_name = "message"];
+ * @param value The message to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMessage(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The signed message.
+ *
+ *
+ * string message = 1 [json_name = "message"];
+ * @return This builder for chaining.
+ */
+ public Builder clearMessage() {
+
+ message_ = getDefaultInstance().getMessage();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The signed message.
+ *
+ *
+ * string message = 1 [json_name = "message"];
+ * @param value The bytes for message to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMessageBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object signature_ = "";
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 2 [json_name = "signature"];
+ * @return The signature.
+ */
+ public java.lang.String getSignature() {
+ java.lang.Object ref = signature_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ signature_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 2 [json_name = "signature"];
+ * @return The bytes for signature.
+ */
+ public com.google.protobuf.ByteString
+ getSignatureBytes() {
+ java.lang.Object ref = signature_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ signature_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 2 [json_name = "signature"];
+ * @param value The signature to set.
+ * @return This builder for chaining.
+ */
+ public Builder setSignature(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ signature_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 2 [json_name = "signature"];
+ * @return This builder for chaining.
+ */
+ public Builder clearSignature() {
+
+ signature_ = getDefaultInstance().getSignature();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The signature of the message.
+ *
+ *
+ * string signature = 2 [json_name = "signature"];
+ * @param value The bytes for signature to set.
+ * @return This builder for chaining.
+ */
+ public Builder setSignatureBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ signature_ = value;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object publicKey_ = "";
+ /**
+ *
+ * The public key of the signer.
+ *
+ *
+ * string public_key = 3 [json_name = "publicKey"];
+ * @return The publicKey.
+ */
+ public java.lang.String getPublicKey() {
+ java.lang.Object ref = publicKey_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ publicKey_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ * The public key of the signer.
+ *
+ *
+ * string public_key = 3 [json_name = "publicKey"];
+ * @return The bytes for publicKey.
+ */
+ public com.google.protobuf.ByteString
+ getPublicKeyBytes() {
+ java.lang.Object ref = publicKey_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ publicKey_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ * The public key of the signer.
+ *
+ *
+ * string public_key = 3 [json_name = "publicKey"];
+ * @param value The publicKey to set.
+ * @return This builder for chaining.
+ */
+ public Builder setPublicKey(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ publicKey_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The public key of the signer.
+ *
+ *
+ * string public_key = 3 [json_name = "publicKey"];
+ * @return This builder for chaining.
+ */
+ public Builder clearPublicKey() {
+
+ publicKey_ = getDefaultInstance().getPublicKey();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The public key of the signer.
+ *
+ *
+ * string public_key = 3 [json_name = "publicKey"];
+ * @param value The bytes for publicKey to set.
+ * @return This builder for chaining.
+ */
+ public Builder setPublicKeyBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ publicKey_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:pactus.VerifyMessageRequest)
+ }
+
+ // @@protoc_insertion_point(class_scope:pactus.VerifyMessageRequest)
+ private static final pactus.utils.UtilsOuterClass.VerifyMessageRequest DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new pactus.utils.UtilsOuterClass.VerifyMessageRequest();
+ }
+
+ public static pactus.utils.UtilsOuterClass.VerifyMessageRequest getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser
+ PARSER = new com.google.protobuf.AbstractParser() {
+ @java.lang.Override
+ public VerifyMessageRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ Builder builder = newBuilder();
+ try {
+ builder.mergeFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(builder.buildPartial());
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(e)
+ .setUnfinishedMessage(builder.buildPartial());
+ }
+ return builder.buildPartial();
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.VerifyMessageRequest getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+ }
+
+ public interface VerifyMessageResponseOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:pactus.VerifyMessageResponse)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ *
+ * Indicates if the signature is valid (true) or not (false).
+ *
+ *
+ * bool is_valid = 1 [json_name = "isValid"];
+ * @return The isValid.
+ */
+ boolean getIsValid();
+ }
+ /**
+ *
+ * Response message containing the resualt of validation of signature and message.
+ *
+ *
+ * Protobuf type {@code pactus.VerifyMessageResponse}
+ */
+ public static final class VerifyMessageResponse extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:pactus.VerifyMessageResponse)
+ VerifyMessageResponseOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use VerifyMessageResponse.newBuilder() to construct.
+ private VerifyMessageResponse(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+ private VerifyMessageResponse() {
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new VerifyMessageResponse();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_VerifyMessageResponse_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_VerifyMessageResponse_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.utils.UtilsOuterClass.VerifyMessageResponse.class, pactus.utils.UtilsOuterClass.VerifyMessageResponse.Builder.class);
+ }
+
+ public static final int IS_VALID_FIELD_NUMBER = 1;
+ private boolean isValid_;
+ /**
+ *
+ * Indicates if the signature is valid (true) or not (false).
+ *
+ *
+ * bool is_valid = 1 [json_name = "isValid"];
+ * @return The isValid.
+ */
+ @java.lang.Override
+ public boolean getIsValid() {
+ return isValid_;
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (isValid_ != false) {
+ output.writeBool(1, isValid_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (isValid_ != false) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBoolSize(1, isValid_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof pactus.utils.UtilsOuterClass.VerifyMessageResponse)) {
+ return super.equals(obj);
+ }
+ pactus.utils.UtilsOuterClass.VerifyMessageResponse other = (pactus.utils.UtilsOuterClass.VerifyMessageResponse) obj;
+
+ if (getIsValid()
+ != other.getIsValid()) return false;
+ if (!getUnknownFields().equals(other.getUnknownFields())) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + IS_VALID_FIELD_NUMBER;
+ hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
+ getIsValid());
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(pactus.utils.UtilsOuterClass.VerifyMessageResponse prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ *
+ * Response message containing the resualt of validation of signature and message.
+ *
+ *
+ * Protobuf type {@code pactus.VerifyMessageResponse}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder implements
+ // @@protoc_insertion_point(builder_implements:pactus.VerifyMessageResponse)
+ pactus.utils.UtilsOuterClass.VerifyMessageResponseOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_VerifyMessageResponse_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_VerifyMessageResponse_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.utils.UtilsOuterClass.VerifyMessageResponse.class, pactus.utils.UtilsOuterClass.VerifyMessageResponse.Builder.class);
+ }
+
+ // Construct using pactus.utils.UtilsOuterClass.VerifyMessageResponse.newBuilder()
+ private Builder() {
+
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ isValid_ = false;
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return pactus.utils.UtilsOuterClass.internal_static_pactus_VerifyMessageResponse_descriptor;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.VerifyMessageResponse getDefaultInstanceForType() {
+ return pactus.utils.UtilsOuterClass.VerifyMessageResponse.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.VerifyMessageResponse build() {
+ pactus.utils.UtilsOuterClass.VerifyMessageResponse result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.VerifyMessageResponse buildPartial() {
+ pactus.utils.UtilsOuterClass.VerifyMessageResponse result = new pactus.utils.UtilsOuterClass.VerifyMessageResponse(this);
+ result.isValid_ = isValid_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof pactus.utils.UtilsOuterClass.VerifyMessageResponse) {
+ return mergeFrom((pactus.utils.UtilsOuterClass.VerifyMessageResponse)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(pactus.utils.UtilsOuterClass.VerifyMessageResponse other) {
+ if (other == pactus.utils.UtilsOuterClass.VerifyMessageResponse.getDefaultInstance()) return this;
+ if (other.getIsValid() != false) {
+ setIsValid(other.getIsValid());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 8: {
+ isValid_ = input.readBool();
+
+ break;
+ } // case 8
+ default: {
+ if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+ done = true; // was an endgroup tag
+ }
+ break;
+ } // default:
+ } // switch (tag)
+ } // while (!done)
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.unwrapIOException();
+ } finally {
+ onChanged();
+ } // finally
+ return this;
+ }
+
+ private boolean isValid_ ;
+ /**
+ *
+ * Indicates if the signature is valid (true) or not (false).
+ *
+ *
+ * bool is_valid = 1 [json_name = "isValid"];
+ * @return The isValid.
+ */
+ @java.lang.Override
+ public boolean getIsValid() {
+ return isValid_;
+ }
+ /**
+ *
+ * Indicates if the signature is valid (true) or not (false).
+ *
+ *
+ * bool is_valid = 1 [json_name = "isValid"];
+ * @param value The isValid to set.
+ * @return This builder for chaining.
+ */
+ public Builder setIsValid(boolean value) {
+
+ isValid_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * Indicates if the signature is valid (true) or not (false).
+ *
+ *
+ * bool is_valid = 1 [json_name = "isValid"];
+ * @return This builder for chaining.
+ */
+ public Builder clearIsValid() {
+
+ isValid_ = false;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:pactus.VerifyMessageResponse)
+ }
+
+ // @@protoc_insertion_point(class_scope:pactus.VerifyMessageResponse)
+ private static final pactus.utils.UtilsOuterClass.VerifyMessageResponse DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new pactus.utils.UtilsOuterClass.VerifyMessageResponse();
+ }
+
+ public static pactus.utils.UtilsOuterClass.VerifyMessageResponse getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser
+ PARSER = new com.google.protobuf.AbstractParser() {
+ @java.lang.Override
+ public VerifyMessageResponse parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ Builder builder = newBuilder();
+ try {
+ builder.mergeFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(builder.buildPartial());
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(e)
+ .setUnfinishedMessage(builder.buildPartial());
+ }
+ return builder.buildPartial();
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public pactus.utils.UtilsOuterClass.VerifyMessageResponse getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+ }
+
+ private static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_pactus_SignMessageWithPrivateKeyRequest_descriptor;
+ private static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_pactus_SignMessageWithPrivateKeyRequest_fieldAccessorTable;
+ private static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_pactus_SignMessageWithPrivateKeyResponse_descriptor;
+ private static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_pactus_SignMessageWithPrivateKeyResponse_fieldAccessorTable;
+ private static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_pactus_VerifyMessageRequest_descriptor;
+ private static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_pactus_VerifyMessageRequest_fieldAccessorTable;
+ private static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_pactus_VerifyMessageResponse_descriptor;
+ private static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_pactus_VerifyMessageResponse_fieldAccessorTable;
+
+ public static com.google.protobuf.Descriptors.FileDescriptor
+ getDescriptor() {
+ return descriptor;
+ }
+ private static com.google.protobuf.Descriptors.FileDescriptor
+ descriptor;
+ static {
+ java.lang.String[] descriptorData = {
+ "\n\013utils.proto\022\006pactus\"]\n SignMessageWith" +
+ "PrivateKeyRequest\022\037\n\013private_key\030\001 \001(\tR\n" +
+ "privateKey\022\030\n\007message\030\002 \001(\tR\007message\"A\n!" +
+ "SignMessageWithPrivateKeyResponse\022\034\n\tsig" +
+ "nature\030\001 \001(\tR\tsignature\"m\n\024VerifyMessage" +
+ "Request\022\030\n\007message\030\001 \001(\tR\007message\022\034\n\tsig" +
+ "nature\030\002 \001(\tR\tsignature\022\035\n\npublic_key\030\003 " +
+ "\001(\tR\tpublicKey\"2\n\025VerifyMessageResponse\022" +
+ "\031\n\010is_valid\030\001 \001(\010R\007isValid2\307\001\n\005Utils\022p\n\031" +
+ "SignMessageWithPrivateKey\022(.pactus.SignM" +
+ "essageWithPrivateKeyRequest\032).pactus.Sig" +
+ "nMessageWithPrivateKeyResponse\022L\n\rVerify" +
+ "Message\022\034.pactus.VerifyMessageRequest\032\035." +
+ "pactus.VerifyMessageResponseB@\n\014pactus.u" +
+ "tilsZ0github.com/pactus-project/pactus/w" +
+ "ww/grpc/pactusb\006proto3"
+ };
+ descriptor = com.google.protobuf.Descriptors.FileDescriptor
+ .internalBuildGeneratedFileFrom(descriptorData,
+ new com.google.protobuf.Descriptors.FileDescriptor[] {
+ });
+ internal_static_pactus_SignMessageWithPrivateKeyRequest_descriptor =
+ getDescriptor().getMessageTypes().get(0);
+ internal_static_pactus_SignMessageWithPrivateKeyRequest_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_pactus_SignMessageWithPrivateKeyRequest_descriptor,
+ new java.lang.String[] { "PrivateKey", "Message", });
+ internal_static_pactus_SignMessageWithPrivateKeyResponse_descriptor =
+ getDescriptor().getMessageTypes().get(1);
+ internal_static_pactus_SignMessageWithPrivateKeyResponse_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_pactus_SignMessageWithPrivateKeyResponse_descriptor,
+ new java.lang.String[] { "Signature", });
+ internal_static_pactus_VerifyMessageRequest_descriptor =
+ getDescriptor().getMessageTypes().get(2);
+ internal_static_pactus_VerifyMessageRequest_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_pactus_VerifyMessageRequest_descriptor,
+ new java.lang.String[] { "Message", "Signature", "PublicKey", });
+ internal_static_pactus_VerifyMessageResponse_descriptor =
+ getDescriptor().getMessageTypes().get(3);
+ internal_static_pactus_VerifyMessageResponse_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_pactus_VerifyMessageResponse_descriptor,
+ new java.lang.String[] { "IsValid", });
+ }
+
+ // @@protoc_insertion_point(outer_class_scope)
+}
diff --git a/www/grpc/gen/java/pactus/wallet/WalletGrpc.java b/www/grpc/gen/java/pactus/wallet/WalletGrpc.java
index 1a9f9b571..806e827e8 100644
--- a/www/grpc/gen/java/pactus/wallet/WalletGrpc.java
+++ b/www/grpc/gen/java/pactus/wallet/WalletGrpc.java
@@ -297,6 +297,37 @@ pactus.wallet.WalletOuterClass.GetAddressHistoryResponse> getGetAddressHistoryMe
return getGetAddressHistoryMethod;
}
+ private static volatile io.grpc.MethodDescriptor getSignMessageMethod;
+
+ @io.grpc.stub.annotations.RpcMethod(
+ fullMethodName = SERVICE_NAME + '/' + "SignMessage",
+ requestType = pactus.wallet.WalletOuterClass.SignMessageRequest.class,
+ responseType = pactus.wallet.WalletOuterClass.SignMessageResponse.class,
+ methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
+ public static io.grpc.MethodDescriptor getSignMessageMethod() {
+ io.grpc.MethodDescriptor getSignMessageMethod;
+ if ((getSignMessageMethod = WalletGrpc.getSignMessageMethod) == null) {
+ synchronized (WalletGrpc.class) {
+ if ((getSignMessageMethod = WalletGrpc.getSignMessageMethod) == null) {
+ WalletGrpc.getSignMessageMethod = getSignMessageMethod =
+ io.grpc.MethodDescriptor.newBuilder()
+ .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SignMessage"))
+ .setSampledToLocalTracing(true)
+ .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ pactus.wallet.WalletOuterClass.SignMessageRequest.getDefaultInstance()))
+ .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
+ pactus.wallet.WalletOuterClass.SignMessageResponse.getDefaultInstance()))
+ .setSchemaDescriptor(new WalletMethodDescriptorSupplier("SignMessage"))
+ .build();
+ }
+ }
+ }
+ return getSignMessageMethod;
+ }
+
/**
* Creates a new async stub that supports all call types for the service
*/
@@ -439,6 +470,16 @@ public void getAddressHistory(pactus.wallet.WalletOuterClass.GetAddressHistoryRe
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetAddressHistoryMethod(), responseObserver);
}
+ /**
+ *
+ * SignMessage signs an arbitrary message.
+ *
+ */
+ public void signMessage(pactus.wallet.WalletOuterClass.SignMessageRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSignMessageMethod(), responseObserver);
+ }
+
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
@@ -504,6 +545,13 @@ public void getAddressHistory(pactus.wallet.WalletOuterClass.GetAddressHistoryRe
pactus.wallet.WalletOuterClass.GetAddressHistoryRequest,
pactus.wallet.WalletOuterClass.GetAddressHistoryResponse>(
this, METHODID_GET_ADDRESS_HISTORY)))
+ .addMethod(
+ getSignMessageMethod(),
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
+ new MethodHandlers<
+ pactus.wallet.WalletOuterClass.SignMessageRequest,
+ pactus.wallet.WalletOuterClass.SignMessageResponse>(
+ this, METHODID_SIGN_MESSAGE)))
.build();
}
}
@@ -624,6 +672,17 @@ public void getAddressHistory(pactus.wallet.WalletOuterClass.GetAddressHistoryRe
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getGetAddressHistoryMethod(), getCallOptions()), request, responseObserver);
}
+
+ /**
+ *
+ * SignMessage signs an arbitrary message.
+ *
+ */
+ public void signMessage(pactus.wallet.WalletOuterClass.SignMessageRequest request,
+ io.grpc.stub.StreamObserver responseObserver) {
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
+ getChannel().newCall(getSignMessageMethod(), getCallOptions()), request, responseObserver);
+ }
}
/**
@@ -733,6 +792,16 @@ public pactus.wallet.WalletOuterClass.GetAddressHistoryResponse getAddressHistor
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getGetAddressHistoryMethod(), getCallOptions(), request);
}
+
+ /**
+ *
+ * SignMessage signs an arbitrary message.
+ *
+ */
+ public pactus.wallet.WalletOuterClass.SignMessageResponse signMessage(pactus.wallet.WalletOuterClass.SignMessageRequest request) {
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
+ getChannel(), getSignMessageMethod(), getCallOptions(), request);
+ }
}
/**
@@ -851,6 +920,17 @@ public com.google.common.util.concurrent.ListenableFuture
+ * SignMessage signs an arbitrary message.
+ *
+ */
+ public com.google.common.util.concurrent.ListenableFuture signMessage(
+ pactus.wallet.WalletOuterClass.SignMessageRequest request) {
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
+ getChannel().newCall(getSignMessageMethod(), getCallOptions()), request);
+ }
}
private static final int METHODID_CREATE_WALLET = 0;
@@ -862,6 +942,7 @@ public com.google.common.util.concurrent.ListenableFuture implements
io.grpc.stub.ServerCalls.UnaryMethod,
@@ -916,6 +997,10 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv
serviceImpl.getAddressHistory((pactus.wallet.WalletOuterClass.GetAddressHistoryRequest) request,
(io.grpc.stub.StreamObserver) responseObserver);
break;
+ case METHODID_SIGN_MESSAGE:
+ serviceImpl.signMessage((pactus.wallet.WalletOuterClass.SignMessageRequest) request,
+ (io.grpc.stub.StreamObserver) responseObserver);
+ break;
default:
throw new AssertionError();
}
@@ -986,6 +1071,7 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
.addMethod(getGetValidatorAddressMethod())
.addMethod(getGetNewAddressMethod())
.addMethod(getGetAddressHistoryMethod())
+ .addMethod(getSignMessageMethod())
.build();
}
}
diff --git a/www/grpc/gen/java/pactus/wallet/WalletOuterClass.java b/www/grpc/gen/java/pactus/wallet/WalletOuterClass.java
index 8cc257d87..57746fdb6 100644
--- a/www/grpc/gen/java/pactus/wallet/WalletOuterClass.java
+++ b/www/grpc/gen/java/pactus/wallet/WalletOuterClass.java
@@ -15377,6 +15377,1747 @@ public pactus.wallet.WalletOuterClass.GetTotalBalanceResponse getDefaultInstance
}
+ public interface SignMessageRequestOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:pactus.SignMessageRequest)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ *
+ * The name of the wallet.
+ *
+ *
+ * string wallet_name = 1 [json_name = "walletName"];
+ * @return The walletName.
+ */
+ java.lang.String getWalletName();
+ /**
+ *
+ * The name of the wallet.
+ *
+ *
+ * string wallet_name = 1 [json_name = "walletName"];
+ * @return The bytes for walletName.
+ */
+ com.google.protobuf.ByteString
+ getWalletNameBytes();
+
+ /**
+ *
+ * The password for unlocking the wallet for signing.
+ *
+ *
+ * string password = 2 [json_name = "password"];
+ * @return The password.
+ */
+ java.lang.String getPassword();
+ /**
+ *
+ * The password for unlocking the wallet for signing.
+ *
+ *
+ * string password = 2 [json_name = "password"];
+ * @return The bytes for password.
+ */
+ com.google.protobuf.ByteString
+ getPasswordBytes();
+
+ /**
+ *
+ * The account address associated with the private key.
+ *
+ *
+ * string address = 3 [json_name = "address"];
+ * @return The address.
+ */
+ java.lang.String getAddress();
+ /**
+ *
+ * The account address associated with the private key.
+ *
+ *
+ * string address = 3 [json_name = "address"];
+ * @return The bytes for address.
+ */
+ com.google.protobuf.ByteString
+ getAddressBytes();
+
+ /**
+ *
+ * The arbitrary message to be signed.
+ *
+ *
+ * string message = 4 [json_name = "message"];
+ * @return The message.
+ */
+ java.lang.String getMessage();
+ /**
+ *
+ * The arbitrary message to be signed.
+ *
+ *
+ * string message = 4 [json_name = "message"];
+ * @return The bytes for message.
+ */
+ com.google.protobuf.ByteString
+ getMessageBytes();
+ }
+ /**
+ *
+ * Request message to sign an arbitrary message.
+ *
+ *
+ * Protobuf type {@code pactus.SignMessageRequest}
+ */
+ public static final class SignMessageRequest extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:pactus.SignMessageRequest)
+ SignMessageRequestOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use SignMessageRequest.newBuilder() to construct.
+ private SignMessageRequest(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+ private SignMessageRequest() {
+ walletName_ = "";
+ password_ = "";
+ address_ = "";
+ message_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new SignMessageRequest();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.wallet.WalletOuterClass.internal_static_pactus_SignMessageRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.wallet.WalletOuterClass.internal_static_pactus_SignMessageRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.wallet.WalletOuterClass.SignMessageRequest.class, pactus.wallet.WalletOuterClass.SignMessageRequest.Builder.class);
+ }
+
+ public static final int WALLET_NAME_FIELD_NUMBER = 1;
+ private volatile java.lang.Object walletName_;
+ /**
+ *
+ * The name of the wallet.
+ *
+ *
+ * string wallet_name = 1 [json_name = "walletName"];
+ * @return The walletName.
+ */
+ @java.lang.Override
+ public java.lang.String getWalletName() {
+ java.lang.Object ref = walletName_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ walletName_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ * The name of the wallet.
+ *
+ *
+ * string wallet_name = 1 [json_name = "walletName"];
+ * @return The bytes for walletName.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getWalletNameBytes() {
+ java.lang.Object ref = walletName_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ walletName_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int PASSWORD_FIELD_NUMBER = 2;
+ private volatile java.lang.Object password_;
+ /**
+ *
+ * The password for unlocking the wallet for signing.
+ *
+ *
+ * string password = 2 [json_name = "password"];
+ * @return The password.
+ */
+ @java.lang.Override
+ public java.lang.String getPassword() {
+ java.lang.Object ref = password_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ password_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ * The password for unlocking the wallet for signing.
+ *
+ *
+ * string password = 2 [json_name = "password"];
+ * @return The bytes for password.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getPasswordBytes() {
+ java.lang.Object ref = password_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ password_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int ADDRESS_FIELD_NUMBER = 3;
+ private volatile java.lang.Object address_;
+ /**
+ *
+ * The account address associated with the private key.
+ *
+ *
+ * string address = 3 [json_name = "address"];
+ * @return The address.
+ */
+ @java.lang.Override
+ public java.lang.String getAddress() {
+ java.lang.Object ref = address_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ address_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ * The account address associated with the private key.
+ *
+ *
+ * string address = 3 [json_name = "address"];
+ * @return The bytes for address.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getAddressBytes() {
+ java.lang.Object ref = address_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ address_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ public static final int MESSAGE_FIELD_NUMBER = 4;
+ private volatile java.lang.Object message_;
+ /**
+ *
+ * The arbitrary message to be signed.
+ *
+ *
+ * string message = 4 [json_name = "message"];
+ * @return The message.
+ */
+ @java.lang.Override
+ public java.lang.String getMessage() {
+ java.lang.Object ref = message_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ * The arbitrary message to be signed.
+ *
+ *
+ * string message = 4 [json_name = "message"];
+ * @return The bytes for message.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ java.lang.Object ref = message_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(walletName_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, walletName_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(password_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 2, password_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(address_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 3, address_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 4, message_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(walletName_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, walletName_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(password_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, password_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(address_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, address_);
+ }
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(message_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, message_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof pactus.wallet.WalletOuterClass.SignMessageRequest)) {
+ return super.equals(obj);
+ }
+ pactus.wallet.WalletOuterClass.SignMessageRequest other = (pactus.wallet.WalletOuterClass.SignMessageRequest) obj;
+
+ if (!getWalletName()
+ .equals(other.getWalletName())) return false;
+ if (!getPassword()
+ .equals(other.getPassword())) return false;
+ if (!getAddress()
+ .equals(other.getAddress())) return false;
+ if (!getMessage()
+ .equals(other.getMessage())) return false;
+ if (!getUnknownFields().equals(other.getUnknownFields())) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + WALLET_NAME_FIELD_NUMBER;
+ hash = (53 * hash) + getWalletName().hashCode();
+ hash = (37 * hash) + PASSWORD_FIELD_NUMBER;
+ hash = (53 * hash) + getPassword().hashCode();
+ hash = (37 * hash) + ADDRESS_FIELD_NUMBER;
+ hash = (53 * hash) + getAddress().hashCode();
+ hash = (37 * hash) + MESSAGE_FIELD_NUMBER;
+ hash = (53 * hash) + getMessage().hashCode();
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(pactus.wallet.WalletOuterClass.SignMessageRequest prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ *
+ * Request message to sign an arbitrary message.
+ *
+ *
+ * Protobuf type {@code pactus.SignMessageRequest}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder implements
+ // @@protoc_insertion_point(builder_implements:pactus.SignMessageRequest)
+ pactus.wallet.WalletOuterClass.SignMessageRequestOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.wallet.WalletOuterClass.internal_static_pactus_SignMessageRequest_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.wallet.WalletOuterClass.internal_static_pactus_SignMessageRequest_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.wallet.WalletOuterClass.SignMessageRequest.class, pactus.wallet.WalletOuterClass.SignMessageRequest.Builder.class);
+ }
+
+ // Construct using pactus.wallet.WalletOuterClass.SignMessageRequest.newBuilder()
+ private Builder() {
+
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ walletName_ = "";
+
+ password_ = "";
+
+ address_ = "";
+
+ message_ = "";
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return pactus.wallet.WalletOuterClass.internal_static_pactus_SignMessageRequest_descriptor;
+ }
+
+ @java.lang.Override
+ public pactus.wallet.WalletOuterClass.SignMessageRequest getDefaultInstanceForType() {
+ return pactus.wallet.WalletOuterClass.SignMessageRequest.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public pactus.wallet.WalletOuterClass.SignMessageRequest build() {
+ pactus.wallet.WalletOuterClass.SignMessageRequest result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public pactus.wallet.WalletOuterClass.SignMessageRequest buildPartial() {
+ pactus.wallet.WalletOuterClass.SignMessageRequest result = new pactus.wallet.WalletOuterClass.SignMessageRequest(this);
+ result.walletName_ = walletName_;
+ result.password_ = password_;
+ result.address_ = address_;
+ result.message_ = message_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof pactus.wallet.WalletOuterClass.SignMessageRequest) {
+ return mergeFrom((pactus.wallet.WalletOuterClass.SignMessageRequest)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(pactus.wallet.WalletOuterClass.SignMessageRequest other) {
+ if (other == pactus.wallet.WalletOuterClass.SignMessageRequest.getDefaultInstance()) return this;
+ if (!other.getWalletName().isEmpty()) {
+ walletName_ = other.walletName_;
+ onChanged();
+ }
+ if (!other.getPassword().isEmpty()) {
+ password_ = other.password_;
+ onChanged();
+ }
+ if (!other.getAddress().isEmpty()) {
+ address_ = other.address_;
+ onChanged();
+ }
+ if (!other.getMessage().isEmpty()) {
+ message_ = other.message_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ walletName_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 10
+ case 18: {
+ password_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 18
+ case 26: {
+ address_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 26
+ case 34: {
+ message_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 34
+ default: {
+ if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+ done = true; // was an endgroup tag
+ }
+ break;
+ } // default:
+ } // switch (tag)
+ } // while (!done)
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.unwrapIOException();
+ } finally {
+ onChanged();
+ } // finally
+ return this;
+ }
+
+ private java.lang.Object walletName_ = "";
+ /**
+ *
+ * The name of the wallet.
+ *
+ *
+ * string wallet_name = 1 [json_name = "walletName"];
+ * @return The walletName.
+ */
+ public java.lang.String getWalletName() {
+ java.lang.Object ref = walletName_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ walletName_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ * The name of the wallet.
+ *
+ *
+ * string wallet_name = 1 [json_name = "walletName"];
+ * @return The bytes for walletName.
+ */
+ public com.google.protobuf.ByteString
+ getWalletNameBytes() {
+ java.lang.Object ref = walletName_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ walletName_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ * The name of the wallet.
+ *
+ *
+ * string wallet_name = 1 [json_name = "walletName"];
+ * @param value The walletName to set.
+ * @return This builder for chaining.
+ */
+ public Builder setWalletName(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ walletName_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The name of the wallet.
+ *
+ *
+ * string wallet_name = 1 [json_name = "walletName"];
+ * @return This builder for chaining.
+ */
+ public Builder clearWalletName() {
+
+ walletName_ = getDefaultInstance().getWalletName();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The name of the wallet.
+ *
+ *
+ * string wallet_name = 1 [json_name = "walletName"];
+ * @param value The bytes for walletName to set.
+ * @return This builder for chaining.
+ */
+ public Builder setWalletNameBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ walletName_ = value;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object password_ = "";
+ /**
+ *
+ * The password for unlocking the wallet for signing.
+ *
+ *
+ * string password = 2 [json_name = "password"];
+ * @return The password.
+ */
+ public java.lang.String getPassword() {
+ java.lang.Object ref = password_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ password_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ * The password for unlocking the wallet for signing.
+ *
+ *
+ * string password = 2 [json_name = "password"];
+ * @return The bytes for password.
+ */
+ public com.google.protobuf.ByteString
+ getPasswordBytes() {
+ java.lang.Object ref = password_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ password_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ * The password for unlocking the wallet for signing.
+ *
+ *
+ * string password = 2 [json_name = "password"];
+ * @param value The password to set.
+ * @return This builder for chaining.
+ */
+ public Builder setPassword(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ password_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The password for unlocking the wallet for signing.
+ *
+ *
+ * string password = 2 [json_name = "password"];
+ * @return This builder for chaining.
+ */
+ public Builder clearPassword() {
+
+ password_ = getDefaultInstance().getPassword();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The password for unlocking the wallet for signing.
+ *
+ *
+ * string password = 2 [json_name = "password"];
+ * @param value The bytes for password to set.
+ * @return This builder for chaining.
+ */
+ public Builder setPasswordBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ password_ = value;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object address_ = "";
+ /**
+ *
+ * The account address associated with the private key.
+ *
+ *
+ * string address = 3 [json_name = "address"];
+ * @return The address.
+ */
+ public java.lang.String getAddress() {
+ java.lang.Object ref = address_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ address_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ * The account address associated with the private key.
+ *
+ *
+ * string address = 3 [json_name = "address"];
+ * @return The bytes for address.
+ */
+ public com.google.protobuf.ByteString
+ getAddressBytes() {
+ java.lang.Object ref = address_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ address_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ * The account address associated with the private key.
+ *
+ *
+ * string address = 3 [json_name = "address"];
+ * @param value The address to set.
+ * @return This builder for chaining.
+ */
+ public Builder setAddress(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ address_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The account address associated with the private key.
+ *
+ *
+ * string address = 3 [json_name = "address"];
+ * @return This builder for chaining.
+ */
+ public Builder clearAddress() {
+
+ address_ = getDefaultInstance().getAddress();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The account address associated with the private key.
+ *
+ *
+ * string address = 3 [json_name = "address"];
+ * @param value The bytes for address to set.
+ * @return This builder for chaining.
+ */
+ public Builder setAddressBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ address_ = value;
+ onChanged();
+ return this;
+ }
+
+ private java.lang.Object message_ = "";
+ /**
+ *
+ * The arbitrary message to be signed.
+ *
+ *
+ * string message = 4 [json_name = "message"];
+ * @return The message.
+ */
+ public java.lang.String getMessage() {
+ java.lang.Object ref = message_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ message_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ * The arbitrary message to be signed.
+ *
+ *
+ * string message = 4 [json_name = "message"];
+ * @return The bytes for message.
+ */
+ public com.google.protobuf.ByteString
+ getMessageBytes() {
+ java.lang.Object ref = message_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ message_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ * The arbitrary message to be signed.
+ *
+ *
+ * string message = 4 [json_name = "message"];
+ * @param value The message to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMessage(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The arbitrary message to be signed.
+ *
+ *
+ * string message = 4 [json_name = "message"];
+ * @return This builder for chaining.
+ */
+ public Builder clearMessage() {
+
+ message_ = getDefaultInstance().getMessage();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * The arbitrary message to be signed.
+ *
+ *
+ * string message = 4 [json_name = "message"];
+ * @param value The bytes for message to set.
+ * @return This builder for chaining.
+ */
+ public Builder setMessageBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ message_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:pactus.SignMessageRequest)
+ }
+
+ // @@protoc_insertion_point(class_scope:pactus.SignMessageRequest)
+ private static final pactus.wallet.WalletOuterClass.SignMessageRequest DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new pactus.wallet.WalletOuterClass.SignMessageRequest();
+ }
+
+ public static pactus.wallet.WalletOuterClass.SignMessageRequest getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser
+ PARSER = new com.google.protobuf.AbstractParser() {
+ @java.lang.Override
+ public SignMessageRequest parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ Builder builder = newBuilder();
+ try {
+ builder.mergeFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(builder.buildPartial());
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(e)
+ .setUnfinishedMessage(builder.buildPartial());
+ }
+ return builder.buildPartial();
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public pactus.wallet.WalletOuterClass.SignMessageRequest getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+ }
+
+ public interface SignMessageResponseOrBuilder extends
+ // @@protoc_insertion_point(interface_extends:pactus.SignMessageResponse)
+ com.google.protobuf.MessageOrBuilder {
+
+ /**
+ *
+ * Signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The signature.
+ */
+ java.lang.String getSignature();
+ /**
+ *
+ * Signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The bytes for signature.
+ */
+ com.google.protobuf.ByteString
+ getSignatureBytes();
+ }
+ /**
+ *
+ * Response message containing the available balance of the wallet.
+ *
+ *
+ * Protobuf type {@code pactus.SignMessageResponse}
+ */
+ public static final class SignMessageResponse extends
+ com.google.protobuf.GeneratedMessageV3 implements
+ // @@protoc_insertion_point(message_implements:pactus.SignMessageResponse)
+ SignMessageResponseOrBuilder {
+ private static final long serialVersionUID = 0L;
+ // Use SignMessageResponse.newBuilder() to construct.
+ private SignMessageResponse(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
+ super(builder);
+ }
+ private SignMessageResponse() {
+ signature_ = "";
+ }
+
+ @java.lang.Override
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new SignMessageResponse();
+ }
+
+ @java.lang.Override
+ public final com.google.protobuf.UnknownFieldSet
+ getUnknownFields() {
+ return this.unknownFields;
+ }
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.wallet.WalletOuterClass.internal_static_pactus_SignMessageResponse_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.wallet.WalletOuterClass.internal_static_pactus_SignMessageResponse_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.wallet.WalletOuterClass.SignMessageResponse.class, pactus.wallet.WalletOuterClass.SignMessageResponse.Builder.class);
+ }
+
+ public static final int SIGNATURE_FIELD_NUMBER = 1;
+ private volatile java.lang.Object signature_;
+ /**
+ *
+ * Signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The signature.
+ */
+ @java.lang.Override
+ public java.lang.String getSignature() {
+ java.lang.Object ref = signature_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ signature_ = s;
+ return s;
+ }
+ }
+ /**
+ *
+ * Signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The bytes for signature.
+ */
+ @java.lang.Override
+ public com.google.protobuf.ByteString
+ getSignatureBytes() {
+ java.lang.Object ref = signature_;
+ if (ref instanceof java.lang.String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ signature_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+
+ private byte memoizedIsInitialized = -1;
+ @java.lang.Override
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized == 1) return true;
+ if (isInitialized == 0) return false;
+
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ @java.lang.Override
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(signature_)) {
+ com.google.protobuf.GeneratedMessageV3.writeString(output, 1, signature_);
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ @java.lang.Override
+ public int getSerializedSize() {
+ int size = memoizedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(signature_)) {
+ size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, signature_);
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSize = size;
+ return size;
+ }
+
+ @java.lang.Override
+ public boolean equals(final java.lang.Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof pactus.wallet.WalletOuterClass.SignMessageResponse)) {
+ return super.equals(obj);
+ }
+ pactus.wallet.WalletOuterClass.SignMessageResponse other = (pactus.wallet.WalletOuterClass.SignMessageResponse) obj;
+
+ if (!getSignature()
+ .equals(other.getSignature())) return false;
+ if (!getUnknownFields().equals(other.getUnknownFields())) return false;
+ return true;
+ }
+
+ @java.lang.Override
+ public int hashCode() {
+ if (memoizedHashCode != 0) {
+ return memoizedHashCode;
+ }
+ int hash = 41;
+ hash = (19 * hash) + getDescriptor().hashCode();
+ hash = (37 * hash) + SIGNATURE_FIELD_NUMBER;
+ hash = (53 * hash) + getSignature().hashCode();
+ hash = (29 * hash) + getUnknownFields().hashCode();
+ memoizedHashCode = hash;
+ return hash;
+ }
+
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseFrom(
+ java.nio.ByteBuffer data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseFrom(
+ java.nio.ByteBuffer data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseDelimitedFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input);
+ }
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse parseFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return com.google.protobuf.GeneratedMessageV3
+ .parseWithIOException(PARSER, input, extensionRegistry);
+ }
+
+ @java.lang.Override
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder() {
+ return DEFAULT_INSTANCE.toBuilder();
+ }
+ public static Builder newBuilder(pactus.wallet.WalletOuterClass.SignMessageResponse prototype) {
+ return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
+ }
+ @java.lang.Override
+ public Builder toBuilder() {
+ return this == DEFAULT_INSTANCE
+ ? new Builder() : new Builder().mergeFrom(this);
+ }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ *
+ * Response message containing the available balance of the wallet.
+ *
+ *
+ * Protobuf type {@code pactus.SignMessageResponse}
+ */
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessageV3.Builder implements
+ // @@protoc_insertion_point(builder_implements:pactus.SignMessageResponse)
+ pactus.wallet.WalletOuterClass.SignMessageResponseOrBuilder {
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return pactus.wallet.WalletOuterClass.internal_static_pactus_SignMessageResponse_descriptor;
+ }
+
+ @java.lang.Override
+ protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return pactus.wallet.WalletOuterClass.internal_static_pactus_SignMessageResponse_fieldAccessorTable
+ .ensureFieldAccessorsInitialized(
+ pactus.wallet.WalletOuterClass.SignMessageResponse.class, pactus.wallet.WalletOuterClass.SignMessageResponse.Builder.class);
+ }
+
+ // Construct using pactus.wallet.WalletOuterClass.SignMessageResponse.newBuilder()
+ private Builder() {
+
+ }
+
+ private Builder(
+ com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
+ super(parent);
+
+ }
+ @java.lang.Override
+ public Builder clear() {
+ super.clear();
+ signature_ = "";
+
+ return this;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return pactus.wallet.WalletOuterClass.internal_static_pactus_SignMessageResponse_descriptor;
+ }
+
+ @java.lang.Override
+ public pactus.wallet.WalletOuterClass.SignMessageResponse getDefaultInstanceForType() {
+ return pactus.wallet.WalletOuterClass.SignMessageResponse.getDefaultInstance();
+ }
+
+ @java.lang.Override
+ public pactus.wallet.WalletOuterClass.SignMessageResponse build() {
+ pactus.wallet.WalletOuterClass.SignMessageResponse result = buildPartial();
+ if (!result.isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return result;
+ }
+
+ @java.lang.Override
+ public pactus.wallet.WalletOuterClass.SignMessageResponse buildPartial() {
+ pactus.wallet.WalletOuterClass.SignMessageResponse result = new pactus.wallet.WalletOuterClass.SignMessageResponse(this);
+ result.signature_ = signature_;
+ onBuilt();
+ return result;
+ }
+
+ @java.lang.Override
+ public Builder clone() {
+ return super.clone();
+ }
+ @java.lang.Override
+ public Builder setField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.setField(field, value);
+ }
+ @java.lang.Override
+ public Builder clearField(
+ com.google.protobuf.Descriptors.FieldDescriptor field) {
+ return super.clearField(field);
+ }
+ @java.lang.Override
+ public Builder clearOneof(
+ com.google.protobuf.Descriptors.OneofDescriptor oneof) {
+ return super.clearOneof(oneof);
+ }
+ @java.lang.Override
+ public Builder setRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ int index, java.lang.Object value) {
+ return super.setRepeatedField(field, index, value);
+ }
+ @java.lang.Override
+ public Builder addRepeatedField(
+ com.google.protobuf.Descriptors.FieldDescriptor field,
+ java.lang.Object value) {
+ return super.addRepeatedField(field, value);
+ }
+ @java.lang.Override
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof pactus.wallet.WalletOuterClass.SignMessageResponse) {
+ return mergeFrom((pactus.wallet.WalletOuterClass.SignMessageResponse)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(pactus.wallet.WalletOuterClass.SignMessageResponse other) {
+ if (other == pactus.wallet.WalletOuterClass.SignMessageResponse.getDefaultInstance()) return this;
+ if (!other.getSignature().isEmpty()) {
+ signature_ = other.signature_;
+ onChanged();
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ onChanged();
+ return this;
+ }
+
+ @java.lang.Override
+ public final boolean isInitialized() {
+ return true;
+ }
+
+ @java.lang.Override
+ public Builder mergeFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
+ try {
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ signature_ = input.readStringRequireUtf8();
+
+ break;
+ } // case 10
+ default: {
+ if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+ done = true; // was an endgroup tag
+ }
+ break;
+ } // default:
+ } // switch (tag)
+ } // while (!done)
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.unwrapIOException();
+ } finally {
+ onChanged();
+ } // finally
+ return this;
+ }
+
+ private java.lang.Object signature_ = "";
+ /**
+ *
+ * Signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The signature.
+ */
+ public java.lang.String getSignature() {
+ java.lang.Object ref = signature_;
+ if (!(ref instanceof java.lang.String)) {
+ com.google.protobuf.ByteString bs =
+ (com.google.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ signature_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ *
+ * Signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return The bytes for signature.
+ */
+ public com.google.protobuf.ByteString
+ getSignatureBytes() {
+ java.lang.Object ref = signature_;
+ if (ref instanceof String) {
+ com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ signature_ = b;
+ return b;
+ } else {
+ return (com.google.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ *
+ * Signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @param value The signature to set.
+ * @return This builder for chaining.
+ */
+ public Builder setSignature(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ signature_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * Signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @return This builder for chaining.
+ */
+ public Builder clearSignature() {
+
+ signature_ = getDefaultInstance().getSignature();
+ onChanged();
+ return this;
+ }
+ /**
+ *
+ * Signature of the message.
+ *
+ *
+ * string signature = 1 [json_name = "signature"];
+ * @param value The bytes for signature to set.
+ * @return This builder for chaining.
+ */
+ public Builder setSignatureBytes(
+ com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ checkByteStringIsUtf8(value);
+
+ signature_ = value;
+ onChanged();
+ return this;
+ }
+ @java.lang.Override
+ public final Builder setUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.setUnknownFields(unknownFields);
+ }
+
+ @java.lang.Override
+ public final Builder mergeUnknownFields(
+ final com.google.protobuf.UnknownFieldSet unknownFields) {
+ return super.mergeUnknownFields(unknownFields);
+ }
+
+
+ // @@protoc_insertion_point(builder_scope:pactus.SignMessageResponse)
+ }
+
+ // @@protoc_insertion_point(class_scope:pactus.SignMessageResponse)
+ private static final pactus.wallet.WalletOuterClass.SignMessageResponse DEFAULT_INSTANCE;
+ static {
+ DEFAULT_INSTANCE = new pactus.wallet.WalletOuterClass.SignMessageResponse();
+ }
+
+ public static pactus.wallet.WalletOuterClass.SignMessageResponse getDefaultInstance() {
+ return DEFAULT_INSTANCE;
+ }
+
+ private static final com.google.protobuf.Parser
+ PARSER = new com.google.protobuf.AbstractParser() {
+ @java.lang.Override
+ public SignMessageResponse parsePartialFrom(
+ com.google.protobuf.CodedInputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ Builder builder = newBuilder();
+ try {
+ builder.mergeFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(builder.buildPartial());
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(e)
+ .setUnfinishedMessage(builder.buildPartial());
+ }
+ return builder.buildPartial();
+ }
+ };
+
+ public static com.google.protobuf.Parser parser() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public com.google.protobuf.Parser getParserForType() {
+ return PARSER;
+ }
+
+ @java.lang.Override
+ public pactus.wallet.WalletOuterClass.SignMessageResponse getDefaultInstanceForType() {
+ return DEFAULT_INSTANCE;
+ }
+
+ }
+
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_pactus_AddressInfo_descriptor;
private static final
@@ -15477,6 +17218,16 @@ public pactus.wallet.WalletOuterClass.GetTotalBalanceResponse getDefaultInstance
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_pactus_GetTotalBalanceResponse_fieldAccessorTable;
+ private static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_pactus_SignMessageRequest_descriptor;
+ private static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_pactus_SignMessageRequest_fieldAccessorTable;
+ private static final com.google.protobuf.Descriptors.Descriptor
+ internal_static_pactus_SignMessageResponse_descriptor;
+ private static final
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
+ internal_static_pactus_SignMessageResponse_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
@@ -15531,30 +17282,36 @@ public pactus.wallet.WalletOuterClass.GetTotalBalanceResponse getDefaultInstance
"let_name\030\001 \001(\tR\nwalletName\"_\n\027GetTotalBa" +
"lanceResponse\022\037\n\013wallet_name\030\001 \001(\tR\nwall" +
"etName\022#\n\rtotal_balance\030\002 \001(\003R\014totalBala" +
- "nce*b\n\013AddressType\022\031\n\025ADDRESS_TYPE_TREAS" +
- "URY\020\000\022\032\n\026ADDRESS_TYPE_VALIDATOR\020\001\022\034\n\030ADD" +
- "RESS_TYPE_BLS_ACCOUNT\020\0022\352\005\n\006Wallet\022I\n\014Cr" +
- "eateWallet\022\033.pactus.CreateWalletRequest\032" +
- "\034.pactus.CreateWalletResponse\022L\n\rRestore" +
- "Wallet\022\034.pactus.RestoreWalletRequest\032\035.p" +
- "actus.RestoreWalletResponse\022C\n\nLoadWalle" +
- "t\022\031.pactus.LoadWalletRequest\032\032.pactus.Lo" +
- "adWalletResponse\022I\n\014UnloadWallet\022\033.pactu" +
- "s.UnloadWalletRequest\032\034.pactus.UnloadWal" +
- "letResponse\022R\n\017GetTotalBalance\022\036.pactus." +
- "GetTotalBalanceRequest\032\037.pactus.GetTotal" +
- "BalanceResponse\022[\n\022SignRawTransaction\022!." +
- "pactus.SignRawTransactionRequest\032\".pactu" +
- "s.SignRawTransactionResponse\022^\n\023GetValid" +
- "atorAddress\022\".pactus.GetValidatorAddress" +
- "Request\032#.pactus.GetValidatorAddressResp" +
- "onse\022L\n\rGetNewAddress\022\034.pactus.GetNewAdd" +
- "ressRequest\032\035.pactus.GetNewAddressRespon" +
- "se\022X\n\021GetAddressHistory\022 .pactus.GetAddr" +
- "essHistoryRequest\032!.pactus.GetAddressHis" +
- "toryResponseBA\n\rpactus.walletZ0github.co" +
- "m/pactus-project/pactus/www/grpc/pactusb" +
- "\006proto3"
+ "nce\"\205\001\n\022SignMessageRequest\022\037\n\013wallet_nam" +
+ "e\030\001 \001(\tR\nwalletName\022\032\n\010password\030\002 \001(\tR\010p" +
+ "assword\022\030\n\007address\030\003 \001(\tR\007address\022\030\n\007mes" +
+ "sage\030\004 \001(\tR\007message\"3\n\023SignMessageRespon" +
+ "se\022\034\n\tsignature\030\001 \001(\tR\tsignature*b\n\013Addr" +
+ "essType\022\031\n\025ADDRESS_TYPE_TREASURY\020\000\022\032\n\026AD" +
+ "DRESS_TYPE_VALIDATOR\020\001\022\034\n\030ADDRESS_TYPE_B" +
+ "LS_ACCOUNT\020\0022\262\006\n\006Wallet\022I\n\014CreateWallet\022" +
+ "\033.pactus.CreateWalletRequest\032\034.pactus.Cr" +
+ "eateWalletResponse\022L\n\rRestoreWallet\022\034.pa" +
+ "ctus.RestoreWalletRequest\032\035.pactus.Resto" +
+ "reWalletResponse\022C\n\nLoadWallet\022\031.pactus." +
+ "LoadWalletRequest\032\032.pactus.LoadWalletRes" +
+ "ponse\022I\n\014UnloadWallet\022\033.pactus.UnloadWal" +
+ "letRequest\032\034.pactus.UnloadWalletResponse" +
+ "\022R\n\017GetTotalBalance\022\036.pactus.GetTotalBal" +
+ "anceRequest\032\037.pactus.GetTotalBalanceResp" +
+ "onse\022[\n\022SignRawTransaction\022!.pactus.Sign" +
+ "RawTransactionRequest\032\".pactus.SignRawTr" +
+ "ansactionResponse\022^\n\023GetValidatorAddress" +
+ "\022\".pactus.GetValidatorAddressRequest\032#.p" +
+ "actus.GetValidatorAddressResponse\022L\n\rGet" +
+ "NewAddress\022\034.pactus.GetNewAddressRequest" +
+ "\032\035.pactus.GetNewAddressResponse\022X\n\021GetAd" +
+ "dressHistory\022 .pactus.GetAddressHistoryR" +
+ "equest\032!.pactus.GetAddressHistoryRespons" +
+ "e\022F\n\013SignMessage\022\032.pactus.SignMessageReq" +
+ "uest\032\033.pactus.SignMessageResponseBA\n\rpac" +
+ "tus.walletZ0github.com/pactus-project/pa" +
+ "ctus/www/grpc/pactusb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
@@ -15681,6 +17438,18 @@ public pactus.wallet.WalletOuterClass.GetTotalBalanceResponse getDefaultInstance
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_pactus_GetTotalBalanceResponse_descriptor,
new java.lang.String[] { "WalletName", "TotalBalance", });
+ internal_static_pactus_SignMessageRequest_descriptor =
+ getDescriptor().getMessageTypes().get(20);
+ internal_static_pactus_SignMessageRequest_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_pactus_SignMessageRequest_descriptor,
+ new java.lang.String[] { "WalletName", "Password", "Address", "Message", });
+ internal_static_pactus_SignMessageResponse_descriptor =
+ getDescriptor().getMessageTypes().get(21);
+ internal_static_pactus_SignMessageResponse_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
+ internal_static_pactus_SignMessageResponse_descriptor,
+ new java.lang.String[] { "Signature", });
pactus.transaction.TransactionOuterClass.getDescriptor();
}
diff --git a/www/grpc/gen/js/utils_grpc_pb.js b/www/grpc/gen/js/utils_grpc_pb.js
new file mode 100644
index 000000000..e0b645230
--- /dev/null
+++ b/www/grpc/gen/js/utils_grpc_pb.js
@@ -0,0 +1,81 @@
+// GENERATED CODE -- DO NOT EDIT!
+
+'use strict';
+var grpc = require('grpc');
+var utils_pb = require('./utils_pb.js');
+
+function serialize_pactus_SignMessageWithPrivateKeyRequest(arg) {
+ if (!(arg instanceof utils_pb.SignMessageWithPrivateKeyRequest)) {
+ throw new Error('Expected argument of type pactus.SignMessageWithPrivateKeyRequest');
+ }
+ return Buffer.from(arg.serializeBinary());
+}
+
+function deserialize_pactus_SignMessageWithPrivateKeyRequest(buffer_arg) {
+ return utils_pb.SignMessageWithPrivateKeyRequest.deserializeBinary(new Uint8Array(buffer_arg));
+}
+
+function serialize_pactus_SignMessageWithPrivateKeyResponse(arg) {
+ if (!(arg instanceof utils_pb.SignMessageWithPrivateKeyResponse)) {
+ throw new Error('Expected argument of type pactus.SignMessageWithPrivateKeyResponse');
+ }
+ return Buffer.from(arg.serializeBinary());
+}
+
+function deserialize_pactus_SignMessageWithPrivateKeyResponse(buffer_arg) {
+ return utils_pb.SignMessageWithPrivateKeyResponse.deserializeBinary(new Uint8Array(buffer_arg));
+}
+
+function serialize_pactus_VerifyMessageRequest(arg) {
+ if (!(arg instanceof utils_pb.VerifyMessageRequest)) {
+ throw new Error('Expected argument of type pactus.VerifyMessageRequest');
+ }
+ return Buffer.from(arg.serializeBinary());
+}
+
+function deserialize_pactus_VerifyMessageRequest(buffer_arg) {
+ return utils_pb.VerifyMessageRequest.deserializeBinary(new Uint8Array(buffer_arg));
+}
+
+function serialize_pactus_VerifyMessageResponse(arg) {
+ if (!(arg instanceof utils_pb.VerifyMessageResponse)) {
+ throw new Error('Expected argument of type pactus.VerifyMessageResponse');
+ }
+ return Buffer.from(arg.serializeBinary());
+}
+
+function deserialize_pactus_VerifyMessageResponse(buffer_arg) {
+ return utils_pb.VerifyMessageResponse.deserializeBinary(new Uint8Array(buffer_arg));
+}
+
+
+// Utils service defines RPC methods for utility functions such as message
+// signing and verification.
+var UtilsService = exports.UtilsService = {
+ // SignMessageWithPrivateKey sign message with provided private key.
+signMessageWithPrivateKey: {
+ path: '/pactus.Utils/SignMessageWithPrivateKey',
+ requestStream: false,
+ responseStream: false,
+ requestType: utils_pb.SignMessageWithPrivateKeyRequest,
+ responseType: utils_pb.SignMessageWithPrivateKeyResponse,
+ requestSerialize: serialize_pactus_SignMessageWithPrivateKeyRequest,
+ requestDeserialize: deserialize_pactus_SignMessageWithPrivateKeyRequest,
+ responseSerialize: serialize_pactus_SignMessageWithPrivateKeyResponse,
+ responseDeserialize: deserialize_pactus_SignMessageWithPrivateKeyResponse,
+ },
+ // VerifyMessage verify signature with public key and message
+verifyMessage: {
+ path: '/pactus.Utils/VerifyMessage',
+ requestStream: false,
+ responseStream: false,
+ requestType: utils_pb.VerifyMessageRequest,
+ responseType: utils_pb.VerifyMessageResponse,
+ requestSerialize: serialize_pactus_VerifyMessageRequest,
+ requestDeserialize: deserialize_pactus_VerifyMessageRequest,
+ responseSerialize: serialize_pactus_VerifyMessageResponse,
+ responseDeserialize: deserialize_pactus_VerifyMessageResponse,
+ },
+};
+
+exports.UtilsClient = grpc.makeGenericClientConstructor(UtilsService);
diff --git a/www/grpc/gen/js/utils_pb.js b/www/grpc/gen/js/utils_pb.js
new file mode 100644
index 000000000..6384f3614
--- /dev/null
+++ b/www/grpc/gen/js/utils_pb.js
@@ -0,0 +1,722 @@
+// source: utils.proto
+/**
+ * @fileoverview
+ * @enhanceable
+ * @suppress {missingRequire} reports error on implicit type usages.
+ * @suppress {messageConventions} JS Compiler reports an error if a variable or
+ * field starts with 'MSG_' and isn't a translatable message.
+ * @public
+ */
+// GENERATED CODE -- DO NOT EDIT!
+/* eslint-disable */
+// @ts-nocheck
+
+var jspb = require('google-protobuf');
+var goog = jspb;
+var global =
+ (typeof globalThis !== 'undefined' && globalThis) ||
+ (typeof window !== 'undefined' && window) ||
+ (typeof global !== 'undefined' && global) ||
+ (typeof self !== 'undefined' && self) ||
+ (function () { return this; }).call(null) ||
+ Function('return this')();
+
+goog.exportSymbol('proto.pactus.SignMessageWithPrivateKeyRequest', null, global);
+goog.exportSymbol('proto.pactus.SignMessageWithPrivateKeyResponse', null, global);
+goog.exportSymbol('proto.pactus.VerifyMessageRequest', null, global);
+goog.exportSymbol('proto.pactus.VerifyMessageResponse', null, global);
+/**
+ * Generated by JsPbCodeGenerator.
+ * @param {Array=} opt_data Optional initial data array, typically from a
+ * server response, or constructed directly in Javascript. The array is used
+ * in place and becomes part of the constructed object. It is not cloned.
+ * If no data is provided, the constructed object will be empty, but still
+ * valid.
+ * @extends {jspb.Message}
+ * @constructor
+ */
+proto.pactus.SignMessageWithPrivateKeyRequest = function(opt_data) {
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
+};
+goog.inherits(proto.pactus.SignMessageWithPrivateKeyRequest, jspb.Message);
+if (goog.DEBUG && !COMPILED) {
+ /**
+ * @public
+ * @override
+ */
+ proto.pactus.SignMessageWithPrivateKeyRequest.displayName = 'proto.pactus.SignMessageWithPrivateKeyRequest';
+}
+/**
+ * Generated by JsPbCodeGenerator.
+ * @param {Array=} opt_data Optional initial data array, typically from a
+ * server response, or constructed directly in Javascript. The array is used
+ * in place and becomes part of the constructed object. It is not cloned.
+ * If no data is provided, the constructed object will be empty, but still
+ * valid.
+ * @extends {jspb.Message}
+ * @constructor
+ */
+proto.pactus.SignMessageWithPrivateKeyResponse = function(opt_data) {
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
+};
+goog.inherits(proto.pactus.SignMessageWithPrivateKeyResponse, jspb.Message);
+if (goog.DEBUG && !COMPILED) {
+ /**
+ * @public
+ * @override
+ */
+ proto.pactus.SignMessageWithPrivateKeyResponse.displayName = 'proto.pactus.SignMessageWithPrivateKeyResponse';
+}
+/**
+ * Generated by JsPbCodeGenerator.
+ * @param {Array=} opt_data Optional initial data array, typically from a
+ * server response, or constructed directly in Javascript. The array is used
+ * in place and becomes part of the constructed object. It is not cloned.
+ * If no data is provided, the constructed object will be empty, but still
+ * valid.
+ * @extends {jspb.Message}
+ * @constructor
+ */
+proto.pactus.VerifyMessageRequest = function(opt_data) {
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
+};
+goog.inherits(proto.pactus.VerifyMessageRequest, jspb.Message);
+if (goog.DEBUG && !COMPILED) {
+ /**
+ * @public
+ * @override
+ */
+ proto.pactus.VerifyMessageRequest.displayName = 'proto.pactus.VerifyMessageRequest';
+}
+/**
+ * Generated by JsPbCodeGenerator.
+ * @param {Array=} opt_data Optional initial data array, typically from a
+ * server response, or constructed directly in Javascript. The array is used
+ * in place and becomes part of the constructed object. It is not cloned.
+ * If no data is provided, the constructed object will be empty, but still
+ * valid.
+ * @extends {jspb.Message}
+ * @constructor
+ */
+proto.pactus.VerifyMessageResponse = function(opt_data) {
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
+};
+goog.inherits(proto.pactus.VerifyMessageResponse, jspb.Message);
+if (goog.DEBUG && !COMPILED) {
+ /**
+ * @public
+ * @override
+ */
+ proto.pactus.VerifyMessageResponse.displayName = 'proto.pactus.VerifyMessageResponse';
+}
+
+
+
+if (jspb.Message.GENERATE_TO_OBJECT) {
+/**
+ * Creates an object representation of this proto.
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
+ * Optional fields that are not set will be set to undefined.
+ * To access a reserved field use, foo.pb_, eg, foo.pb_default.
+ * For the list of reserved names please see:
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
+ * JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @return {!Object}
+ */
+proto.pactus.SignMessageWithPrivateKeyRequest.prototype.toObject = function(opt_includeInstance) {
+ return proto.pactus.SignMessageWithPrivateKeyRequest.toObject(opt_includeInstance, this);
+};
+
+
+/**
+ * Static version of the {@see toObject} method.
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
+ * the JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @param {!proto.pactus.SignMessageWithPrivateKeyRequest} msg The msg instance to transform.
+ * @return {!Object}
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.SignMessageWithPrivateKeyRequest.toObject = function(includeInstance, msg) {
+ var f, obj = {
+ privateKey: jspb.Message.getFieldWithDefault(msg, 1, ""),
+ message: jspb.Message.getFieldWithDefault(msg, 2, "")
+ };
+
+ if (includeInstance) {
+ obj.$jspbMessageInstance = msg;
+ }
+ return obj;
+};
+}
+
+
+/**
+ * Deserializes binary data (in protobuf wire format).
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
+ * @return {!proto.pactus.SignMessageWithPrivateKeyRequest}
+ */
+proto.pactus.SignMessageWithPrivateKeyRequest.deserializeBinary = function(bytes) {
+ var reader = new jspb.BinaryReader(bytes);
+ var msg = new proto.pactus.SignMessageWithPrivateKeyRequest;
+ return proto.pactus.SignMessageWithPrivateKeyRequest.deserializeBinaryFromReader(msg, reader);
+};
+
+
+/**
+ * Deserializes binary data (in protobuf wire format) from the
+ * given reader into the given message object.
+ * @param {!proto.pactus.SignMessageWithPrivateKeyRequest} msg The message object to deserialize into.
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
+ * @return {!proto.pactus.SignMessageWithPrivateKeyRequest}
+ */
+proto.pactus.SignMessageWithPrivateKeyRequest.deserializeBinaryFromReader = function(msg, reader) {
+ while (reader.nextField()) {
+ if (reader.isEndGroup()) {
+ break;
+ }
+ var field = reader.getFieldNumber();
+ switch (field) {
+ case 1:
+ var value = /** @type {string} */ (reader.readString());
+ msg.setPrivateKey(value);
+ break;
+ case 2:
+ var value = /** @type {string} */ (reader.readString());
+ msg.setMessage(value);
+ break;
+ default:
+ reader.skipField();
+ break;
+ }
+ }
+ return msg;
+};
+
+
+/**
+ * Serializes the message to binary data (in protobuf wire format).
+ * @return {!Uint8Array}
+ */
+proto.pactus.SignMessageWithPrivateKeyRequest.prototype.serializeBinary = function() {
+ var writer = new jspb.BinaryWriter();
+ proto.pactus.SignMessageWithPrivateKeyRequest.serializeBinaryToWriter(this, writer);
+ return writer.getResultBuffer();
+};
+
+
+/**
+ * Serializes the given message to binary data (in protobuf wire
+ * format), writing to the given BinaryWriter.
+ * @param {!proto.pactus.SignMessageWithPrivateKeyRequest} message
+ * @param {!jspb.BinaryWriter} writer
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.SignMessageWithPrivateKeyRequest.serializeBinaryToWriter = function(message, writer) {
+ var f = undefined;
+ f = message.getPrivateKey();
+ if (f.length > 0) {
+ writer.writeString(
+ 1,
+ f
+ );
+ }
+ f = message.getMessage();
+ if (f.length > 0) {
+ writer.writeString(
+ 2,
+ f
+ );
+ }
+};
+
+
+/**
+ * optional string private_key = 1;
+ * @return {string}
+ */
+proto.pactus.SignMessageWithPrivateKeyRequest.prototype.getPrivateKey = function() {
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
+};
+
+
+/**
+ * @param {string} value
+ * @return {!proto.pactus.SignMessageWithPrivateKeyRequest} returns this
+ */
+proto.pactus.SignMessageWithPrivateKeyRequest.prototype.setPrivateKey = function(value) {
+ return jspb.Message.setProto3StringField(this, 1, value);
+};
+
+
+/**
+ * optional string message = 2;
+ * @return {string}
+ */
+proto.pactus.SignMessageWithPrivateKeyRequest.prototype.getMessage = function() {
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
+};
+
+
+/**
+ * @param {string} value
+ * @return {!proto.pactus.SignMessageWithPrivateKeyRequest} returns this
+ */
+proto.pactus.SignMessageWithPrivateKeyRequest.prototype.setMessage = function(value) {
+ return jspb.Message.setProto3StringField(this, 2, value);
+};
+
+
+
+
+
+if (jspb.Message.GENERATE_TO_OBJECT) {
+/**
+ * Creates an object representation of this proto.
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
+ * Optional fields that are not set will be set to undefined.
+ * To access a reserved field use, foo.pb_, eg, foo.pb_default.
+ * For the list of reserved names please see:
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
+ * JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @return {!Object}
+ */
+proto.pactus.SignMessageWithPrivateKeyResponse.prototype.toObject = function(opt_includeInstance) {
+ return proto.pactus.SignMessageWithPrivateKeyResponse.toObject(opt_includeInstance, this);
+};
+
+
+/**
+ * Static version of the {@see toObject} method.
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
+ * the JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @param {!proto.pactus.SignMessageWithPrivateKeyResponse} msg The msg instance to transform.
+ * @return {!Object}
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.SignMessageWithPrivateKeyResponse.toObject = function(includeInstance, msg) {
+ var f, obj = {
+ signature: jspb.Message.getFieldWithDefault(msg, 1, "")
+ };
+
+ if (includeInstance) {
+ obj.$jspbMessageInstance = msg;
+ }
+ return obj;
+};
+}
+
+
+/**
+ * Deserializes binary data (in protobuf wire format).
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
+ * @return {!proto.pactus.SignMessageWithPrivateKeyResponse}
+ */
+proto.pactus.SignMessageWithPrivateKeyResponse.deserializeBinary = function(bytes) {
+ var reader = new jspb.BinaryReader(bytes);
+ var msg = new proto.pactus.SignMessageWithPrivateKeyResponse;
+ return proto.pactus.SignMessageWithPrivateKeyResponse.deserializeBinaryFromReader(msg, reader);
+};
+
+
+/**
+ * Deserializes binary data (in protobuf wire format) from the
+ * given reader into the given message object.
+ * @param {!proto.pactus.SignMessageWithPrivateKeyResponse} msg The message object to deserialize into.
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
+ * @return {!proto.pactus.SignMessageWithPrivateKeyResponse}
+ */
+proto.pactus.SignMessageWithPrivateKeyResponse.deserializeBinaryFromReader = function(msg, reader) {
+ while (reader.nextField()) {
+ if (reader.isEndGroup()) {
+ break;
+ }
+ var field = reader.getFieldNumber();
+ switch (field) {
+ case 1:
+ var value = /** @type {string} */ (reader.readString());
+ msg.setSignature(value);
+ break;
+ default:
+ reader.skipField();
+ break;
+ }
+ }
+ return msg;
+};
+
+
+/**
+ * Serializes the message to binary data (in protobuf wire format).
+ * @return {!Uint8Array}
+ */
+proto.pactus.SignMessageWithPrivateKeyResponse.prototype.serializeBinary = function() {
+ var writer = new jspb.BinaryWriter();
+ proto.pactus.SignMessageWithPrivateKeyResponse.serializeBinaryToWriter(this, writer);
+ return writer.getResultBuffer();
+};
+
+
+/**
+ * Serializes the given message to binary data (in protobuf wire
+ * format), writing to the given BinaryWriter.
+ * @param {!proto.pactus.SignMessageWithPrivateKeyResponse} message
+ * @param {!jspb.BinaryWriter} writer
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.SignMessageWithPrivateKeyResponse.serializeBinaryToWriter = function(message, writer) {
+ var f = undefined;
+ f = message.getSignature();
+ if (f.length > 0) {
+ writer.writeString(
+ 1,
+ f
+ );
+ }
+};
+
+
+/**
+ * optional string signature = 1;
+ * @return {string}
+ */
+proto.pactus.SignMessageWithPrivateKeyResponse.prototype.getSignature = function() {
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
+};
+
+
+/**
+ * @param {string} value
+ * @return {!proto.pactus.SignMessageWithPrivateKeyResponse} returns this
+ */
+proto.pactus.SignMessageWithPrivateKeyResponse.prototype.setSignature = function(value) {
+ return jspb.Message.setProto3StringField(this, 1, value);
+};
+
+
+
+
+
+if (jspb.Message.GENERATE_TO_OBJECT) {
+/**
+ * Creates an object representation of this proto.
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
+ * Optional fields that are not set will be set to undefined.
+ * To access a reserved field use, foo.pb_, eg, foo.pb_default.
+ * For the list of reserved names please see:
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
+ * JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @return {!Object}
+ */
+proto.pactus.VerifyMessageRequest.prototype.toObject = function(opt_includeInstance) {
+ return proto.pactus.VerifyMessageRequest.toObject(opt_includeInstance, this);
+};
+
+
+/**
+ * Static version of the {@see toObject} method.
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
+ * the JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @param {!proto.pactus.VerifyMessageRequest} msg The msg instance to transform.
+ * @return {!Object}
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.VerifyMessageRequest.toObject = function(includeInstance, msg) {
+ var f, obj = {
+ message: jspb.Message.getFieldWithDefault(msg, 1, ""),
+ signature: jspb.Message.getFieldWithDefault(msg, 2, ""),
+ publicKey: jspb.Message.getFieldWithDefault(msg, 3, "")
+ };
+
+ if (includeInstance) {
+ obj.$jspbMessageInstance = msg;
+ }
+ return obj;
+};
+}
+
+
+/**
+ * Deserializes binary data (in protobuf wire format).
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
+ * @return {!proto.pactus.VerifyMessageRequest}
+ */
+proto.pactus.VerifyMessageRequest.deserializeBinary = function(bytes) {
+ var reader = new jspb.BinaryReader(bytes);
+ var msg = new proto.pactus.VerifyMessageRequest;
+ return proto.pactus.VerifyMessageRequest.deserializeBinaryFromReader(msg, reader);
+};
+
+
+/**
+ * Deserializes binary data (in protobuf wire format) from the
+ * given reader into the given message object.
+ * @param {!proto.pactus.VerifyMessageRequest} msg The message object to deserialize into.
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
+ * @return {!proto.pactus.VerifyMessageRequest}
+ */
+proto.pactus.VerifyMessageRequest.deserializeBinaryFromReader = function(msg, reader) {
+ while (reader.nextField()) {
+ if (reader.isEndGroup()) {
+ break;
+ }
+ var field = reader.getFieldNumber();
+ switch (field) {
+ case 1:
+ var value = /** @type {string} */ (reader.readString());
+ msg.setMessage(value);
+ break;
+ case 2:
+ var value = /** @type {string} */ (reader.readString());
+ msg.setSignature(value);
+ break;
+ case 3:
+ var value = /** @type {string} */ (reader.readString());
+ msg.setPublicKey(value);
+ break;
+ default:
+ reader.skipField();
+ break;
+ }
+ }
+ return msg;
+};
+
+
+/**
+ * Serializes the message to binary data (in protobuf wire format).
+ * @return {!Uint8Array}
+ */
+proto.pactus.VerifyMessageRequest.prototype.serializeBinary = function() {
+ var writer = new jspb.BinaryWriter();
+ proto.pactus.VerifyMessageRequest.serializeBinaryToWriter(this, writer);
+ return writer.getResultBuffer();
+};
+
+
+/**
+ * Serializes the given message to binary data (in protobuf wire
+ * format), writing to the given BinaryWriter.
+ * @param {!proto.pactus.VerifyMessageRequest} message
+ * @param {!jspb.BinaryWriter} writer
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.VerifyMessageRequest.serializeBinaryToWriter = function(message, writer) {
+ var f = undefined;
+ f = message.getMessage();
+ if (f.length > 0) {
+ writer.writeString(
+ 1,
+ f
+ );
+ }
+ f = message.getSignature();
+ if (f.length > 0) {
+ writer.writeString(
+ 2,
+ f
+ );
+ }
+ f = message.getPublicKey();
+ if (f.length > 0) {
+ writer.writeString(
+ 3,
+ f
+ );
+ }
+};
+
+
+/**
+ * optional string message = 1;
+ * @return {string}
+ */
+proto.pactus.VerifyMessageRequest.prototype.getMessage = function() {
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
+};
+
+
+/**
+ * @param {string} value
+ * @return {!proto.pactus.VerifyMessageRequest} returns this
+ */
+proto.pactus.VerifyMessageRequest.prototype.setMessage = function(value) {
+ return jspb.Message.setProto3StringField(this, 1, value);
+};
+
+
+/**
+ * optional string signature = 2;
+ * @return {string}
+ */
+proto.pactus.VerifyMessageRequest.prototype.getSignature = function() {
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
+};
+
+
+/**
+ * @param {string} value
+ * @return {!proto.pactus.VerifyMessageRequest} returns this
+ */
+proto.pactus.VerifyMessageRequest.prototype.setSignature = function(value) {
+ return jspb.Message.setProto3StringField(this, 2, value);
+};
+
+
+/**
+ * optional string public_key = 3;
+ * @return {string}
+ */
+proto.pactus.VerifyMessageRequest.prototype.getPublicKey = function() {
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
+};
+
+
+/**
+ * @param {string} value
+ * @return {!proto.pactus.VerifyMessageRequest} returns this
+ */
+proto.pactus.VerifyMessageRequest.prototype.setPublicKey = function(value) {
+ return jspb.Message.setProto3StringField(this, 3, value);
+};
+
+
+
+
+
+if (jspb.Message.GENERATE_TO_OBJECT) {
+/**
+ * Creates an object representation of this proto.
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
+ * Optional fields that are not set will be set to undefined.
+ * To access a reserved field use, foo.pb_, eg, foo.pb_default.
+ * For the list of reserved names please see:
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
+ * JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @return {!Object}
+ */
+proto.pactus.VerifyMessageResponse.prototype.toObject = function(opt_includeInstance) {
+ return proto.pactus.VerifyMessageResponse.toObject(opt_includeInstance, this);
+};
+
+
+/**
+ * Static version of the {@see toObject} method.
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
+ * the JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @param {!proto.pactus.VerifyMessageResponse} msg The msg instance to transform.
+ * @return {!Object}
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.VerifyMessageResponse.toObject = function(includeInstance, msg) {
+ var f, obj = {
+ isValid: jspb.Message.getBooleanFieldWithDefault(msg, 1, false)
+ };
+
+ if (includeInstance) {
+ obj.$jspbMessageInstance = msg;
+ }
+ return obj;
+};
+}
+
+
+/**
+ * Deserializes binary data (in protobuf wire format).
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
+ * @return {!proto.pactus.VerifyMessageResponse}
+ */
+proto.pactus.VerifyMessageResponse.deserializeBinary = function(bytes) {
+ var reader = new jspb.BinaryReader(bytes);
+ var msg = new proto.pactus.VerifyMessageResponse;
+ return proto.pactus.VerifyMessageResponse.deserializeBinaryFromReader(msg, reader);
+};
+
+
+/**
+ * Deserializes binary data (in protobuf wire format) from the
+ * given reader into the given message object.
+ * @param {!proto.pactus.VerifyMessageResponse} msg The message object to deserialize into.
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
+ * @return {!proto.pactus.VerifyMessageResponse}
+ */
+proto.pactus.VerifyMessageResponse.deserializeBinaryFromReader = function(msg, reader) {
+ while (reader.nextField()) {
+ if (reader.isEndGroup()) {
+ break;
+ }
+ var field = reader.getFieldNumber();
+ switch (field) {
+ case 1:
+ var value = /** @type {boolean} */ (reader.readBool());
+ msg.setIsValid(value);
+ break;
+ default:
+ reader.skipField();
+ break;
+ }
+ }
+ return msg;
+};
+
+
+/**
+ * Serializes the message to binary data (in protobuf wire format).
+ * @return {!Uint8Array}
+ */
+proto.pactus.VerifyMessageResponse.prototype.serializeBinary = function() {
+ var writer = new jspb.BinaryWriter();
+ proto.pactus.VerifyMessageResponse.serializeBinaryToWriter(this, writer);
+ return writer.getResultBuffer();
+};
+
+
+/**
+ * Serializes the given message to binary data (in protobuf wire
+ * format), writing to the given BinaryWriter.
+ * @param {!proto.pactus.VerifyMessageResponse} message
+ * @param {!jspb.BinaryWriter} writer
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.VerifyMessageResponse.serializeBinaryToWriter = function(message, writer) {
+ var f = undefined;
+ f = message.getIsValid();
+ if (f) {
+ writer.writeBool(
+ 1,
+ f
+ );
+ }
+};
+
+
+/**
+ * optional bool is_valid = 1;
+ * @return {boolean}
+ */
+proto.pactus.VerifyMessageResponse.prototype.getIsValid = function() {
+ return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false));
+};
+
+
+/**
+ * @param {boolean} value
+ * @return {!proto.pactus.VerifyMessageResponse} returns this
+ */
+proto.pactus.VerifyMessageResponse.prototype.setIsValid = function(value) {
+ return jspb.Message.setProto3BooleanField(this, 1, value);
+};
+
+
+goog.object.extend(exports, proto.pactus);
diff --git a/www/grpc/gen/js/wallet_grpc_pb.js b/www/grpc/gen/js/wallet_grpc_pb.js
index 491447f2c..fc67ea02e 100644
--- a/www/grpc/gen/js/wallet_grpc_pb.js
+++ b/www/grpc/gen/js/wallet_grpc_pb.js
@@ -159,6 +159,28 @@ function deserialize_pactus_RestoreWalletResponse(buffer_arg) {
return wallet_pb.RestoreWalletResponse.deserializeBinary(new Uint8Array(buffer_arg));
}
+function serialize_pactus_SignMessageRequest(arg) {
+ if (!(arg instanceof wallet_pb.SignMessageRequest)) {
+ throw new Error('Expected argument of type pactus.SignMessageRequest');
+ }
+ return Buffer.from(arg.serializeBinary());
+}
+
+function deserialize_pactus_SignMessageRequest(buffer_arg) {
+ return wallet_pb.SignMessageRequest.deserializeBinary(new Uint8Array(buffer_arg));
+}
+
+function serialize_pactus_SignMessageResponse(arg) {
+ if (!(arg instanceof wallet_pb.SignMessageResponse)) {
+ throw new Error('Expected argument of type pactus.SignMessageResponse');
+ }
+ return Buffer.from(arg.serializeBinary());
+}
+
+function deserialize_pactus_SignMessageResponse(buffer_arg) {
+ return wallet_pb.SignMessageResponse.deserializeBinary(new Uint8Array(buffer_arg));
+}
+
function serialize_pactus_SignRawTransactionRequest(arg) {
if (!(arg instanceof wallet_pb.SignRawTransactionRequest)) {
throw new Error('Expected argument of type pactus.SignRawTransactionRequest');
@@ -315,6 +337,18 @@ getAddressHistory: {
responseSerialize: serialize_pactus_GetAddressHistoryResponse,
responseDeserialize: deserialize_pactus_GetAddressHistoryResponse,
},
+ // SignMessage signs an arbitrary message.
+signMessage: {
+ path: '/pactus.Wallet/SignMessage',
+ requestStream: false,
+ responseStream: false,
+ requestType: wallet_pb.SignMessageRequest,
+ responseType: wallet_pb.SignMessageResponse,
+ requestSerialize: serialize_pactus_SignMessageRequest,
+ requestDeserialize: deserialize_pactus_SignMessageRequest,
+ responseSerialize: serialize_pactus_SignMessageResponse,
+ responseDeserialize: deserialize_pactus_SignMessageResponse,
+ },
};
exports.WalletClient = grpc.makeGenericClientConstructor(WalletService);
diff --git a/www/grpc/gen/js/wallet_pb.js b/www/grpc/gen/js/wallet_pb.js
index a4ec91712..4e53e90ea 100644
--- a/www/grpc/gen/js/wallet_pb.js
+++ b/www/grpc/gen/js/wallet_pb.js
@@ -40,6 +40,8 @@ goog.exportSymbol('proto.pactus.LoadWalletRequest', null, global);
goog.exportSymbol('proto.pactus.LoadWalletResponse', null, global);
goog.exportSymbol('proto.pactus.RestoreWalletRequest', null, global);
goog.exportSymbol('proto.pactus.RestoreWalletResponse', null, global);
+goog.exportSymbol('proto.pactus.SignMessageRequest', null, global);
+goog.exportSymbol('proto.pactus.SignMessageResponse', null, global);
goog.exportSymbol('proto.pactus.SignRawTransactionRequest', null, global);
goog.exportSymbol('proto.pactus.SignRawTransactionResponse', null, global);
goog.exportSymbol('proto.pactus.UnloadWalletRequest', null, global);
@@ -464,6 +466,48 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.pactus.GetTotalBalanceResponse.displayName = 'proto.pactus.GetTotalBalanceResponse';
}
+/**
+ * Generated by JsPbCodeGenerator.
+ * @param {Array=} opt_data Optional initial data array, typically from a
+ * server response, or constructed directly in Javascript. The array is used
+ * in place and becomes part of the constructed object. It is not cloned.
+ * If no data is provided, the constructed object will be empty, but still
+ * valid.
+ * @extends {jspb.Message}
+ * @constructor
+ */
+proto.pactus.SignMessageRequest = function(opt_data) {
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
+};
+goog.inherits(proto.pactus.SignMessageRequest, jspb.Message);
+if (goog.DEBUG && !COMPILED) {
+ /**
+ * @public
+ * @override
+ */
+ proto.pactus.SignMessageRequest.displayName = 'proto.pactus.SignMessageRequest';
+}
+/**
+ * Generated by JsPbCodeGenerator.
+ * @param {Array=} opt_data Optional initial data array, typically from a
+ * server response, or constructed directly in Javascript. The array is used
+ * in place and becomes part of the constructed object. It is not cloned.
+ * If no data is provided, the constructed object will be empty, but still
+ * valid.
+ * @extends {jspb.Message}
+ * @constructor
+ */
+proto.pactus.SignMessageResponse = function(opt_data) {
+ jspb.Message.initialize(this, opt_data, 0, -1, null, null);
+};
+goog.inherits(proto.pactus.SignMessageResponse, jspb.Message);
+if (goog.DEBUG && !COMPILED) {
+ /**
+ * @public
+ * @override
+ */
+ proto.pactus.SignMessageResponse.displayName = 'proto.pactus.SignMessageResponse';
+}
@@ -3655,6 +3699,356 @@ proto.pactus.GetTotalBalanceResponse.prototype.setTotalBalance = function(value)
};
+
+
+
+if (jspb.Message.GENERATE_TO_OBJECT) {
+/**
+ * Creates an object representation of this proto.
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
+ * Optional fields that are not set will be set to undefined.
+ * To access a reserved field use, foo.pb_, eg, foo.pb_default.
+ * For the list of reserved names please see:
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
+ * JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @return {!Object}
+ */
+proto.pactus.SignMessageRequest.prototype.toObject = function(opt_includeInstance) {
+ return proto.pactus.SignMessageRequest.toObject(opt_includeInstance, this);
+};
+
+
+/**
+ * Static version of the {@see toObject} method.
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
+ * the JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @param {!proto.pactus.SignMessageRequest} msg The msg instance to transform.
+ * @return {!Object}
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.SignMessageRequest.toObject = function(includeInstance, msg) {
+ var f, obj = {
+ walletName: jspb.Message.getFieldWithDefault(msg, 1, ""),
+ password: jspb.Message.getFieldWithDefault(msg, 2, ""),
+ address: jspb.Message.getFieldWithDefault(msg, 3, ""),
+ message: jspb.Message.getFieldWithDefault(msg, 4, "")
+ };
+
+ if (includeInstance) {
+ obj.$jspbMessageInstance = msg;
+ }
+ return obj;
+};
+}
+
+
+/**
+ * Deserializes binary data (in protobuf wire format).
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
+ * @return {!proto.pactus.SignMessageRequest}
+ */
+proto.pactus.SignMessageRequest.deserializeBinary = function(bytes) {
+ var reader = new jspb.BinaryReader(bytes);
+ var msg = new proto.pactus.SignMessageRequest;
+ return proto.pactus.SignMessageRequest.deserializeBinaryFromReader(msg, reader);
+};
+
+
+/**
+ * Deserializes binary data (in protobuf wire format) from the
+ * given reader into the given message object.
+ * @param {!proto.pactus.SignMessageRequest} msg The message object to deserialize into.
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
+ * @return {!proto.pactus.SignMessageRequest}
+ */
+proto.pactus.SignMessageRequest.deserializeBinaryFromReader = function(msg, reader) {
+ while (reader.nextField()) {
+ if (reader.isEndGroup()) {
+ break;
+ }
+ var field = reader.getFieldNumber();
+ switch (field) {
+ case 1:
+ var value = /** @type {string} */ (reader.readString());
+ msg.setWalletName(value);
+ break;
+ case 2:
+ var value = /** @type {string} */ (reader.readString());
+ msg.setPassword(value);
+ break;
+ case 3:
+ var value = /** @type {string} */ (reader.readString());
+ msg.setAddress(value);
+ break;
+ case 4:
+ var value = /** @type {string} */ (reader.readString());
+ msg.setMessage(value);
+ break;
+ default:
+ reader.skipField();
+ break;
+ }
+ }
+ return msg;
+};
+
+
+/**
+ * Serializes the message to binary data (in protobuf wire format).
+ * @return {!Uint8Array}
+ */
+proto.pactus.SignMessageRequest.prototype.serializeBinary = function() {
+ var writer = new jspb.BinaryWriter();
+ proto.pactus.SignMessageRequest.serializeBinaryToWriter(this, writer);
+ return writer.getResultBuffer();
+};
+
+
+/**
+ * Serializes the given message to binary data (in protobuf wire
+ * format), writing to the given BinaryWriter.
+ * @param {!proto.pactus.SignMessageRequest} message
+ * @param {!jspb.BinaryWriter} writer
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.SignMessageRequest.serializeBinaryToWriter = function(message, writer) {
+ var f = undefined;
+ f = message.getWalletName();
+ if (f.length > 0) {
+ writer.writeString(
+ 1,
+ f
+ );
+ }
+ f = message.getPassword();
+ if (f.length > 0) {
+ writer.writeString(
+ 2,
+ f
+ );
+ }
+ f = message.getAddress();
+ if (f.length > 0) {
+ writer.writeString(
+ 3,
+ f
+ );
+ }
+ f = message.getMessage();
+ if (f.length > 0) {
+ writer.writeString(
+ 4,
+ f
+ );
+ }
+};
+
+
+/**
+ * optional string wallet_name = 1;
+ * @return {string}
+ */
+proto.pactus.SignMessageRequest.prototype.getWalletName = function() {
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
+};
+
+
+/**
+ * @param {string} value
+ * @return {!proto.pactus.SignMessageRequest} returns this
+ */
+proto.pactus.SignMessageRequest.prototype.setWalletName = function(value) {
+ return jspb.Message.setProto3StringField(this, 1, value);
+};
+
+
+/**
+ * optional string password = 2;
+ * @return {string}
+ */
+proto.pactus.SignMessageRequest.prototype.getPassword = function() {
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
+};
+
+
+/**
+ * @param {string} value
+ * @return {!proto.pactus.SignMessageRequest} returns this
+ */
+proto.pactus.SignMessageRequest.prototype.setPassword = function(value) {
+ return jspb.Message.setProto3StringField(this, 2, value);
+};
+
+
+/**
+ * optional string address = 3;
+ * @return {string}
+ */
+proto.pactus.SignMessageRequest.prototype.getAddress = function() {
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
+};
+
+
+/**
+ * @param {string} value
+ * @return {!proto.pactus.SignMessageRequest} returns this
+ */
+proto.pactus.SignMessageRequest.prototype.setAddress = function(value) {
+ return jspb.Message.setProto3StringField(this, 3, value);
+};
+
+
+/**
+ * optional string message = 4;
+ * @return {string}
+ */
+proto.pactus.SignMessageRequest.prototype.getMessage = function() {
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
+};
+
+
+/**
+ * @param {string} value
+ * @return {!proto.pactus.SignMessageRequest} returns this
+ */
+proto.pactus.SignMessageRequest.prototype.setMessage = function(value) {
+ return jspb.Message.setProto3StringField(this, 4, value);
+};
+
+
+
+
+
+if (jspb.Message.GENERATE_TO_OBJECT) {
+/**
+ * Creates an object representation of this proto.
+ * Field names that are reserved in JavaScript and will be renamed to pb_name.
+ * Optional fields that are not set will be set to undefined.
+ * To access a reserved field use, foo.pb_, eg, foo.pb_default.
+ * For the list of reserved names please see:
+ * net/proto2/compiler/js/internal/generator.cc#kKeyword.
+ * @param {boolean=} opt_includeInstance Deprecated. whether to include the
+ * JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @return {!Object}
+ */
+proto.pactus.SignMessageResponse.prototype.toObject = function(opt_includeInstance) {
+ return proto.pactus.SignMessageResponse.toObject(opt_includeInstance, this);
+};
+
+
+/**
+ * Static version of the {@see toObject} method.
+ * @param {boolean|undefined} includeInstance Deprecated. Whether to include
+ * the JSPB instance for transitional soy proto support:
+ * http://goto/soy-param-migration
+ * @param {!proto.pactus.SignMessageResponse} msg The msg instance to transform.
+ * @return {!Object}
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.SignMessageResponse.toObject = function(includeInstance, msg) {
+ var f, obj = {
+ signature: jspb.Message.getFieldWithDefault(msg, 1, "")
+ };
+
+ if (includeInstance) {
+ obj.$jspbMessageInstance = msg;
+ }
+ return obj;
+};
+}
+
+
+/**
+ * Deserializes binary data (in protobuf wire format).
+ * @param {jspb.ByteSource} bytes The bytes to deserialize.
+ * @return {!proto.pactus.SignMessageResponse}
+ */
+proto.pactus.SignMessageResponse.deserializeBinary = function(bytes) {
+ var reader = new jspb.BinaryReader(bytes);
+ var msg = new proto.pactus.SignMessageResponse;
+ return proto.pactus.SignMessageResponse.deserializeBinaryFromReader(msg, reader);
+};
+
+
+/**
+ * Deserializes binary data (in protobuf wire format) from the
+ * given reader into the given message object.
+ * @param {!proto.pactus.SignMessageResponse} msg The message object to deserialize into.
+ * @param {!jspb.BinaryReader} reader The BinaryReader to use.
+ * @return {!proto.pactus.SignMessageResponse}
+ */
+proto.pactus.SignMessageResponse.deserializeBinaryFromReader = function(msg, reader) {
+ while (reader.nextField()) {
+ if (reader.isEndGroup()) {
+ break;
+ }
+ var field = reader.getFieldNumber();
+ switch (field) {
+ case 1:
+ var value = /** @type {string} */ (reader.readString());
+ msg.setSignature(value);
+ break;
+ default:
+ reader.skipField();
+ break;
+ }
+ }
+ return msg;
+};
+
+
+/**
+ * Serializes the message to binary data (in protobuf wire format).
+ * @return {!Uint8Array}
+ */
+proto.pactus.SignMessageResponse.prototype.serializeBinary = function() {
+ var writer = new jspb.BinaryWriter();
+ proto.pactus.SignMessageResponse.serializeBinaryToWriter(this, writer);
+ return writer.getResultBuffer();
+};
+
+
+/**
+ * Serializes the given message to binary data (in protobuf wire
+ * format), writing to the given BinaryWriter.
+ * @param {!proto.pactus.SignMessageResponse} message
+ * @param {!jspb.BinaryWriter} writer
+ * @suppress {unusedLocalVariables} f is only used for nested messages
+ */
+proto.pactus.SignMessageResponse.serializeBinaryToWriter = function(message, writer) {
+ var f = undefined;
+ f = message.getSignature();
+ if (f.length > 0) {
+ writer.writeString(
+ 1,
+ f
+ );
+ }
+};
+
+
+/**
+ * optional string signature = 1;
+ * @return {string}
+ */
+proto.pactus.SignMessageResponse.prototype.getSignature = function() {
+ return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
+};
+
+
+/**
+ * @param {string} value
+ * @return {!proto.pactus.SignMessageResponse} returns this
+ */
+proto.pactus.SignMessageResponse.prototype.setSignature = function(value) {
+ return jspb.Message.setProto3StringField(this, 1, value);
+};
+
+
/**
* @enum {number}
*/
diff --git a/www/grpc/gen/python/utils_pb2.py b/www/grpc/gen/python/utils_pb2.py
new file mode 100644
index 000000000..7861e87ad
--- /dev/null
+++ b/www/grpc/gen/python/utils_pb2.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: utils.proto
+"""Generated protocol buffer code."""
+from google.protobuf.internal import builder as _builder
+from google.protobuf import descriptor as _descriptor
+from google.protobuf import descriptor_pool as _descriptor_pool
+from google.protobuf import symbol_database as _symbol_database
+# @@protoc_insertion_point(imports)
+
+_sym_db = _symbol_database.Default()
+
+
+
+
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0butils.proto\x12\x06pactus\"]\n SignMessageWithPrivateKeyRequest\x12\x1f\n\x0bprivate_key\x18\x01 \x01(\tR\nprivateKey\x12\x18\n\x07message\x18\x02 \x01(\tR\x07message\"A\n!SignMessageWithPrivateKeyResponse\x12\x1c\n\tsignature\x18\x01 \x01(\tR\tsignature\"m\n\x14VerifyMessageRequest\x12\x18\n\x07message\x18\x01 \x01(\tR\x07message\x12\x1c\n\tsignature\x18\x02 \x01(\tR\tsignature\x12\x1d\n\npublic_key\x18\x03 \x01(\tR\tpublicKey\"2\n\x15VerifyMessageResponse\x12\x19\n\x08is_valid\x18\x01 \x01(\x08R\x07isValid2\xc7\x01\n\x05Utils\x12p\n\x19SignMessageWithPrivateKey\x12(.pactus.SignMessageWithPrivateKeyRequest\x1a).pactus.SignMessageWithPrivateKeyResponse\x12L\n\rVerifyMessage\x12\x1c.pactus.VerifyMessageRequest\x1a\x1d.pactus.VerifyMessageResponseB@\n\x0cpactus.utilsZ0github.com/pactus-project/pactus/www/grpc/pactusb\x06proto3')
+
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'utils_pb2', globals())
+if _descriptor._USE_C_DESCRIPTORS == False:
+
+ DESCRIPTOR._options = None
+ DESCRIPTOR._serialized_options = b'\n\014pactus.utilsZ0github.com/pactus-project/pactus/www/grpc/pactus'
+ _SIGNMESSAGEWITHPRIVATEKEYREQUEST._serialized_start=23
+ _SIGNMESSAGEWITHPRIVATEKEYREQUEST._serialized_end=116
+ _SIGNMESSAGEWITHPRIVATEKEYRESPONSE._serialized_start=118
+ _SIGNMESSAGEWITHPRIVATEKEYRESPONSE._serialized_end=183
+ _VERIFYMESSAGEREQUEST._serialized_start=185
+ _VERIFYMESSAGEREQUEST._serialized_end=294
+ _VERIFYMESSAGERESPONSE._serialized_start=296
+ _VERIFYMESSAGERESPONSE._serialized_end=346
+ _UTILS._serialized_start=349
+ _UTILS._serialized_end=548
+# @@protoc_insertion_point(module_scope)
diff --git a/www/grpc/gen/python/utils_pb2_grpc.py b/www/grpc/gen/python/utils_pb2_grpc.py
new file mode 100644
index 000000000..90e02e1c8
--- /dev/null
+++ b/www/grpc/gen/python/utils_pb2_grpc.py
@@ -0,0 +1,107 @@
+# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
+"""Client and server classes corresponding to protobuf-defined services."""
+import grpc
+
+import utils_pb2 as utils__pb2
+
+
+class UtilsStub(object):
+ """Utils service defines RPC methods for utility functions such as message
+ signing and verification.
+ """
+
+ def __init__(self, channel):
+ """Constructor.
+
+ Args:
+ channel: A grpc.Channel.
+ """
+ self.SignMessageWithPrivateKey = channel.unary_unary(
+ '/pactus.Utils/SignMessageWithPrivateKey',
+ request_serializer=utils__pb2.SignMessageWithPrivateKeyRequest.SerializeToString,
+ response_deserializer=utils__pb2.SignMessageWithPrivateKeyResponse.FromString,
+ )
+ self.VerifyMessage = channel.unary_unary(
+ '/pactus.Utils/VerifyMessage',
+ request_serializer=utils__pb2.VerifyMessageRequest.SerializeToString,
+ response_deserializer=utils__pb2.VerifyMessageResponse.FromString,
+ )
+
+
+class UtilsServicer(object):
+ """Utils service defines RPC methods for utility functions such as message
+ signing and verification.
+ """
+
+ def SignMessageWithPrivateKey(self, request, context):
+ """SignMessageWithPrivateKey sign message with provided private key.
+ """
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+ def VerifyMessage(self, request, context):
+ """VerifyMessage verify signature with public key and message
+ """
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
+
+def add_UtilsServicer_to_server(servicer, server):
+ rpc_method_handlers = {
+ 'SignMessageWithPrivateKey': grpc.unary_unary_rpc_method_handler(
+ servicer.SignMessageWithPrivateKey,
+ request_deserializer=utils__pb2.SignMessageWithPrivateKeyRequest.FromString,
+ response_serializer=utils__pb2.SignMessageWithPrivateKeyResponse.SerializeToString,
+ ),
+ 'VerifyMessage': grpc.unary_unary_rpc_method_handler(
+ servicer.VerifyMessage,
+ request_deserializer=utils__pb2.VerifyMessageRequest.FromString,
+ response_serializer=utils__pb2.VerifyMessageResponse.SerializeToString,
+ ),
+ }
+ generic_handler = grpc.method_handlers_generic_handler(
+ 'pactus.Utils', rpc_method_handlers)
+ server.add_generic_rpc_handlers((generic_handler,))
+
+
+ # This class is part of an EXPERIMENTAL API.
+class Utils(object):
+ """Utils service defines RPC methods for utility functions such as message
+ signing and verification.
+ """
+
+ @staticmethod
+ def SignMessageWithPrivateKey(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/pactus.Utils/SignMessageWithPrivateKey',
+ utils__pb2.SignMessageWithPrivateKeyRequest.SerializeToString,
+ utils__pb2.SignMessageWithPrivateKeyResponse.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+
+ @staticmethod
+ def VerifyMessage(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/pactus.Utils/VerifyMessage',
+ utils__pb2.VerifyMessageRequest.SerializeToString,
+ utils__pb2.VerifyMessageResponse.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
diff --git a/www/grpc/gen/python/wallet_pb2.py b/www/grpc/gen/python/wallet_pb2.py
index c38ae8742..5dfe4de4d 100644
--- a/www/grpc/gen/python/wallet_pb2.py
+++ b/www/grpc/gen/python/wallet_pb2.py
@@ -14,7 +14,7 @@
import transaction_pb2 as transaction__pb2
-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cwallet.proto\x12\x06pactus\x1a\x11transaction.proto\"p\n\x0b\x41\x64\x64ressInfo\x12\x18\n\x07\x61\x64\x64ress\x18\x01 \x01(\tR\x07\x61\x64\x64ress\x12\x1d\n\npublic_key\x18\x02 \x01(\tR\tpublicKey\x12\x14\n\x05label\x18\x03 \x01(\tR\x05label\x12\x12\n\x04path\x18\x04 \x01(\tR\x04path\"\xa5\x01\n\x0bHistoryInfo\x12%\n\x0etransaction_id\x18\x01 \x01(\tR\rtransactionId\x12\x12\n\x04time\x18\x02 \x01(\rR\x04time\x12!\n\x0cpayload_type\x18\x03 \x01(\tR\x0bpayloadType\x12 \n\x0b\x64\x65scription\x18\x04 \x01(\tR\x0b\x64\x65scription\x12\x16\n\x06\x61mount\x18\x05 \x01(\x03R\x06\x61mount\"U\n\x18GetAddressHistoryRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\x18\n\x07\x61\x64\x64ress\x18\x02 \x01(\tR\x07\x61\x64\x64ress\"S\n\x19GetAddressHistoryResponse\x12\x36\n\x0chistory_info\x18\x01 \x03(\x0b\x32\x13.pactus.HistoryInfoR\x0bhistoryInfo\"\x85\x01\n\x14GetNewAddressRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\x36\n\x0c\x61\x64\x64ress_type\x18\x02 \x01(\x0e\x32\x13.pactus.AddressTypeR\x0b\x61\x64\x64ressType\x12\x14\n\x05label\x18\x03 \x01(\tR\x05label\"p\n\x15GetNewAddressResponse\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\x36\n\x0c\x61\x64\x64ress_info\x18\x02 \x01(\x0b\x32\x13.pactus.AddressInfoR\x0b\x61\x64\x64ressInfo\"o\n\x14RestoreWalletRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\x1a\n\x08mnemonic\x18\x02 \x01(\tR\x08mnemonic\x12\x1a\n\x08password\x18\x03 \x01(\tR\x08password\"8\n\x15RestoreWalletResponse\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\"R\n\x13\x43reateWalletRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\x1a\n\x08password\x18\x04 \x01(\tR\x08password\"2\n\x14\x43reateWalletResponse\x12\x1a\n\x08mnemonic\x18\x02 \x01(\tR\x08mnemonic\"4\n\x11LoadWalletRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\"5\n\x12LoadWalletResponse\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\"6\n\x13UnloadWalletRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\"7\n\x14UnloadWalletResponse\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\";\n\x1aGetValidatorAddressRequest\x12\x1d\n\npublic_key\x18\x01 \x01(\tR\tpublicKey\"7\n\x1bGetValidatorAddressResponse\x12\x18\n\x07\x61\x64\x64ress\x18\x01 \x01(\tR\x07\x61\x64\x64ress\"\x81\x01\n\x19SignRawTransactionRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\'\n\x0fraw_transaction\x18\x02 \x01(\tR\x0erawTransaction\x12\x1a\n\x08password\x18\x03 \x01(\tR\x08password\"y\n\x1aSignRawTransactionResponse\x12%\n\x0etransaction_id\x18\x01 \x01(\tR\rtransactionId\x12\x34\n\x16signed_raw_transaction\x18\x02 \x01(\tR\x14signedRawTransaction\"9\n\x16GetTotalBalanceRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\"_\n\x17GetTotalBalanceResponse\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12#\n\rtotal_balance\x18\x02 \x01(\x03R\x0ctotalBalance*b\n\x0b\x41\x64\x64ressType\x12\x19\n\x15\x41\x44\x44RESS_TYPE_TREASURY\x10\x00\x12\x1a\n\x16\x41\x44\x44RESS_TYPE_VALIDATOR\x10\x01\x12\x1c\n\x18\x41\x44\x44RESS_TYPE_BLS_ACCOUNT\x10\x02\x32\xea\x05\n\x06Wallet\x12I\n\x0c\x43reateWallet\x12\x1b.pactus.CreateWalletRequest\x1a\x1c.pactus.CreateWalletResponse\x12L\n\rRestoreWallet\x12\x1c.pactus.RestoreWalletRequest\x1a\x1d.pactus.RestoreWalletResponse\x12\x43\n\nLoadWallet\x12\x19.pactus.LoadWalletRequest\x1a\x1a.pactus.LoadWalletResponse\x12I\n\x0cUnloadWallet\x12\x1b.pactus.UnloadWalletRequest\x1a\x1c.pactus.UnloadWalletResponse\x12R\n\x0fGetTotalBalance\x12\x1e.pactus.GetTotalBalanceRequest\x1a\x1f.pactus.GetTotalBalanceResponse\x12[\n\x12SignRawTransaction\x12!.pactus.SignRawTransactionRequest\x1a\".pactus.SignRawTransactionResponse\x12^\n\x13GetValidatorAddress\x12\".pactus.GetValidatorAddressRequest\x1a#.pactus.GetValidatorAddressResponse\x12L\n\rGetNewAddress\x12\x1c.pactus.GetNewAddressRequest\x1a\x1d.pactus.GetNewAddressResponse\x12X\n\x11GetAddressHistory\x12 .pactus.GetAddressHistoryRequest\x1a!.pactus.GetAddressHistoryResponseBA\n\rpactus.walletZ0github.com/pactus-project/pactus/www/grpc/pactusb\x06proto3')
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cwallet.proto\x12\x06pactus\x1a\x11transaction.proto\"p\n\x0b\x41\x64\x64ressInfo\x12\x18\n\x07\x61\x64\x64ress\x18\x01 \x01(\tR\x07\x61\x64\x64ress\x12\x1d\n\npublic_key\x18\x02 \x01(\tR\tpublicKey\x12\x14\n\x05label\x18\x03 \x01(\tR\x05label\x12\x12\n\x04path\x18\x04 \x01(\tR\x04path\"\xa5\x01\n\x0bHistoryInfo\x12%\n\x0etransaction_id\x18\x01 \x01(\tR\rtransactionId\x12\x12\n\x04time\x18\x02 \x01(\rR\x04time\x12!\n\x0cpayload_type\x18\x03 \x01(\tR\x0bpayloadType\x12 \n\x0b\x64\x65scription\x18\x04 \x01(\tR\x0b\x64\x65scription\x12\x16\n\x06\x61mount\x18\x05 \x01(\x03R\x06\x61mount\"U\n\x18GetAddressHistoryRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\x18\n\x07\x61\x64\x64ress\x18\x02 \x01(\tR\x07\x61\x64\x64ress\"S\n\x19GetAddressHistoryResponse\x12\x36\n\x0chistory_info\x18\x01 \x03(\x0b\x32\x13.pactus.HistoryInfoR\x0bhistoryInfo\"\x85\x01\n\x14GetNewAddressRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\x36\n\x0c\x61\x64\x64ress_type\x18\x02 \x01(\x0e\x32\x13.pactus.AddressTypeR\x0b\x61\x64\x64ressType\x12\x14\n\x05label\x18\x03 \x01(\tR\x05label\"p\n\x15GetNewAddressResponse\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\x36\n\x0c\x61\x64\x64ress_info\x18\x02 \x01(\x0b\x32\x13.pactus.AddressInfoR\x0b\x61\x64\x64ressInfo\"o\n\x14RestoreWalletRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\x1a\n\x08mnemonic\x18\x02 \x01(\tR\x08mnemonic\x12\x1a\n\x08password\x18\x03 \x01(\tR\x08password\"8\n\x15RestoreWalletResponse\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\"R\n\x13\x43reateWalletRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\x1a\n\x08password\x18\x04 \x01(\tR\x08password\"2\n\x14\x43reateWalletResponse\x12\x1a\n\x08mnemonic\x18\x02 \x01(\tR\x08mnemonic\"4\n\x11LoadWalletRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\"5\n\x12LoadWalletResponse\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\"6\n\x13UnloadWalletRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\"7\n\x14UnloadWalletResponse\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\";\n\x1aGetValidatorAddressRequest\x12\x1d\n\npublic_key\x18\x01 \x01(\tR\tpublicKey\"7\n\x1bGetValidatorAddressResponse\x12\x18\n\x07\x61\x64\x64ress\x18\x01 \x01(\tR\x07\x61\x64\x64ress\"\x81\x01\n\x19SignRawTransactionRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\'\n\x0fraw_transaction\x18\x02 \x01(\tR\x0erawTransaction\x12\x1a\n\x08password\x18\x03 \x01(\tR\x08password\"y\n\x1aSignRawTransactionResponse\x12%\n\x0etransaction_id\x18\x01 \x01(\tR\rtransactionId\x12\x34\n\x16signed_raw_transaction\x18\x02 \x01(\tR\x14signedRawTransaction\"9\n\x16GetTotalBalanceRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\"_\n\x17GetTotalBalanceResponse\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12#\n\rtotal_balance\x18\x02 \x01(\x03R\x0ctotalBalance\"\x85\x01\n\x12SignMessageRequest\x12\x1f\n\x0bwallet_name\x18\x01 \x01(\tR\nwalletName\x12\x1a\n\x08password\x18\x02 \x01(\tR\x08password\x12\x18\n\x07\x61\x64\x64ress\x18\x03 \x01(\tR\x07\x61\x64\x64ress\x12\x18\n\x07message\x18\x04 \x01(\tR\x07message\"3\n\x13SignMessageResponse\x12\x1c\n\tsignature\x18\x01 \x01(\tR\tsignature*b\n\x0b\x41\x64\x64ressType\x12\x19\n\x15\x41\x44\x44RESS_TYPE_TREASURY\x10\x00\x12\x1a\n\x16\x41\x44\x44RESS_TYPE_VALIDATOR\x10\x01\x12\x1c\n\x18\x41\x44\x44RESS_TYPE_BLS_ACCOUNT\x10\x02\x32\xb2\x06\n\x06Wallet\x12I\n\x0c\x43reateWallet\x12\x1b.pactus.CreateWalletRequest\x1a\x1c.pactus.CreateWalletResponse\x12L\n\rRestoreWallet\x12\x1c.pactus.RestoreWalletRequest\x1a\x1d.pactus.RestoreWalletResponse\x12\x43\n\nLoadWallet\x12\x19.pactus.LoadWalletRequest\x1a\x1a.pactus.LoadWalletResponse\x12I\n\x0cUnloadWallet\x12\x1b.pactus.UnloadWalletRequest\x1a\x1c.pactus.UnloadWalletResponse\x12R\n\x0fGetTotalBalance\x12\x1e.pactus.GetTotalBalanceRequest\x1a\x1f.pactus.GetTotalBalanceResponse\x12[\n\x12SignRawTransaction\x12!.pactus.SignRawTransactionRequest\x1a\".pactus.SignRawTransactionResponse\x12^\n\x13GetValidatorAddress\x12\".pactus.GetValidatorAddressRequest\x1a#.pactus.GetValidatorAddressResponse\x12L\n\rGetNewAddress\x12\x1c.pactus.GetNewAddressRequest\x1a\x1d.pactus.GetNewAddressResponse\x12X\n\x11GetAddressHistory\x12 .pactus.GetAddressHistoryRequest\x1a!.pactus.GetAddressHistoryResponse\x12\x46\n\x0bSignMessage\x12\x1a.pactus.SignMessageRequest\x1a\x1b.pactus.SignMessageResponseBA\n\rpactus.walletZ0github.com/pactus-project/pactus/www/grpc/pactusb\x06proto3')
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'wallet_pb2', globals())
@@ -22,8 +22,8 @@
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'\n\rpactus.walletZ0github.com/pactus-project/pactus/www/grpc/pactus'
- _ADDRESSTYPE._serialized_start=1805
- _ADDRESSTYPE._serialized_end=1903
+ _ADDRESSTYPE._serialized_start=1994
+ _ADDRESSTYPE._serialized_end=2092
_ADDRESSINFO._serialized_start=43
_ADDRESSINFO._serialized_end=155
_HISTORYINFO._serialized_start=158
@@ -64,6 +64,10 @@
_GETTOTALBALANCEREQUEST._serialized_end=1706
_GETTOTALBALANCERESPONSE._serialized_start=1708
_GETTOTALBALANCERESPONSE._serialized_end=1803
- _WALLET._serialized_start=1906
- _WALLET._serialized_end=2652
+ _SIGNMESSAGEREQUEST._serialized_start=1806
+ _SIGNMESSAGEREQUEST._serialized_end=1939
+ _SIGNMESSAGERESPONSE._serialized_start=1941
+ _SIGNMESSAGERESPONSE._serialized_end=1992
+ _WALLET._serialized_start=2095
+ _WALLET._serialized_end=2913
# @@protoc_insertion_point(module_scope)
diff --git a/www/grpc/gen/python/wallet_pb2_grpc.py b/www/grpc/gen/python/wallet_pb2_grpc.py
index b3ada2bf4..0bdf5636e 100644
--- a/www/grpc/gen/python/wallet_pb2_grpc.py
+++ b/www/grpc/gen/python/wallet_pb2_grpc.py
@@ -60,6 +60,11 @@ def __init__(self, channel):
request_serializer=wallet__pb2.GetAddressHistoryRequest.SerializeToString,
response_deserializer=wallet__pb2.GetAddressHistoryResponse.FromString,
)
+ self.SignMessage = channel.unary_unary(
+ '/pactus.Wallet/SignMessage',
+ request_serializer=wallet__pb2.SignMessageRequest.SerializeToString,
+ response_deserializer=wallet__pb2.SignMessageResponse.FromString,
+ )
class WalletServicer(object):
@@ -130,6 +135,13 @@ def GetAddressHistory(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
+ def SignMessage(self, request, context):
+ """SignMessage signs an arbitrary message.
+ """
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
+ context.set_details('Method not implemented!')
+ raise NotImplementedError('Method not implemented!')
+
def add_WalletServicer_to_server(servicer, server):
rpc_method_handlers = {
@@ -178,6 +190,11 @@ def add_WalletServicer_to_server(servicer, server):
request_deserializer=wallet__pb2.GetAddressHistoryRequest.FromString,
response_serializer=wallet__pb2.GetAddressHistoryResponse.SerializeToString,
),
+ 'SignMessage': grpc.unary_unary_rpc_method_handler(
+ servicer.SignMessage,
+ request_deserializer=wallet__pb2.SignMessageRequest.FromString,
+ response_serializer=wallet__pb2.SignMessageResponse.SerializeToString,
+ ),
}
generic_handler = grpc.method_handlers_generic_handler(
'pactus.Wallet', rpc_method_handlers)
@@ -341,3 +358,20 @@ def GetAddressHistory(request,
wallet__pb2.GetAddressHistoryResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+
+ @staticmethod
+ def SignMessage(request,
+ target,
+ options=(),
+ channel_credentials=None,
+ call_credentials=None,
+ insecure=False,
+ compression=None,
+ wait_for_ready=None,
+ timeout=None,
+ metadata=None):
+ return grpc.experimental.unary_unary(request, target, '/pactus.Wallet/SignMessage',
+ wallet__pb2.SignMessageRequest.SerializeToString,
+ wallet__pb2.SignMessageResponse.FromString,
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
diff --git a/www/grpc/gen/rust/pactus.rs b/www/grpc/gen/rust/pactus.rs
index f2bbd36bd..8bbe8bd42 100644
--- a/www/grpc/gen/rust/pactus.rs
+++ b/www/grpc/gen/rust/pactus.rs
@@ -923,6 +923,47 @@ pub struct PeerInfo {
#[prost(int32, tag="20")]
pub completed_sessions: i32,
}
+/// Request message for sign message with private key.
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct SignMessageWithPrivateKeyRequest {
+ /// The private key to sign the message.
+ #[prost(string, tag="1")]
+ pub private_key: ::prost::alloc::string::String,
+ /// The message to sign.
+ #[prost(string, tag="2")]
+ pub message: ::prost::alloc::string::String,
+}
+/// Response message containing the generated signature.
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct SignMessageWithPrivateKeyResponse {
+ /// The signature of the message.
+ #[prost(string, tag="1")]
+ pub signature: ::prost::alloc::string::String,
+}
+/// Request message for verifying a message signature.
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct VerifyMessageRequest {
+ /// The signed message.
+ #[prost(string, tag="1")]
+ pub message: ::prost::alloc::string::String,
+ /// The signature of the message.
+ #[prost(string, tag="2")]
+ pub signature: ::prost::alloc::string::String,
+ /// The public key of the signer.
+ #[prost(string, tag="3")]
+ pub public_key: ::prost::alloc::string::String,
+}
+/// Response message containing the resualt of validation of signature and message.
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct VerifyMessageResponse {
+ /// Indicates if the signature is valid (true) or not (false).
+ #[prost(bool, tag="1")]
+ pub is_valid: bool,
+}
/// Message containing address information.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
@@ -1139,6 +1180,31 @@ pub struct GetTotalBalanceResponse {
#[prost(int64, tag="2")]
pub total_balance: i64,
}
+/// Request message to sign an arbitrary message.
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct SignMessageRequest {
+ /// The name of the wallet.
+ #[prost(string, tag="1")]
+ pub wallet_name: ::prost::alloc::string::String,
+ /// The password for unlocking the wallet for signing.
+ #[prost(string, tag="2")]
+ pub password: ::prost::alloc::string::String,
+ /// The account address associated with the private key.
+ #[prost(string, tag="3")]
+ pub address: ::prost::alloc::string::String,
+ /// The arbitrary message to be signed.
+ #[prost(string, tag="4")]
+ pub message: ::prost::alloc::string::String,
+}
+/// Response message containing the available balance of the wallet.
+#[allow(clippy::derive_partial_eq_without_eq)]
+#[derive(Clone, PartialEq, ::prost::Message)]
+pub struct SignMessageResponse {
+ /// Signature of the message.
+ #[prost(string, tag="1")]
+ pub signature: ::prost::alloc::string::String,
+}
/// Enum for the address type.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
diff --git a/www/grpc/gen/rust/pactus.serde.rs b/www/grpc/gen/rust/pactus.serde.rs
index 0c8282451..7cd19d589 100644
--- a/www/grpc/gen/rust/pactus.serde.rs
+++ b/www/grpc/gen/rust/pactus.serde.rs
@@ -8017,6 +8017,440 @@ impl<'de> serde::Deserialize<'de> for RestoreWalletResponse {
deserializer.deserialize_struct("pactus.RestoreWalletResponse", FIELDS, GeneratedVisitor)
}
}
+impl serde::Serialize for SignMessageRequest {
+ #[allow(deprecated)]
+ fn serialize(&self, serializer: S) -> std::result::Result
+ where
+ S: serde::Serializer,
+ {
+ use serde::ser::SerializeStruct;
+ let mut len = 0;
+ if !self.wallet_name.is_empty() {
+ len += 1;
+ }
+ if !self.password.is_empty() {
+ len += 1;
+ }
+ if !self.address.is_empty() {
+ len += 1;
+ }
+ if !self.message.is_empty() {
+ len += 1;
+ }
+ let mut struct_ser = serializer.serialize_struct("pactus.SignMessageRequest", len)?;
+ if !self.wallet_name.is_empty() {
+ struct_ser.serialize_field("walletName", &self.wallet_name)?;
+ }
+ if !self.password.is_empty() {
+ struct_ser.serialize_field("password", &self.password)?;
+ }
+ if !self.address.is_empty() {
+ struct_ser.serialize_field("address", &self.address)?;
+ }
+ if !self.message.is_empty() {
+ struct_ser.serialize_field("message", &self.message)?;
+ }
+ struct_ser.end()
+ }
+}
+impl<'de> serde::Deserialize<'de> for SignMessageRequest {
+ #[allow(deprecated)]
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ const FIELDS: &[&str] = &[
+ "wallet_name",
+ "walletName",
+ "password",
+ "address",
+ "message",
+ ];
+
+ #[allow(clippy::enum_variant_names)]
+ enum GeneratedField {
+ WalletName,
+ Password,
+ Address,
+ Message,
+ }
+ impl<'de> serde::Deserialize<'de> for GeneratedField {
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ struct GeneratedVisitor;
+
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = GeneratedField;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(formatter, "expected one of: {:?}", &FIELDS)
+ }
+
+ #[allow(unused_variables)]
+ fn visit_str(self, value: &str) -> std::result::Result
+ where
+ E: serde::de::Error,
+ {
+ match value {
+ "walletName" | "wallet_name" => Ok(GeneratedField::WalletName),
+ "password" => Ok(GeneratedField::Password),
+ "address" => Ok(GeneratedField::Address),
+ "message" => Ok(GeneratedField::Message),
+ _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
+ }
+ }
+ }
+ deserializer.deserialize_identifier(GeneratedVisitor)
+ }
+ }
+ struct GeneratedVisitor;
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = SignMessageRequest;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ formatter.write_str("struct pactus.SignMessageRequest")
+ }
+
+ fn visit_map(self, mut map: V) -> std::result::Result
+ where
+ V: serde::de::MapAccess<'de>,
+ {
+ let mut wallet_name__ = None;
+ let mut password__ = None;
+ let mut address__ = None;
+ let mut message__ = None;
+ while let Some(k) = map.next_key()? {
+ match k {
+ GeneratedField::WalletName => {
+ if wallet_name__.is_some() {
+ return Err(serde::de::Error::duplicate_field("walletName"));
+ }
+ wallet_name__ = Some(map.next_value()?);
+ }
+ GeneratedField::Password => {
+ if password__.is_some() {
+ return Err(serde::de::Error::duplicate_field("password"));
+ }
+ password__ = Some(map.next_value()?);
+ }
+ GeneratedField::Address => {
+ if address__.is_some() {
+ return Err(serde::de::Error::duplicate_field("address"));
+ }
+ address__ = Some(map.next_value()?);
+ }
+ GeneratedField::Message => {
+ if message__.is_some() {
+ return Err(serde::de::Error::duplicate_field("message"));
+ }
+ message__ = Some(map.next_value()?);
+ }
+ }
+ }
+ Ok(SignMessageRequest {
+ wallet_name: wallet_name__.unwrap_or_default(),
+ password: password__.unwrap_or_default(),
+ address: address__.unwrap_or_default(),
+ message: message__.unwrap_or_default(),
+ })
+ }
+ }
+ deserializer.deserialize_struct("pactus.SignMessageRequest", FIELDS, GeneratedVisitor)
+ }
+}
+impl serde::Serialize for SignMessageResponse {
+ #[allow(deprecated)]
+ fn serialize(&self, serializer: S) -> std::result::Result
+ where
+ S: serde::Serializer,
+ {
+ use serde::ser::SerializeStruct;
+ let mut len = 0;
+ if !self.signature.is_empty() {
+ len += 1;
+ }
+ let mut struct_ser = serializer.serialize_struct("pactus.SignMessageResponse", len)?;
+ if !self.signature.is_empty() {
+ struct_ser.serialize_field("signature", &self.signature)?;
+ }
+ struct_ser.end()
+ }
+}
+impl<'de> serde::Deserialize<'de> for SignMessageResponse {
+ #[allow(deprecated)]
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ const FIELDS: &[&str] = &[
+ "signature",
+ ];
+
+ #[allow(clippy::enum_variant_names)]
+ enum GeneratedField {
+ Signature,
+ }
+ impl<'de> serde::Deserialize<'de> for GeneratedField {
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ struct GeneratedVisitor;
+
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = GeneratedField;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(formatter, "expected one of: {:?}", &FIELDS)
+ }
+
+ #[allow(unused_variables)]
+ fn visit_str(self, value: &str) -> std::result::Result
+ where
+ E: serde::de::Error,
+ {
+ match value {
+ "signature" => Ok(GeneratedField::Signature),
+ _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
+ }
+ }
+ }
+ deserializer.deserialize_identifier(GeneratedVisitor)
+ }
+ }
+ struct GeneratedVisitor;
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = SignMessageResponse;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ formatter.write_str("struct pactus.SignMessageResponse")
+ }
+
+ fn visit_map(self, mut map: V) -> std::result::Result
+ where
+ V: serde::de::MapAccess<'de>,
+ {
+ let mut signature__ = None;
+ while let Some(k) = map.next_key()? {
+ match k {
+ GeneratedField::Signature => {
+ if signature__.is_some() {
+ return Err(serde::de::Error::duplicate_field("signature"));
+ }
+ signature__ = Some(map.next_value()?);
+ }
+ }
+ }
+ Ok(SignMessageResponse {
+ signature: signature__.unwrap_or_default(),
+ })
+ }
+ }
+ deserializer.deserialize_struct("pactus.SignMessageResponse", FIELDS, GeneratedVisitor)
+ }
+}
+impl serde::Serialize for SignMessageWithPrivateKeyRequest {
+ #[allow(deprecated)]
+ fn serialize(&self, serializer: S) -> std::result::Result
+ where
+ S: serde::Serializer,
+ {
+ use serde::ser::SerializeStruct;
+ let mut len = 0;
+ if !self.private_key.is_empty() {
+ len += 1;
+ }
+ if !self.message.is_empty() {
+ len += 1;
+ }
+ let mut struct_ser = serializer.serialize_struct("pactus.SignMessageWithPrivateKeyRequest", len)?;
+ if !self.private_key.is_empty() {
+ struct_ser.serialize_field("privateKey", &self.private_key)?;
+ }
+ if !self.message.is_empty() {
+ struct_ser.serialize_field("message", &self.message)?;
+ }
+ struct_ser.end()
+ }
+}
+impl<'de> serde::Deserialize<'de> for SignMessageWithPrivateKeyRequest {
+ #[allow(deprecated)]
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ const FIELDS: &[&str] = &[
+ "private_key",
+ "privateKey",
+ "message",
+ ];
+
+ #[allow(clippy::enum_variant_names)]
+ enum GeneratedField {
+ PrivateKey,
+ Message,
+ }
+ impl<'de> serde::Deserialize<'de> for GeneratedField {
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ struct GeneratedVisitor;
+
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = GeneratedField;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(formatter, "expected one of: {:?}", &FIELDS)
+ }
+
+ #[allow(unused_variables)]
+ fn visit_str(self, value: &str) -> std::result::Result
+ where
+ E: serde::de::Error,
+ {
+ match value {
+ "privateKey" | "private_key" => Ok(GeneratedField::PrivateKey),
+ "message" => Ok(GeneratedField::Message),
+ _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
+ }
+ }
+ }
+ deserializer.deserialize_identifier(GeneratedVisitor)
+ }
+ }
+ struct GeneratedVisitor;
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = SignMessageWithPrivateKeyRequest;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ formatter.write_str("struct pactus.SignMessageWithPrivateKeyRequest")
+ }
+
+ fn visit_map(self, mut map: V) -> std::result::Result
+ where
+ V: serde::de::MapAccess<'de>,
+ {
+ let mut private_key__ = None;
+ let mut message__ = None;
+ while let Some(k) = map.next_key()? {
+ match k {
+ GeneratedField::PrivateKey => {
+ if private_key__.is_some() {
+ return Err(serde::de::Error::duplicate_field("privateKey"));
+ }
+ private_key__ = Some(map.next_value()?);
+ }
+ GeneratedField::Message => {
+ if message__.is_some() {
+ return Err(serde::de::Error::duplicate_field("message"));
+ }
+ message__ = Some(map.next_value()?);
+ }
+ }
+ }
+ Ok(SignMessageWithPrivateKeyRequest {
+ private_key: private_key__.unwrap_or_default(),
+ message: message__.unwrap_or_default(),
+ })
+ }
+ }
+ deserializer.deserialize_struct("pactus.SignMessageWithPrivateKeyRequest", FIELDS, GeneratedVisitor)
+ }
+}
+impl serde::Serialize for SignMessageWithPrivateKeyResponse {
+ #[allow(deprecated)]
+ fn serialize(&self, serializer: S) -> std::result::Result
+ where
+ S: serde::Serializer,
+ {
+ use serde::ser::SerializeStruct;
+ let mut len = 0;
+ if !self.signature.is_empty() {
+ len += 1;
+ }
+ let mut struct_ser = serializer.serialize_struct("pactus.SignMessageWithPrivateKeyResponse", len)?;
+ if !self.signature.is_empty() {
+ struct_ser.serialize_field("signature", &self.signature)?;
+ }
+ struct_ser.end()
+ }
+}
+impl<'de> serde::Deserialize<'de> for SignMessageWithPrivateKeyResponse {
+ #[allow(deprecated)]
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ const FIELDS: &[&str] = &[
+ "signature",
+ ];
+
+ #[allow(clippy::enum_variant_names)]
+ enum GeneratedField {
+ Signature,
+ }
+ impl<'de> serde::Deserialize<'de> for GeneratedField {
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ struct GeneratedVisitor;
+
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = GeneratedField;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(formatter, "expected one of: {:?}", &FIELDS)
+ }
+
+ #[allow(unused_variables)]
+ fn visit_str(self, value: &str) -> std::result::Result
+ where
+ E: serde::de::Error,
+ {
+ match value {
+ "signature" => Ok(GeneratedField::Signature),
+ _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
+ }
+ }
+ }
+ deserializer.deserialize_identifier(GeneratedVisitor)
+ }
+ }
+ struct GeneratedVisitor;
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = SignMessageWithPrivateKeyResponse;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ formatter.write_str("struct pactus.SignMessageWithPrivateKeyResponse")
+ }
+
+ fn visit_map(self, mut map: V) -> std::result::Result
+ where
+ V: serde::de::MapAccess<'de>,
+ {
+ let mut signature__ = None;
+ while let Some(k) = map.next_key()? {
+ match k {
+ GeneratedField::Signature => {
+ if signature__.is_some() {
+ return Err(serde::de::Error::duplicate_field("signature"));
+ }
+ signature__ = Some(map.next_value()?);
+ }
+ }
+ }
+ Ok(SignMessageWithPrivateKeyResponse {
+ signature: signature__.unwrap_or_default(),
+ })
+ }
+ }
+ deserializer.deserialize_struct("pactus.SignMessageWithPrivateKeyResponse", FIELDS, GeneratedVisitor)
+ }
+}
impl serde::Serialize for SignRawTransactionRequest {
#[allow(deprecated)]
fn serialize(&self, serializer: S) -> std::result::Result
@@ -9103,6 +9537,224 @@ impl<'de> serde::Deserialize<'de> for ValidatorInfo {
deserializer.deserialize_struct("pactus.ValidatorInfo", FIELDS, GeneratedVisitor)
}
}
+impl serde::Serialize for VerifyMessageRequest {
+ #[allow(deprecated)]
+ fn serialize(&self, serializer: S) -> std::result::Result
+ where
+ S: serde::Serializer,
+ {
+ use serde::ser::SerializeStruct;
+ let mut len = 0;
+ if !self.message.is_empty() {
+ len += 1;
+ }
+ if !self.signature.is_empty() {
+ len += 1;
+ }
+ if !self.public_key.is_empty() {
+ len += 1;
+ }
+ let mut struct_ser = serializer.serialize_struct("pactus.VerifyMessageRequest", len)?;
+ if !self.message.is_empty() {
+ struct_ser.serialize_field("message", &self.message)?;
+ }
+ if !self.signature.is_empty() {
+ struct_ser.serialize_field("signature", &self.signature)?;
+ }
+ if !self.public_key.is_empty() {
+ struct_ser.serialize_field("publicKey", &self.public_key)?;
+ }
+ struct_ser.end()
+ }
+}
+impl<'de> serde::Deserialize<'de> for VerifyMessageRequest {
+ #[allow(deprecated)]
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ const FIELDS: &[&str] = &[
+ "message",
+ "signature",
+ "public_key",
+ "publicKey",
+ ];
+
+ #[allow(clippy::enum_variant_names)]
+ enum GeneratedField {
+ Message,
+ Signature,
+ PublicKey,
+ }
+ impl<'de> serde::Deserialize<'de> for GeneratedField {
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ struct GeneratedVisitor;
+
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = GeneratedField;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(formatter, "expected one of: {:?}", &FIELDS)
+ }
+
+ #[allow(unused_variables)]
+ fn visit_str(self, value: &str) -> std::result::Result
+ where
+ E: serde::de::Error,
+ {
+ match value {
+ "message" => Ok(GeneratedField::Message),
+ "signature" => Ok(GeneratedField::Signature),
+ "publicKey" | "public_key" => Ok(GeneratedField::PublicKey),
+ _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
+ }
+ }
+ }
+ deserializer.deserialize_identifier(GeneratedVisitor)
+ }
+ }
+ struct GeneratedVisitor;
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = VerifyMessageRequest;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ formatter.write_str("struct pactus.VerifyMessageRequest")
+ }
+
+ fn visit_map(self, mut map: V) -> std::result::Result
+ where
+ V: serde::de::MapAccess<'de>,
+ {
+ let mut message__ = None;
+ let mut signature__ = None;
+ let mut public_key__ = None;
+ while let Some(k) = map.next_key()? {
+ match k {
+ GeneratedField::Message => {
+ if message__.is_some() {
+ return Err(serde::de::Error::duplicate_field("message"));
+ }
+ message__ = Some(map.next_value()?);
+ }
+ GeneratedField::Signature => {
+ if signature__.is_some() {
+ return Err(serde::de::Error::duplicate_field("signature"));
+ }
+ signature__ = Some(map.next_value()?);
+ }
+ GeneratedField::PublicKey => {
+ if public_key__.is_some() {
+ return Err(serde::de::Error::duplicate_field("publicKey"));
+ }
+ public_key__ = Some(map.next_value()?);
+ }
+ }
+ }
+ Ok(VerifyMessageRequest {
+ message: message__.unwrap_or_default(),
+ signature: signature__.unwrap_or_default(),
+ public_key: public_key__.unwrap_or_default(),
+ })
+ }
+ }
+ deserializer.deserialize_struct("pactus.VerifyMessageRequest", FIELDS, GeneratedVisitor)
+ }
+}
+impl serde::Serialize for VerifyMessageResponse {
+ #[allow(deprecated)]
+ fn serialize(&self, serializer: S) -> std::result::Result
+ where
+ S: serde::Serializer,
+ {
+ use serde::ser::SerializeStruct;
+ let mut len = 0;
+ if self.is_valid {
+ len += 1;
+ }
+ let mut struct_ser = serializer.serialize_struct("pactus.VerifyMessageResponse", len)?;
+ if self.is_valid {
+ struct_ser.serialize_field("isValid", &self.is_valid)?;
+ }
+ struct_ser.end()
+ }
+}
+impl<'de> serde::Deserialize<'de> for VerifyMessageResponse {
+ #[allow(deprecated)]
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ const FIELDS: &[&str] = &[
+ "is_valid",
+ "isValid",
+ ];
+
+ #[allow(clippy::enum_variant_names)]
+ enum GeneratedField {
+ IsValid,
+ }
+ impl<'de> serde::Deserialize<'de> for GeneratedField {
+ fn deserialize(deserializer: D) -> std::result::Result
+ where
+ D: serde::Deserializer<'de>,
+ {
+ struct GeneratedVisitor;
+
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = GeneratedField;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(formatter, "expected one of: {:?}", &FIELDS)
+ }
+
+ #[allow(unused_variables)]
+ fn visit_str(self, value: &str) -> std::result::Result
+ where
+ E: serde::de::Error,
+ {
+ match value {
+ "isValid" | "is_valid" => Ok(GeneratedField::IsValid),
+ _ => Err(serde::de::Error::unknown_field(value, FIELDS)),
+ }
+ }
+ }
+ deserializer.deserialize_identifier(GeneratedVisitor)
+ }
+ }
+ struct GeneratedVisitor;
+ impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
+ type Value = VerifyMessageResponse;
+
+ fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ formatter.write_str("struct pactus.VerifyMessageResponse")
+ }
+
+ fn visit_map(self, mut map: V) -> std::result::Result
+ where
+ V: serde::de::MapAccess<'de>,
+ {
+ let mut is_valid__ = None;
+ while let Some(k) = map.next_key()? {
+ match k {
+ GeneratedField::IsValid => {
+ if is_valid__.is_some() {
+ return Err(serde::de::Error::duplicate_field("isValid"));
+ }
+ is_valid__ = Some(map.next_value()?);
+ }
+ }
+ }
+ Ok(VerifyMessageResponse {
+ is_valid: is_valid__.unwrap_or_default(),
+ })
+ }
+ }
+ deserializer.deserialize_struct("pactus.VerifyMessageResponse", FIELDS, GeneratedVisitor)
+ }
+}
impl serde::Serialize for VoteInfo {
#[allow(deprecated)]
fn serialize(&self, serializer: S) -> std::result::Result
diff --git a/www/grpc/gen/rust/pactus.tonic.rs b/www/grpc/gen/rust/pactus.tonic.rs
index 771b22c46..cd4fd58fe 100644
--- a/www/grpc/gen/rust/pactus.tonic.rs
+++ b/www/grpc/gen/rust/pactus.tonic.rs
@@ -2215,6 +2215,380 @@ pub mod network_server {
}
}
/// Generated client implementations.
+pub mod utils_client {
+ #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
+ use tonic::codegen::*;
+ use tonic::codegen::http::Uri;
+ #[derive(Debug, Clone)]
+ pub struct UtilsClient {
+ inner: tonic::client::Grpc,
+ }
+ impl UtilsClient {
+ /// Attempt to create a new client by connecting to a given endpoint.
+ pub async fn connect(dst: D) -> Result
+ where
+ D: TryInto,
+ D::Error: Into,
+ {
+ let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
+ Ok(Self::new(conn))
+ }
+ }
+ impl UtilsClient
+ where
+ T: tonic::client::GrpcService,
+ T::Error: Into,
+ T::ResponseBody: Body + Send + 'static,
+ ::Error: Into + Send,
+ {
+ pub fn new(inner: T) -> Self {
+ let inner = tonic::client::Grpc::new(inner);
+ Self { inner }
+ }
+ pub fn with_origin(inner: T, origin: Uri) -> Self {
+ let inner = tonic::client::Grpc::with_origin(inner, origin);
+ Self { inner }
+ }
+ pub fn with_interceptor(
+ inner: T,
+ interceptor: F,
+ ) -> UtilsClient>
+ where
+ F: tonic::service::Interceptor,
+ T::ResponseBody: Default,
+ T: tonic::codegen::Service<
+ http::Request,
+ Response = http::Response<
+ >::ResponseBody,
+ >,
+ >,
+ ,
+ >>::Error: Into + Send + Sync,
+ {
+ UtilsClient::new(InterceptedService::new(inner, interceptor))
+ }
+ /// Compress requests with the given encoding.
+ ///
+ /// This requires the server to support it otherwise it might respond with an
+ /// error.
+ #[must_use]
+ pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
+ self.inner = self.inner.send_compressed(encoding);
+ self
+ }
+ /// Enable decompressing responses.
+ #[must_use]
+ pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
+ self.inner = self.inner.accept_compressed(encoding);
+ self
+ }
+ /// Limits the maximum size of a decoded message.
+ ///
+ /// Default: `4MB`
+ #[must_use]
+ pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
+ self.inner = self.inner.max_decoding_message_size(limit);
+ self
+ }
+ /// Limits the maximum size of an encoded message.
+ ///
+ /// Default: `usize::MAX`
+ #[must_use]
+ pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
+ self.inner = self.inner.max_encoding_message_size(limit);
+ self
+ }
+ pub async fn sign_message_with_private_key(
+ &mut self,
+ request: impl tonic::IntoRequest,
+ ) -> std::result::Result<
+ tonic::Response,
+ tonic::Status,
+ > {
+ self.inner
+ .ready()
+ .await
+ .map_err(|e| {
+ tonic::Status::new(
+ tonic::Code::Unknown,
+ format!("Service was not ready: {}", e.into()),
+ )
+ })?;
+ let codec = tonic::codec::ProstCodec::default();
+ let path = http::uri::PathAndQuery::from_static(
+ "/pactus.Utils/SignMessageWithPrivateKey",
+ );
+ let mut req = request.into_request();
+ req.extensions_mut()
+ .insert(GrpcMethod::new("pactus.Utils", "SignMessageWithPrivateKey"));
+ self.inner.unary(req, path, codec).await
+ }
+ pub async fn verify_message(
+ &mut self,
+ request: impl tonic::IntoRequest,
+ ) -> std::result::Result<
+ tonic::Response,
+ tonic::Status,
+ > {
+ self.inner
+ .ready()
+ .await
+ .map_err(|e| {
+ tonic::Status::new(
+ tonic::Code::Unknown,
+ format!("Service was not ready: {}", e.into()),
+ )
+ })?;
+ let codec = tonic::codec::ProstCodec::default();
+ let path = http::uri::PathAndQuery::from_static(
+ "/pactus.Utils/VerifyMessage",
+ );
+ let mut req = request.into_request();
+ req.extensions_mut()
+ .insert(GrpcMethod::new("pactus.Utils", "VerifyMessage"));
+ self.inner.unary(req, path, codec).await
+ }
+ }
+}
+/// Generated server implementations.
+pub mod utils_server {
+ #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
+ use tonic::codegen::*;
+ /// Generated trait containing gRPC methods that should be implemented for use with UtilsServer.
+ #[async_trait]
+ pub trait Utils: Send + Sync + 'static {
+ async fn sign_message_with_private_key(
+ &self,
+ request: tonic::Request,
+ ) -> std::result::Result<
+ tonic::Response,
+ tonic::Status,
+ >;
+ async fn verify_message(
+ &self,
+ request: tonic::Request,
+ ) -> std::result::Result<
+ tonic::Response,
+ tonic::Status,
+ >;
+ }
+ #[derive(Debug)]
+ pub struct UtilsServer {
+ inner: _Inner,
+ accept_compression_encodings: EnabledCompressionEncodings,
+ send_compression_encodings: EnabledCompressionEncodings,
+ max_decoding_message_size: Option,
+ max_encoding_message_size: Option,
+ }
+ struct _Inner(Arc);
+ impl UtilsServer {
+ pub fn new(inner: T) -> Self {
+ Self::from_arc(Arc::new(inner))
+ }
+ pub fn from_arc(inner: Arc) -> Self {
+ let inner = _Inner(inner);
+ Self {
+ inner,
+ accept_compression_encodings: Default::default(),
+ send_compression_encodings: Default::default(),
+ max_decoding_message_size: None,
+ max_encoding_message_size: None,
+ }
+ }
+ pub fn with_interceptor(
+ inner: T,
+ interceptor: F,
+ ) -> InterceptedService
+ where
+ F: tonic::service::Interceptor,
+ {
+ InterceptedService::new(Self::new(inner), interceptor)
+ }
+ /// Enable decompressing requests with the given encoding.
+ #[must_use]
+ pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
+ self.accept_compression_encodings.enable(encoding);
+ self
+ }
+ /// Compress responses with the given encoding, if the client supports it.
+ #[must_use]
+ pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
+ self.send_compression_encodings.enable(encoding);
+ self
+ }
+ /// Limits the maximum size of a decoded message.
+ ///
+ /// Default: `4MB`
+ #[must_use]
+ pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
+ self.max_decoding_message_size = Some(limit);
+ self
+ }
+ /// Limits the maximum size of an encoded message.
+ ///
+ /// Default: `usize::MAX`
+ #[must_use]
+ pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
+ self.max_encoding_message_size = Some(limit);
+ self
+ }
+ }
+ impl tonic::codegen::Service> for UtilsServer
+ where
+ T: Utils,
+ B: Body + Send + 'static,
+ B::Error: Into + Send + 'static,
+ {
+ type Response = http::Response;
+ type Error = std::convert::Infallible;
+ type Future = BoxFuture;
+ fn poll_ready(
+ &mut self,
+ _cx: &mut Context<'_>,
+ ) -> Poll> {
+ Poll::Ready(Ok(()))
+ }
+ fn call(&mut self, req: http::Request) -> Self::Future {
+ let inner = self.inner.clone();
+ match req.uri().path() {
+ "/pactus.Utils/SignMessageWithPrivateKey" => {
+ #[allow(non_camel_case_types)]
+ struct SignMessageWithPrivateKeySvc(pub Arc);
+ impl<
+ T: Utils,
+ > tonic::server::UnaryService<
+ super::SignMessageWithPrivateKeyRequest,
+ > for SignMessageWithPrivateKeySvc {
+ type Response = super::SignMessageWithPrivateKeyResponse;
+ type Future = BoxFuture<
+ tonic::Response,
+ tonic::Status,
+ >;
+ fn call(
+ &mut self,
+ request: tonic::Request<
+ super::SignMessageWithPrivateKeyRequest,
+ >,
+ ) -> Self::Future {
+ let inner = Arc::clone(&self.0);
+ let fut = async move {
+ (*inner).sign_message_with_private_key(request).await
+ };
+ Box::pin(fut)
+ }
+ }
+ let accept_compression_encodings = self.accept_compression_encodings;
+ let send_compression_encodings = self.send_compression_encodings;
+ let max_decoding_message_size = self.max_decoding_message_size;
+ let max_encoding_message_size = self.max_encoding_message_size;
+ let inner = self.inner.clone();
+ let fut = async move {
+ let inner = inner.0;
+ let method = SignMessageWithPrivateKeySvc(inner);
+ let codec = tonic::codec::ProstCodec::default();
+ let mut grpc = tonic::server::Grpc::new(codec)
+ .apply_compression_config(
+ accept_compression_encodings,
+ send_compression_encodings,
+ )
+ .apply_max_message_size_config(
+ max_decoding_message_size,
+ max_encoding_message_size,
+ );
+ let res = grpc.unary(method, req).await;
+ Ok(res)
+ };
+ Box::pin(fut)
+ }
+ "/pactus.Utils/VerifyMessage" => {
+ #[allow(non_camel_case_types)]
+ struct VerifyMessageSvc(pub Arc);
+ impl<
+ T: Utils,
+ > tonic::server::UnaryService
+ for VerifyMessageSvc {
+ type Response = super::VerifyMessageResponse;
+ type Future = BoxFuture<
+ tonic::Response,
+ tonic::Status,
+ >;
+ fn call(
+ &mut self,
+ request: tonic::Request,
+ ) -> Self::Future {
+ let inner = Arc::clone(&self.0);
+ let fut = async move {
+ (*inner).verify_message(request).await
+ };
+ Box::pin(fut)
+ }
+ }
+ let accept_compression_encodings = self.accept_compression_encodings;
+ let send_compression_encodings = self.send_compression_encodings;
+ let max_decoding_message_size = self.max_decoding_message_size;
+ let max_encoding_message_size = self.max_encoding_message_size;
+ let inner = self.inner.clone();
+ let fut = async move {
+ let inner = inner.0;
+ let method = VerifyMessageSvc(inner);
+ let codec = tonic::codec::ProstCodec::default();
+ let mut grpc = tonic::server::Grpc::new(codec)
+ .apply_compression_config(
+ accept_compression_encodings,
+ send_compression_encodings,
+ )
+ .apply_max_message_size_config(
+ max_decoding_message_size,
+ max_encoding_message_size,
+ );
+ let res = grpc.unary(method, req).await;
+ Ok(res)
+ };
+ Box::pin(fut)
+ }
+ _ => {
+ Box::pin(async move {
+ Ok(
+ http::Response::builder()
+ .status(200)
+ .header("grpc-status", "12")
+ .header("content-type", "application/grpc")
+ .body(empty_body())
+ .unwrap(),
+ )
+ })
+ }
+ }
+ }
+ }
+ impl Clone for UtilsServer {
+ fn clone(&self) -> Self {
+ let inner = self.inner.clone();
+ Self {
+ inner,
+ accept_compression_encodings: self.accept_compression_encodings,
+ send_compression_encodings: self.send_compression_encodings,
+ max_decoding_message_size: self.max_decoding_message_size,
+ max_encoding_message_size: self.max_encoding_message_size,
+ }
+ }
+ }
+ impl Clone for _Inner {
+ fn clone(&self) -> Self {
+ Self(Arc::clone(&self.0))
+ }
+ }
+ impl std::fmt::Debug for _Inner {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ write!(f, "{:?}", self.0)
+ }
+ }
+ impl tonic::server::NamedService for UtilsServer {
+ const NAME: &'static str = "pactus.Utils";
+ }
+}
+/// Generated client implementations.
pub mod wallet_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
@@ -2521,6 +2895,30 @@ pub mod wallet_client {
.insert(GrpcMethod::new("pactus.Wallet", "GetAddressHistory"));
self.inner.unary(req, path, codec).await
}
+ pub async fn sign_message(
+ &mut self,
+ request: impl tonic::IntoRequest,
+ ) -> std::result::Result<
+ tonic::Response,
+ tonic::Status,
+ > {
+ self.inner
+ .ready()
+ .await
+ .map_err(|e| {
+ tonic::Status::new(
+ tonic::Code::Unknown,
+ format!("Service was not ready: {}", e.into()),
+ )
+ })?;
+ let codec = tonic::codec::ProstCodec::default();
+ let path = http::uri::PathAndQuery::from_static(
+ "/pactus.Wallet/SignMessage",
+ );
+ let mut req = request.into_request();
+ req.extensions_mut().insert(GrpcMethod::new("pactus.Wallet", "SignMessage"));
+ self.inner.unary(req, path, codec).await
+ }
}
}
/// Generated server implementations.
@@ -2593,6 +2991,13 @@ pub mod wallet_server {
tonic::Response,
tonic::Status,
>;
+ async fn sign_message(
+ &self,
+ request: tonic::Request,
+ ) -> std::result::Result<
+ tonic::Response,
+ tonic::Status,
+ >;
}
#[derive(Debug)]
pub struct WalletServer {
@@ -3083,6 +3488,52 @@ pub mod wallet_server {
};
Box::pin(fut)
}
+ "/pactus.Wallet/SignMessage" => {
+ #[allow(non_camel_case_types)]
+ struct SignMessageSvc(pub Arc);
+ impl<
+ T: Wallet,
+ > tonic::server::UnaryService
+ for SignMessageSvc {
+ type Response = super::SignMessageResponse;
+ type Future = BoxFuture<
+ tonic::Response,
+ tonic::Status,
+ >;
+ fn call(
+ &mut self,
+ request: tonic::Request,
+ ) -> Self::Future {
+ let inner = Arc::clone(&self.0);
+ let fut = async move {
+ (*inner).sign_message(request).await
+ };
+ Box::pin(fut)
+ }
+ }
+ let accept_compression_encodings = self.accept_compression_encodings;
+ let send_compression_encodings = self.send_compression_encodings;
+ let max_decoding_message_size = self.max_decoding_message_size;
+ let max_encoding_message_size = self.max_encoding_message_size;
+ let inner = self.inner.clone();
+ let fut = async move {
+ let inner = inner.0;
+ let method = SignMessageSvc(inner);
+ let codec = tonic::codec::ProstCodec::default();
+ let mut grpc = tonic::server::Grpc::new(codec)
+ .apply_compression_config(
+ accept_compression_encodings,
+ send_compression_encodings,
+ )
+ .apply_max_message_size_config(
+ max_decoding_message_size,
+ max_encoding_message_size,
+ );
+ let res = grpc.unary(method, req).await;
+ Ok(res)
+ };
+ Box::pin(fut)
+ }
_ => {
Box::pin(async move {
Ok(
diff --git a/www/grpc/proto/utils.proto b/www/grpc/proto/utils.proto
new file mode 100644
index 000000000..39499a637
--- /dev/null
+++ b/www/grpc/proto/utils.proto
@@ -0,0 +1,46 @@
+syntax = "proto3";
+package pactus;
+
+option go_package = "github.com/pactus-project/pactus/www/grpc/pactus";
+option java_package = "pactus.utils";
+
+// Utils service defines RPC methods for utility functions such as message
+// signing and verification.
+service Utils {
+ // SignMessageWithPrivateKey sign message with provided private key.
+ rpc SignMessageWithPrivateKey(SignMessageWithPrivateKeyRequest) returns (SignMessageWithPrivateKeyResponse);
+
+ // VerifyMessage verify signature with public key and message
+ rpc VerifyMessage(VerifyMessageRequest) returns (VerifyMessageResponse);
+}
+
+// Request message for sign message with private key.
+message SignMessageWithPrivateKeyRequest {
+ // The private key to sign the message.
+ string private_key = 1;
+
+ // The message to sign.
+ string message = 2;
+}
+
+// Response message containing the generated signature.
+message SignMessageWithPrivateKeyResponse {
+ // The signature of the message.
+ string signature = 1;
+}
+
+// Request message for verifying a message signature.
+message VerifyMessageRequest {
+ // The signed message.
+ string message = 1;
+ // The signature of the message.
+ string signature = 2;
+ // The public key of the signer.
+ string public_key = 3;
+}
+
+// Response message containing the resualt of validation of signature and message.
+message VerifyMessageResponse {
+ // Indicates if the signature is valid (true) or not (false).
+ bool is_valid = 1;
+}
diff --git a/www/grpc/proto/wallet.proto b/www/grpc/proto/wallet.proto
index 7d526a0f0..b6dd88b1b 100644
--- a/www/grpc/proto/wallet.proto
+++ b/www/grpc/proto/wallet.proto
@@ -40,7 +40,11 @@ service Wallet {
// GetAddressHistory retrieves the transaction history of an address.
rpc GetAddressHistory(GetAddressHistoryRequest)
returns (GetAddressHistoryResponse);
-}
+
+ // SignMessage signs an arbitrary message.
+ rpc SignMessage(SignMessageRequest)
+ returns (SignMessageResponse);
+ }
// Enum for the address type.
enum AddressType {
@@ -206,3 +210,21 @@ message GetTotalBalanceResponse {
// The total balance of the wallet in NanoPAC.
int64 total_balance = 2;
}
+
+// Request message to sign an arbitrary message.
+message SignMessageRequest {
+ // The name of the wallet.
+ string wallet_name = 1;
+ // The password for unlocking the wallet for signing.
+ string password = 2;
+ // The account address associated with the private key.
+ string address = 3;
+ // The arbitrary message to be signed.
+ string message = 4;
+}
+
+// Response message containing the available balance of the wallet.
+message SignMessageResponse {
+ // Signature of the message.
+ string signature = 1;
+}
diff --git a/www/grpc/server.go b/www/grpc/server.go
index f0c6ec9b2..b43ab3301 100644
--- a/www/grpc/server.go
+++ b/www/grpc/server.go
@@ -79,10 +79,12 @@ func (s *Server) startListening(listener net.Listener) error {
blockchainServer := newBlockchainServer(s)
transactionServer := newTransactionServer(s)
networkServer := newNetworkServer(s)
+ utilServer := newUtilsServer(s)
pactus.RegisterBlockchainServer(grpcServer, blockchainServer)
pactus.RegisterTransactionServer(grpcServer, transactionServer)
pactus.RegisterNetworkServer(grpcServer, networkServer)
+ pactus.RegisterUtilsServer(grpcServer, utilServer)
if s.config.EnableWallet {
walletServer := newWalletServer(s, s.walletMgr)
diff --git a/www/grpc/server_test.go b/www/grpc/server_test.go
index f90acee56..3f8d9091d 100644
--- a/www/grpc/server_test.go
+++ b/www/grpc/server_test.go
@@ -159,3 +159,16 @@ func (td *testData) walletClient(t *testing.T) (*grpc.ClientConn, pactus.WalletC
return conn, pactus.NewWalletClient(conn)
}
+
+func (td *testData) utilClient(t *testing.T) (*grpc.ClientConn, pactus.UtilsClient) {
+ t.Helper()
+
+ conn, err := grpc.NewClient("passthrough://bufnet",
+ grpc.WithContextDialer(td.bufDialer),
+ grpc.WithTransportCredentials(insecure.NewCredentials()))
+ if err != nil {
+ t.Fatalf("Failed to dial wallet server: %v", err)
+ }
+
+ return conn, pactus.NewUtilsClient(conn)
+}
diff --git a/www/grpc/swagger-ui/pactus.swagger.json b/www/grpc/swagger-ui/pactus.swagger.json
index fd0e4baaa..ccf851722 100644
--- a/www/grpc/swagger-ui/pactus.swagger.json
+++ b/www/grpc/swagger-ui/pactus.swagger.json
@@ -23,6 +23,9 @@
{
"name": "Network"
},
+ {
+ "name": "Utils"
+ },
{
"name": "Wallet"
}
@@ -38,6 +41,91 @@
"application/json"
],
"paths": {
+ "/pactus/Utils/sign_message_with_private_key": {
+ "get": {
+ "summary": "SignMessageWithPrivateKey sign message with provided private key.",
+ "operationId": "Utils_SignMessageWithPrivateKey",
+ "responses": {
+ "200": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/pactusSignMessageWithPrivateKeyResponse"
+ }
+ },
+ "default": {
+ "description": "An unexpected error response.",
+ "schema": {
+ "$ref": "#/definitions/rpcStatus"
+ }
+ }
+ },
+ "parameters": [
+ {
+ "name": "privateKey",
+ "description": "The private key to sign the message.",
+ "in": "query",
+ "required": false,
+ "type": "string"
+ },
+ {
+ "name": "message",
+ "description": "The message to sign.",
+ "in": "query",
+ "required": false,
+ "type": "string"
+ }
+ ],
+ "tags": [
+ "Utils"
+ ]
+ }
+ },
+ "/pactus/Utils/verify_message": {
+ "get": {
+ "summary": "VerifyMessage verify signature with public key and message",
+ "operationId": "Utils_VerifyMessage",
+ "responses": {
+ "200": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/pactusVerifyMessageResponse"
+ }
+ },
+ "default": {
+ "description": "An unexpected error response.",
+ "schema": {
+ "$ref": "#/definitions/rpcStatus"
+ }
+ }
+ },
+ "parameters": [
+ {
+ "name": "message",
+ "description": "The signed message.",
+ "in": "query",
+ "required": false,
+ "type": "string"
+ },
+ {
+ "name": "signature",
+ "description": "The signature of the message.",
+ "in": "query",
+ "required": false,
+ "type": "string"
+ },
+ {
+ "name": "publicKey",
+ "description": "The public key of the signer.",
+ "in": "query",
+ "required": false,
+ "type": "string"
+ }
+ ],
+ "tags": [
+ "Utils"
+ ]
+ }
+ },
"/pactus/blockchain/get_account": {
"get": {
"summary": "GetAccount retrieves information about an account based on the provided\naddress.",
@@ -1049,6 +1137,59 @@
]
}
},
+ "/pactus/wallet/sign_message": {
+ "get": {
+ "summary": "SignMessage signs an arbitrary message.",
+ "operationId": "Wallet_SignMessage",
+ "responses": {
+ "200": {
+ "description": "A successful response.",
+ "schema": {
+ "$ref": "#/definitions/pactusSignMessageResponse"
+ }
+ },
+ "default": {
+ "description": "An unexpected error response.",
+ "schema": {
+ "$ref": "#/definitions/rpcStatus"
+ }
+ }
+ },
+ "parameters": [
+ {
+ "name": "walletName",
+ "description": "The name of the wallet.",
+ "in": "query",
+ "required": false,
+ "type": "string"
+ },
+ {
+ "name": "password",
+ "description": "The password for unlocking the wallet for signing.",
+ "in": "query",
+ "required": false,
+ "type": "string"
+ },
+ {
+ "name": "address",
+ "description": "The account address associated with the private key.",
+ "in": "query",
+ "required": false,
+ "type": "string"
+ },
+ {
+ "name": "message",
+ "description": "The arbitrary message to be signed.",
+ "in": "query",
+ "required": false,
+ "type": "string"
+ }
+ ],
+ "tags": [
+ "Wallet"
+ ]
+ }
+ },
"/pactus/wallet/sign_raw_transaction": {
"get": {
"summary": "SignRawTransaction signs a raw transaction for a specified wallet.",
@@ -1976,6 +2117,26 @@
},
"description": "Response message containing the name of the restored wallet."
},
+ "pactusSignMessageResponse": {
+ "type": "object",
+ "properties": {
+ "signature": {
+ "type": "string",
+ "description": "Signature of the message."
+ }
+ },
+ "description": "Response message containing the available balance of the wallet."
+ },
+ "pactusSignMessageWithPrivateKeyResponse": {
+ "type": "object",
+ "properties": {
+ "signature": {
+ "type": "string",
+ "description": "The signature of the message."
+ }
+ },
+ "description": "Response message containing the generated signature."
+ },
"pactusSignRawTransactionResponse": {
"type": "object",
"properties": {
@@ -2131,6 +2292,16 @@
},
"description": "Message containing information about a validator."
},
+ "pactusVerifyMessageResponse": {
+ "type": "object",
+ "properties": {
+ "isValid": {
+ "type": "boolean",
+ "description": "Indicates if the signature is valid (true) or not (false)."
+ }
+ },
+ "description": "Response message containing the resualt of validation of signature and message."
+ },
"pactusVoteInfo": {
"type": "object",
"properties": {
diff --git a/www/grpc/utils.go b/www/grpc/utils.go
new file mode 100644
index 000000000..294a94fc1
--- /dev/null
+++ b/www/grpc/utils.go
@@ -0,0 +1,61 @@
+package grpc
+
+import (
+ "context"
+
+ "github.com/pactus-project/pactus/crypto/bls"
+ pactus "github.com/pactus-project/pactus/www/grpc/gen/go"
+)
+
+type utilServer struct {
+ *Server
+}
+
+func newUtilsServer(server *Server) *utilServer {
+ return &utilServer{
+ Server: server,
+ }
+}
+
+func (*utilServer) SignMessageWithPrivateKey(_ context.Context,
+ req *pactus.SignMessageWithPrivateKeyRequest,
+) (*pactus.SignMessageWithPrivateKeyResponse, error) {
+ prvKey, err := bls.PrivateKeyFromString(req.PrivateKey)
+ if err != nil {
+ return nil, err
+ }
+
+ sig := prvKey.Sign([]byte(req.Message)).String()
+
+ return &pactus.SignMessageWithPrivateKeyResponse{
+ Signature: sig,
+ }, nil
+}
+
+func (*utilServer) VerifyMessage(_ context.Context,
+ req *pactus.VerifyMessageRequest,
+) (*pactus.VerifyMessageResponse, error) {
+ sig, err := bls.SignatureFromString(req.Signature)
+ if err != nil {
+ return &pactus.VerifyMessageResponse{
+ IsValid: false,
+ }, err
+ }
+
+ pub, err := bls.PublicKeyFromString(req.PublicKey)
+ if err != nil {
+ return &pactus.VerifyMessageResponse{
+ IsValid: false,
+ }, err
+ }
+
+ if err := pub.Verify([]byte(req.Message), sig); err != nil {
+ return &pactus.VerifyMessageResponse{
+ IsValid: false,
+ }, err
+ }
+
+ return &pactus.VerifyMessageResponse{
+ IsValid: true,
+ }, nil
+}
diff --git a/www/grpc/utils_test.go b/www/grpc/utils_test.go
new file mode 100644
index 000000000..5ab04d777
--- /dev/null
+++ b/www/grpc/utils_test.go
@@ -0,0 +1,82 @@
+package grpc
+
+import (
+ "context"
+ "testing"
+
+ pactus "github.com/pactus-project/pactus/www/grpc/gen/go"
+ "github.com/stretchr/testify/assert"
+)
+
+func TestSignMessageWithPrivateKey(t *testing.T) {
+ conf := testConfig()
+ td := setup(t, conf)
+ conn, client := td.utilClient(t)
+
+ msg := "pactus"
+ prvStr := "SECRET1PDRWTLP5PX0FAHDX39GXZJP7FKZFALML0D5U9TT9KVQHDUC99CMGQQJVK67"
+ invalidPrvStr := "INVSECRET1PDRWTLP5PX0FAHDX39GXZJP7FKZFALML0D5U9TT9KVQHDUC99CMGQQJVK67"
+ expectedSig := "923d67a8624cbb7972b29328e15ec76cc846076ccf00a9e94d991c677846f334ae4ba4551396fbcd6d1cab7593baf3b7"
+
+ t.Run("", func(t *testing.T) {
+ res, err := client.SignMessageWithPrivateKey(context.Background(),
+ &pactus.SignMessageWithPrivateKeyRequest{
+ Message: msg,
+ PrivateKey: prvStr,
+ })
+
+ assert.Nil(t, err)
+ assert.Equal(t, res.Signature, expectedSig)
+ })
+
+ t.Run("", func(t *testing.T) {
+ res, err := client.SignMessageWithPrivateKey(context.Background(),
+ &pactus.SignMessageWithPrivateKeyRequest{
+ Message: msg,
+ PrivateKey: invalidPrvStr,
+ })
+
+ assert.NotNil(t, err)
+ assert.Nil(t, res)
+ })
+
+ assert.Nil(t, conn.Close(), "Error closing connection")
+ td.StopServer()
+}
+
+func TestVerifyMessage(t *testing.T) {
+ conf := testConfig()
+ td := setup(t, conf)
+ conn, client := td.utilClient(t)
+
+ msg := "pactus"
+ pubStr := "public1p4u8hfytl2pj6l9rj0t54gxcdmna4hq52ncqkkqjf3arha5mlk3x4mzpyjkhmdl20jae7f65aamjr" +
+ "vqcvf4sudcapz52ctcwc8r9wz3z2gwxs38880cgvfy49ta5ssyjut05myd4zgmjqstggmetyuyg7v5jhx47a"
+ sigStr := "923d67a8624cbb7972b29328e15ec76cc846076ccf00a9e94d991c677846f334ae4ba4551396fbcd6d1cab7593baf3b7"
+ invalidSigStr := "113d67a8624cbb7972b29328e15ec76cc846076ccf00a9e94d991c677846f334ae4ba4551396fbcd6d1cab7593baf3c9"
+
+ t.Run("", func(t *testing.T) {
+ res, err := client.VerifyMessage(context.Background(),
+ &pactus.VerifyMessageRequest{
+ Message: msg,
+ Signature: sigStr,
+ PublicKey: pubStr,
+ })
+ assert.Nil(t, err)
+ assert.True(t, res.IsValid)
+ })
+
+ t.Run("", func(t *testing.T) {
+ _, err := client.VerifyMessage(context.Background(),
+ &pactus.VerifyMessageRequest{
+ Message: msg,
+ Signature: invalidSigStr,
+ PublicKey: pubStr,
+ })
+
+ assert.NotNil(t, err)
+ })
+
+ assert.Nil(t, conn.Close(), "Error closing connection")
+ td.StopServer()
+}
diff --git a/www/grpc/wallet.go b/www/grpc/wallet.go
index ae39ed266..1c32744a1 100644
--- a/www/grpc/wallet.go
+++ b/www/grpc/wallet.go
@@ -187,3 +187,16 @@ func (s *walletServer) GetAddressHistory(_ context.Context,
HistoryInfo: s.mapHistoryInfo(data),
}, nil
}
+
+func (s *walletServer) SignMessage(_ context.Context,
+ req *pactus.SignMessageRequest,
+) (*pactus.SignMessageResponse, error) {
+ sig, err := s.walletManager.SignMessage(req.Message, req.Password, req.Address, req.WalletName)
+ if err != nil {
+ return nil, err
+ }
+
+ return &pactus.SignMessageResponse{
+ Signature: sig,
+ }, nil
+}
diff --git a/www/jsonrpc/server.go b/www/jsonrpc/server.go
index f7542c085..7d7c8e5cf 100644
--- a/www/jsonrpc/server.go
+++ b/www/jsonrpc/server.go
@@ -58,9 +58,10 @@ func (s *Server) StartServer(grpcServer string) error {
networkService := pactus.RegisterNetworkJsonRPC(grpcConn)
transactionService := pactus.RegisterTransactionJsonRPC(grpcConn)
walletService := pactus.RegisterWalletJsonRPC(grpcConn)
+ utilsService := pactus.RegisterUtilsJsonRPC(grpcConn)
server := jrpc.NewServer()
- server.RegisterServices(blockchainService, networkService, transactionService, walletService)
+ server.RegisterServices(blockchainService, networkService, transactionService, walletService, utilsService)
listener, err := net.Listen("tcp", s.config.Listen)
if err != nil {