Skip to content

Commit

Permalink
Change auth fields #patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Romanov authored and Aleksandr Romanov committed Dec 31, 2024
1 parent 9ce0f8a commit 19b6f42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 1 addition & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ let localDependencies: [PackageDescription.Package.Dependency] = commonDependenc
.package(name: "OversizeServices", path: "../OversizeServices"),
]

var dependencies: [PackageDescription.Package.Dependency] = remoteDependencies

if ProcessInfo.processInfo.environment["BUILD_MODE"] == "DEV" {
dependencies = localDependencies
}
let dependencies: [PackageDescription.Package.Dependency] = remoteDependencies

let package = Package(
name: "OversizeAppStoreServices",
Expand Down
10 changes: 5 additions & 5 deletions Sources/OversizeAppStoreServices/Auth/EnvAuthenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ public struct EnvAuthenticator: Authenticator {
throw Error.missingEnvironmentVariable("AppStore.Account")
}

guard let appStoreCertificate = storage.getPassword(for: "AppConnector-Certificate-" + keyLabel) else {
guard let appStoreIssuerID = storage.getPassword(for: "AppConnector-IssuerID-" + keyLabel) else {
throw Error.missingEnvironmentVariable("AppStore.Key.Default")
}

guard let appStoreCredentials = storage.getCredentials(with: "AppConnector-" + keyLabel) else {
guard let appStoreCertificate = storage.getCredentials(with: "AppConnector-Certificate-" + keyLabel) else {
throw Error.missingEnvironmentVariable("AppStore.Key.Default")
}

let privateKey = try JWT.PrivateKey(pemRepresentation: appStoreCertificate)
let privateKey = try JWT.PrivateKey(pemRepresentation: appStoreCertificate.password)

jwt = JWT(
api: api,
keyID: appStoreCredentials.password,
issuerID: appStoreCredentials.login,
keyID: appStoreCertificate.login,
issuerID: appStoreIssuerID,
expiryDuration: 20 * 60,
privateKey: privateKey
)
Expand Down

0 comments on commit 19b6f42

Please sign in to comment.