Add SecretKey.swift.gyb to Secrets module.

This commit is contained in:
Brent Simmons 2024-07-07 15:37:51 -07:00
parent 6c9f9e2889
commit 7d40924509
2 changed files with 5 additions and 4 deletions

View File

@ -16,6 +16,7 @@ let package = Package(
.target(
name: "Secrets",
dependencies: [],
exclude: ["SecretKey.swift.gyb"],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency")
]

View File

@ -1,4 +1,4 @@
// Generated by Secrets.swift.gyb
// Generated by SecretKey.swift.gyb
%{
import os
@ -19,12 +19,12 @@ def snake_to_camel(snake_str):
salt = [byte for byte in os.urandom(64)]
}%
import Secrets
import Foundation
public final class Secrets: SecretsProvider, Sendable {
public struct SecretKey {
% for secret in secrets:
public let ${snake_to_camel(secret)}: String = {
public static let ${snake_to_camel(secret)}: String = {
let encoded: [UInt8] = [
% for chunk in chunks(encode(os.environ.get(secret) or "", salt), 8):
${"".join(["0x%02x, " % byte for byte in chunk])}