Skip to content

Commit

Permalink
Update AppleIdentityToken for 'is_private_email' (#59)
Browse files Browse the repository at this point in the history
It would be helpful to determine whether the user is using a proxy email address. This change simply adds parsing for the 'is_private_email' claim from the JWT.
  • Loading branch information
gargs authored Jul 21, 2021
1 parent 8e4b835 commit df79553
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/JWTKit/Vendor/AppleIdentityToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public struct AppleIdentityToken: JWTPayload {
case issuedAt = "iat"
case expires = "exp"
case emailVerified = "email_verified"
case isPrivateEmail = "is_private_email"
case nonceSupported = "nonce_supported"
}

Expand Down Expand Up @@ -41,6 +42,9 @@ public struct AppleIdentityToken: JWTPayload {

/// A Boolean value that indicates whether the service has verified the email. The value of this claim is always true because the servers only return verified email addresses.
public let emailVerified: BoolClaim?

/// A Boolean value that indicates whether the email shared by the user is the proxy address. It is absent (nil) if the user is not using a proxy email address.
public let isPrivateEmail: BoolClaim?

public func verify(using signer: JWTSigner) throws {
guard self.issuer.value == "https://appleid.apple.com" else {
Expand Down

0 comments on commit df79553

Please sign in to comment.