Documentation
¶
Index ¶
- func IsNotFound(err error) bool
- func LoadPrivateKeyFromFile(filePath string) (any, error)
- func ParsePrivateKey(keyData []byte) (any, error)
- type Client
- type ClientOption
- func WithAudience(audience string) ClientOption
- func WithBaseURL(baseURL string) ClientOption
- func WithClientCertificate(certFile, keyFile string) ClientOption
- func WithClientCertificateFromString(certPEM, keyPEM string) ClientOption
- func WithCustomAgent(customAgent string) ClientOption
- func WithDebug() ClientOption
- func WithGlobalHeader(key, value string) ClientOption
- func WithGlobalHeaders(headers map[string]string) ClientOption
- func WithInsecureSkipVerify() ClientOption
- func WithLogger(logger *zap.Logger) ClientOption
- func WithMinTLSVersion(minVersion uint16) ClientOption
- func WithProxy(proxyURL string) ClientOption
- func WithRetryCount(count int) ClientOption
- func WithRetryMaxWaitTime(maxWaitTime time.Duration) ClientOption
- func WithRetryWaitTime(waitTime time.Duration) ClientOption
- func WithRootCertificateFromString(pemContent string) ClientOption
- func WithRootCertificates(pemFilePaths ...string) ClientOption
- func WithTLSClientConfig(tlsConfig *tls.Config) ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- func WithTransport(transport http.RoundTripper) ClientOption
- func WithUserAgent(userAgent string) ClientOption
- type NotaryAPIClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
IsNotFound returns true when err is an API 404 response. Use this in cleanup functions to treat "already deleted" as non-fatal.
func LoadPrivateKeyFromFile ¶
LoadPrivateKeyFromFile reads and parses a private key from a .p8 file path.
func ParsePrivateKey ¶
ParsePrivateKey parses a PEM-encoded private key (ECDSA or RSA) from bytes.
Types ¶
type Client ¶
type Client struct {
NotaryAPI *NotaryAPIClient
// contains filtered or unexported fields
}
Client is the main entry point for the Apple Notary API SDK.
func NewClient ¶
func NewClient(keyID, issuerID string, privateKey any, options ...client.ClientOption) (*Client, error)
NewClient creates a new Apple Notary API client. Parameters:
- keyID: Your App Store Connect API Key ID
- issuerID: Your App Store Connect Issuer ID (Team ID)
- privateKey: Your App Store Connect private key (*rsa.PrivateKey or *ecdsa.PrivateKey)
- options: Optional configuration options (WithLogger, WithTimeout, etc.)
func NewClientFromEnv ¶
func NewClientFromEnv(options ...client.ClientOption) (*Client, error)
NewClientFromEnv creates a client using environment variables. Expects: APPLE_KEY_ID, APPLE_ISSUER_ID, and one of APPLE_PRIVATE_KEY_PEM or APPLE_PRIVATE_KEY_PATH. Parameters:
- options: Optional configuration options (WithLogger, WithTimeout, etc.)
func NewClientFromFile ¶
func NewClientFromFile(keyID, issuerID, privateKeyPath string, options ...client.ClientOption) (*Client, error)
NewClientFromFile creates a client using a private key from file. Parameters:
- keyID: Your App Store Connect API Key ID
- issuerID: Your App Store Connect Issuer ID (Team ID)
- privateKeyPath: Path to your App Store Connect private key file (.p8)
- options: Optional configuration options (WithLogger, WithTimeout, etc.)
type ClientOption ¶
type ClientOption = client.ClientOption
ClientOption configures the Apple Notary API transport at construction time. Pass one or more ClientOption values to NewClient, NewClientFromFile, or NewClientFromEnv.
func WithAudience ¶
func WithAudience(audience string) ClientOption
WithAudience sets a custom JWT audience (default: "appstoreconnect-v1").
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL sets a custom base URL, overriding the default Apple Notary endpoint.
func WithClientCertificate ¶
func WithClientCertificate(certFile, keyFile string) ClientOption
WithClientCertificate sets a client certificate for mutual TLS authentication.
func WithClientCertificateFromString ¶
func WithClientCertificateFromString(certPEM, keyPEM string) ClientOption
WithClientCertificateFromString sets a client certificate from PEM-encoded strings.
func WithCustomAgent ¶
func WithCustomAgent(customAgent string) ClientOption
WithCustomAgent appends a custom identifier to the default user agent.
func WithDebug ¶
func WithDebug() ClientOption
WithDebug enables resty's request/response debug logging.
func WithGlobalHeader ¶
func WithGlobalHeader(key, value string) ClientOption
WithGlobalHeader adds a single header to every outgoing request.
func WithGlobalHeaders ¶
func WithGlobalHeaders(headers map[string]string) ClientOption
WithGlobalHeaders adds multiple headers to every outgoing request.
func WithInsecureSkipVerify ¶
func WithInsecureSkipVerify() ClientOption
WithInsecureSkipVerify disables TLS certificate verification (use only for testing).
func WithLogger ¶
func WithLogger(logger *zap.Logger) ClientOption
WithLogger sets a custom zap logger. Returns an error if logger is nil.
func WithMinTLSVersion ¶
func WithMinTLSVersion(minVersion uint16) ClientOption
WithMinTLSVersion sets the minimum TLS version for connections.
func WithProxy ¶
func WithProxy(proxyURL string) ClientOption
WithProxy sets an HTTP proxy for all requests.
func WithRetryCount ¶
func WithRetryCount(count int) ClientOption
WithRetryCount sets the maximum number of retries for failed requests.
func WithRetryMaxWaitTime ¶
func WithRetryMaxWaitTime(maxWaitTime time.Duration) ClientOption
WithRetryMaxWaitTime sets the maximum wait time between retry attempts.
func WithRetryWaitTime ¶
func WithRetryWaitTime(waitTime time.Duration) ClientOption
WithRetryWaitTime sets the initial wait time between retry attempts.
func WithRootCertificateFromString ¶
func WithRootCertificateFromString(pemContent string) ClientOption
WithRootCertificateFromString adds a custom root CA certificate from PEM string.
func WithRootCertificates ¶
func WithRootCertificates(pemFilePaths ...string) ClientOption
WithRootCertificates adds custom root CA certificates for server validation.
func WithTLSClientConfig ¶
func WithTLSClientConfig(tlsConfig *tls.Config) ClientOption
WithTLSClientConfig sets custom TLS configuration.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets the timeout for all HTTP requests.
func WithTransport ¶
func WithTransport(transport http.RoundTripper) ClientOption
WithTransport sets a custom HTTP transport (http.RoundTripper).
func WithUserAgent ¶
func WithUserAgent(userAgent string) ClientOption
WithUserAgent sets a custom user-agent string.
type NotaryAPIClient ¶
type NotaryAPIClient struct {
Submissions *submissions.Submissions
}
NotaryAPIClient groups all Apple Notary API services.