1import { StyleProp, ViewStyle, ViewProps } from 'react-native'; 2 3// @needsAudit 4export declare type AppleAuthenticationButtonProps = ViewProps & { 5 /** 6 * The method to call when the user presses the button. You should call [`AppleAuthentication.signInAsync`](#isavailableasync) 7 * in here. 8 */ 9 onPress: () => void; 10 /** 11 * The type of button text to display ("Sign In with Apple" vs. "Continue with Apple"). 12 */ 13 buttonType: AppleAuthenticationButtonType; 14 /** 15 * The Apple-defined color scheme to use to display the button. 16 */ 17 buttonStyle: AppleAuthenticationButtonStyle; 18 /** 19 * The border radius to use when rendering the button. This works similarly to 20 * `style.borderRadius` in other Views. 21 */ 22 cornerRadius?: number; 23 /** 24 * The custom style to apply to the button. Should not include `backgroundColor` or `borderRadius` 25 * properties. 26 */ 27 style?: StyleProp<Omit<ViewStyle, 'backgroundColor' | 'borderRadius'>>; 28}; 29 30// @needsAudit 31/** 32 * The options you can supply when making a call to [`AppleAuthentication.signInAsync()`](#appleauthenticationsigninasyncoptions). 33 * None of these options are required. 34 * 35 * @see [Apple 36 * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationopenidrequest) 37 * for more details. 38 */ 39export type AppleAuthenticationSignInOptions = { 40 /** 41 * Array of user information scopes to which your app is requesting access. Note that the user can 42 * choose to deny your app access to any scope at the time of logging in. You will still need to 43 * handle `null` values for any scopes you request. Additionally, note that the requested scopes 44 * will only be provided to you the first time each user signs into your app; in subsequent 45 * requests they will be `null`. Defaults to `[]` (no scopes). 46 */ 47 requestedScopes?: AppleAuthenticationScope[]; 48 49 /** 50 * An arbitrary string that is returned unmodified in the corresponding credential after a 51 * successful authentication. This can be used to verify that the response was from the request 52 * you made and avoid replay attacks. More information on this property is available in the 53 * OAuth 2.0 protocol [RFC6749](https://tools.ietf.org/html/rfc6749#section-10.12). 54 */ 55 state?: string; 56 57 /** 58 * An arbitrary string that is used to prevent replay attacks. See more information on this in the 59 * [OpenID Connect specification](https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowSteps). 60 */ 61 nonce?: string; 62}; 63 64// @needsAudit @docsMissing 65/** 66 * The options you can supply when making a call to [`AppleAuthentication.refreshAsync()`](#appleauthenticationrefreshasyncoptions). 67 * You must include the ID string of the user whose credentials you'd like to refresh. 68 * 69 * @see [Apple 70 * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationopenidrequest) 71 * for more details. 72 */ 73export type AppleAuthenticationRefreshOptions = { 74 user: string; 75 76 /** 77 * Array of user information scopes to which your app is requesting access. Note that the user can 78 * choose to deny your app access to any scope at the time of logging in. You will still need to 79 * handle `null` values for any scopes you request. Additionally, note that the requested scopes 80 * will only be provided to you the first time each user signs into your app; in subsequent 81 * requests they will be `null`. Defaults to `[]` (no scopes). 82 */ 83 requestedScopes?: AppleAuthenticationScope[]; 84 85 /** 86 * An arbitrary string that is returned unmodified in the corresponding credential after a 87 * successful authentication. This can be used to verify that the response was from the request 88 * you made and avoid replay attacks. More information on this property is available in the 89 * OAuth 2.0 protocol [RFC6749](https://tools.ietf.org/html/rfc6749#section-10.12). 90 */ 91 state?: string; 92}; 93 94// @needsAudit 95/** 96 * The options you can supply when making a call to [`AppleAuthentication.signOutAsync()`](#appleauthenticationsignoutasyncoptions). 97 * You must include the ID string of the user to sign out. 98 * 99 * @see [Apple 100 * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationopenidrequest) 101 * for more details. 102 */ 103export type AppleAuthenticationSignOutOptions = { 104 user: string; 105 106 /** 107 * An arbitrary string that is returned unmodified in the corresponding credential after a 108 * successful authentication. This can be used to verify that the response was from the request 109 * you made and avoid replay attacks. More information on this property is available in the 110 * OAuth 2.0 protocol [RFC6749](https://tools.ietf.org/html/rfc6749#section-10.12). 111 */ 112 state?: string; 113}; 114 115// @needsAudit 116/** 117 * The object type returned from a successful call to [`AppleAuthentication.signInAsync()`](#appleauthenticationsigninasyncoptions), 118 * [`AppleAuthentication.refreshAsync()`](#appleauthenticationrefreshasyncoptions), or [`AppleAuthentication.signOutAsync()`](#appleauthenticationsignoutasyncoptions) 119 * which contains all of the pertinent user and credential information. 120 * 121 * @see [Apple 122 * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidcredential) 123 * for more details. 124 */ 125export type AppleAuthenticationCredential = { 126 /** 127 * An identifier associated with the authenticated user. You can use this to check if the user is 128 * still authenticated later. This is stable and can be shared across apps released under the same 129 * development team. The same user will have a different identifier for apps released by other 130 * developers. 131 */ 132 user: string; 133 134 /** 135 * An arbitrary string that your app provided as `state` in the request that generated the 136 * credential. Used to verify that the response was from the request you made. Can be used to 137 * avoid replay attacks. If you did not provide `state` when making the sign-in request, this field 138 * will be `null`. 139 */ 140 state: string | null; 141 142 /** 143 * The user's name. May be `null` or contain `null` values if you didn't request the `FULL_NAME` 144 * scope, if the user denied access, or if this is not the first time the user has signed into 145 * your app. 146 */ 147 fullName: AppleAuthenticationFullName | null; 148 149 /** 150 * The user's email address. Might not be present if you didn't request the `EMAIL` scope. May 151 * also be null if this is not the first time the user has signed into your app. If the user chose 152 * to withhold their email address, this field will instead contain an obscured email address with 153 * an Apple domain. 154 */ 155 email: string | null; 156 157 /** 158 * A value that indicates whether the user appears to the system to be a real person. 159 */ 160 realUserStatus: AppleAuthenticationUserDetectionStatus; 161 162 /** 163 * A JSON Web Token (JWT) that securely communicates information about the user to your app. 164 */ 165 identityToken: string | null; 166 167 /** 168 * A short-lived session token used by your app for proof of authorization when interacting with 169 * the app's server counterpart. Unlike `user`, this is ephemeral and will change each session. 170 */ 171 authorizationCode: string | null; 172}; 173 174// @needsAudit @docsMissing 175/** 176 * An object representing the tokenized portions of the user's full name. Any of all of the fields 177 * may be `null`. Only applicable fields that the user has allowed your app to access will be nonnull. 178 */ 179export type AppleAuthenticationFullName = { 180 namePrefix: string | null; 181 givenName: string | null; 182 middleName: string | null; 183 familyName: string | null; 184 nameSuffix: string | null; 185 nickname: string | null; 186}; 187 188// @needsAudit @docsMissing 189/** 190 * An enum whose values specify scopes you can request when calling [`AppleAuthentication.signInAsync()`](#appleauthenticationsigninasyncoptions). 191 * 192 * > Note that it is possible that you will not be granted all of the scopes which you request. 193 * > You will still need to handle null values for any fields you request. 194 * 195 * @see [Apple 196 * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationscope) 197 * for more details. 198 */ 199export enum AppleAuthenticationScope { 200 FULL_NAME = 0, 201 EMAIL = 1, 202} 203 204// @needsAudit @docsMissing 205export enum AppleAuthenticationOperation { 206 /** 207 * An operation that depends on the particular kind of credential provider. 208 */ 209 IMPLICIT = 0, 210 LOGIN = 1, 211 REFRESH = 2, 212 LOGOUT = 3, 213} 214 215// @needsAudit @docsMissing 216/** 217 * An enum whose values specify state of the credential when checked with [`AppleAuthentication.getCredentialStateAsync()`](#appleauthenticationgetcredentialstateasyncuser). 218 * 219 * @see [Apple 220 * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidprovidercredentialstate) 221 * for more details. 222 */ 223export enum AppleAuthenticationCredentialState { 224 REVOKED = 0, 225 AUTHORIZED = 1, 226 NOT_FOUND = 2, 227 TRANSFERRED = 3, 228} 229 230// @needsAudit 231/** 232 * An enum whose values specify the system's best guess for how likely the current user is a real person. 233 * 234 * @see [Apple 235 * Documentation](https://developer.apple.com/documentation/authenticationservices/asuserdetectionstatus) 236 * for more details. 237 */ 238export enum AppleAuthenticationUserDetectionStatus { 239 /** 240 * The system does not support this determination and there is no data. 241 */ 242 UNSUPPORTED = 0, 243 /** 244 * The system has not determined whether the user might be a real person. 245 */ 246 UNKNOWN = 1, 247 /** 248 * The user appears to be a real person. 249 */ 250 LIKELY_REAL = 2, 251} 252 253// @needsAudit 254/** 255 * An enum whose values control which pre-defined text to use when rendering an [`AppleAuthenticationButton`](#appleauthenticationappleauthenticationbutton). 256 */ 257export enum AppleAuthenticationButtonType { 258 /** 259 * "Sign in with Apple" 260 */ 261 SIGN_IN = 0, 262 /** 263 * "Continue with Apple" 264 */ 265 CONTINUE = 1, 266 /** 267 * "Sign up with Apple" 268 * @platform ios 13.2+ 269 */ 270 SIGN_UP = 2, 271} 272 273// @needsAudit 274/** 275 * An enum whose values control which pre-defined color scheme to use when rendering an [`AppleAuthenticationButton`](#appleauthenticationappleauthenticationbutton). 276 */ 277export enum AppleAuthenticationButtonStyle { 278 /** 279 * White button with black text. 280 */ 281 WHITE = 0, 282 /** 283 * White button with a black outline and black text. 284 */ 285 WHITE_OUTLINE = 1, 286 /** 287 * Black button with white text. 288 */ 289 BLACK = 2, 290} 291