initialize static method
Future<void>
initialize(
{ - required String apiUrl,
- String? namespace,
- bool? debug,
- TransportCredentials? transportCredentials,
- dynamic authorize,
})
Implementation
static Future<void> initialize({
required String apiUrl,
String? namespace,
bool? debug,
TransportCredentials? transportCredentials,
Authorize? authorize,
}) async {
// setup transport credentials
TransportCredentials _transportCredentials =
transportCredentials ?? NoTransportCredentials();
// set values
ServiceClient _heraClient =
await HeraChannel.userServiceClient(apiUrl, _transportCredentials);
// build authorize
Authorize _authorize = authorize ?? NoAuthorization();
// get block user public key
HeraRequest publicKeysReq = HeraRequest();
publicKeysReq.cloudToken = await _authorize.getAccessToken();
HeraResponse publicKeysResp = await _heraClient.publicKeys(publicKeysReq);
String? jwtPublicKey = publicKeysResp.publicKeys["hera-public-key"];
// biometric storage
service = HeraService(
grpcUserClient: _heraClient,
jwtPublicKey: jwtPublicKey ?? "",
authorize: _authorize,
debug: debug ?? false,
sharedPreferences: await SharedPreferences.getInstance(),
namespace: namespace ?? "",
);
}