arkana 1.3.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce80a9e65c8e5657c8b6a911369535704cd614be0933aba04972b0ff593adedf
4
- data.tar.gz: 00b7213a6d42eb9ccd3acd3970a8cd520a3452306f60898d02fa3fba22adcb13
3
+ metadata.gz: eb1bab49c8625e2a2bd1cb8bd378789df20767222714a950028af877a4cfeb81
4
+ data.tar.gz: 9978033d03df9ea1c29528d8a506e6f82e43040c5675e81e5a84c2dc692a8b59
5
5
  SHA512:
6
- metadata.gz: bbfcc870b444b746a44c0ae611d92ea7fd62a72c45bc563a9217c1d4a84bfd4eb249ff8a612cb76d1911200f664195a35efb2bb6bf90f75998ddbd4fde039cfa
7
- data.tar.gz: e8e57f955a70b2d03b58cc0566cfef9633ce9a78e765d135786c49892880c44ca171a3e2991b5399348c3bd5650b69c52fb2728c80e79eaf06da7ed8c1f93168
6
+ metadata.gz: 06d2d9248ba8d07e6faa667861a163599e246d61544168d7eebac39e974adf2af0ab4fdf28af7f3582727c4f304dd7d18f3692f7a5b521305865af4df7439e84
7
+ data.tar.gz: 242062bff10a161e4a5734a828bcebed1694d3de700f2160720e17d87f3566c3ea68406e80f5e1c4c18a74294423df415881e0804ff75853f7ecf78eb410485a
@@ -24,6 +24,8 @@ class Config
24
24
  attr_reader :should_generate_unit_tests
25
25
  # @returns [string]
26
26
  attr_reader :package_manager
27
+ # @returns [boolean]
28
+ attr_reader :should_cocoapods_cross_import_modules
27
29
 
28
30
  # @returns [string]
29
31
  attr_accessor :current_flavor
@@ -45,6 +47,8 @@ class Config
45
47
  @should_generate_unit_tests = yaml["should_generate_unit_tests"]
46
48
  @should_generate_unit_tests = true if @should_generate_unit_tests.nil?
47
49
  @package_manager = yaml["package_manager"] || "spm"
50
+ @should_cocoapods_cross_import_modules = yaml["should_cocoapods_cross_import_modules"]
51
+ @should_cocoapods_cross_import_modules = true if @should_cocoapods_cross_import_modules.nil?
48
52
  end
49
53
  # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
50
54
 
@@ -24,6 +24,8 @@ class TemplateArguments
24
24
  @swift_declaration_strategy = config.swift_declaration_strategy
25
25
  # Whether unit tests should be generated.
26
26
  @should_generate_unit_tests = config.should_generate_unit_tests
27
+ # Whether cocoapods modules should cross import.
28
+ @should_cocoapods_cross_import_modules = config.should_cocoapods_cross_import_modules
27
29
  end
28
30
 
29
31
  def environment_protocol_secrets(environment)
@@ -12,6 +12,9 @@ Pod::Spec.new do |spec|
12
12
  spec.source = { path: "./" }
13
13
  spec.source_files = 'Sources/**/*.swift'
14
14
  spec.ios.deployment_target = '11.0'
15
+ spec.osx.deployment_target = '11.0'
16
+ spec.tvos.deployment_target = '11.0'
17
+ spec.watchos.deployment_target = '4.0'
15
18
  spec.swift_version = '5.0'
16
19
 
17
20
  spec.dependency '<%= @pod_name %>Interfaces', '~> 1.0.0'
@@ -5,7 +5,14 @@
5
5
  // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
6
6
 
7
7
  import Foundation
8
+ <% if !@should_cocoapods_cross_import_modules %>
9
+ #if COCOAPODS
10
+ #else
11
+ <% end %>
8
12
  import <%= @import_name %>Interfaces
13
+ <% if !@should_cocoapods_cross_import_modules %>
14
+ #endif
15
+ <% end %>
9
16
 
