Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(never merge) Added print statements #678

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,20 @@ class DerivPasskeysPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, View
)
viewModelScope.launch {
try {
println("Started")
val credentialManager = CredentialManager.create(activity)
println("Credential Manager called with request: ${listOf(getPublicKeyCredentialOption)}")
val result = credentialManager.getCredential(
context = activity,
request = GetCredentialRequest(listOf(getPublicKeyCredentialOption)),
)
println("Credential Manager results: $result")
val credential = result.credential as PublicKeyCredential
println("Credential json: ${credential.authenticationResponseJson}")
println("Credential: $credential")
callback(credential.authenticationResponseJson, null)
} catch (e: Exception) {
println("getCredential exception -> $e -> ${e.message}" )
callback(null, e)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,25 @@ class DerivPasskeysDataSource extends BaseDerivPasskeysDataSource {
final String url =
'https://${passkeysConnectionInfoModel.endpoint}/oauth2/api/v1/passkeys/login/verify';

print('DerivPasskeysDataSource: url -> $url');

final Map<String, String> headers = <String, String>{
'Content-Type': 'application/json',
'Authorization': 'Bearer $jwtToken',
'User-Agent': userAgent ?? 'Dart/3.0 (dart:io)',
'accept': 'application/json'
};

print('DerivPasskeysDataSource: headers -> $headers');

final Map<String, dynamic> jsonDecodedResponse = await client.post(
url: url,
headers: headers,
jsonBody: requestBodyModel.toJson(),
);

print('DerivPasskeysDataSource: jsonDecodedResponse -> $jsonDecodedResponse');

if (jsonDecodedResponse.containsKey('error_code')) {
throw ServerException(
errorCode: jsonDecodedResponse['error_code'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class MethodChannelDerivPasskeys extends BaseDerivPasskeysMethodChannel {
methodChannel.invokeMethod<String>(
'getCredential', <String, String>{'options': options}).catchError(
(Object error) {
print('MethodChannelDerivPasskeys: error -> $error');
if (error is PlatformException) {
if (error.code == '1001' ||
error.code == 'GetCredentialCancellationException') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,21 @@ class DerivPasskeysService {
.toJson();
final String options = jsonEncode(getOptionsResult);

print('DerivPasskeysService: options -> $options');

final String? response =
await BaseDerivPasskeysMethodChannel.instance.getCredential(options);

print('DerivPasskeysService: response -> $response');

if (response == null) {
throw PlatformException(
code: 'null-response',
message: 'Unable to get response from Passkey.');
}

final Map<String, dynamic> decodedResponse = jsonDecode(response);
print('DerivPasskeysService: decodedResponse -> $decodedResponse');

final DerivPasskeysVerifyCredentialsResponseEntity
getVerifyCredentialsResult = await repository.verifyCredentials(
Expand All @@ -100,6 +105,12 @@ class DerivPasskeysService {
userAgent: userAgent,
);

print('DerivPasskeysService: appId -> ${passkeysConnectionInfoEntity.appId}');
print('DerivPasskeysService: publicKeyCredential -> $decodedResponse');
print('DerivPasskeysService: jwtToken -> $jwtToken');
print('DerivPasskeysService: passkeysConnectionInfoEntity -> $passkeysConnectionInfoEntity');
print('DerivPasskeysService: userAgent -> $userAgent');
print('DerivPasskeysService: getVerifyCredentialsResult -> $getVerifyCredentialsResult');
return getVerifyCredentialsResult;
}
}
Expand Down
Loading