Skip to content

Commit

Permalink
update jwt payload
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-maxwellelliott committed Jan 14, 2025
1 parent 9f92d7c commit 2936a44
Show file tree
Hide file tree
Showing 6 changed files with 228 additions and 178 deletions.
3 changes: 1 addition & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module(name = "sign-here")

bazel_dep(name = "rules_apple", version = "3.5.0", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "rules_swift", version = "1.18.0", repo_name = "build_bazel_rules_swift", max_compatibility_level = 2)
bazel_dep(name = "rules_apple", version = "3.16.1", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "swift-syntax", version = "509.0.2", repo_name = "SwiftSyntax")
bazel_dep(name = "swift_argument_parser", version = "1.3.0", repo_name = "com_github_apple_swift_argument_parser")

Expand Down
383 changes: 216 additions & 167 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ internal struct CreateProvisioningProfileCommand: ParsableCommand {
let jsonWebToken: String = try jsonWebTokenService.createToken(
keyIdentifier: keyIdentifier,
issuerID: issuerID,
secretKey: try files.read(Path(itunesConnectKeyPath))
secretKey: try files.read(Path(itunesConnectKeyPath)),
enterprise: enterprise
)
let deviceIDs: Set<String> = try iTunesConnectService.fetchITCDeviceIDs(jsonWebToken: jsonWebToken)
guard let profileName, let profile = try? fetchProvisioningProfile(jsonWebToken: jsonWebToken, name: profileName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ internal struct DeleteProvisioningProfileCommand: ParsableCommand {
let jsonWebToken: String = try jsonWebTokenService.createToken(
keyIdentifier: keyIdentifier,
issuerID: issuerID,
secretKey: try files.read(Path(itunesConnectKeyPath))
secretKey: try files.read(Path(itunesConnectKeyPath)),
enterprise: enterprise
)
try iTunesConnectService.deleteProvisioningProfile(
jsonWebToken: jsonWebToken,
Expand Down
8 changes: 5 additions & 3 deletions Sources/SignHereLibrary/Services/JSONWebTokenService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ internal protocol JSONWebTokenService {
func createToken(
keyIdentifier: String,
issuerID: String,
secretKey: Data
secretKey: Data,
enterprise: Bool
) throws -> String
}

Expand Down Expand Up @@ -44,7 +45,8 @@ internal class JSONWebTokenServiceImp: JSONWebTokenService {
func createToken(
keyIdentifier: String,
issuerID: String,
secretKey: Data
secretKey: Data,
enterprise: Bool
) throws -> String {
let header: JSONWebTokenHeader = .init(
alg: "ES256",
Expand All @@ -57,7 +59,7 @@ internal class JSONWebTokenServiceImp: JSONWebTokenService {
iss: issuerID,
iat: currentTime.timeIntervalSince1970,
exp: expirationTime.timeIntervalSince1970,
aud: "appstoreconnect-v1"
aud: enterprise ? "apple-developer-enterprise-v1" : "appstoreconnect-v1"
)
let jsonEncoder: JSONEncoder = .init()
var components: [String] = [
Expand Down
6 changes: 2 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
workspace(name = "com_github_tinder_sign_here")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "build_bazel_rules_apple",
sha256 = "9c4f1e1ec4fdfeac5bddb07fa0e872c398e3d8eb0ac596af9c463f9123ace292",
url = "https://github.com/bazelbuild/rules_apple/releases/download/3.2.1/rules_apple.3.2.1.tar.gz",
sha256 = "352428421c89dba8859055c3e1ba42f742c224544bf0e196c926d1cf44a2d726",
url = "https://github.com/bazelbuild/rules_apple/releases/download/3.16.1/rules_apple.3.16.1.tar.gz",
)

load(
Expand Down

0 comments on commit 2936a44

Please sign in to comment.