initialize method
Initializer function for this class. It will be executed when ConnectionsManager is initialized. Use this to set-up your authentication flow, like setting up the signingManager instance.
Implementation
@override
void initialize() {
identifier = const Uuid().v4();
// If not receiving a JWK for a Key Pair to use, look for it in the local storage
// If not found, generate a random key pair and store it in Local Storage for future use
SharedPreferences.getInstance().then((prefs) async {
var jwk = prefs.getString('signing_manager_jwk');
if (jwk != null) {
logger.i("Found Keys JWK. Starting Signing Manager from old config");
var decoded = json.decode(jwk);
signingManager = SigningManager.initializeFromJwk(decoded);
} else {
logger.i(
"Old JWK Config not found. Starting a new instance for signing session");
signingManager = SigningManager.initialize();
var encoded = signingManager.convertToJwk();
await prefs.setString('signing_manager_jwk', encoded!);
}
});
}