Skip to content

Allow loading of private keys from environment variables instead of files.ย #43

@katjuncker

Description

@katjuncker

The Apple class accepts a key file path, which makes security more difficult as the keys in my setup need to be stored as environment variables and not committed to the codebase.

I'd suggest allowing the option for passing in an InMemory object directly as this class supports reading from files, strings, and base64 encoded strings.

My workaround is as follows:

 class CustomApple extends Apple {
	 public function getLocalKey(): Key|InMemory
	 {
		 return InMemory::base64Encoded($this->keyFilePath);
	 }
 }

$provider = new CustomApple([
	'clientId' => $_ENV['APPLE_OAUTH_CLIENT_ID'],
	'teamId' => $_ENV['APPLE_OAUTH_TEAM_ID'],
	'keyFileId' => $_ENV['APPLE_OAUTH_KEY_ID'],
	'keyFilePath' => $_ENV['APPLE_OAUTH_KEY_BASE64'],
	'redirectUri' => $_ENV['APPLE_OAUTH_REDIRECT_URI'],
]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions