JWT
public struct JWT : Sendable
A JSON Web Token used to authorize requests sent through BagbutikService.
Bagbutik creates tokens with Apple’s required ES256 signature and a 20 minute expiration. When a service sends a request, the signature is regenerated automatically if the current token has expired.
Full documentation for how JWT is used with the API: https://developer.apple.com/documentation/appstoreconnectapi/generating_tokens_for_api_requests
-
A value telling if the JWT has expired.
Declaration
Swift
public var isExpired: Bool { get } -
The signature to use in the authorization header when performing requests.
Declaration
Swift
public private(set) var encodedSignature: String { get } -
Creates a token for a team based API key.
Use this initializer for the standard App Store Connect API keys that include both a key ID and an issuer ID.
Full documentation for how to get the required keys: https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api
Declaration
Swift
public init(keyId: String, issuerId: String, privateKey: String) throwsParameters
keyIdYour private key ID from App Store Connect, for example
2X9R4HXF34.issuerIdYour issuer ID from the API Keys page in App Store Connect.
privateKeyThe contents of the downloaded
.p8private key. -
Creates a token for a team based API key by loading the private key from disk.
Declaration
Swift
public init(keyId: String, issuerId: String, privateKeyPath: String) throwsParameters
keyIdYour private key ID from App Store Connect.
issuerIdYour issuer ID from the API Keys page in App Store Connect.
privateKeyPathA file system path to the downloaded
.p8private key. -
Creates a token for an individual API key.
Use this initializer when Apple does not provide an issuer ID for the key.
Declaration
Swift
public init(keyId: String, privateKey: String) throwsParameters
keyIdYour private key ID from App Store Connect.
privateKeyThe contents of the downloaded
.p8private key. -
Creates a token for an individual API key by loading the private key from disk.
Declaration
Swift
public init(keyId: String, privateKeyPath: String) throwsParameters
keyIdYour private key ID from App Store Connect.
privateKeyPathA file system path to the downloaded
.p8private key.
View on GitHub