Skip to content

Commit

Permalink
Merge pull request #487 from atsign-foundation/uptake_commons_into_auth
Browse files Browse the repository at this point in the history
build: Updated dependencies
  • Loading branch information
purnimavenkatasubbu authored Jan 23, 2024
2 parents d690d5f + 3ef7603 commit e8e5ed9
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 25 deletions.
6 changes: 6 additions & 0 deletions packages/at_auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.0.4
- build[deps]: Upgraded the following packages:
- at_commons to v4.0.0
- at_utils to v3.0.16
- at_chops to v1.0.7
- at_lookup to v3.0.44
## 1.0.3
- fix: upgrade at_lookup to 3.0.43 since 3.0.42 has breaking change for private key reference
## 1.0.2
Expand Down
13 changes: 7 additions & 6 deletions packages/at_auth/lib/src/at_auth_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,17 @@ class AtAuthImpl implements AtAuth {
// and delete cram key from server
final encryptionPublicKey = atAuthKeys.defaultEncryptionPublicKey;
UpdateVerbBuilder updateBuilder = UpdateVerbBuilder()
..atKey = 'publickey'
..isPublic = true
..value = encryptionPublicKey
..sharedBy = atOnboardingRequest.atSign;
..atKey = (AtKey()
..key = 'publickey'
..sharedBy = atOnboardingRequest.atSign
..metadata = (Metadata()..isPublic = true))
..value = encryptionPublicKey;
String? encryptKeyUpdateResult = await atLookUp!.executeVerb(updateBuilder);
_logger.info('Encryption public key update result $encryptKeyUpdateResult');

//8. Delete cram secret from the keystore as cram auth is complete
DeleteVerbBuilder deleteBuilder = DeleteVerbBuilder()
..atKey = AtConstants.atCramSecret;
..atKey = (AtKey()..key = AtConstants.atCramSecret);
String? deleteResponse = await atLookUp!.executeVerb(deleteBuilder);
_logger.info('Cram secret delete response : $deleteResponse');
atOnboardingResponse.isSuccessful = true;
Expand Down Expand Up @@ -251,7 +252,7 @@ class AtAuthImpl implements AtAuth {
_logger.finer('enrollment response: ${enrollmentResponse.toString()}');
var enrollmentIdFromServer = enrollmentResponse.enrollmentId;
var enrollmentStatus = enrollmentResponse.enrollStatus;
if (enrollmentStatus != EnrollStatus.approved) {
if (enrollmentStatus != EnrollmentStatus.approved) {
throw AtAuthenticationException(
'initial enrollment is not approved. Status from server: $enrollmentStatus');
}
Expand Down
15 changes: 8 additions & 7 deletions packages/at_auth/lib/src/enroll/at_enrollment_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ class AtEnrollmentImpl implements AtEnrollmentBase {

Future<String> _getDefaultEncryptionPublicKey(AtLookUp atLookupImpl) async {
var lookupVerbBuilder = LookupVerbBuilder()
..atKey = 'publickey'
..sharedBy = _atSign;
..atKey = (AtKey()
..key = 'publickey'
..sharedBy = _atSign);
String? lookupResult = await atLookupImpl.executeVerb(lookupVerbBuilder);
if (lookupResult == null || lookupResult.isEmpty) {
throw AtEnrollmentException(
Expand Down Expand Up @@ -164,15 +165,15 @@ class AtEnrollmentImpl implements AtEnrollmentBase {
_convertEnrollmentStatusToEnum(String enrollmentStatus) {
switch (enrollmentStatus) {
case 'approved':
return EnrollStatus.approved;
return EnrollmentStatus.approved;
case 'denied:':
return EnrollStatus.denied;
return EnrollmentStatus.denied;
case 'expired':
return EnrollStatus.expired;
return EnrollmentStatus.expired;
case 'revoked':
return EnrollStatus.revoked;
return EnrollmentStatus.revoked;
case 'pending':
return EnrollStatus.pending;
return EnrollmentStatus.pending;
default:
throw AtEnrollmentException(
'$enrollmentStatus is not a valid enrollment status');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AtEnrollmentResponse {
String enrollmentId;

/// The status of the enrollment operation.
EnrollStatus enrollStatus;
EnrollmentStatus enrollStatus;

/// Optional authentication keys associated with the enrollment.
AtAuthKeys? atAuthKeys;
Expand Down
10 changes: 5 additions & 5 deletions packages/at_auth/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: at_auth
description: Package that implements common logic for onboarding/authenticating an atsign to a secondary server
version: 1.0.3
version: 1.0.4
homepage: https://atsign.com/
repository: https://github.com/atsign-foundation/at_libraries

environment:
sdk: '>=3.0.0 <4.0.0'

dependencies:
at_commons: ^3.0.58
at_lookup: ^3.0.43
at_chops: ^1.0.6
at_utils: ^3.0.15
at_commons: ^4.0.0
at_lookup: ^3.0.44
at_chops: ^1.0.7
at_utils: ^3.0.16
meta: ^1.8.0
at_demo_data: ^1.0.3
crypton: ^2.1.0
Expand Down
2 changes: 1 addition & 1 deletion packages/at_auth/test/at_auth_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void main() {
.thenAnswer((_) =>
Future.value(AtAuthResponse('@alice🛠')..isSuccessful = true));
final mockEnrollmentResponse =
AtEnrollmentResponse("abc123", EnrollStatus.approved);
AtEnrollmentResponse("abc123", EnrollmentStatus.approved);
when(() => mockAtEnrollment.submitEnrollment(any(), mockAtLookUp))
.thenAnswer((_) => Future.value(mockEnrollmentResponse));
final atOnboardingRequest = AtOnboardingRequest('@alice🛠')
Expand Down
2 changes: 1 addition & 1 deletion packages/at_auth/test/enrollment_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void main() {
AtEnrollmentResponse atEnrollmentResponse = await atEnrollmentServiceImpl
.submitEnrollment(atNewEnrollmentRequest, mockAtLookUp);
expect(atEnrollmentResponse.enrollmentId, '123');
expect(atEnrollmentResponse.enrollStatus, EnrollStatus.pending);
expect(atEnrollmentResponse.enrollStatus, EnrollmentStatus.pending);
});

group('A group of test related to AtEnrollmentBuilder', () {
Expand Down
4 changes: 0 additions & 4 deletions tests/at_onboarding_cli_functional_tests/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ dependencies:
at_utils: ^3.0.15
at_lookup: ^3.0.40

dependency_overrides:
at_auth:
path: ../../packages/at_auth

dev_dependencies:
lints: ^1.0.0
test: ^1.17.2
Expand Down

0 comments on commit e8e5ed9

Please sign in to comment.