diff --git a/.gitignore b/.gitignore index 166e2919..d816fb55 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,7 @@ Credentials.xcconfig Pods/ gen/ Podfile.lock + +# Swift Build +.build/ +Package.resolved diff --git a/GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifiableAccountDetail.m b/GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifiableAccountDetail.m new file mode 100644 index 00000000..c26b3434 --- /dev/null +++ b/GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifiableAccountDetail.m @@ -0,0 +1,20 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiableAccountDetail.h" + +@implementation GIDVerifiableAccountDetail +@end diff --git a/GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifiedAccountDetailResult.m b/GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifiedAccountDetailResult.m new file mode 100644 index 00000000..1d1b7928 --- /dev/null +++ b/GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifiedAccountDetailResult.m @@ -0,0 +1,20 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiedAccountDetailResult.h" + +@implementation GIDVerifiedAccountDetailResult +@end diff --git a/GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifyAccountDetail.m b/GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifyAccountDetail.m index dd73ea61..f003ebf6 100644 --- a/GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifyAccountDetail.m +++ b/GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifyAccountDetail.m @@ -16,5 +16,37 @@ #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifyAccountDetail.h" +#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiableAccountDetail.h" +#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiedAccountDetailResult.h" + @implementation GIDVerifyAccountDetail + +#if TARGET_OS_IOS || TARGET_OS_MACCATALYST + +- (void)verifyAccountDetails:(NSArray *)accountDetails + presentingViewController:(UIViewController *)presentingViewController + completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult, + NSError *_Nullable error))completion { + // TODO(#383): Implement this method. +} + +- (void)verifyAccountDetails:(NSArray *)accountDetails + presentingViewController:(UIViewController *)presentingViewController + hint:(nullable NSString *)hint + completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult, + NSError *_Nullable error))completion { + // TODO(#383): Implement this method. +} + +- (void)verifyAccountDetails:(NSArray *)accountDetails + presentingViewController:(UIViewController *)presentingViewController + hint:(nullable NSString *)hint + additionalScopes:(nullable NSArray *)additionalScopes + completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult, + NSError *_Nullable error))completion { + // TODO(#383): Implement this method. +} + +#endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST + @end diff --git a/GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiableAccountDetail.h b/GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiableAccountDetail.h new file mode 100644 index 00000000..58248a64 --- /dev/null +++ b/GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiableAccountDetail.h @@ -0,0 +1,22 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/// Helper object used to hold GIDAccountDetailType representing a list of +/// account details that Google can verify via GSI. +@interface GIDVerifiableAccountDetail : NSObject +@end diff --git a/GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiedAccountDetailResult.h b/GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiedAccountDetailResult.h new file mode 100644 index 00000000..c9762920 --- /dev/null +++ b/GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiedAccountDetailResult.h @@ -0,0 +1,22 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/// A helper object that contains the result of a verification flow. +/// This will pass back the necessary tokens to the requesting party. +@interface GIDVerifiedAccountDetailResult : NSObject +@end diff --git a/GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifyAccountDetail.h b/GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifyAccountDetail.h index 5dacfdcb..76f86bf6 100644 --- a/GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifyAccountDetail.h +++ b/GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifyAccountDetail.h @@ -15,6 +15,78 @@ */ #import +#import +#if __has_include() +#import +#elif __has_include() +#import +#endif + +@class GIDVerifiableAccountDetail; +@class GIDVerifiedAccountDetailResult; + +NS_ASSUME_NONNULL_BEGIN + +/// This class is used to verify a user's Google account details. @interface GIDVerifyAccountDetail : NSObject + +#if TARGET_OS_IOS || TARGET_OS_MACCATALYST + +/// Starts an interactive verification flow. +/// +/// The completion will be called at the end of this process. Any saved verification +/// state will be replaced by the result of this flow. +/// +/// @param accountDetails A list of verifiable account details. +/// @param presentingViewController The view controller used to present `SFSafariViewController` on +/// iOS 9 and 10 and to supply `presentationContextProvider` for `ASWebAuthenticationSession` on +/// iOS 13+. +/// @param completion The optional block called asynchronously on the main queue upon completion. +- (void)verifyAccountDetails:(NSArray *)accountDetails + presentingViewController:(UIViewController *)presentingViewController + completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult, + NSError *_Nullable error))completion; + +/// Starts an interactive verification flow using the provided hint. +/// +/// The completion will be called at the end of this process. Any saved verification +/// state will be replaced by the result of this flow. +/// +/// @param accountDetails A list of verifiable account details. +/// @param presentingViewController The view controller used to present `SFSafariViewController` on +/// iOS 9 and 10 and to supply `presentationContextProvider` for `ASWebAuthenticationSession` on +/// iOS 13+. +/// @param hint An optional hint for the authorization server, for example the user's ID or email +/// address, to be prefilled if possible. +/// @param completion The optional block called asynchronously on the main queue upon completion. +- (void)verifyAccountDetails:(NSArray *)accountDetails + presentingViewController:(UIViewController *)presentingViewController + hint:(nullable NSString *)hint + completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult, + NSError *_Nullable error))completion; + +/// Starts an interactive verification flow using the provided hint and additional scopes. +/// +/// The completion will be called at the end of this process. Any saved verification +/// state will be replaced by the result of this flow. +/// +/// @param accountDetails A list of verifiable account details. +/// @param presentingViewController The view controller used to present `SFSafariViewController` on +/// iOS 9 and 10. +/// @param hint An optional hint for the authorization server, for example the user's ID or email +/// address, to be prefilled if possible. +/// @param additionalScopes An optional array of scopes to request in addition to the basic profile scopes. +/// @param completion The optional block called asynchronously on the main queue upon completion. +- (void)verifyAccountDetails:(NSArray *)accountDetails + presentingViewController:(UIViewController *)presentingViewController + hint:(nullable NSString *)hint + additionalScopes:(nullable NSArray *)additionalScopes + completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult, + NSError *_Nullable error))completion; + +#endif + @end + +NS_ASSUME_NONNULL_END diff --git a/GoogleSignIn/Sources/Public/GoogleSignIn/GoogleSignIn.h b/GoogleSignIn/Sources/Public/GoogleSignIn/GoogleSignIn.h index 5d9cfd7f..b1b4d240 100644 --- a/GoogleSignIn/Sources/Public/GoogleSignIn/GoogleSignIn.h +++ b/GoogleSignIn/Sources/Public/GoogleSignIn/GoogleSignIn.h @@ -22,6 +22,8 @@ #import "GIDToken.h" #import "GIDSignInResult.h" #import "GIDVerifyAccountDetail.h" +#import "GIDVerifiableAccountDetail.h" +#import "GIDVerifiedAccountDetailResult.h" #if TARGET_OS_IOS || TARGET_OS_MACCATALYST #import "GIDSignInButton.h" #endif