-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#53 Add support to Android using Kotlin code generation
- Loading branch information
Showing
38 changed files
with
1,176 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Kotlin Tests | ||
on: [push, pull_request] | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest # Assuming Kotlin projects can be built on Linux | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- name: Cache Gradle packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '3.2' | ||
bundler-cache: true # Runs 'bundle install' and caches installed gems automatically | ||
- name: Generate Kotlin Code & Run Tests | ||
run: bundle exec rake test_kotlin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// DO NOT MODIFY | ||
// Automatically generated by Arkana (https://github.com/rogerluan/arkana) | ||
package com.arkanakeys | ||
|
||
object MySecrets { | ||
private val salt = listOf(0x3f, 0xb6, 0x2, 0x3, 0xbf, 0x54, 0xf5, 0x67, 0x95, 0xc, 0x56, 0x47, 0x87, 0x55, 0x60, 0x74, 0x6, 0x77, 0x8b, 0xd6, 0x88, 0x41, 0x99, 0xe2, 0x97, 0x92, 0x9f, 0x68, 0x7d, 0x6c, 0x39, 0x64, 0xca, 0x98, 0xe7, 0x8d, 0xe8, 0x9e, 0x1f, 0xe5, 0xad, 0x45, 0x32, 0xac, 0xc5, 0xe1, 0xf6, 0x4f, 0x67, 0xcc, 0x6a, 0xee, 0x66, 0xac, 0x80, 0xea, 0x78, 0x1b, 0xd6, 0x78, 0x4, 0x97, 0xfa, 0xcc) | ||
|
||
internal fun decode(encoded: List<Int>, cipher: List<Int>): String { | ||
val decoded = encoded.mapIndexed { index, item -> | ||
(item xor cipher[(index % cipher.size)]).toByte() | ||
}.toByteArray() | ||
return decoded.toString(Charsets.UTF_8) | ||
} | ||
|
||
internal fun decodeInt(encoded: List<Int>, cipher: List<Int>): Int { | ||
return decode(encoded = encoded, cipher = cipher).toInt() | ||
} | ||
|
||
internal fun decodeBoolean(encoded: List<Int>, cipher: List<Int>): Boolean { | ||
return decode(encoded = encoded, cipher = cipher).toBoolean() | ||
} | ||
|
||
object Global { | ||
val someBooleanSecret: Boolean | ||
get() { | ||
val encoded = listOf(0x4b, 0xc4, 0x77, 0x66) | ||
return decodeBoolean(encoded = encoded, cipher = salt) | ||
} | ||
|
||
val someIntSecret: Int | ||
get() { | ||
val encoded = listOf(0xb, 0x84) | ||
return decodeInt(encoded = encoded, cipher = salt) | ||
} | ||
|
||
val mySecretAPIKey: String | ||
get() { | ||
val encoded = listOf(0x6, 0x84, 0x30, 0x30, 0x8c, 0x63, 0xc7, 0x57, 0xa6, 0x3a, 0x6e, 0x72, 0xb3, 0x62, 0x57, 0x41, 0x3e, 0x47, 0xbc, 0xef, 0xba, 0x73, 0xaa, 0xd1, 0xa0, 0xa0, 0xaf, 0x5b, 0x4b, 0x54, 0xc, 0x50, 0xfd, 0xaf, 0xd2, 0xb5, 0xd8, 0xa9) | ||
return decode(encoded = encoded, cipher = salt) | ||
} | ||
} | ||
|
||
object Dev : MySecretsEnvironment { | ||
override val serviceKey: String | ||
get() { | ||
val encoded = listOf(0x4b, 0xde, 0x6b, 0x70, 0x9f, 0x30, 0x90, 0x11, 0xb5, 0x67, 0x33, 0x3e, 0xa7, 0x3c, 0x13, 0x54, 0x75, 0x12, 0xe8, 0xa4, 0xed, 0x35) | ||
return decode(encoded = encoded, cipher = salt) | ||
} | ||
} | ||
|
||
object Staging : MySecretsEnvironment { | ||
override val serviceKey: String | ||
get() { | ||
val encoded = listOf(0x4b, 0xde, 0x6b, 0x70, 0x9f, 0x27, 0x81, 0x6, 0xf2, 0x65, 0x38, 0x20, 0xa7, 0x3e, 0x5, 0xd, 0x26, 0x1e, 0xf8, 0xf6, 0xfb, 0x24, 0xfa, 0x90, 0xf2, 0xe6) | ||
return decode(encoded = encoded, cipher = salt) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// DO NOT MODIFY | ||
// Automatically generated by Arkana (https://github.com/rogerluan/arkana) | ||
|
||
import Foundation | ||
import MySecretsInterfaces | ||
|
||
public enum MySecrets { | ||
@inline(__always) | ||
fileprivate static let salt: [UInt8] = [ | ||
0x47, 0x7c, 0xe3, 0x7f, 0x80, 0xa8, 0x41, 0x6c, 0x2, 0xc3, 0x7f, 0x3f, 0x63, 0xd9, 0xb6, 0x57, 0x3a, 0x33, 0x98, 0xed, 0xfa, 0x71, 0xcb, 0x9a, 0x55, 0x23, 0x52, 0x1c, 0x31, 0xc0, 0x74, 0xd4, 0x7e, 0x6e, 0xf5, 0xca, 0xbc, 0x25, 0x69, 0xcd, 0x9, 0, 0xcb, 0x70, 0xd3, 0x5e, 0xa5, 0x92, 0xe7, 0x6b, 0x2, 0x90, 0x29, 0xc2, 0x44, 0xc8, 0x5a, 0xc2, 0xc0, 0xc7, 0x42, 0x30, 0x40, 0xa3 | ||
] | ||
|
||
static func decode(encoded: [UInt8], cipher: [UInt8]) -> String { | ||
return String(decoding: encoded.enumerated().map { offset, element in | ||
element ^ cipher[offset % cipher.count] | ||
}, as: UTF8.self) | ||
} | ||
|
||
static func decode(encoded: [UInt8], cipher: [UInt8]) -> Bool { | ||
let stringValue: String = Self.decode(encoded: encoded, cipher: cipher) | ||
return Bool(stringValue)! | ||
} | ||
|
||
static func decode(encoded: [UInt8], cipher: [UInt8]) -> Int { | ||
let stringValue: String = Self.decode(encoded: encoded, cipher: cipher) | ||
return Int(stringValue)! | ||
} | ||
} | ||
|
||
public extension MySecrets { | ||
struct Global: MySecretsGlobalProtocol { | ||
public init() {} | ||
|
||
@inline(__always) | ||
public lazy var someBooleanSecret: Bool = { | ||
let encoded: [UInt8] = [ | ||
0x33, 0xe, 0x96, 0x1a | ||
] | ||
return MySecrets.decode(encoded: encoded, cipher: MySecrets.salt) | ||
}() | ||
|
||
@inline(__always) | ||
public lazy var someIntSecret: Int = { | ||
let encoded: [UInt8] = [ | ||
0x73, 0x4e | ||
] | ||
return MySecrets.decode(encoded: encoded, cipher: MySecrets.salt) | ||
}() | ||
|
||
@inline(__always) | ||
public lazy var mySecretAPIKey: String = { | ||
let encoded: [UInt8] = [ | ||
0x7e, 0x4e, 0xd1, 0x4c, 0xb3, 0x9f, 0x73, 0x5c, 0x31, 0xf5, 0x47, 0xa, 0x57, 0xee, 0x81, 0x62, 0x2, 0x3, 0xaf, 0xd4, 0xc8, 0x43, 0xf8, 0xa9, 0x62, 0x11, 0x62, 0x2f, 0x7, 0xf8, 0x41, 0xe0, 0x49, 0x59, 0xc0, 0xf2, 0x8c, 0x12 | ||
] | ||
return MySecrets.decode(encoded: encoded, cipher: MySecrets.salt) | ||
}() | ||
} | ||
} | ||
|
||
public extension MySecrets { | ||
struct Dev: MySecretsEnvironmentProtocol { | ||
public init() {} | ||
|
||
@inline(__always) | ||
public lazy var serviceKey: String = { | ||
let encoded: [UInt8] = [ | ||
0x33, 0x14, 0x8a, 0xc, 0xa0, 0xcc, 0x24, 0x1a, 0x22, 0xa8, 0x1a, 0x46, 0x43, 0xb0, 0xc5, 0x77, 0x49, 0x56, 0xfb, 0x9f, 0x9f, 0x5 | ||
] | ||
return MySecrets.decode(encoded: encoded, cipher: MySecrets.salt) | ||
}() | ||
} | ||
} | ||
|
||
public extension MySecrets { | ||
struct Staging: MySecretsEnvironmentProtocol { | ||
public init() {} | ||
|
||
@inline(__always) | ||
public lazy var serviceKey: String = { | ||
let encoded: [UInt8] = [ | ||
0x33, 0x14, 0x8a, 0xc, 0xa0, 0xdb, 0x35, 0xd, 0x65, 0xaa, 0x11, 0x58, 0x43, 0xb2, 0xd3, 0x2e, 0x1a, 0x5a, 0xeb, 0xcd, 0x89, 0x14, 0xa8, 0xe8, 0x30, 0x57 | ||
] | ||
return MySecrets.decode(encoded: encoded, cipher: MySecrets.salt) | ||
}() | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.