1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asuserdetectionstatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ASUserDetectionStatus(pub NSInteger);
impl ASUserDetectionStatus {
#[doc(alias = "ASUserDetectionStatusUnsupported")]
pub const Unsupported: Self = Self(0);
#[doc(alias = "ASUserDetectionStatusUnknown")]
pub const Unknown: Self = Self(1);
#[doc(alias = "ASUserDetectionStatusLikelyReal")]
pub const LikelyReal: Self = Self(2);
}
unsafe impl Encode for ASUserDetectionStatus {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for ASUserDetectionStatus {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asuseragerange?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ASUserAgeRange(pub NSInteger);
impl ASUserAgeRange {
#[doc(alias = "ASUserAgeRangeUnknown")]
pub const Unknown: Self = Self(0);
#[doc(alias = "ASUserAgeRangeChild")]
pub const Child: Self = Self(1);
#[doc(alias = "ASUserAgeRangeNotChild")]
pub const NotChild: Self = Self(2);
}
unsafe impl Encode for ASUserAgeRange {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for ASUserAgeRange {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidcredential?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct ASAuthorizationAppleIDCredential;
);
#[cfg(feature = "ASAuthorizationCredential")]
extern_conformance!(
unsafe impl ASAuthorizationCredential for ASAuthorizationAppleIDCredential {}
);
extern_conformance!(
unsafe impl NSCoding for ASAuthorizationAppleIDCredential {}
);
extern_conformance!(
unsafe impl NSCopying for ASAuthorizationAppleIDCredential {}
);
unsafe impl CopyingHelper for ASAuthorizationAppleIDCredential {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for ASAuthorizationAppleIDCredential {}
);
extern_conformance!(
unsafe impl NSSecureCoding for ASAuthorizationAppleIDCredential {}
);
impl ASAuthorizationAppleIDCredential {
extern_methods!(
/// An opaque user ID associated with the AppleID used for the sign in. This identifier will be stable across the 'developer team', it can later be used as an input to
///
/// See: ASAuthorizationRequest to request user contact information.
///
/// The identifier will remain stable as long as the user is connected with the requesting client. The value may change upon user disconnecting from the identity provider.
#[unsafe(method(user))]
#[unsafe(method_family = none)]
pub unsafe fn user(&self) -> Retained<NSString>;
/// A copy of the state value that was passed to ASAuthorizationRequest.
#[unsafe(method(state))]
#[unsafe(method_family = none)]
pub unsafe fn state(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "ASAuthorization")]
/// This value will contain a list of scopes for which the user provided authorization. These may contain a subset of the requested scopes on
///
/// See: ASAuthorizationAppleIDRequest. The application should query this value to identify which scopes were returned as it maybe different from ones requested.
#[unsafe(method(authorizedScopes))]
#[unsafe(method_family = none)]
pub unsafe fn authorizedScopes(&self) -> Retained<NSArray<ASAuthorizationScope>>;
/// A short-lived, one-time valid token that provides proof of authorization to the server component of the app. The authorization code is bound to the specific transaction using the state attribute passed in the authorization request. The server component of the app can validate the code using Appleās identity service endpoint provided for this purpose.
#[unsafe(method(authorizationCode))]
#[unsafe(method_family = none)]
pub unsafe fn authorizationCode(&self) -> Option<Retained<NSData>>;
/// A JSON Web Token (JWT) used to communicate information about the identity of the user in a secure way to the app. The ID token will contain the following information: Issuer Identifier, Subject Identifier, Audience, Expiry Time and Issuance Time signed by Apple's identity service.
#[unsafe(method(identityToken))]
#[unsafe(method_family = none)]
pub unsafe fn identityToken(&self) -> Option<Retained<NSData>>;
/// An optional email shared by the user. This field is populated with a value that the user authorized.
#[unsafe(method(email))]
#[unsafe(method_family = none)]
pub unsafe fn email(&self) -> Option<Retained<NSString>>;
/// An optional full name shared by the user. This field is populated with a value that the user authorized.
#[unsafe(method(fullName))]
#[unsafe(method_family = none)]
pub unsafe fn fullName(&self) -> Option<Retained<NSPersonNameComponents>>;
/// Check this property for a hint as to whether the current user is a "real user".
///
/// See: ASUserDetectionStatus for guidelines on handling each status
#[unsafe(method(realUserStatus))]
#[unsafe(method_family = none)]
pub unsafe fn realUserStatus(&self) -> ASUserDetectionStatus;
/// Check this property to determine whether the current user is a child.
///
/// See: ASUserAgeRange for guidelines on handling each status.
#[unsafe(method(userAgeRange))]
#[unsafe(method_family = none)]
pub unsafe fn userAgeRange(&self) -> ASUserAgeRange;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}