@softistx/janus-graphql 0.0.0-stage → 0.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +716 -2
  3. package/dist/api-keys/index.d.ts +11 -0
  4. package/dist/api-keys/index.d.ts.map +1 -0
  5. package/dist/api-keys/resolvers/deps.d.ts +39 -0
  6. package/dist/api-keys/resolvers/deps.d.ts.map +1 -0
  7. package/dist/api-keys/resolvers/index.d.ts +39 -0
  8. package/dist/api-keys/resolvers/index.d.ts.map +1 -0
  9. package/dist/api-keys/resolvers/list.d.ts +16 -0
  10. package/dist/api-keys/resolvers/list.d.ts.map +1 -0
  11. package/dist/api-keys/resolvers/manage.d.ts +17 -0
  12. package/dist/api-keys/resolvers/manage.d.ts.map +1 -0
  13. package/dist/api-keys/sdl.d.ts +14 -0
  14. package/dist/api-keys/sdl.d.ts.map +1 -0
  15. package/dist/api-keys/shape.d.ts +38 -0
  16. package/dist/api-keys/shape.d.ts.map +1 -0
  17. package/dist/api-keys/types.d.ts +149 -0
  18. package/dist/api-keys/types.d.ts.map +1 -0
  19. package/dist/avatar/index.d.ts +32 -0
  20. package/dist/avatar/index.d.ts.map +1 -0
  21. package/dist/avatar/resolvers.d.ts +41 -0
  22. package/dist/avatar/resolvers.d.ts.map +1 -0
  23. package/dist/avatar/sdl.d.ts +16 -0
  24. package/dist/avatar/sdl.d.ts.map +1 -0
  25. package/dist/bad-input.d.ts +17 -0
  26. package/dist/bad-input.d.ts.map +1 -0
  27. package/dist/connection/connection.d.ts +36 -0
  28. package/dist/connection/connection.d.ts.map +1 -0
  29. package/dist/connection/credential.d.ts +34 -0
  30. package/dist/connection/credential.d.ts.map +1 -0
  31. package/dist/connection/types.d.ts +61 -0
  32. package/dist/connection/types.d.ts.map +1 -0
  33. package/dist/context/create.d.ts +32 -0
  34. package/dist/context/create.d.ts.map +1 -0
  35. package/dist/context/index.d.ts +9 -0
  36. package/dist/context/index.d.ts.map +1 -0
  37. package/dist/context/registry.d.ts +72 -0
  38. package/dist/context/registry.d.ts.map +1 -0
  39. package/dist/context/resolve.d.ts +20 -0
  40. package/dist/context/resolve.d.ts.map +1 -0
  41. package/dist/device.d.ts +28 -0
  42. package/dist/device.d.ts.map +1 -0
  43. package/dist/directives/apply.d.ts +51 -0
  44. package/dist/directives/apply.d.ts.map +1 -0
  45. package/dist/directives/guard.d.ts +22 -0
  46. package/dist/directives/guard.d.ts.map +1 -0
  47. package/dist/directives/permission/enforce.d.ts +24 -0
  48. package/dist/directives/permission/enforce.d.ts.map +1 -0
  49. package/dist/directives/permission/model.d.ts +35 -0
  50. package/dist/directives/permission/model.d.ts.map +1 -0
  51. package/dist/directives/permission/path.d.ts +31 -0
  52. package/dist/directives/permission/path.d.ts.map +1 -0
  53. package/dist/directives/permission/validate.d.ts +42 -0
  54. package/dist/directives/permission/validate.d.ts.map +1 -0
  55. package/dist/directives/read.d.ts +43 -0
  56. package/dist/directives/read.d.ts.map +1 -0
  57. package/dist/directives/validate.d.ts +39 -0
  58. package/dist/directives/validate.d.ts.map +1 -0
  59. package/dist/directives/words.d.ts +7 -0
  60. package/dist/directives/words.d.ts.map +1 -0
  61. package/dist/errors/denial.d.ts +6 -0
  62. package/dist/errors/denial.d.ts.map +1 -0
  63. package/dist/errors/index.d.ts +12 -0
  64. package/dist/errors/index.d.ts.map +1 -0
  65. package/dist/errors/janus-error.d.ts +20 -0
  66. package/dist/errors/janus-error.d.ts.map +1 -0
  67. package/dist/errors/mask.d.ts +69 -0
  68. package/dist/errors/mask.d.ts.map +1 -0
  69. package/dist/fresh.d.ts +44 -0
  70. package/dist/fresh.d.ts.map +1 -0
  71. package/dist/helpers.d.ts +56 -0
  72. package/dist/helpers.d.ts.map +1 -0
  73. package/dist/index.d.ts +86 -0
  74. package/dist/index.d.ts.map +1 -0
  75. package/dist/index.js +3393 -0
  76. package/dist/index.js.map +75 -0
  77. package/dist/invitations/index.d.ts +12 -0
  78. package/dist/invitations/index.d.ts.map +1 -0
  79. package/dist/invitations/resolvers/anonymous.d.ts +11 -0
  80. package/dist/invitations/resolvers/anonymous.d.ts.map +1 -0
  81. package/dist/invitations/resolvers/deps.d.ts +38 -0
  82. package/dist/invitations/resolvers/deps.d.ts.map +1 -0
  83. package/dist/invitations/resolvers/index.d.ts +37 -0
  84. package/dist/invitations/resolvers/index.d.ts.map +1 -0
  85. package/dist/invitations/resolvers/owner.d.ts +17 -0
  86. package/dist/invitations/resolvers/owner.d.ts.map +1 -0
  87. package/dist/invitations/sdl/accept.d.ts +7 -0
  88. package/dist/invitations/sdl/accept.d.ts.map +1 -0
  89. package/dist/invitations/sdl/index.d.ts +14 -0
  90. package/dist/invitations/sdl/index.d.ts.map +1 -0
  91. package/dist/invitations/sdl/owner.d.ts +8 -0
  92. package/dist/invitations/sdl/owner.d.ts.map +1 -0
  93. package/dist/invitations/shape.d.ts +63 -0
  94. package/dist/invitations/shape.d.ts.map +1 -0
  95. package/dist/invitations/types/index.d.ts +5 -0
  96. package/dist/invitations/types/index.d.ts.map +1 -0
  97. package/dist/invitations/types/options.d.ts +104 -0
  98. package/dist/invitations/types/options.d.ts.map +1 -0
  99. package/dist/invitations/types/out.d.ts +136 -0
  100. package/dist/invitations/types/out.d.ts.map +1 -0
  101. package/dist/invitations/types/surface.d.ts +18 -0
  102. package/dist/invitations/types/surface.d.ts.map +1 -0
  103. package/dist/map-code.d.ts +10 -0
  104. package/dist/map-code.d.ts.map +1 -0
  105. package/dist/mask-error.d.ts +18 -0
  106. package/dist/mask-error.d.ts.map +1 -0
  107. package/dist/memo.d.ts +16 -0
  108. package/dist/memo.d.ts.map +1 -0
  109. package/dist/options.d.ts +17 -0
  110. package/dist/options.d.ts.map +1 -0
  111. package/dist/passkeys/deps.d.ts +23 -0
  112. package/dist/passkeys/deps.d.ts.map +1 -0
  113. package/dist/passkeys/first-factor.types.d.ts +38 -0
  114. package/dist/passkeys/first-factor.types.d.ts.map +1 -0
  115. package/dist/passkeys/index.d.ts +14 -0
  116. package/dist/passkeys/index.d.ts.map +1 -0
  117. package/dist/passkeys/resolvers.d.ts +23 -0
  118. package/dist/passkeys/resolvers.d.ts.map +1 -0
  119. package/dist/passkeys/sdl.d.ts +14 -0
  120. package/dist/passkeys/sdl.d.ts.map +1 -0
  121. package/dist/passkeys/shape.d.ts +14 -0
  122. package/dist/passkeys/shape.d.ts.map +1 -0
  123. package/dist/passkeys/sign-in.resolvers.d.ts +19 -0
  124. package/dist/passkeys/sign-in.resolvers.d.ts.map +1 -0
  125. package/dist/passkeys/sign-in.sdl.d.ts +16 -0
  126. package/dist/passkeys/sign-in.sdl.d.ts.map +1 -0
  127. package/dist/passkeys/types.d.ts +193 -0
  128. package/dist/passkeys/types.d.ts.map +1 -0
  129. package/dist/plugin.d.ts +59 -0
  130. package/dist/plugin.d.ts.map +1 -0
  131. package/dist/renewal.d.ts +51 -0
  132. package/dist/renewal.d.ts.map +1 -0
  133. package/dist/report.d.ts +29 -0
  134. package/dist/report.d.ts.map +1 -0
  135. package/dist/sdl.d.ts +12 -0
  136. package/dist/sdl.d.ts.map +1 -0
  137. package/dist/second-factor/index.d.ts +12 -0
  138. package/dist/second-factor/index.d.ts.map +1 -0
  139. package/dist/second-factor/resolvers/deps.d.ts +39 -0
  140. package/dist/second-factor/resolvers/deps.d.ts.map +1 -0
  141. package/dist/second-factor/resolvers/index.d.ts +39 -0
  142. package/dist/second-factor/resolvers/index.d.ts.map +1 -0
  143. package/dist/second-factor/resolvers/sign-in.d.ts +10 -0
  144. package/dist/second-factor/resolvers/sign-in.d.ts.map +1 -0
  145. package/dist/second-factor/resolvers/status.d.ts +10 -0
  146. package/dist/second-factor/resolvers/status.d.ts.map +1 -0
  147. package/dist/second-factor/resolvers/step-up.d.ts +16 -0
  148. package/dist/second-factor/resolvers/step-up.d.ts.map +1 -0
  149. package/dist/second-factor/resolvers/writes.d.ts +19 -0
  150. package/dist/second-factor/resolvers/writes.d.ts.map +1 -0
  151. package/dist/second-factor/sdl.d.ts +14 -0
  152. package/dist/second-factor/sdl.d.ts.map +1 -0
  153. package/dist/second-factor/shape.d.ts +18 -0
  154. package/dist/second-factor/shape.d.ts.map +1 -0
  155. package/dist/second-factor/types/index.d.ts +5 -0
  156. package/dist/second-factor/types/index.d.ts.map +1 -0
  157. package/dist/second-factor/types/options.d.ts +61 -0
  158. package/dist/second-factor/types/options.d.ts.map +1 -0
  159. package/dist/second-factor/types/out.d.ts +84 -0
  160. package/dist/second-factor/types/out.d.ts.map +1 -0
  161. package/dist/second-factor/types/surface.d.ts +89 -0
  162. package/dist/second-factor/types/surface.d.ts.map +1 -0
  163. package/dist/social/index.d.ts +10 -0
  164. package/dist/social/index.d.ts.map +1 -0
  165. package/dist/social/resolvers.d.ts +25 -0
  166. package/dist/social/resolvers.d.ts.map +1 -0
  167. package/dist/social/sdl.d.ts +13 -0
  168. package/dist/social/sdl.d.ts.map +1 -0
  169. package/dist/social/shape.d.ts +11 -0
  170. package/dist/social/shape.d.ts.map +1 -0
  171. package/dist/social/types.d.ts +160 -0
  172. package/dist/social/types.d.ts.map +1 -0
  173. package/dist/surface/api.d.ts +16 -0
  174. package/dist/surface/api.d.ts.map +1 -0
  175. package/dist/surface/request.d.ts +10 -0
  176. package/dist/surface/request.d.ts.map +1 -0
  177. package/dist/surface/signed-in.d.ts +30 -0
  178. package/dist/surface/signed-in.d.ts.map +1 -0
  179. package/dist/types.d.ts +117 -0
  180. package/dist/types.d.ts.map +1 -0
  181. package/dist/wiring.d.ts +56 -0
  182. package/dist/wiring.d.ts.map +1 -0
  183. package/docs/README.md +26 -0
  184. package/docs/guide/api-keys.md +365 -0
  185. package/docs/guide/avatars.md +129 -0
  186. package/docs/guide/context.md +371 -0
  187. package/docs/guide/directives.md +371 -0
  188. package/docs/guide/errors.md +318 -0
  189. package/docs/guide/federation.md +71 -0
  190. package/docs/guide/invitations.md +269 -0
  191. package/docs/guide/passkeys.md +207 -0
  192. package/docs/guide/second-factor.md +238 -0
  193. package/docs/guide/social.md +190 -0
  194. package/docs/guide/step-up.md +208 -0
  195. package/docs/guide/subscriptions.md +255 -0
  196. package/docs/guide/telemetry.md +45 -0
  197. package/docs/roadmap.md +124 -0
  198. package/docs/troubleshooting.md +1265 -0
  199. package/graphql/janus-api-keys.graphqls +237 -0
  200. package/graphql/janus-avatar.graphqls +19 -0
  201. package/graphql/janus-invitations.graphqls +280 -0
  202. package/graphql/janus-passkey-sign-in.graphqls +40 -0
  203. package/graphql/janus-passkeys.graphqls +134 -0
  204. package/graphql/janus-second-factor.graphqls +199 -0
  205. package/graphql/janus-social.graphqls +155 -0
  206. package/graphql/janus.graphqls +44 -0
  207. package/package.json +80 -5