10
17
  public enum <%= @namespace %> {
11
18
  @inline(__always)
@@ -2,15 +2,29 @@
2
2
  // Automatically generated by Arkana (https://github.com/rogerluan/arkana)
3
3
 
4
4
  import Foundation
5
+ import <%= @import_name %>Interfaces
5
6
  import XCTest
6
7
  @testable import <%= @import_name %>
7
8
 
8
9
 
9
10
  final class <%= @namespace %>Tests: XCTestCase {
10
- private var salt: [UInt8] = [
11
- <%= @salt.formatted %>
11
+ private var salt: [UInt8]!
12
+ private var globalSecrets: <%= @namespace %>GlobalProtocol!
12
13
 
13
- ]
14
+ override func setUp() {
15
+ super.setUp()
16
+ salt = [
17
+ <%= @salt.formatted %>
18
+
19
+ ]
20
+ globalSecrets = <%= @namespace %>.Global()
21
+ }
22
+
23
+ override func tearDown() {
24
+ globalSecrets = nil
25
+ salt = nil
26
+ super.tearDown()
27
+ }
14
28
 
15
29
  func test_decodeRandomHexKey_shouldDecode() {
16
30
  <% hex_key = SecureRandom.hex(64) %>
@@ -71,4 +85,40 @@ final class <%= @namespace %>Tests: XCTestCase {
71
85
  ]
72
86
  XCTAssertEqual(<%= @namespace %>.decode(encoded: encoded, cipher: salt), 42)
73
87
  }
88
+
89
+ func test_encodeAndDecodeValueWithDollarSign_shouldDecode() {
90
+ <% dollar_sign_key = "real_$lim_shady" %>
91
+ <% secret = generate_test_secret(key: dollar_sign_key) %>
92
+ let encoded: [UInt8] = [
93
+ <%= secret.encoded_value %>
94
+
95
+ ]
96
+ XCTAssertEqual(<%= @namespace %>.decode(encoded: encoded, cipher: salt), "real_$lim_shady")
97
+ }
98
+ <% if ENV["ARKANA_RUNNING_CI_INTEGRATION_TESTS"] %>
99
+
100
+ func test_decodeEnvVarFromDotfile_withDollarSign__andEscaped_andNoQuotes_shouldDecode() {
101
+ XCTAssertEqual(globalSecrets.secretWithDollarSignEscapedAndAndNoQuotesKey, "real_$lim_shady")
102
+ }
103
+
104
+ func test_decodeEnvVarFromDotfile_withDollarSign__andEscaped_andDoubleQuotes_shouldDecode() {
105
+ XCTAssertEqual(globalSecrets.secretWithDollarSignEscapedAndDoubleQuoteKey, "real_$lim_shady")
106
+ }
107
+
108
+ func test_decodeEnvVarFromDotfile_withDollarSign__andNotEscaped_andSingleQuotes_shouldDecode() {
109
+ XCTAssertEqual(globalSecrets.secretWithDollarSignNotEscapedAndSingleQuoteKey, "real_$lim_shady")
110
+ }
111
+
112
+ func test_decodeEnvVarFromDotfile_withDollarSign__andNotEscaped_andDoubleQuotes_shouldDecodeWithUnexpectedValue() {
113
+ XCTAssertNotEqual(globalSecrets.secretWithDollarSignNotEscapedAndDoubleQuotesKey, "real_$lim_shady")
114
+ }
115
+
116
+ func test_decodeEnvVarFromDotfile_withDollarSign__andNotEscaped_andNoQuotes_shouldDecodeWithUnexpectedValue() {
117
+ XCTAssertNotEqual(globalSecrets.secretWithDollarSignNotEscapedAndNoQuotesKey, "real_$lim_shady")
118
+ }
119
+
120
+ func test_decodeEnvVarFromDotfile_withWeirdCharacters_shouldDecode() {
121
+ XCTAssertEqual(globalSecrets.secretWithWeirdCharactersKey, "` ~ ! @ # % ^ & * ( ) _ - + = { [ } } | : ; ' < , > . ? /")
122
+ }
123
+ <% end %>
74
124
  }
@@ -12,5 +12,8 @@ Pod::Spec.new do |spec|
12
12
  spec.source = { path: "./" }
13
13
  spec.source_files = 'Sources/**/*.swift'
14
14
  spec.ios.deployment_target = '11.0'
15
+ spec.osx.deployment_target = '11.0'
16
+ spec.tvos.deployment_target = '11.0'
17
+ spec.watchos.deployment_target = '4.0'
15
18
  spec.swift_version = '5.0'
16
19
  end
@@ -10,6 +10,8 @@ let package = Package(
10
10
  platforms: [
11
11
  .macOS(.v11),
12
12
  .iOS(.v11),
13
+ .tvOS(.v11),
14
+ .watchOS(.v4),
13
15
  ],
14
16
  products: [
15
17
  .library(
@@ -10,6 +10,8 @@ let package = Package(
10
10
  platforms: [
11
11
  .macOS(.v11),
12
12
  .iOS(.v11),
13
+ .tvOS(.v11),
14
+ .watchOS(.v4),
13
15
  ],
14
16
  products: [
15
17
  .library(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Arkana
4
- VERSION = "1.3.1"
4
+ VERSION = "1.5.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkana
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Oba
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-12 00:00:00.000000000 Z
11
+ date: 2023-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -105,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
- version: 2.6.9
108
+ version: '2.7'
109
109
  required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
111
  - - ">="