iFun Engine API  1.0.0-b6053
Great Technology for Great Games
apple_game_center_authentication.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2020 iFunFactory Inc. All Rights Reserved.
2 //
3 // This work is confidential and proprietary to iFunFactory Inc. and
4 // must not be used, disclosed, copied, or distributed without the prior
5 // consent of iFunFactory Inc.
6 
9 #ifndef INCLUDE_FUNAPI_SERVICE_APPLE_GAME_CENTER_AUTHENTICATION_H_
10 #define INCLUDE_FUNAPI_SERVICE_APPLE_GAME_CENTER_AUTHENTICATION_H_
11 
12 #include <funapi/types.h>
13 
14 
15 namespace fun {
16 
17 enum AppleGameCenterAuthErrorCode {
18  kUnknownError,
19  kCertificateVerificationFailure,
20  kCurlError,
21  kInvalidCertificate,
22  kInvalidCertificateIssuer,
23  kInvalidHttpStatus,
24  kInvalidAuthParameter,
25  kInvalidPublicKeyUrl,
26  kAuthenticationSuccess
27 };
28 
29 
30 struct FUNAPI_DLL_VISIBILITY AppleGameCenterAuthenticationRequest {
32  const string &bundle_id, const string &player_id,
33  const string &public_key_url, const std::vector<uint8_t> &signature,
34  const std::vector<uint8_t> &salt, const uint64_t timestamp);
35 
36  string bundle_id;
37  string player_id;
38  string public_key_url;
39  std::vector<uint8_t> signature;
40  std::vector<uint8_t> salt;
41  uint64_t timestamp;
42 };
43 
44 
45 struct FUNAPI_DLL_VISIBILITY AppleGameCenterAuthenticationRequest2 {
47  const string &bundle_id, const string &player_id,
48  const string &public_key_url, const string &b64_signature,
49  const string &b64_salt, const uint64_t timestamp);
50 
51  string bundle_id;
52  string player_id;
53  string public_key_url;
54  string b64_signature;
55  string b64_salt;
56  uint64_t timestamp;
57 };
58 
59 
60 struct FUNAPI_DLL_VISIBILITY AppleGameCenterAuthenticationResponse {
62 
63  bool success;
64  AppleGameCenterAuthErrorCode error_code;
65  string error_message;
66 };
67 
68 
69 typedef function<
70  void(const AppleGameCenterAuthenticationRequest &request,
72  bool error)> AppleGameCenterAuthenticationResponseHandler;
73 
74 typedef function<
75  void(const AppleGameCenterAuthenticationRequest2 &request,
77  bool error)> AppleGameCenterAuthenticationResponseHandler2;
78 
79 
80 FUNAPI_DLL_VISIBILITY
81 void Authenticate(const AppleGameCenterAuthenticationRequest &request,
82  const AppleGameCenterAuthenticationResponseHandler &handler,
83  size_t timeout_in_ms = 0);
84 
85 
86 FUNAPI_DLL_VISIBILITY
87 void Authenticate(const AppleGameCenterAuthenticationRequest2 &request,
88  const AppleGameCenterAuthenticationResponseHandler2 &handler,
89  size_t timeout_in_ms = 0);
90 
91 } // namespace fun
92 
93 #endif // INCLUDE_FUNAPI_SERVICE_APPLE_GAME_CENTER_AUTHENTICATION_H_
Definition: apple_game_center_authentication.h:60
Definition: apple_game_center_authentication.h:45
Definition: json.h:18
Definition: apple_game_center_authentication.h:30