@@ -0,0 +1,237 @@
1
+ """
2
+ A personal API key, as its holder and the bound object's owners see it. The
3
+ secret is never here: `createApiKey` answers it once.
4
+ """
5
+ type JanusApiKey {
6
+ """
7
+ The key's id: what `revokeApiKey` takes. Not the secret.
8
+ """
9
+ id: ID!
10
+ """
11
+ The id of the user who holds the key.
12
+ """
13
+ userId: ID!
14
+ """
15
+ The label its holder chose, 1 to 100 characters.
16
+ """
17
+ name: String!
18
+ """
19
+ The start of the token: its prefix and the first characters of its id
20
+ (`sl_0192ab…`). Enough to recognise the key, not to use it.
21
+ """
22
+ prefix: String!
23
+ """
24
+ What the key may do, as given at creation (`mcp:read`), or null for a key
25
+ that may do whatever its user may. Janus never enforces them: the
26
+ application does, where it serves the key's requests.
27
+ """
28
+ scopes: [String!]
29
+ """
30
+ The one object the key acts in, or null for an unbound key.
31
+ """
32
+ bound: JanusApiKeyBound
33
+ """
34
+ `ACTIVE`, `REVOKED` or `EXPIRED`.
35
+ """
36
+ status: JanusApiKeyStatus!
37
+ """
38
+ When the key was created, as an ISO-8601 string.
39
+ """
40
+ createdAt: String!
41
+ """
42
+ When the key stops being usable, as an ISO-8601 string.
43
+ """
44
+ expiresAt: String!
45
+ """
46
+ When the key was last used, as an ISO-8601 string; null while it was never
47
+ used. It moves at most once per throttle window.
48
+ """
49
+ lastUsedAt: String
50
+ """
51
+ When the key was revoked, as an ISO-8601 string; null while the key stands.
52
+ """
53
+ revokedAt: String
54
+ }
55
+
56
+ """
57
+ The object a key is bound to: a workspace, an account, a project… as the
58
+ application names it.
59
+ """
60
+ type JanusApiKeyBound {
61
+ """
62
+ What the object is, as the application names its kinds (`workspace`).
63
+ """
64
+ type: String!
65
+ """
66
+ The id of the object.
67
+ """
68
+ id: ID!
69
+ }
70
+
71
+ """
72
+ Whether a key can still be used.
73
+ """
74
+ enum JanusApiKeyStatus {
75
+ """
76
+ Usable until `expiresAt`.
77
+ """
78
+ ACTIVE
79
+ """
80
+ Revoked (`revokedAt`): refused from then on.
81
+ """
82
+ REVOKED
83
+ """
84
+ Past `expiresAt` without being revoked.
85
+ """
86
+ EXPIRED
87
+ }
88
+
89
+ """
90
+ A key just created: `secret` is the whole token, answered this once.
91
+ """
92
+ type JanusCreatedApiKey {
93
+ """
94
+ The key that was created, as `apiKeys` lists it.
95
+ """
96
+ apiKey: JanusApiKey!
97
+ """
98
+ The whole token (`sl_…`). Shown only in this answer and never stored: a
99
+ lost secret is a new key. The response is `no-store`.
100
+ """
101
+ secret: String!
102
+ }
103
+
104
+ """
105
+ One page of keys, oldest first. `nextCursor` is null on the last page; a page
106
+ may hold fewer than `limit` keys and still have a next one.
107
+ """
108
+ type JanusApiKeyPage {
109
+ """
110
+ The keys of this page, oldest first.
111
+ """
112
+ items: [JanusApiKey!]!
113
+ """
114
+ Pass it as `after` to read the next page; null on the last page.
115
+ """
116
+ nextCursor: String
117
+ }
118
+
119
+ """
120
+ The lifetimes `createApiKey` offers, in days, and the one it takes when
121
+ `lifetimeDays` is absent.
122
+ """
123
+ type JanusApiKeyLifetimes {
124
+ """
125
+ The lifetimes a new key may have, in days.
126
+ """
127
+ days: [Int!]!
128
+ """
129
+ The lifetime, in days, taken when `lifetimeDays` is absent.
130
+ """
131
+ default: Int!
132
+ }
133
+
134
+ extend type Query {
135
+ """
136
+ The signed-in user's own keys — standing, revoked and expired — oldest
137
+ first; when the application binds keys, only those bound to the object
138
+ `boundTo` names (or that the request's context names). `limit` is a
139
+ positive integer, 20 by default and at most 100; `after` is the previous
140
+ page's `nextCursor`. NOT_FOUND when the application's `authorize` refuses,
141
+ or `boundTo` names no object. A `boundTo` empty or over 200 characters is
142
+ BAD_USER_INPUT (`field`).
143
+ """
144
+ apiKeys(
145
+ """
146
+ The object whose keys to list; absent: the one the request's context
147
+ names, when the application binds keys.
148
+ """
149
+ boundTo: ID
150
+ """
151
+ The page size: a positive integer, 20 by default, at most 100.
152
+ """
153
+ limit: Int
154
+ """
155
+ The previous page's `nextCursor`; absent for the first page.
156
+ """
157
+ after: String
158
+ ): JanusApiKeyPage! @authenticated
159
+ """
160
+ Every key bound to the object `boundTo` names (or that the request's
161
+ context names), whoever holds it: the object owner's view. Paged and
162
+ refused as `apiKeys`, and NOT_FOUND when there is no object.
163
+ """
164
+ boundApiKeys(
165
+ """
166
+ The object whose keys to list; absent: the one the request's context names.
167
+ """
168
+ boundTo: ID
169
+ """
170
+ The page size: a positive integer, 20 by default, at most 100.
171
+ """
172
+ limit: Int
173
+ """
174
+ The previous page's `nextCursor`; absent for the first page.
175
+ """
176
+ after: String
177
+ ): JanusApiKeyPage! @authenticated
178
+ """
179
+ The lifetimes a new key may have.
180
+ """
181
+ apiKeyLifetimes: JanusApiKeyLifetimes! @authenticated
182
+ }
183
+
184
+ extend type Mutation {
185
+ """
186
+ Creates a key for the signed-in user. Needs a recent step-up. The key is
187
+ bound to the object `boundTo` names (or that the request's context names)
188
+ when the application binds keys, and answers its `secret`, the only time
189
+ it is shown. `lifetimeDays` is one of `apiKeyLifetimes.days` (its
190
+ `default` when absent; BAD_USER_INPUT otherwise); `scopes` are what the
191
+ key may do (absent: whatever its user may). STEP_UP_REQUIRED (403) unless
192
+ the session proved who it is recently, and always for a request signed by
193
+ a key: a key never creates a key. API_KEY_INVALID (400, `field`) for a
194
+ name or scopes the core cannot keep, API_KEY_LIMIT (409, `maxActive`) when
195
+ the user holds the most standing keys, NOT_FOUND when `authorize` refuses.
196
+ A `name` over 100 characters, more than 32 `scopes` or one over 100
197
+ characters is BAD_USER_INPUT (400, `field`) before `authorize` runs.
198
+ """
199
+ createApiKey(
200
+ """
201
+ The label for the key, 1 to 100 characters.
202
+ """
203
+ name: String!
204
+ """
205
+ One of `apiKeyLifetimes.days`; absent: its `default`.
206
+ """
207
+ lifetimeDays: Int
208
+ """
209
+ What the key may do, at most 32 of at most 100 characters each; absent:
210
+ whatever its user may.
211
+ """
212
+ scopes: [String!]
213
+ """
214
+ The object to bind the key to, at most 200 characters; absent: the one
215
+ the request's context names, when the application binds keys.
216
+ """
217
+ boundTo: ID
218
+ ): JanusCreatedApiKey! @authenticated
219
+ """
220
+ Revokes a key and answers it; revoking a revoked key is not an error. The
221
+ key is the signed-in user's own, or one bound to the object `boundTo`
222
+ names (or that the request's context names), as `authorize` allows.
223
+ NOT_FOUND for an id that names neither, whatever `authorize` answers, and
224
+ when `authorize` refuses.
225
+ """
226
+ revokeApiKey(
227
+ """
228
+ The id of the key to revoke.
229
+ """
230
+ id: ID!
231
+ """
232
+ The object the key is bound to; absent: the one the request's context
233
+ names, or none for the user's own key.
234
+ """
235
+ boundTo: ID
236
+ ): JanusApiKey! @authenticated
237
+ }
@@ -0,0 +1,19 @@
1
+ """
2
+ The image of an account, as the application's resolvers hand it out.
3
+ `updatedAt` is an ISO-8601 string, so the type needs no scalar.
4
+ """
5
+ type JanusAvatar {
6
+ """
7
+ The id the application stored the image under; changes with every upload.
8
+ """
9
+ id: ID!
10
+ """
11
+ When the avatar was set, as an ISO-8601 string.
12
+ """
13
+ updatedAt: String!
14
+ """
15
+ The URL of the application's own route that streams the image at this
16
+ size, behind its session and access check. Never a public URL.
17
+ """
18
+ url(size: Int!): String!
19
+ }
@@ -0,0 +1,280 @@
1
+ """
2
+ An invitation into a scope (an organization, a team), as its owners see it.
3
+ The code is never here: `issueInvitation` and `resendInvitation` answer it
4
+ once.
5
+ """
6
+ type JanusInvitation {
7
+ id: ID!
8
+ """
9
+ The organization (or any grouping) the invitation is into.
10
+ """
11
+ scope: String!
12
+ email: String!
13
+ name: String!
14
+ role: String!
15
+ locale: String
16
+ """
17
+ The application's opaque reference the invitation was issued with (its own
18
+ record), or null.
19
+ """
20
+ ref: String
21
+ """
22
+ The user type the invitation is for, one of the configured types; an
23
+ invitation stored before types existed reads as the first one.
24
+ """
25
+ type: String!
26
+ """
27
+ `pending`, `accepted` or `revoked`. A `pending` invitation past
28
+ `expiresAt` is lapsed: it cannot be previewed or accepted, and
29
+ `resendInvitation` gives it a new code.
30
+ """
31
+ status: String!
32
+ """
33
+ The id of the user who sent it, or null when the system issued it.
34
+ """
35
+ invitedBy: ID
36
+ """
37
+ Timestamps, as ISO-8601 strings.
38
+ """
39
+ createdAt: String!
40
+ updatedAt: String!
41
+ expiresAt: String!
42
+ acceptedBy: ID
43
+ acceptedAt: String
44
+ revokedAt: String
45
+ """
46
+ The id of the user who revoked it, or null.
47
+ """
48
+ revokedBy: ID
49
+ """
50
+ The id of the user who last sent it again, or null.
51
+ """
52
+ resentBy: ID
53
+ }
54
+
55
+ """
56
+ An invitation just issued or sent again.
57
+ """
58
+ type JanusIssuedInvitation {
59
+ invitation: JanusInvitation!
60
+ """
61
+ The code, a secret: null unless `answerCode` is on. It belongs in the
62
+ invitation e-mail's link, never in a URL you log or a response a cache
63
+ keeps (the response is `no-store`).
64
+ """
65
+ code: String
66
+ }
67
+
68
+ """
69
+ One page of a scope's invitations. `nextCursor` is null on the last page.
70
+ """
71
+ type JanusInvitationPage {
72
+ items: [JanusInvitation!]!
73
+ nextCursor: String
74
+ """
75
+ How many invitations of the scope match the filters (`status`, `role`,
76
+ `ref`), whatever the paging. Counted only when selected, and answered only on a page
77
+ `invitations` returned (a page of your own has no count and fails). A `pending`
78
+ invitation past `expiresAt` still counts, as it is still listed.
79
+ """
80
+ totalCount: Int!
81
+ }
82
+
83
+ """
84
+ The order of a scope's invitations: by creation.
85
+ """
86
+ enum JanusInvitationOrder {
87
+ OLDEST
88
+ NEWEST
89
+ }
90
+
91
+ """
92
+ Whether lapsed invitations (pending, past their expiry) are left out of a
93
+ list: `EXCLUDE` drops them and keeps every other invitation, `ONLY` keeps
94
+ only them.
95
+ """
96
+ enum JanusInvitationLapsed {
97
+ EXCLUDE
98
+ ONLY
99
+ }
100
+
101
+ """
102
+ What a code names, for the page the invitee lands on: the content of the
103
+ invitation, nothing about who sent it or how it stands.
104
+ """
105
+ type JanusInvitationPreview {
106
+ id: ID!
107
+ scope: String!
108
+ email: String!
109
+ name: String!
110
+ role: String!
111
+ locale: String
112
+ """
113
+ The user type the invitation is for, so the page can adapt its wording or
114
+ flow to it.
115
+ """
116
+ type: String!
117
+ """
118
+ The name of the scope's organization (school, clinic, workspace), from the
119
+ application's describeScope option; null when it names none or is not
120
+ given.
121
+ """
122
+ organization: String
123
+ expiresAt: String!
124
+ """
125
+ Whether the page should ask for a password: false for a user type with no
126
+ password, or somebody who already has an account with a proved e-mail and a
127
+ password.
128
+ """
129
+ needsPassword: Boolean!
130
+ }
131
+
132
+ """
133
+ The invitation was accepted and a session was opened: a new invitee, an
134
+ account whose e-mail was never proved, or a proved account with no password
135
+ yet, given one.
136
+ """
137
+ type InvitationSignedIn {
138
+ """
139
+ The session token, only with `answerToken`; otherwise the session
140
+ cookie is set and this is null.
141
+ """
142
+ token: String
143
+ userId: ID!
144
+ """
145
+ When the session ends, as an ISO-8601 string.
146
+ """
147
+ expiresAt: String!
148
+ newDevice: Boolean!
149
+ invitationId: ID!
150
+ scope: String!
151
+ role: String!
152
+ }
153
+
154
+ """
155
+ The invitation was accepted and a second factor is still to prove: confirm
156
+ it with the challenge. No session is open yet. The challenge is a secret:
157
+ never in a URL or a log.
158
+ """
159
+ type InvitationSecondFactor {
160
+ challenge: String!
161
+ """
162
+ When the challenge lapses, as an ISO-8601 string.
163
+ """
164
+ expiresAt: String!
165
+ """
166
+ What can answer the challenge: `totp` always, and `passkey` when the
167
+ user holds one.
168
+ """
169
+ methods: [String!]!
170
+ """
171
+ The JSON text for `navigator.credentials.get({ publicKey })`, present
172
+ exactly when `methods` holds `passkey`.
173
+ """
174
+ passkeyOptions: String
175
+ invitationId: ID!
176
+ scope: String!
177
+ }
178
+
179
+ """
180
+ The address belongs to a proved user who already has a password (the password
181
+ given is ignored), or who has none and gave none. They are NOT signed in: an
182
+ invitation proves the inbox, not who holds the account. Send them to the
183
+ sign-in page.
184
+ """
185
+ type InvitationSignIn {
186
+ invitationId: ID!
187
+ scope: String!
188
+ email: String!
189
+ }
190
+
191
+ union InvitationAcceptResult =
192
+ | InvitationSignedIn
193
+ | InvitationSecondFactor
194
+ | InvitationSignIn
195
+
196
+ extend type Query {
197
+ """
198
+ One scope's invitations, `OLDEST` first unless `order` says `NEWEST`.
199
+ `status` is `pending`, `accepted` or `revoked` (BAD_USER_INPUT
200
+ otherwise); `role` and `ref` keep the invitations with exactly that role
201
+ or reference; `lapsed` is `EXCLUDE` to leave out the lapsed (pending,
202
+ past `expiresAt`) or `ONLY` to keep just them, and `totalCount` follows
203
+ it; `limit` is a positive integer, 20 by default and at most
204
+ 100; `after` is the previous page's `nextCursor`, in the same order. An
205
+ empty `role` or `ref` is BAD_USER_INPUT. Each BAD_USER_INPUT (and
206
+ INVALID_CURSOR) names the argument in `extensions.field`.
207
+ NOT_FOUND when the application's `authorize` refuses the scope.
208
+ """
209
+ invitations(
210
+ scope: String!
211
+ status: String
212
+ role: String
213
+ ref: String
214
+ lapsed: JanusInvitationLapsed
215
+ order: JanusInvitationOrder
216
+ limit: Int
217
+ after: String
218
+ ): JanusInvitationPage! @authenticated
219
+ """
220
+ What `code` names, without spending it. INVITATION_INVALID (400, `extensions.reason`: unknown,
221
+ expired, accepted or revoked) for any code that names no pending, unlapsed
222
+ invitation. Open to anybody: the
223
+ code is a secret (send it in the variables of a POST, never in a URL), and
224
+ the field is not throttled here. A `code` longer than 43 characters is
225
+ BAD_USER_INPUT (400, `field: 'code'`).
226
+ """
227
+ invitationPreview(code: String!): JanusInvitationPreview!
228
+ }
229
+
230
+ extend type Mutation {
231
+ """
232
+ Invites `email` into `scope` with `role`; the inviter is the signed-in
233
+ user. Issuing again for an address that has a pending invitation revokes
234
+ it and makes a new one. INVITATION_INVALID (`field`) for an input that
235
+ cannot be kept, INVITATION_LIMIT (`maxActive`) when the scope is full,
236
+ NOT_FOUND when `authorize` refuses. `ref` is an opaque reference to your
237
+ own record (1 to 100 characters), answered back and usable as a filter of
238
+ `invitations`. An argument over its maximum (`scope` 512, `email` 254, `name`,
239
+ `role` and `ref` 100, `locale` 35 characters) is BAD_USER_INPUT (400, `field`)
240
+ before `authorize` runs. `type` is the user type the invitee becomes: required when
241
+ the instance configures several user types (null or absent means the
242
+ instance's single type), INVITATION_INVALID
243
+ (`field: 'type'`) when absent then, or when it names none of them.
244
+ """
245
+ issueInvitation(
246
+ scope: String!
247
+ email: String!
248
+ name: String!
249
+ role: String!
250
+ locale: String
251
+ ref: String
252
+ type: String
253
+ ): JanusIssuedInvitation! @authenticated
254
+ """
255
+ A new code and lifetime for a pending invitation, lapsed or not; the old
256
+ code stops working. NOT_FOUND for an id of another scope,
257
+ INVITATION_NOT_PENDING (409) when it is accepted or revoked.
258
+ """
259
+ resendInvitation(scope: String!, id: ID!): JanusIssuedInvitation!
260
+ @authenticated
261
+ """
262
+ Takes a pending invitation back. NOT_FOUND as `resendInvitation`,
263
+ INVITATION_NOT_PENDING (409) when it is accepted or already revoked.
264
+ """
265
+ revokeInvitation(scope: String!, id: ID!): JanusInvitation! @authenticated
266
+ """
267
+ Accepts the invitation `code` names: the code proves the invitee's inbox.
268
+ A new invitee, an account whose e-mail was never proved, or a proved account
269
+ with no password yet (given one) is signed in (the session cookie, or `token`
270
+ with `answerToken`); a proved user who already has a password (the password
271
+ given is ignored), or who has none and gave none, is answered
272
+ `InvitationSignIn` and is not. INVITATION_INVALID (400, `extensions.reason`: unknown, expired, accepted or revoked) for a code that names no pending
273
+ invitation, PASSWORD_REQUIRED (400) when a password is needed and absent.
274
+ INVITATION_REFUSED (403) when the application's `beforeAccept` refused, with
275
+ nothing written. A `code` over 43 characters or a `password` over 1024 is
276
+ BAD_USER_INPUT (400, `field`), the code unspent.
277
+ Open to anybody and not throttled here.
278
+ """
279
+ acceptInvitation(code: String!, password: String): InvitationAcceptResult!
280
+ }
@@ -0,0 +1,40 @@
1
+ """
2
+ A passkey sign-in begun: give `options` to the browser and keep `challenge`
3
+ until `passkeySignIn`.
4
+ """
5
+ type JanusPasskeySignInChallenge {
6
+ """
7
+ The JSON text for `navigator.credentials.get({ publicKey })`, with no
8
+ credential named: the browser offers the discoverable passkeys it holds.
9
+ """
10
+ options: String!
11
+ """
12
+ The secret `passkeySignIn` spends, once. Never in a URL or a log.
13
+ """
14
+ challenge: String!
15
+ """
16
+ When the challenge lapses, as an ISO-8601 string.
17
+ """
18
+ expiresAt: String!
19
+ }
20
+
21
+ extend type Query {
22
+ """
23
+ Makes a sign-in challenge and the options the browser needs. Anyone may
24
+ ask: rate-limit it where requests enter, as each call stores one
25
+ short-lived token. The response is never cached.
26
+ """
27
+ passkeySignInOptions: JanusPasskeySignInChallenge!
28
+ }
29
+
30
+ extend type Mutation {
31
+ """
32
+ Signs in with a passkey alone, with what `navigator.credentials.get`
33
+ answered, as a JSON string: no password and no code. One attempt per
34
+ challenge: a refusal is CREDENTIALS_INVALID, 401, and asks for new options;
35
+ a missing, spent or lapsed challenge is TOKEN_UNKNOWN, TOKEN_SPENT or
36
+ TOKEN_EXPIRED. Sets the session cookie, or answers `token` with
37
+ `answerToken`, and the device cookie.
38
+ """
39
+ passkeySignIn(challenge: String!, assertion: String!): PasskeySignedIn!
40
+ }
@@ -0,0 +1,134 @@
1
+ """
2
+ One passkey a user registered. Never carries the public key or the counter.
3
+ """
4
+ type JanusPasskey {
5
+ """
6
+ The authenticator's credential id, base64url. Pass it back to
7
+ `renamePasskey` and `removePasskey`.
8
+ """
9
+ credentialId: ID!
10
+ """
11
+ The name the user gave it.
12
+ """
13
+ name: String!
14
+ """
15
+ What the authenticator reported at registration (`internal`, `usb`).
16
+ """
17
+ transports: [String!]!
18
+ """
19
+ The authenticator model, for an icon or a label.
20
+ """
21
+ aaguid: String!
22
+ """
23
+ Whether the credential may be synced across the user's devices.
24
+ """
25
+ backupEligible: Boolean!
26
+ """
27
+ Whether it is synced now.
28
+ """
29
+ backedUp: Boolean!
30
+ """
31
+ When it was registered, as an ISO-8601 string.
32
+ """
33
+ createdAt: String!
34
+ """
35
+ When it last answered a challenge, as an ISO-8601 string, or null.
36
+ """
37
+ lastUsedAt: String
38
+ }
39
+
40
+ """
41
+ A registration begun: give `options` to the browser and keep `challenge`
42
+ until `registerPasskey`.
43
+ """
44
+ type JanusPasskeyRegistration {
45
+ """
46
+ The JSON text for `navigator.credentials.create({ publicKey })`, as the
47
+ verifier shaped it.
48
+ """
49
+ options: String!
50
+ """
51
+ The secret `registerPasskey` spends, once. Never in a URL or a log.
52
+ """
53
+ challenge: String!
54
+ """
55
+ When the challenge lapses, as an ISO-8601 string.
56
+ """
57
+ expiresAt: String!
58
+ }
59
+
60
+ """
61
+ A passkey sign-in completed: the session cookie is set on the response, or,
62
+ with `passkeyResolvers({ answerToken: true })`, the session token is
63
+ answered in `token` and no cookie is set. Extend this type with a `user`
64
+ field of your own: its parent carries the signed-in user.
65
+ """
66
+ type PasskeySignedIn {
67
+ """
68
+ The session token, answered only when `passkeyResolvers` has
69
+ `answerToken: true`; null otherwise. A secret like a session cookie:
70
+ never in a URL or a log.
71
+ """
72
+ token: String
73
+ """
74
+ The signed-in user's id.
75
+ """
76
+ userId: ID!
77
+ """
78
+ When the session expires, as an ISO-8601 string.
79
+ """
80
+ expiresAt: String!
81
+ """
82
+ Whether the session was opened from a device the user had not used.
83
+ """
84
+ newDevice: Boolean!
85
+ }
86
+
87
+ extend type Query {
88
+ """
89
+ The signed-in user's passkeys, oldest first.
90
+ """
91
+ passkeys: [JanusPasskey!]! @authenticated
92
+ """
93
+ Makes a registration challenge and the options the browser needs. Only a
94
+ user with an active TOTP can register a passkey
95
+ (SECOND_FACTOR_NOT_ENROLLED otherwise).
96
+ """
97
+ passkeyRegistrationOptions: JanusPasskeyRegistration! @authenticated
98
+ }
99
+
100
+ extend type Mutation {
101
+ """
102
+ Finishes a registration with what `navigator.credentials.create`
103
+ answered, as a JSON string, and a name of 1 to 100 characters. Needs a
104
+ session that proved who it is recently (STEP_UP_REQUIRED). The challenge
105
+ is spent even when the response does not verify (PASSKEY_INVALID): ask for
106
+ new options.
107
+ """
108
+ registerPasskey(
109
+ challenge: String!
110
+ response: String!
111
+ name: String!
112
+ ): JanusPasskey! @authenticated
113
+ """
114
+ Renames one of the user's passkeys. False when it is not theirs or not
115
+ there.
116
+ """
117
+ renamePasskey(credentialId: ID!, name: String!): Boolean! @authenticated
118
+ """
119
+ Removes one of the user's passkeys. True when this call removed it. Needs
120
+ a session that proved who it is recently (STEP_UP_REQUIRED).
121
+ """
122
+ removePasskey(credentialId: ID!): Boolean! @authenticated
123
+ """
124
+ Redeems a sign-in's second-factor challenge with what
125
+ `navigator.credentials.get` answered, as a JSON string. Five attempts per
126
+ challenge, shared with the TOTP code (CODE_INVALID with attemptsLeft). Sets
127
+ the session cookie, or answers `token` with `answerToken`, and the
128
+ device cookie.
129
+ """
130
+ confirmSecondFactorPasskey(
131
+ challenge: String!
132
+ assertion: String!
133
+ ): PasskeySignedIn!
134
+ }