restoreSession method

Future<bool> restoreSession()

Implementation

Future<bool> restoreSession() async {
  try {
    if (_core.secureStorage.has(StorageConstants.solflareSession)) {
      final session = _core.secureStorage.get(
        StorageConstants.solflareSession,
      )!;
      _currentKeyPair = CryptoKeyPair(
        hex.encode(_getKeyBytes('${session['self_private_key']}')),
        hex.encode(_getKeyBytes('${session['self_public_key']}')),
      );
      _solflarePublicKey = session['solflare_encryption_public_key']!;
      _sessionToken = session['session_token']!;
      await _createSharedSecret();
      return true;
    }
    return false;
  } catch (e) {
    rethrow;
  }
}