secure-keys 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +28 -1
 - data/lib/core/console/arguments/handler.rb +30 -0
 - data/lib/core/console/arguments/parser.rb +43 -0
 - data/lib/core/globals/globals.rb +11 -7
 - data/lib/keys.rb +3 -2
 - data/lib/version.rb +1 -1
 - metadata +18 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8cd5c377f201fdb4fd22802645629371e0846768d444398b5fc8de07152edb58
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 845e7fb862ec80987753479bfba9b978336c3090123c41b7dac765ec20a1465b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 301b39d752b908b2f8817223a74ee84d8f08a9e3da3f7c41be022d03f392af2a0cb0dd2a320ed73e0c643536826606dad87a9c384da4c3c58c2e2e1af8149c6c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: bd83843339d9169c06e80e31ed3b0fb98f574cd2367001158e668ae38534cc287f8f959b57fbadf343da89e9ddd216f89952c2289a489a9843dbd6ab2bff80ba
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -128,6 +128,33 @@ Using bundler: 
     | 
|
| 
       128 
128 
     | 
    
         
             
            bundle exec secure-keys
         
     | 
| 
       129 
129 
     | 
    
         
             
            ```
         
     | 
| 
       130 
130 
     | 
    
         | 
| 
      
 131 
     | 
    
         
            +
            To get more information about the command, you can use the `--help` option.
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 134 
     | 
    
         
            +
            secure-keys --help
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            # Output
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
            Usage: secure-keys [--options]
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
                -h, --help                       Use the provided commands to select the params
         
     | 
| 
      
 141 
     | 
    
         
            +
                -d, --delimiter DELIMITER        The delimiter to use for the key access (default: ",")
         
     | 
| 
      
 142 
     | 
    
         
            +
                -i, --identifier IDENTIFIER      The identifier to use for the key access (default: "secure-keys")
         
     | 
| 
      
 143 
     | 
    
         
            +
                -v, --version                    Show the secure-keys version
         
     | 
| 
      
 144 
     | 
    
         
            +
            ```
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
            To avoid defining the `SECURE_KEYS_IDENTIFIER` and `SECURE_KEYS_DELIMITER` env variables, you can use the `--identifier` and `--delimiter` options.
         
     | 
| 
      
 147 
     | 
    
         
            +
             
     | 
| 
      
 148 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 149 
     | 
    
         
            +
            secure-keys --identifier "your-keychain-or-env-variable-identifier" --delimiter "|"
         
     | 
| 
      
 150 
     | 
    
         
            +
            ```
         
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
      
 152 
     | 
    
         
            +
            Also, you can use the short options:
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 155 
     | 
    
         
            +
            secure-keys -i "your-keychain-or-env-variable-identifier" -d "|"
         
     | 
| 
      
 156 
     | 
    
         
            +
            ```
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
       131 
158 
     | 
    
         
             
            ### iOS project
         
     | 
| 
       132 
159 
     | 
    
         | 
| 
       133 
160 
     | 
    
         
             
            Within the iOS project, you can use the `SecureKeys` target dependency like:
         
     | 
| 
         @@ -189,7 +216,7 @@ The process when the script is executed is: 
     | 
|
| 
       189 
216 
     | 
    
         | 
| 
       190 
217 
     | 
    
         
             
            1. Create a `.secure-keys` directory.
         
     | 
| 
       191 
218 
     | 
    
         
             
            2. Create a temporary `Swift Package` in the `.secure-keys` directory.
         
     | 
| 
       192 
     | 
    
         
            -
            3. Copy the ` 
     | 
| 
      
 219 
     | 
    
         
            +
            3. Copy the `SecureKeys` source code to the temporary `Swift Package`.
         
     | 
| 
       193 
220 
     | 
    
         | 
| 
       194 
221 
     | 
    
         
             
               ```swift
         
     | 
| 
       195 
