/
constants.go
84 lines (73 loc) · 2.82 KB
/
constants.go
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
// beeper-imessage - A Matrix-iMessage puppeting bridge.
// Copyright (C) 2023 Beeper, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package appleid
import (
"net/url"
)
// Constants that depend on the browser and device
const (
UserAgent = "Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0"
Language = "en-GB"
AcceptLanguage = Language + ",en-US;q=0.7,en;q=0.3"
TimeZone = "GMT+00:00"
TimeZoneName = "Europe/London"
)
// Static constants
const (
AppleIDBaseURL = "https://appleid.apple.com"
APIKey = "cbf64fd6843ee630b463f358ea0b707b"
OAuthClientID = "af1139274f266b22b68c2a3e7ad932cb3c0bbe854e13a79af78dcc73136882c3"
OAuthRedirectURI = AppleIDBaseURL
OAuthResponseType = "code"
OAuthResponseMode = "web_message"
HdrValFDClientInfoVersion = "1.1"
HdrValRequestContext = "ca"
HdrValDocumentAccept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"
)
// Custom header names that are used in multiple places
const (
HdrAuthAttributes = "X-Apple-Auth-Attributes"
HdrAuthSessionID = "X-Apple-ID-Session-Id"
HdrScnt = "scnt"
)
var idmsaBaseURL = url.URL{
Scheme: "https",
Host: "idmsa.apple.com",
Path: authBasePath,
}
var appleIDBaseURL = url.URL{
Scheme: "https",
Host: "appleid.apple.com",
Path: accountManageBasePath,
}
// OAuth paths (under idmsa.apple.com)
const (
authBasePath = "/appleauth/auth"
federatePath = authBasePath + "/federate"
initPath = authBasePath + "/signin/init"
completePath = authBasePath + "/signin/complete"
trustedDeviceSecurityCodePath = authBasePath + "/verify/trusteddevice/securitycode"
requestPhoneCodePath = authBasePath + "/verify/phone"
submitPhoneCodePath = authBasePath + "/verify/phone/securitycode"
loginIframePath = authBasePath + "/authorize/signin"
)
// Apple ID paths (under appleid.apple.com)
const (
additionalAuthenticatePath = "/authenticate/password"
accountManageBasePath = "/account/manage"
appSpecificPasswordPath = accountManageBasePath + "/security/secondary-password"
gsTokenPath = accountManageBasePath + "/gs/ws/token"
)