Skip to main content

fexr.validate

The fexr.validate challenge is passed to the server/node. The node/server responds with challenge response. The challenge response is received at the client which indicates whether the connection is success or not.

Parameters

The input parameters for ValidatePermission is the IP,DID and a code. When this challenge is given to the server which is the node to which we want to establish a connection.

IP

type: string | required

proxyIP or the public IP address of the node or server is the mandatory input parameter for ValidatePermission. It is using this public IP address the connection between the node and the wallet is established.

DID

type: string | optional

DID or Decentralized Identity is the unique identity of each node. This value is an optional parameter because for a new node in the network the DID will only be created after the first connection is established.

code

type: int | required

Code is just an integer code number which is used as a identification code.

Response

When the challenge is received at the server/node side, the server/node responds with a challenge response,

p2pConnectionStatus

type: bool

This peer to peer connection status is a boolean value which indicates whether the connection is existing or not.

code

type: int

This response code is an integer value which indicates the status of the connection.

Sample Code

  PassportService().validatePermission("IP Address",
"DID", 0)
.then((p2pConnectionStatus value) => setState(() {
_CONNECTED = value.connected;
})
)
);

Example

Example
Future<p2pConnectionStatus> validatePermission(
String proxyIP, String dID, int code) async {
p2pConnectionStatus response;
final channel = ClientChannel(
proxyIP,
port: Const.PORT,
options: ChannelOptions(
credentials: ChannelCredentials.insecure(),
codecRegistry:
CodecRegistry(codecs: const [GzipCodec(), IdentityCodec()]),
),
);

stub = POPServiceClient(channel,
options: CallOptions(timeout: Duration(seconds: 10)));

try {
response = await stub
.validatePermission(web3WalletPermission(dID: dID, code: code, payload: ""));
// result = response.toString();
} catch (e) {
return p2pConnectionStatus(
connected: false, code: 404, message: e.toString());
}
await channel.shutdown();
return response;
}