Skip to content

Commit

Permalink
fix: check if keychain already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
vanlooverenkoen committed Dec 12, 2023
1 parent 9e56782 commit 40a6fe9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.10.5

# Fix:
- First check if new keychain already exists before creating a new one

# 0.10.4

# Fix:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';

import 'package:impaktfull_cli/src/core/model/data/secret.dart';
import 'package:impaktfull_cli/src/core/model/error/impaktfull_cli_error.dart';
import 'package:impaktfull_cli/src/core/plugin/impaktfull_cli_plugin.dart';
import 'package:impaktfull_cli/src/core/util/logger/logger.dart';
import 'package:impaktfull_cli/src/core/util/process/process_runner.dart';
Expand All @@ -17,6 +18,12 @@ class MacOsKeyChainPlugin extends ImpaktfullCliPlugin {
Secret globalKeyChainPassword,
) async {
final fullKeyChainName = _fullKeyChainName(keyChainName);
final originalKeyChains = await _getUserKeyChains();
if (originalKeyChains.contains(fullKeyChainName)) {
throw ImpaktfullCliError(
'$fullKeyChainName already exists, make sure to remove it first.');
}

ImpaktfullCliLogger.debug('Create Apple KeyChain ($fullKeyChainName)');
await processRunner.runProcess([
'security',
Expand Down

0 comments on commit 40a6fe9

Please sign in to comment.