pub struct ConnectTokenEncoder { /* private fields */ }
Expand description
Represents a private key used to create JWT tokens for use with App Store Connect.
See https://developer.apple.com/documentation/appstoreconnectapi/creating_api_keys_for_app_store_connect_api and https://developer.apple.com/documentation/appstoreconnectapi/generating_tokens_for_api_requests for more details.
This entity holds the necessary metadata to issue new JWT tokens.
App Store Connect API tokens/JWTs are derived from:
- A key identifier. This is a short alphanumeric string like
DEADBEEF42
. - An issuer ID. This is likely a UUID.
- A private key. Likely ECDSA.
All these are issued by Apple. You can log in to App Store Connect and see/manage your keys at https://appstoreconnect.apple.com/access/api.
Implementations§
Source§impl ConnectTokenEncoder
impl ConnectTokenEncoder
Sourcepub fn from_jwt_encoding_key(
key_id: String,
issuer_id: String,
encoding_key: EncodingKey,
) -> Self
pub fn from_jwt_encoding_key( key_id: String, issuer_id: String, encoding_key: EncodingKey, ) -> Self
Construct an instance from an EncodingKey instance.
This is the lowest level API and ultimately what all constructors use.
Sourcepub fn from_ecdsa_der(
key_id: String,
issuer_id: String,
der_data: &[u8],
) -> Result<Self>
pub fn from_ecdsa_der( key_id: String, issuer_id: String, der_data: &[u8], ) -> Result<Self>
Construct an instance from a DER encoded ECDSA private key.
Sourcepub fn from_ecdsa_pem(
key_id: String,
issuer_id: String,
pem_data: &[u8],
) -> Result<Self>
pub fn from_ecdsa_pem( key_id: String, issuer_id: String, pem_data: &[u8], ) -> Result<Self>
Create a token from a PEM encoded ECDSA private key.
Sourcepub fn from_ecdsa_pem_path(
key_id: String,
issuer_id: String,
path: impl AsRef<Path>,
) -> Result<Self>
pub fn from_ecdsa_pem_path( key_id: String, issuer_id: String, path: impl AsRef<Path>, ) -> Result<Self>
Create a token from a PEM encoded ECDSA private key in a filesystem path.
Sourcepub fn from_api_key_id(key_id: String, issuer_id: String) -> Result<Self>
pub fn from_api_key_id(key_id: String, issuer_id: String) -> Result<Self>
Attempt to construct in instance from an API Key ID.
e.g. DEADBEEF42
. This looks for an AuthKey_<id>.p8
file in default search
locations like ~/.appstoreconnect/private_keys
.
Sourcepub fn new_token(&self, duration: u64) -> Result<AppStoreConnectToken>
pub fn new_token(&self, duration: u64) -> Result<AppStoreConnectToken>
Mint a new JWT token.
Using the private key and key metadata bound to this instance, we issue a new JWT for the requested duration.
Trait Implementations§
Source§impl Clone for ConnectTokenEncoder
impl Clone for ConnectTokenEncoder
Source§fn clone(&self) -> ConnectTokenEncoder
fn clone(&self) -> ConnectTokenEncoder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl TryFrom<UnifiedApiKey> for ConnectTokenEncoder
impl TryFrom<UnifiedApiKey> for ConnectTokenEncoder
Auto Trait Implementations§
impl Freeze for ConnectTokenEncoder
impl RefUnwindSafe for ConnectTokenEncoder
impl Send for ConnectTokenEncoder
impl Sync for ConnectTokenEncoder
impl Unpin for ConnectTokenEncoder
impl UnwindSafe for ConnectTokenEncoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)