Skip to content

Commit

Permalink
Merge pull request #1299 from atsign-foundation/1294-atchopsselfencry…
Browse files Browse the repository at this point in the history
…ptionkey-in-atchops-is-not-being-set

fix: Add SelfEncryptionKey to the AtChops instance
  • Loading branch information
sitaram-kalluri authored Apr 16, 2024
2 parents 49e2816 + 3316286 commit 1f8e20b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/at_client_mobile/lib/at_client_mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ export 'package:at_client/at_client.dart';

@Deprecated('Use AtClientMobile.authService')
export 'src/at_client_auth.dart';
export 'src/at_client_mobile_base.dart';
@Deprecated('Use AtClientMobile.authService')
export 'src/at_client_service.dart';

// Contains public methods to handle the onboarding, authentication, and enrollment submission for an atSign
export 'src/auth/at_auth_service.dart';

@Deprecated('Use AtClientMobile.authService')
// TODO: Remove this is next major release
export 'src/auth/at_auth_service_impl.dart';
// Contains the enrollment details
export 'src/enrollment/enrollment_info.dart';
export 'src/keychain_manager.dart';
export 'src/onboarding_status.dart';
export 'src/at_client_mobile_base.dart';
4 changes: 3 additions & 1 deletion packages/at_client_mobile/lib/src/at_client_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import 'dart:convert';
import 'dart:core';

import 'package:at_chops/at_chops.dart';
import 'package:at_client_mobile/at_client_mobile.dart';
import 'package:at_client_mobile/src/atsign_key.dart';
import 'package:at_commons/at_builders.dart';
import 'package:at_lookup/at_lookup.dart';
import 'package:at_utils/at_logger.dart';
import 'package:at_chops/at_chops.dart';
import 'package:flutter/cupertino.dart';

class AtClientService {
Expand Down Expand Up @@ -454,6 +454,8 @@ class AtClientService {
decryptedAtKeys[BackupKeyConstants.PKAM_PUBLIC_KEY_FROM_KEY_FILE]!,
decryptedAtKeys[BackupKeyConstants.PKAM_PRIVATE_KEY_FROM_KEY_FILE]!);
final atChopsKeys = AtChopsKeys.create(atEncryptionKeyPair, atPkamKeyPair);
atChopsKeys.selfEncryptionKey = AESKey(
decryptedAtKeys[BackupKeyConstants.SELF_ENCRYPTION_KEY_FROM_FILE]!);
final atChops = AtChopsImpl(atChopsKeys);
return atChops;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ class AtAuthServiceImpl implements AtAuthService {

final Map<String, Completer<EnrollmentStatus>> _outcomes = {};

/// Returns an instance of [AtAuthService]
///
/// Usage:
/// ```dart
/// AtAuthService authService = AtClientMobile.authService(_atsign!, _atClientPreference);
/// ```
AtAuthServiceImpl(this._atSign, this._atClientPreference) {
// If the '@' symbol is omitted, it leads to an incorrect format for the AtKey when retrieving the
// encrypted defaultEncryptionPrivateKey and encrypted defaultSelfEncryptionKey.
Expand Down

0 comments on commit 1f8e20b

Please sign in to comment.