getStorageNoncePublicKey method
getStorageNoncePublicKey
Implementation
Future<String> getStorageNoncePublicKey() async {
final Completer<String> _completer = Completer<String>();
String _storageNoncePublicKey = '';
SharedSecretsResponse sharedSecretsResponse = SharedSecretsResponse();
final Map<String, String> requestHeaders = {
'Content-type': 'application/json',
'Accept': 'application/json',
};
try {
const String _body =
'{"query": "query {sharedSecrets {storageNoncePublicKey}}"}';
logger.d('getStorageNoncePublicKey: requestHttp.body=' + _body);
final http.Response responseHttp = await http.post(
Uri.parse(endpoint! + '/api'),
body: _body,
headers: requestHeaders);
logger.d(
'getStorageNoncePublicKey: responseHttp.body=' + responseHttp.body);
if (responseHttp.statusCode == 200) {
sharedSecretsResponse =
sharedSecretsResponseFromJson(responseHttp.body);
if (sharedSecretsResponse.data != null &&
sharedSecretsResponse.data!.storageNoncePublicKey != null) {
_storageNoncePublicKey =
sharedSecretsResponse.data!.storageNoncePublicKey!;
}
}
} catch (e) {
logger.d('getStorageNoncePublicKey: error=' + e.toString());
}
_completer.complete(_storageNoncePublicKey);
return _completer.future;
}