mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Move Secrets.swift to Secrets package.
This commit is contained in:
@@ -15,7 +15,8 @@ let package = Package(
|
||||
targets: [
|
||||
.target(
|
||||
name: "Secrets",
|
||||
dependencies: []
|
||||
dependencies: [],
|
||||
exclude: ["Secrets.swift.gyb"]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
89
Modules/Secrets/Sources/Secrets/Secrets.swift
Normal file
89
Modules/Secrets/Sources/Secrets/Secrets.swift
Normal file
@@ -0,0 +1,89 @@
|
||||
// Generated by Secrets.swift.gyb
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Secrets: SecretsProvider {
|
||||
|
||||
public init() {
|
||||
}
|
||||
|
||||
public var mercuryClientId: String {
|
||||
let encoded: [UInt8] = [
|
||||
0xdc, 0x92, 0x74, 0x46, 0x0d, 0xae, 0x1f, 0x01,
|
||||
0x2e, 0x19, 0xbe, 0xaa,
|
||||
]
|
||||
|
||||
return decode(encoded, salt: salt)
|
||||
}
|
||||
|
||||
public var mercuryClientSecret: String {
|
||||
let encoded: [UInt8] = [
|
||||
0xea, 0xce, 0x36, 0x78, 0x20, 0x9a, 0x0d, 0x19,
|
||||
0x02, 0x06, 0x82, 0xfb, 0x1a, 0x23, 0x5e, 0x7a,
|
||||
0x61, 0xb9, 0xc5, 0xfc, 0x94, 0xc9, 0xe1, 0x46,
|
||||
0x91, 0x20, 0xe4, 0x73, 0x6b, 0x66, 0x03, 0x41,
|
||||
0x4f, 0x1f, 0x46, 0x4d, 0x88, 0xbf, 0x44, 0xad,
|
||||
0x43, 0x41, 0x6c, 0xf3, 0x10, 0xfd, 0x32, 0x66,
|
||||
0x70, 0x28, 0x08, 0x68, 0x1a, 0x00, 0xe6, 0x8b,
|
||||
0xa7, 0x15, 0x26, 0xa4, 0x5b, 0xd7, 0xc8, 0x91,
|
||||
]
|
||||
|
||||
return decode(encoded, salt: salt)
|
||||
}
|
||||
|
||||
public var feedlyClientId: String {
|
||||
let encoded: [UInt8] = [
|
||||
0xdc, 0x99, 0x77,
|
||||
]
|
||||
|
||||
return decode(encoded, salt: salt)
|
||||
}
|
||||
|
||||
public var feedlyClientSecret: String {
|
||||
let encoded: [UInt8] = [
|
||||
0xf3, 0xa0, 0x78, 0x59, 0x3d, 0xa0, 0x5f, 0x32,
|
||||
0x21, 0x13, 0x84, 0xf4, 0x5b, 0x50, 0x05, 0x5d,
|
||||
0x7c, 0x91, 0xf6, 0xf8, 0xe2, 0xc7, 0xec, 0x50,
|
||||
0xa7, 0x24, 0xdb, 0x35, 0x47, 0x06, 0x05, 0x7b,
|
||||
]
|
||||
|
||||
return decode(encoded, salt: salt)
|
||||
}
|
||||
|
||||
public var inoreaderAppId: String {
|
||||
let encoded: [UInt8] = [
|
||||
0x8b, 0xce, 0x39, 0x11, 0x51, 0xe0, 0x5e, 0x45,
|
||||
0x72,
|
||||
]
|
||||
|
||||
return decode(encoded, salt: salt)
|
||||
}
|
||||
|
||||
public var inoreaderAppKey: String {
|
||||
let encoded: [UInt8] = [
|
||||
0x83, 0x9f, 0x31, 0x69, 0x29, 0x81, 0x07, 0x26,
|
||||
0x1f, 0x2a, 0x90, 0xd3, 0x1d, 0x56, 0x78, 0x59,
|
||||
0x56, 0x8d, 0xb0, 0xfc, 0xc9, 0xcd, 0xe4, 0x13,
|
||||
0x99, 0x2c, 0xd9, 0x68, 0x44, 0x33, 0x03, 0x65,
|
||||
]
|
||||
|
||||
return decode(encoded, salt: salt)
|
||||
}
|
||||
|
||||
private let salt: [UInt8] = [
|
||||
0xb2, 0xf7, 0x00, 0x28, 0x68, 0xd9, 0x6c, 0x76,
|
||||
0x47, 0x6b, 0xdb, 0x98, 0x6d, 0x1a, 0x28, 0x11,
|
||||
0x15, 0xc9, 0x81, 0x91, 0xa7, 0xa0, 0x86, 0x23,
|
||||
0xd7, 0x4b, 0x9e, 0x05, 0x28, 0x54, 0x40, 0x35,
|
||||
0x7b, 0x7d, 0x10, 0x0e, 0xe3, 0x88, 0x02, 0xce,
|
||||
0x20, 0x26, 0x0a, 0x9c, 0x44, 0x8b, 0x41, 0x24,
|
||||
0x05, 0x1e, 0x6e, 0x09, 0x6b, 0x39, 0xb6, 0xdf,
|
||||
0xe6, 0x4f, 0x68, 0x9d, 0x3e, 0xaf, 0x82, 0xf7,
|
||||
]
|
||||
|
||||
private func decode(_ encoded: [UInt8], salt: [UInt8]) -> String {
|
||||
String(decoding: encoded.enumerated().map { (offset, element) in
|
||||
element ^ salt[offset % salt.count]
|
||||
}, as: UTF8.self)
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,13 @@ def snake_to_camel(snake_str):
|
||||
|
||||
salt = [byte for byte in os.urandom(64)]
|
||||
}%
|
||||
import Secrets
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct Secrets: SecretsProvider {
|
||||
|
||||
public init() {
|
||||
}
|
||||
% for secret in secrets:
|
||||
|
||||
public var ${snake_to_camel(secret)}: String {
|
||||
@@ -36,7 +40,6 @@ public struct Secrets: SecretsProvider {
|
||||
%{
|
||||
# custom example: static let myVariable = "${os.environ.get('MY_CUSTOM_VARIABLE')}"
|
||||
}%
|
||||
|
||||
private let salt: [UInt8] = [
|
||||
% for chunk in chunks(salt, 8):
|
||||
${"".join(["0x%02x, " % byte for byte in chunk])}
|
||||
@@ -48,5 +51,4 @@ public struct Secrets: SecretsProvider {
|
||||
element ^ salt[offset % salt.count]
|
||||
}, as: UTF8.self)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user