-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyamka.sus
135 lines (118 loc) · 3.22 KB
/
yamka.sus
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
include impostor.sus
set output html
set html_topbar_logo /home/portasynthinca3/yamka_press_kit/icons/icon_color_on_transparency.png
set html_topbar_title Yamka API
enum(2) ErrorCode {
@> Internal server error <@
internal_error(0),
@> Invalid email supplied to log_in() <@
invalid_email(1),
@> Invalid password supplied to log_in() <@
invalid_password(2),
@> Invalid 2FA code supplied to the MFA confirmation <@
invalid_mfa_code(3),
@> Missing token permission <@
token_perm_denied(4),
@> Permission denied (other reasons) <@
permission_denied(5),
@> Invalid access token supplied to auth() <@
invalid_access_token(6),
@> Failed to perform a contact-related action <@
contact_error(7),
@> Invalid username supplied to User.send_friend_rq() <@
invalid_username(8),
@> Invalid invitation code supplied to Group.join() <@
invalid_invite(9),
@> Invalid code supplied to confirm_email() <@
invalid_confirmation_code(10),
@> Poll-related error <@
poll_error(11),
@> Key-related error <@
key_error(12),
@> Invalid credential(s) supplied to change_password() <@
invalid_credential(13)
}
enum(1) State {
awaiting_login(0)
}
set default_state awaiting_login
@> The user has to solve a captcha <@
confirmation Captcha(0) {
request {
image_url: Str[match: /https:\/\/.+\.png/];
}
response {
solved: Str[len: 3..8];
}
}
@> The user has to provide a 2FA 6-/8-digit code <@
confirmation MFA(1) {
request { }
response {
code: Str[match: /[0-9]{6,8}/];
}
}
@> Represents access token permissions <@
bitfield(4) AccessTokenPerm {
see_profile(0),
see_relationships(1),
see_groups(2),
see_direct_messages(3),
edit_profile(4),
edit_relationships(5),
send_group_messages(6),
send_direct_messages(7),
receive_group_messages(8),
read_group_message_history(9),
receive_direct_messages(10),
read_direct_message_history(11),
delete_group_messages(12),
delete_direct_messages(13),
create_groups(14),
edit_groups(15),
delete_groups(16),
join_groups(17),
leave_groups(18),
ban_memers(19),
kick_members(20),
manage_roles(21),
delete_others_messages(22),
create_polls(23),
vote_in_polls(24),
@> The user is a bot <@
bot(26)
}
@> Acquire an access token <@
globalmethod log_in(0) {
email: Str[match: /[^\t \r\n@]+@[^\t \r\n@]+/];
password: Str[len: 5..64];
perms: AccessTokenPerm;
@> A randomly generated string unique for every user agent <@
id_str: Str[len: 16..64];
returns {
token: Str[match: /\w{16,64}/];
}
ratelimit 3 every 30s;
states { awaiting_login }
errors { invalid_email, invalid_password, invalid_mfa_code }
confirmations { Captcha, MFA }
}
@> Authorize using an access token <@
globalmethod auth(1) {
token: Str[match: /\w{16,64}/];
returns {
@> The user associated with this token <@
user: User;
@> The user agent associated with this token <@
agent: Agent;
}
ratelimit 3 every 60s;
states { awaiting_login }
errors { invalid_access_token }
}
entity User(0) {
id: Int(8);
}
entity Agent(1) {
id: Int(8);
}