Skip to content

Commit

Permalink
Added new apple public identifier key
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Szulc committed Jan 25, 2022
1 parent 0a629b2 commit 1d3b60a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ It is welcome to open a pull request with a fix of any issue:
- [x] Make library compatible with PHP `7.4.3`. Reported
in [Uncaught JsonException: Malformed UTF-8 characters](https://github.com/AzimoLabs/apple-sign-in-php-sdk/issues/4)
- [x] Make library compatible with PHP `8.0.0`
- [x] Refactor \Azimo\Apple\Api\Enum\CryptographicAlgorithmEnum, so algorithms are fetched dynamically from https://appleid.apple.com/auth/keys

## Miscellaneous

Expand Down
3 changes: 3 additions & 0 deletions src/Api/Enum/CryptographicAlgorithmEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ final class CryptographicAlgorithmEnum

public const KID_YUYXOY = 'YuyXoY';

public const KID_W6WCOKB = 'W6WcOKB';

public static function supportedAlgorithms(): array
{
return [
self::KID_86D88KF,
self::KID_EXAUNML,
self::KID_YUYXOY,
self::KID_W6WCOKB,
];
}

Expand Down

4 comments on commit 1d3b60a

@devedup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can anyone explain why these new keys keep appearing and what can be done to have this work automatically. I'm having to rely on catching an error log to see its broken for a client, and then fixing and deploying afterwards - which isn't great. Do Apple give any warnings of new keys being used?

@hywak
Copy link
Collaborator

@hywak hywak commented on 1d3b60a Jan 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea whether Apple is informing about updating the keys. However, I'm trying to figure out how to get rid of that exception, because we are facing the same problem as you. Initially I thought that keys won't change often. I was wrong :|

@hywak
Copy link
Collaborator

@hywak hywak commented on 1d3b60a Jan 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix is released, sorry for inconvenience.

@devedup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see you have a TODO item already to fetch the algorithms dynamically..... the code already does this 🤔.

So you don't really need to maintain your own internal list of supported key IDs in an enum, just lookup the key in the list downloaded. 🤷‍♂️ I think you can just delete the enum and the checks around it, and inside JsonWebKeySetCollection::getByCryptographicAlgorithm just check the keys downloaded already.

Please sign in to comment.