rogerluan/arkana

View on GitHub
docs/demo-used-to-gen-image.swift

Summary

Maintainability
A
1 hr
Test Coverage
// 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)
        }()
    }
}