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

feat: introduce at_signing_algo and hashing_algo in at_auth_request and at_onboarding_request #608

Open
wants to merge 11 commits into
base: trunk
Choose a base branch
from
Open
8 changes: 5 additions & 3 deletions packages/at_auth/lib/src/at_auth_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class AtAuthImpl implements AtAuth {
}
atLookUp ??= AtLookupImpl(
atAuthRequest.atSign, atAuthRequest.rootDomain, atAuthRequest.rootPort);
var atChops = _createAtChops(atAuthKeys);
this.atChops = atChops;
atLookUp!.atChops = atChops;
atLookUp?.signingAlgoType = atAuthRequest.signingAlgoType;
atLookUp?.hashingAlgoType = atAuthRequest.hashingAlgoType;
atLookUp!.atChops = atChops = _createAtChops(atAuthKeys);
srieteja marked this conversation as resolved.
Show resolved Hide resolved
_logger.finer('Authenticating using PKAM');
var isPkamAuthenticated = false;
pkamAuthenticator ??= PkamAuthenticator(atAuthRequest.atSign, atLookUp!);
Expand Down Expand Up @@ -106,6 +106,8 @@ class AtAuthImpl implements AtAuth {
atEnrollmentBase = AtEnrollmentImpl(atOnboardingRequest.atSign);
atLookUp ??= AtLookupImpl(atOnboardingRequest.atSign,
atOnboardingRequest.rootDomain, atOnboardingRequest.rootPort);
atLookUp?.signingAlgoType = atOnboardingRequest.signingAlgoType;
atLookUp?.hashingAlgoType = atOnboardingRequest.hashingAlgoType;

//1. cram auth
cramAuthenticator ??=
Expand Down
7 changes: 7 additions & 0 deletions packages/at_auth/lib/src/auth/at_auth_request.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:at_auth/src/keys/at_auth_keys.dart';
import 'package:at_chops/at_chops.dart';
import 'package:at_commons/at_commons.dart';

/// Represents an authentication request of an atSign.
Expand Down Expand Up @@ -31,4 +32,10 @@ class AtAuthRequest {

/// public key id from secure element if [authMode] is [PkamAuthMode.sim]
String? publicKeyId;

/// Signing algorithm to use for pkam authentication
SigningAlgoType signingAlgoType = SigningAlgoType.rsa2048;

/// Hashing algorithm to use for pkam authentication
HashingAlgoType hashingAlgoType = HashingAlgoType.sha256;
}
7 changes: 7 additions & 0 deletions packages/at_auth/lib/src/onboard/at_onboarding_request.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:at_chops/at_chops.dart';
import 'package:at_commons/at_commons.dart';

class AtOnboardingRequest {
Expand All @@ -13,4 +14,10 @@ class AtOnboardingRequest {

/// public key id if [authMode] is [PkamAuthMode.sim]
String? publicKeyId;

/// Signing algorithm to use for cram authentication
SigningAlgoType signingAlgoType = SigningAlgoType.rsa2048;

/// Hashing algorithm to use for cram authentication
HashingAlgoType hashingAlgoType = HashingAlgoType.sha256;
}