arkana 1.1.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arkana/encoder.rb +1 -0
- data/lib/arkana/helpers/enumerable.rb +16 -0
- data/lib/arkana/helpers/swift_template_helper.rb +1 -0
- data/lib/arkana/models/config.rb +1 -1
- data/lib/arkana/models/type.rb +3 -0
- data/lib/arkana/templates/arkana.swift.erb +10 -0
- data/lib/arkana/templates/arkana_tests.swift.erb +30 -0
- data/lib/arkana/version.rb +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3242744410abe76a55179b7b5b96f439954ab12ba5e7ff158f6246632638fe82
|
4
|
+
data.tar.gz: 1d4f26ecd3620042a7b8766760e294565bee9d16dd21f2784fe493e82745bc14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a9ebab8bb7034af9b9a754f1b808f77a7d56ead4220a96037411103512a0accb5774989cf86aedf6b31f2c8426798826cab243c100c104386beae8104c36603
|
7
|
+
data.tar.gz: d8d6b424743d72b83f349078febc04bcb08621f8472211a69ec594e35ecb32c4dde96cb72ead008766f3bc5381c12f3170d356275403ac0a69c676d2fcf501e9
|
data/lib/arkana/encoder.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Enumerable extensions and utilities.
|
4
|
+
module Enumerable
|
5
|
+
# NOTE: This is a backport of Ruby 2.7 filter_map. This method can be deleted when the minimum target Ruby version is 2.7
|
6
|
+
# We're not gating against redefining the method (e.g. via `unless Enumerable.method_defined? :filter_map`) because this
|
7
|
+
# would reduce the code coverage when analysing code coverage on Ruby versions >= 2.7
|
8
|
+
def filter_map
|
9
|
+
return to_enum(:filter_map) unless block_given?
|
10
|
+
|
11
|
+
each_with_object([]) do |item, res|
|
12
|
+
processed = yield(item)
|
13
|
+
res << processed if processed
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/arkana/models/config.rb
CHANGED
@@ -32,7 +32,7 @@ class Config
|
|
32
32
|
|
33
33
|
# rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
34
34
|
def initialize(yaml)
|
35
|
-
@environments = (yaml["environments"] || []).map(&:
|
35
|
+
@environments = (yaml["environments"] || []).map(&:capitalize_first_letter)
|
36
36
|
@environment_secrets = yaml["environment_secrets"] || []
|
37
37
|
@global_secrets = yaml["global_secrets"] || []
|
38
38
|
default_name = "ArkanaKeys"
|
data/lib/arkana/models/type.rb
CHANGED
@@ -19,6 +19,16 @@ public enum <%= @namespace %> {
|
|
19
19
|
element ^ cipher[offset % cipher.count]
|
20
20
|
}, as: UTF8.self)
|
21
21
|
}
|
22
|
+
|
23
|
+
static func decode(encoded: [UInt8], cipher: [UInt8]) -> Bool {
|
24
|
+
let stringValue: String = Self.decode(encoded: encoded, cipher: cipher)
|
25
|
+
return Bool(stringValue)!
|
26
|
+
}
|
27
|
+
|
28
|
+
static func decode(encoded: [UInt8], cipher: [UInt8]) -> Int {
|
29
|
+
let stringValue: String = Self.decode(encoded: encoded, cipher: cipher)
|
30
|
+
return Int(stringValue)!
|
31
|
+
}
|
22
32
|
}
|
23
33
|
|
24
34
|
public extension <%= @namespace %> {
|
@@ -41,4 +41,34 @@ final class <%= @namespace %>Tests: XCTestCase {
|
|
41
41
|
]
|
42
42
|
XCTAssertEqual(<%= @namespace %>.decode(encoded: encoded, cipher: salt), "<%= uuid_key %>")
|
43
43
|
}
|
44
|
+
|
45
|
+
func test_decodeTrueBoolValue_shouldDecode() {
|
46
|
+
<% bool_key = "true" %>
|
47
|
+
<% secret = generate_test_secret(key: bool_key) %>
|
48
|
+
let encoded: [UInt8] = [
|
49
|
+
<%= secret.encoded_value %>
|
50
|
+
|
51
|
+
]
|
52
|
+
XCTAssertTrue(<%= @namespace %>.decode(encoded: encoded, cipher: salt))
|
53
|
+
}
|
54
|
+
|
55
|
+
func test_decodeFalseBoolValue_shouldDecode() {
|
56
|
+
<% bool_key = "false" %>
|
57
|
+
<% secret = generate_test_secret(key: bool_key) %>
|
58
|
+
let encoded: [UInt8] = [
|
59
|
+
<%= secret.encoded_value %>
|
60
|
+
|
61
|
+
]
|
62
|
+
XCTAssertFalse(<%= @namespace %>.decode(encoded: encoded, cipher: salt))
|
63
|
+
}
|
64
|
+
|
65
|
+
func test_decodeIntValue_shouldDecode() {
|
66
|
+
<% int_key = "42" %>
|
67
|
+
<% secret = generate_test_secret(key: int_key) %>
|
68
|
+
let encoded: [UInt8] = [
|
69
|
+
<%= secret.encoded_value %>
|
70
|
+
|
71
|
+
]
|
72
|
+
XCTAssertEqual(<%= @namespace %>.decode(encoded: encoded, cipher: salt), 42)
|
73
|
+
}
|
44
74
|
}
|
data/lib/arkana/version.rb
CHANGED
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.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roger Oba
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.2'
|
55
|
-
description:
|
55
|
+
description:
|
56
56
|
email:
|
57
57
|
- rogerluan.oba@gmail.com
|
58
58
|
executables:
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- lib/arkana/config_parser.rb
|
68
68
|
- lib/arkana/encoder.rb
|
69
69
|
- lib/arkana/helpers/dotenv_helper.rb
|
70
|
+
- lib/arkana/helpers/enumerable.rb
|
70
71
|
- lib/arkana/helpers/string.rb
|
71
72
|
- lib/arkana/helpers/swift_template_helper.rb
|
72
73
|
- lib/arkana/helpers/ui.rb
|
@@ -96,7 +97,7 @@ metadata:
|
|
96
97
|
source_code_uri: https://github.com/rogerluan/arkana
|
97
98
|
changelog_uri: https://github.com/rogerluan/arkana/blob/main/CHANGELOG.md
|
98
99
|
rubygems_mfa_required: 'true'
|
99
|
-
post_install_message:
|
100
|
+
post_install_message:
|
100
101
|
rdoc_options: []
|
101
102
|
require_paths:
|
102
103
|
- lib
|
@@ -104,15 +105,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
105
|
requirements:
|
105
106
|
- - ">="
|
106
107
|
- !ruby/object:Gem::Version
|
107
|
-
version: 2.
|
108
|
+
version: 2.6.9
|
108
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
110
|
requirements:
|
110
111
|
- - ">="
|
111
112
|
- !ruby/object:Gem::Version
|
112
113
|
version: '0'
|
113
114
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
115
|
-
signing_key:
|
115
|
+
rubygems_version: 3.3.7
|
116
|
+
signing_key:
|
116
117
|
specification_version: 4
|
117
118
|
summary: Store your keys and secrets away from your source code. Designed for Android
|
118
119
|
and iOS projects.
|