222 
     | 
    
         
             
               public enum SecureKey {
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module SecureKeys
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Core
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Console
         
     | 
| 
      
 4 
     | 
    
         
            +
                  module Argument
         
     | 
| 
      
 5 
     | 
    
         
            +
                    class Handler
         
     | 
| 
      
 6 
     | 
    
         
            +
                      class << self
         
     | 
| 
      
 7 
     | 
    
         
            +
                        attr_reader :arguments
         
     | 
| 
      
 8 
     | 
    
         
            +
                      end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                      # Configure the default arguments
         
     | 
| 
      
 11 
     | 
    
         
            +
                      @arguments = {
         
     | 
| 
      
 12 
     | 
    
         
            +
                        delimiter: nil,
         
     | 
| 
      
 13 
     | 
    
         
            +
                        identifier: nil,
         
     | 
| 
      
 14 
     | 
    
         
            +
                      }
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                      # Fetch the argument value by key
         
     | 
| 
      
 17 
     | 
    
         
            +
                      # from CLI arguments or environment variables
         
     | 
| 
      
 18 
     | 
    
         
            +
                      #
         
     | 
| 
      
 19 
     | 
    
         
            +
                      # @param key [Symbol] the argument key
         
     | 
| 
      
 20 
     | 
    
         
            +
                      # @param default [String] the default value
         
     | 
| 
      
 21 
     | 
    
         
            +
                      #
         
     | 
| 
      
 22 
     | 
    
         
            +
                      # @return [String] the argument value
         
     | 
| 
      
 23 
     | 
    
         
            +
                      def self.fetch(key:, default: nil)
         
     | 
| 
      
 24 
     | 
    
         
            +
                        @arguments[key.to_sym] || ENV.fetch("secure_keys_#{key}".upcase, nil) || default
         
     | 
| 
      
 25 
     | 
    
         
            +
                      end
         
     | 
| 
      
 26 
     | 
    
         
            +
                    end
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,43 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'optparse'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require_relative '../../globals/globals'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require_relative './handler'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            module SecureKeys
         
     | 
| 
      
 8 
     | 
    
         
            +
              module Core
         
     | 
| 
      
 9 
     | 
    
         
            +
                module Console
         
     | 
| 
      
 10 
     | 
    
         
            +
                  module Argument
         
     | 
| 
      
 11 
     | 
    
         
            +
                    class Parser < OptionParser
         
     | 
| 
      
 12 
     | 
    
         
            +
                      # Initialize the argument parser with the default options
         
     | 
| 
      
 13 
     | 
    
         
            +
                      def initialize
         
     | 
| 
      
 14 
     | 
    
         
            +
                        super('Usage: secure-keys [--options]')
         
     | 
| 
      
 15 
     | 
    
         
            +
                        separator('')
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                        # Configure the arguement parser
         
     | 
| 
      
 18 
     | 
    
         
            +
                        configure!
         
     | 
| 
      
 19 
     | 
    
         
            +
                        parse!(into: Handler.arguments)
         
     | 
| 
      
 20 
     | 
    
         
            +
                      end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                      private
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                      # Configure the argument parser
         
     | 
| 
      
 25 
     | 
    
         
            +
                      def configure!
         
     | 
| 
      
 26 
     | 
    
         
            +
                        on('-h', '--help', 'Use the provided commands to select the params') do
         
     | 
| 
      
 27 
     | 
    
         
            +
                          puts self
         
     | 
| 
      
 28 
     | 
    
         
            +
                          exit(0)
         
     | 
| 
      
 29 
     | 
    
         
            +
                        end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                        on('-d', '--delimiter DELIMITER', String, "The delimiter to use for the key access (default: \"#{Globals.default_key_delimiter}\")")
         
     | 
| 
      
 32 
     | 
    
         
            +
                        on('-i', '--identifier IDENTIFIER', String, "The identifier to use for the key access (default: \"#{Globals.default_key_access_identifier}\")")
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                        on('-v', '--version', 'Show the secure-keys version') do
         
     | 
| 
      
 35 
     | 
    
         
            +
                          puts "secure-keys version: v#{SecureKeys::VERSION}"
         
     | 
| 
      
 36 
     | 
    
         
            +
                          exit(0)
         
     | 
| 
      
 37 
     | 
    
         
            +
                        end
         
     | 
| 
      
 38 
     | 
    
         
            +
                      end
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
      
 43 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/core/globals/globals.rb
    CHANGED
    
    | 
         @@ -1,5 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #!/usr/bin/env ruby
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require_relative '../console/arguments/handler'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       3 
5 
     | 
    
         
             
            module SecureKeys
         
     | 
| 
       4 
6 
     | 
    
         
             
              module Globals
         
     | 
| 
       5 
7 
     | 
    
         
             
                module_function
         
     | 
| 
         @@ -40,7 +42,15 @@ module SecureKeys 
     | 
|
| 
       40 
42 
     | 
    
         
             
                # Returns the identifier to get all the key names
         
     | 
| 
       41 
43 
     | 
    
         
             
                # @return [String] key access identifier
         
     | 
| 
       42 
44 
     | 
    
         
             
                def key_access_identifier
         
     | 
| 
       43 
     | 
    
         
            -
                   
     | 
| 
      
 45 
     | 
    
         
            +
                  Core::Console::Argument::Handler.fetch(key: :identifier,
         
     | 
| 
      
 46 
     | 
    
         
            +
                                                         default: default_key_access_identifier)
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                # Returns the keys delimiter
         
     | 
| 
      
 50 
     | 
    
         
            +
                # @return [String] keys delimiter
         
     | 
| 
      
 51 
     | 
    
         
            +
                def key_delimiter
         
     | 
| 
      
 52 
     | 
    
         
            +
                  Core::Console::Argument::Handler.fetch(key: :delimiter,
         
     | 
| 
      
 53 
     | 
    
         
            +
                                                         default: default_key_delimiter)
         
     | 
| 
       44 
54 
     | 
    
         
             
                end
         
     | 
| 
       45 
55 
     | 
    
         | 
| 
       46 
56 
     | 
    
         
             
                # Returns the default key access identifier
         
     | 
| 
         @@ -49,12 +59,6 @@ module SecureKeys 
     | 
|
| 
       49 
59 
     | 
    
         
             
                  'secure-keys'
         
     | 
| 
       50 
60 
     | 
    
         
             
                end
         
     | 
| 
       51 
61 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
                # Returns the keys delimiter
         
     | 
| 
       53 
     | 
    
         
            -
                # @return [String] keys delimiter
         
     | 
| 
       54 
     | 
    
         
            -
                def key_delimiter
         
     | 
| 
       55 
     | 
    
         
            -
                  ENV['SECURE_KEYS_DELIMITER'] || default_key_delimiter
         
     | 
| 
       56 
     | 
    
         
            -
                end
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
62 
     | 
    
         
             
                # Returns the default keys delimiter
         
     | 
| 
       59 
63 
     | 
    
         
             
                # @return [String] default keys delimiter
         
     | 
| 
       60 
64 
     | 
    
         
             
                def default_key_delimiter
         
     | 
    
        data/lib/keys.rb
    CHANGED
    
    | 
         @@ -8,6 +8,7 @@ require_relative './core/utils/swift/package' 
     | 
|
| 
       8 
8 
     | 
    
         
             
            require_relative './core/utils/swift/swift'
         
     | 
| 
       9 
9 
     | 
    
         
             
            require_relative './core/utils/swift/xcframework'
         
     | 
| 
       10 
10 
     | 
    
         
             
            require_relative './core/utils/openssl/cipher'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require_relative './core/console/arguments/parser'
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
       12 
13 
     | 
    
         
             
            module SecureKeys
         
     | 
| 
       13 
14 
     | 
    
         
             
              class Generator
         
     | 
| 
         @@ -18,8 +19,8 @@ module SecureKeys 
     | 
|
| 
       18 
19 
     | 
    
         
             
                public
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
       20 
21 
     | 
    
         
             
                def initialize
         
     | 
| 
       21 
     | 
    
         
            -
                  #  
     | 
| 
       22 
     | 
    
         
            -
                   
     | 
| 
      
 22 
     | 
    
         
            +
                  # Configure the argument parser
         
     | 
| 
      
 23 
     | 
    
         
            +
                  SecureKeys::Core::Console::Argument::Parser.new
         
     | 
| 
       23 
24 
     | 
    
         | 
| 
       24 
25 
     | 
    
         
             
                  puts "🔔 You're using a custom delimiter '#{SecureKeys::Globals.key_delimiter}'" unless SecureKeys::Globals.key_delimiter.eql?(SecureKeys::Globals.default_key_delimiter)
         
     | 
| 
       25 
26 
     | 
    
         
             
                  puts "🔔 You're using a custom key access identifier '#{SecureKeys::Globals.key_access_identifier}'" unless SecureKeys::Globals.key_access_identifier.eql?(SecureKeys::Globals.default_key_access_identifier)
         
     | 
    
        data/lib/version.rb
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #!/usr/bin/env ruby
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module SecureKeys
         
     | 
| 
       4 
     | 
    
         
            -
              VERSION = '1.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              VERSION = '1.1.2'.freeze
         
     | 
| 
       5 
5 
     | 
    
         
             
              SUMMARY = 'Secure Keys is a simple tool for managing your secret keys'.freeze
         
     | 
| 
       6 
6 
     | 
    
         
             
              DESCRIPTION = 'Secure Keys is a simple tool to manage your secret keys in your iOS project'.freeze
         
     | 
| 
       7 
7 
     | 
    
         
             
              HOMEPAGE_URI = 'https://github.com/DerianCordobaPerez/secure-keys-generator'.freeze
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: secure-keys
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Derian Córdoba
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2025-02- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2025-02-22 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: base64
         
     | 
| 
         @@ -66,6 +66,20 @@ dependencies: 
     | 
|
| 
       66 
66 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       67 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
68 
     | 
    
         
             
                    version: 2.10.1
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: optparse
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: 0.6.0
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: 0.6.0
         
     | 
| 
       69 
83 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
84 
     | 
    
         
             
              name: osx_keychain
         
     | 
| 
       71 
85 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -102,6 +116,8 @@ executables: 
     | 
|
| 
       102 
116 
     | 
    
         
             
            extensions: []
         
     | 
| 
       103 
117 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       104 
118 
     | 
    
         
             
            files:
         
     | 
| 
      
 119 
     | 
    
         
            +
            - "./lib/core/console/arguments/handler.rb"
         
     | 
| 
      
 120 
     | 
    
         
            +
            - "./lib/core/console/arguments/parser.rb"
         
     | 
| 
       105 
121 
     | 
    
         
             
            - "./lib/core/environment/ci.rb"
         
     | 
| 
       106 
122 
     | 
    
         
             
            - "./lib/core/environment/keychain.rb"
         
     | 
| 
       107 
123 
     | 
    
         
             
            - "./lib/core/globals/globals.rb"
         
     |