File: manager_auth_types.go

package info (click to toggle)
golang-github-henrybear327-go-proton-api 1.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,088 kB
  • sloc: sh: 55; makefile: 26
file content (111 lines) | stat: -rw-r--r-- 1,801 bytes parent folder | download
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
package proton

type AuthInfoReq struct {
	Username string
}

type AuthInfo struct {
	Version         int
	Modulus         string
	ServerEphemeral string
	Salt            string
	SRPSession      string
	TwoFA           TwoFAInfo `json:"2FA"`
}

type AuthVerifier struct {
	Version   int
	ModulusID string
	Salt      string
	Verifier  string
}

type AuthModulus struct {
	Modulus   string
	ModulusID string
}

type FIDO2Req struct {
	AuthenticationOptions any
	ClientData            string
	AuthenticatorData     string
	Signature             string
	CredentialID          string
}

type AuthReq struct {
	Auth2FAReq `json:",omitempty"`

	Username        string
	ClientEphemeral string
	ClientProof     string
	SRPSession      string
}

type Auth struct {
	UserID string

	UID          string
	AccessToken  string
	RefreshToken string
	ServerProof  string

	Scope        string
	TwoFA        TwoFAInfo `json:"2FA"`
	PasswordMode PasswordMode
}

type RegisteredKey struct {
	AttestationFormat string
	CredentialID      []int
	Name              string
}

type FIDO2Info struct {
	AuthenticationOptions any
	RegisteredKeys        []RegisteredKey
}

type TwoFAInfo struct {
	Enabled TwoFAStatus
	FIDO2   FIDO2Info
}

type TwoFAStatus int

const (
	HasTOTP TwoFAStatus = 1 << iota
	HasFIDO2
)

type PasswordMode int

const (
	OnePasswordMode PasswordMode = iota + 1
	TwoPasswordMode
)

type Auth2FAReq struct {
	TwoFactorCode string   `json:",omitempty"`
	FIDO2         FIDO2Req `json:",omitempty"`
}

type AuthRefreshReq struct {
	UID          string
	RefreshToken string
	ResponseType string
	GrantType    string
	RedirectURI  string
	State        string
}

type AuthSession struct {
	UID        string
	CreateTime int64

	ClientID  string
	MemberID  string
	Revocable Bool

	LocalizedClientName string
}