@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.
- package/LICENSE +21 -0
- package/README.md +716 -2
- package/dist/api-keys/index.d.ts +11 -0
- package/dist/api-keys/index.d.ts.map +1 -0
- package/dist/api-keys/resolvers/deps.d.ts +39 -0
- package/dist/api-keys/resolvers/deps.d.ts.map +1 -0
- package/dist/api-keys/resolvers/index.d.ts +39 -0
- package/dist/api-keys/resolvers/index.d.ts.map +1 -0
- package/dist/api-keys/resolvers/list.d.ts +16 -0
- package/dist/api-keys/resolvers/list.d.ts.map +1 -0
- package/dist/api-keys/resolvers/manage.d.ts +17 -0
- package/dist/api-keys/resolvers/manage.d.ts.map +1 -0
- package/dist/api-keys/sdl.d.ts +14 -0
- package/dist/api-keys/sdl.d.ts.map +1 -0
- package/dist/api-keys/shape.d.ts +38 -0
- package/dist/api-keys/shape.d.ts.map +1 -0
- package/dist/api-keys/types.d.ts +149 -0
- package/dist/api-keys/types.d.ts.map +1 -0
- package/dist/avatar/index.d.ts +32 -0
- package/dist/avatar/index.d.ts.map +1 -0
- package/dist/avatar/resolvers.d.ts +41 -0
- package/dist/avatar/resolvers.d.ts.map +1 -0
- package/dist/avatar/sdl.d.ts +16 -0
- package/dist/avatar/sdl.d.ts.map +1 -0
- package/dist/bad-input.d.ts +17 -0
- package/dist/bad-input.d.ts.map +1 -0
- package/dist/connection/connection.d.ts +36 -0
- package/dist/connection/connection.d.ts.map +1 -0
- package/dist/connection/credential.d.ts +34 -0
- package/dist/connection/credential.d.ts.map +1 -0
- package/dist/connection/types.d.ts +61 -0
- package/dist/connection/types.d.ts.map +1 -0
- package/dist/context/create.d.ts +32 -0
- package/dist/context/create.d.ts.map +1 -0
- package/dist/context/index.d.ts +9 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/registry.d.ts +72 -0
- package/dist/context/registry.d.ts.map +1 -0
- package/dist/context/resolve.d.ts +20 -0
- package/dist/context/resolve.d.ts.map +1 -0
- package/dist/device.d.ts +28 -0
- package/dist/device.d.ts.map +1 -0
- package/dist/directives/apply.d.ts +51 -0
- package/dist/directives/apply.d.ts.map +1 -0
- package/dist/directives/guard.d.ts +22 -0
- package/dist/directives/guard.d.ts.map +1 -0
- package/dist/directives/permission/enforce.d.ts +24 -0
- package/dist/directives/permission/enforce.d.ts.map +1 -0
- package/dist/directives/permission/model.d.ts +35 -0
- package/dist/directives/permission/model.d.ts.map +1 -0
- package/dist/directives/permission/path.d.ts +31 -0
- package/dist/directives/permission/path.d.ts.map +1 -0
- package/dist/directives/permission/validate.d.ts +42 -0
- package/dist/directives/permission/validate.d.ts.map +1 -0
- package/dist/directives/read.d.ts +43 -0
- package/dist/directives/read.d.ts.map +1 -0
- package/dist/directives/validate.d.ts +39 -0
- package/dist/directives/validate.d.ts.map +1 -0
- package/dist/directives/words.d.ts +7 -0
- package/dist/directives/words.d.ts.map +1 -0
- package/dist/errors/denial.d.ts +6 -0
- package/dist/errors/denial.d.ts.map +1 -0
- package/dist/errors/index.d.ts +12 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/janus-error.d.ts +20 -0
- package/dist/errors/janus-error.d.ts.map +1 -0
- package/dist/errors/mask.d.ts +69 -0
- package/dist/errors/mask.d.ts.map +1 -0
- package/dist/fresh.d.ts +44 -0
- package/dist/fresh.d.ts.map +1 -0
- package/dist/helpers.d.ts +56 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3393 -0
- package/dist/index.js.map +75 -0
- package/dist/invitations/index.d.ts +12 -0
- package/dist/invitations/index.d.ts.map +1 -0
- package/dist/invitations/resolvers/anonymous.d.ts +11 -0
- package/dist/invitations/resolvers/anonymous.d.ts.map +1 -0
- package/dist/invitations/resolvers/deps.d.ts +38 -0
- package/dist/invitations/resolvers/deps.d.ts.map +1 -0
- package/dist/invitations/resolvers/index.d.ts +37 -0
- package/dist/invitations/resolvers/index.d.ts.map +1 -0
- package/dist/invitations/resolvers/owner.d.ts +17 -0
- package/dist/invitations/resolvers/owner.d.ts.map +1 -0
- package/dist/invitations/sdl/accept.d.ts +7 -0
- package/dist/invitations/sdl/accept.d.ts.map +1 -0
- package/dist/invitations/sdl/index.d.ts +14 -0
- package/dist/invitations/sdl/index.d.ts.map +1 -0
- package/dist/invitations/sdl/owner.d.ts +8 -0
- package/dist/invitations/sdl/owner.d.ts.map +1 -0
- package/dist/invitations/shape.d.ts +63 -0
- package/dist/invitations/shape.d.ts.map +1 -0
- package/dist/invitations/types/index.d.ts +5 -0
- package/dist/invitations/types/index.d.ts.map +1 -0
- package/dist/invitations/types/options.d.ts +104 -0
- package/dist/invitations/types/options.d.ts.map +1 -0
- package/dist/invitations/types/out.d.ts +136 -0
- package/dist/invitations/types/out.d.ts.map +1 -0
- package/dist/invitations/types/surface.d.ts +18 -0
- package/dist/invitations/types/surface.d.ts.map +1 -0
- package/dist/map-code.d.ts +10 -0
- package/dist/map-code.d.ts.map +1 -0
- package/dist/mask-error.d.ts +18 -0
- package/dist/mask-error.d.ts.map +1 -0
- package/dist/memo.d.ts +16 -0
- package/dist/memo.d.ts.map +1 -0
- package/dist/options.d.ts +17 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/passkeys/deps.d.ts +23 -0
- package/dist/passkeys/deps.d.ts.map +1 -0
- package/dist/passkeys/first-factor.types.d.ts +38 -0
- package/dist/passkeys/first-factor.types.d.ts.map +1 -0
- package/dist/passkeys/index.d.ts +14 -0
- package/dist/passkeys/index.d.ts.map +1 -0
- package/dist/passkeys/resolvers.d.ts +23 -0
- package/dist/passkeys/resolvers.d.ts.map +1 -0
- package/dist/passkeys/sdl.d.ts +14 -0
- package/dist/passkeys/sdl.d.ts.map +1 -0
- package/dist/passkeys/shape.d.ts +14 -0
- package/dist/passkeys/shape.d.ts.map +1 -0
- package/dist/passkeys/sign-in.resolvers.d.ts +19 -0
- package/dist/passkeys/sign-in.resolvers.d.ts.map +1 -0
- package/dist/passkeys/sign-in.sdl.d.ts +16 -0
- package/dist/passkeys/sign-in.sdl.d.ts.map +1 -0
- package/dist/passkeys/types.d.ts +193 -0
- package/dist/passkeys/types.d.ts.map +1 -0
- package/dist/plugin.d.ts +59 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/renewal.d.ts +51 -0
- package/dist/renewal.d.ts.map +1 -0
- package/dist/report.d.ts +29 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/sdl.d.ts +12 -0
- package/dist/sdl.d.ts.map +1 -0
- package/dist/second-factor/index.d.ts +12 -0
- package/dist/second-factor/index.d.ts.map +1 -0
- package/dist/second-factor/resolvers/deps.d.ts +39 -0
- package/dist/second-factor/resolvers/deps.d.ts.map +1 -0
- package/dist/second-factor/resolvers/index.d.ts +39 -0
- package/dist/second-factor/resolvers/index.d.ts.map +1 -0
- package/dist/second-factor/resolvers/sign-in.d.ts +10 -0
- package/dist/second-factor/resolvers/sign-in.d.ts.map +1 -0
- package/dist/second-factor/resolvers/status.d.ts +10 -0
- package/dist/second-factor/resolvers/status.d.ts.map +1 -0
- package/dist/second-factor/resolvers/step-up.d.ts +16 -0
- package/dist/second-factor/resolvers/step-up.d.ts.map +1 -0
- package/dist/second-factor/resolvers/writes.d.ts +19 -0
- package/dist/second-factor/resolvers/writes.d.ts.map +1 -0
- package/dist/second-factor/sdl.d.ts +14 -0
- package/dist/second-factor/sdl.d.ts.map +1 -0
- package/dist/second-factor/shape.d.ts +18 -0
- package/dist/second-factor/shape.d.ts.map +1 -0
- package/dist/second-factor/types/index.d.ts +5 -0
- package/dist/second-factor/types/index.d.ts.map +1 -0
- package/dist/second-factor/types/options.d.ts +61 -0
- package/dist/second-factor/types/options.d.ts.map +1 -0
- package/dist/second-factor/types/out.d.ts +84 -0
- package/dist/second-factor/types/out.d.ts.map +1 -0
- package/dist/second-factor/types/surface.d.ts +89 -0
- package/dist/second-factor/types/surface.d.ts.map +1 -0
- package/dist/social/index.d.ts +10 -0
- package/dist/social/index.d.ts.map +1 -0
- package/dist/social/resolvers.d.ts +25 -0
- package/dist/social/resolvers.d.ts.map +1 -0
- package/dist/social/sdl.d.ts +13 -0
- package/dist/social/sdl.d.ts.map +1 -0
- package/dist/social/shape.d.ts +11 -0
- package/dist/social/shape.d.ts.map +1 -0
- package/dist/social/types.d.ts +160 -0
- package/dist/social/types.d.ts.map +1 -0
- package/dist/surface/api.d.ts +16 -0
- package/dist/surface/api.d.ts.map +1 -0
- package/dist/surface/request.d.ts +10 -0
- package/dist/surface/request.d.ts.map +1 -0
- package/dist/surface/signed-in.d.ts +30 -0
- package/dist/surface/signed-in.d.ts.map +1 -0
- package/dist/types.d.ts +117 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/wiring.d.ts +56 -0
- package/dist/wiring.d.ts.map +1 -0
- package/docs/README.md +26 -0
- package/docs/guide/api-keys.md +365 -0
- package/docs/guide/avatars.md +129 -0
- package/docs/guide/context.md +371 -0
- package/docs/guide/directives.md +371 -0
- package/docs/guide/errors.md +318 -0
- package/docs/guide/federation.md +71 -0
- package/docs/guide/invitations.md +269 -0
- package/docs/guide/passkeys.md +207 -0
- package/docs/guide/second-factor.md +238 -0
- package/docs/guide/social.md +190 -0
- package/docs/guide/step-up.md +208 -0
- package/docs/guide/subscriptions.md +255 -0
- package/docs/guide/telemetry.md +45 -0
- package/docs/roadmap.md +124 -0
- package/docs/troubleshooting.md +1265 -0
- package/graphql/janus-api-keys.graphqls +237 -0
- package/graphql/janus-avatar.graphqls +19 -0
- package/graphql/janus-invitations.graphqls +280 -0
- package/graphql/janus-passkey-sign-in.graphqls +40 -0
- package/graphql/janus-passkeys.graphqls +134 -0
- package/graphql/janus-second-factor.graphqls +199 -0
- package/graphql/janus-social.graphqls +155 -0
- package/graphql/janus.graphqls +44 -0
- package/package.json +80 -5
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Whether the signed-in user's TOTP second factor is active.
|
|
3
|
+
"""
|
|
4
|
+
type JanusSecondFactorStatus {
|
|
5
|
+
"""
|
|
6
|
+
True once the factor is active: a sign-in then asks for a code. A factor
|
|
7
|
+
that was started and never activated is not enabled.
|
|
8
|
+
"""
|
|
9
|
+
enabled: Boolean!
|
|
10
|
+
"""
|
|
11
|
+
The recovery codes not yet used. Null without an active factor, 0 when
|
|
12
|
+
all are spent (regenerate them).
|
|
13
|
+
"""
|
|
14
|
+
recoveryCodesLeft: Int
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
A factor started, not yet active: load `secret` or `uri` into the
|
|
19
|
+
authenticator app, then give its first code to `activateSecondFactor`.
|
|
20
|
+
Never cached, never logged.
|
|
21
|
+
"""
|
|
22
|
+
type JanusSecondFactorEnrolment {
|
|
23
|
+
"""
|
|
24
|
+
The TOTP secret in base32, for a user who types it in.
|
|
25
|
+
"""
|
|
26
|
+
secret: String!
|
|
27
|
+
"""
|
|
28
|
+
The `otpauth://` URI to render as a QR code.
|
|
29
|
+
"""
|
|
30
|
+
uri: String!
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
"""
|
|
34
|
+
Ten recovery codes, from `activateSecondFactor` or
|
|
35
|
+
`regenerateRecoveryCodes`. Shown once: no call answers them again.
|
|
36
|
+
"""
|
|
37
|
+
type JanusRecoveryCodes {
|
|
38
|
+
recoveryCodes: [String!]!
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
A sign-in that needs a second factor: no session is open yet. Build it in
|
|
43
|
+
your own sign-in resolver from the core's `secondFactor` answer with
|
|
44
|
+
`secondFactorChallengeOut`, then answer it with `confirmSecondFactor` or
|
|
45
|
+
`recoverSecondFactor`. The challenge is a secret like a session token: never
|
|
46
|
+
in a URL or a log.
|
|
47
|
+
"""
|
|
48
|
+
type JanusSecondFactorChallenge {
|
|
49
|
+
challenge: String!
|
|
50
|
+
"""
|
|
51
|
+
When the challenge lapses, as an ISO-8601 string.
|
|
52
|
+
"""
|
|
53
|
+
expiresAt: String!
|
|
54
|
+
"""
|
|
55
|
+
What can answer it: `totp` always, and `passkey` when the user holds one.
|
|
56
|
+
"""
|
|
57
|
+
methods: [String!]!
|
|
58
|
+
"""
|
|
59
|
+
The JSON text for `navigator.credentials.get({ publicKey })`, present
|
|
60
|
+
exactly when `methods` holds `passkey`.
|
|
61
|
+
"""
|
|
62
|
+
passkeyOptions: String
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
"""
|
|
66
|
+
A second-factor sign-in completed: the session cookie is set on the response,
|
|
67
|
+
or, with `secondFactorResolvers({ answerToken: true })`, the session token is
|
|
68
|
+
answered in `token` and no cookie is set. Extend this type with a `user`
|
|
69
|
+
field of your own: its parent carries the signed-in user.
|
|
70
|
+
"""
|
|
71
|
+
type SecondFactorSignedIn {
|
|
72
|
+
"""
|
|
73
|
+
The session token, answered only with `answerToken: true`; null
|
|
74
|
+
otherwise. A secret like a session cookie: never in a URL or a log.
|
|
75
|
+
"""
|
|
76
|
+
token: String
|
|
77
|
+
"""
|
|
78
|
+
The signed-in user's id.
|
|
79
|
+
"""
|
|
80
|
+
userId: ID!
|
|
81
|
+
"""
|
|
82
|
+
When the session expires, as an ISO-8601 string.
|
|
83
|
+
"""
|
|
84
|
+
expiresAt: String!
|
|
85
|
+
"""
|
|
86
|
+
Whether the session was opened from a device the user had not used.
|
|
87
|
+
"""
|
|
88
|
+
newDevice: Boolean!
|
|
89
|
+
"""
|
|
90
|
+
The recovery codes left after `recoverSecondFactor` spent one; null after
|
|
91
|
+
`confirmSecondFactor`.
|
|
92
|
+
"""
|
|
93
|
+
recoveryCodesLeft: Int
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
"""
|
|
97
|
+
A step-up under way: keep `challenge` (never in a URL) and give it to
|
|
98
|
+
`confirmStepUp` with the code.
|
|
99
|
+
"""
|
|
100
|
+
type JanusStepUpChallenge {
|
|
101
|
+
"""
|
|
102
|
+
How the code is delivered: `email` (a code sent to the user's address by
|
|
103
|
+
your `sendStepUpCode`) or `secondFactor` (the code of the user's
|
|
104
|
+
authenticator app; nothing is sent).
|
|
105
|
+
"""
|
|
106
|
+
via: String!
|
|
107
|
+
challenge: String!
|
|
108
|
+
"""
|
|
109
|
+
When the challenge lapses, as an ISO-8601 string.
|
|
110
|
+
"""
|
|
111
|
+
expiresAt: String!
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
"""
|
|
115
|
+
A step-up confirmed: the request's session proved who it is just now.
|
|
116
|
+
"""
|
|
117
|
+
type JanusStepUpConfirmed {
|
|
118
|
+
"""
|
|
119
|
+
When the session last proved who it is, as an ISO-8601 string.
|
|
120
|
+
"""
|
|
121
|
+
confirmedAt: String!
|
|
122
|
+
"""
|
|
123
|
+
Until when it counts as fresh (`confirmedAt` plus `freshWithin`), as an
|
|
124
|
+
ISO-8601 string. Null when `secondFactorResolvers` was given no
|
|
125
|
+
`freshWithin`.
|
|
126
|
+
"""
|
|
127
|
+
confirmedUntil: String
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
extend type Query {
|
|
131
|
+
"""
|
|
132
|
+
The signed-in user's second factor: whether it is active, and the
|
|
133
|
+
recovery codes left. Put the same resolver on your `Viewer.secondFactor`
|
|
134
|
+
with `secondFactorViewerFields`.
|
|
135
|
+
"""
|
|
136
|
+
secondFactor: JanusSecondFactorStatus! @authenticated
|
|
137
|
+
"""
|
|
138
|
+
Until when the request's session counts as freshly confirmed: its
|
|
139
|
+
sign-in or last step-up plus `freshWithin`. In the past once it no longer
|
|
140
|
+
does; null without `freshWithin` or without a session.
|
|
141
|
+
"""
|
|
142
|
+
sessionConfirmedUntil: String
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
extend type Mutation {
|
|
146
|
+
"""
|
|
147
|
+
Redeems a sign-in's challenge with the code of the authenticator app.
|
|
148
|
+
Five attempts per challenge (CODE_INVALID with attemptsLeft). Sets the
|
|
149
|
+
session cookie, or answers `token` with `answerToken`, and the device
|
|
150
|
+
cookie.
|
|
151
|
+
"""
|
|
152
|
+
confirmSecondFactor(challenge: String!, code: String!): SecondFactorSignedIn!
|
|
153
|
+
"""
|
|
154
|
+
Redeems a sign-in's challenge with a recovery code instead, for a lost
|
|
155
|
+
phone. The code is spent and `recoveryCodesLeft` answers what remains.
|
|
156
|
+
Refused as `confirmSecondFactor`.
|
|
157
|
+
"""
|
|
158
|
+
recoverSecondFactor(
|
|
159
|
+
challenge: String!
|
|
160
|
+
recoveryCode: String!
|
|
161
|
+
): SecondFactorSignedIn!
|
|
162
|
+
"""
|
|
163
|
+
Starts a factor and answers the secret and the URI to show as a QR code.
|
|
164
|
+
SECOND_FACTOR_ACTIVE when one is active. With `freshWithin`, needs a
|
|
165
|
+
fresh session (STEP_UP_REQUIRED).
|
|
166
|
+
"""
|
|
167
|
+
enrollSecondFactor: JanusSecondFactorEnrolment! @authenticated
|
|
168
|
+
"""
|
|
169
|
+
Checks the app's first code and makes the factor active; answers the ten
|
|
170
|
+
recovery codes, once. CODE_INVALID, SECOND_FACTOR_NOT_ENROLLED. With
|
|
171
|
+
`freshWithin`, needs a fresh session.
|
|
172
|
+
"""
|
|
173
|
+
activateSecondFactor(code: String!): JanusRecoveryCodes! @authenticated
|
|
174
|
+
"""
|
|
175
|
+
Replaces all the recovery codes with ten new ones, on a current code of
|
|
176
|
+
the app. Counted five per user per 15 minutes (CODE_INVALID with
|
|
177
|
+
attemptsLeft, or reason `throttled` and `retryAfter`). With
|
|
178
|
+
`freshWithin`, needs a fresh session.
|
|
179
|
+
"""
|
|
180
|
+
regenerateRecoveryCodes(code: String!): JanusRecoveryCodes! @authenticated
|
|
181
|
+
"""
|
|
182
|
+
Turns the factor off, on a current code of the app, checked by a step-up
|
|
183
|
+
of the request's session. SECOND_FACTOR_NOT_ENROLLED without an active
|
|
184
|
+
factor. With `freshWithin`, needs a fresh session.
|
|
185
|
+
"""
|
|
186
|
+
disableSecondFactor(code: String!): Boolean! @authenticated
|
|
187
|
+
"""
|
|
188
|
+
Starts a step-up for the request's session: the app's code when the user
|
|
189
|
+
has an active second factor, else a code sent by `sendStepUpCode`.
|
|
190
|
+
"""
|
|
191
|
+
requestStepUp: JanusStepUpChallenge! @authenticated
|
|
192
|
+
"""
|
|
193
|
+
Confirms the step-up with its challenge and code: the request's session
|
|
194
|
+
proved who it is just now. CODE_INVALID with attemptsLeft, TOKEN_UNKNOWN,
|
|
195
|
+
TOKEN_SPENT, TOKEN_EXPIRED.
|
|
196
|
+
"""
|
|
197
|
+
confirmStepUp(challenge: String!, code: String!): JanusStepUpConfirmed!
|
|
198
|
+
@authenticated
|
|
199
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"""
|
|
2
|
+
One social account linked to a user: the provider's name in the
|
|
3
|
+
application, and the provider's own identifier of the account.
|
|
4
|
+
"""
|
|
5
|
+
type JanusSocialLink {
|
|
6
|
+
"""
|
|
7
|
+
The application's name for the provider (`google`).
|
|
8
|
+
"""
|
|
9
|
+
provider: String!
|
|
10
|
+
"""
|
|
11
|
+
The provider's identifier of the account. Pass it back to `unlinkSocial`;
|
|
12
|
+
keep it out of logs and analytics.
|
|
13
|
+
"""
|
|
14
|
+
accountId: ID!
|
|
15
|
+
"""
|
|
16
|
+
The e-mail the provider reported when the account was linked, if any.
|
|
17
|
+
"""
|
|
18
|
+
email: String
|
|
19
|
+
"""
|
|
20
|
+
When the account was linked, as an ISO-8601 string.
|
|
21
|
+
"""
|
|
22
|
+
linkedAt: String!
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
"""
|
|
26
|
+
A social flow begun: send the visitor to `url`, and keep `flow` until the
|
|
27
|
+
callback.
|
|
28
|
+
"""
|
|
29
|
+
type SocialFlowStart {
|
|
30
|
+
"""
|
|
31
|
+
The provider's authorization URL.
|
|
32
|
+
"""
|
|
33
|
+
url: String!
|
|
34
|
+
"""
|
|
35
|
+
A secret like a session token: the BFF keeps it in its own HttpOnly
|
|
36
|
+
SameSite=Lax cookie and hands it back to `socialSignInComplete`. Never in
|
|
37
|
+
a URL or a log.
|
|
38
|
+
"""
|
|
39
|
+
flow: String!
|
|
40
|
+
"""
|
|
41
|
+
When the flow lapses, as an ISO-8601 string.
|
|
42
|
+
"""
|
|
43
|
+
expiresAt: String!
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
"""
|
|
47
|
+
A social sign-in completed: the session cookie is set on the response, or,
|
|
48
|
+
with `socialResolvers({ answerToken: true })`, the session token is answered
|
|
49
|
+
in `token` and no cookie is set. Extend this type with a `user` field of
|
|
50
|
+
your own: its parent carries the signed-in user.
|
|
51
|
+
"""
|
|
52
|
+
type SocialSignedIn {
|
|
53
|
+
"""
|
|
54
|
+
The session token, answered only when `socialResolvers` has `answerToken:
|
|
55
|
+
true` (the session cookie is then not set); null otherwise. A secret like
|
|
56
|
+
a session cookie: the BFF keeps it in its own HttpOnly cookie and sends
|
|
57
|
+
it back as `Authorization: Bearer`. Never in a URL or a log.
|
|
58
|
+
"""
|
|
59
|
+
token: String
|
|
60
|
+
"""
|
|
61
|
+
The signed-in user's id.
|
|
62
|
+
"""
|
|
63
|
+
userId: ID!
|
|
64
|
+
"""
|
|
65
|
+
When the session expires, as an ISO-8601 string.
|
|
66
|
+
"""
|
|
67
|
+
expiresAt: String!
|
|
68
|
+
"""
|
|
69
|
+
Whether a user was made for this account.
|
|
70
|
+
"""
|
|
71
|
+
created: Boolean!
|
|
72
|
+
"""
|
|
73
|
+
Whether this call linked the account to an existing user.
|
|
74
|
+
"""
|
|
75
|
+
linked: Boolean!
|
|
76
|
+
"""
|
|
77
|
+
Whether the session was opened from a device the user had not used.
|
|
78
|
+
"""
|
|
79
|
+
newDevice: Boolean!
|
|
80
|
+
"""
|
|
81
|
+
The path the flow was started with, or null.
|
|
82
|
+
"""
|
|
83
|
+
returnTo: String
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
"""
|
|
87
|
+
The user has an active second factor: confirm it with the challenge. No
|
|
88
|
+
session is open yet.
|
|
89
|
+
"""
|
|
90
|
+
type SocialSecondFactor {
|
|
91
|
+
challenge: String!
|
|
92
|
+
"""
|
|
93
|
+
When the challenge lapses, as an ISO-8601 string.
|
|
94
|
+
"""
|
|
95
|
+
expiresAt: String!
|
|
96
|
+
"""
|
|
97
|
+
What can answer the challenge: `totp` always, and `passkey` when the
|
|
98
|
+
user holds one. Show only these.
|
|
99
|
+
"""
|
|
100
|
+
methods: [String!]!
|
|
101
|
+
"""
|
|
102
|
+
The JSON text for `navigator.credentials.get({ publicKey })`, present
|
|
103
|
+
exactly when `methods` holds `passkey`. Answer it with
|
|
104
|
+
`confirmSecondFactorPasskey` (`janusPasskeyTypeDefs`). A `totp` code
|
|
105
|
+
goes to `confirmSecondFactor` (`janusSecondFactorTypeDefs`).
|
|
106
|
+
"""
|
|
107
|
+
passkeyOptions: String
|
|
108
|
+
returnTo: String
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
"""
|
|
112
|
+
A link flow completed: the signed-in user now has the account. Not a
|
|
113
|
+
sign-in, so no session is set.
|
|
114
|
+
"""
|
|
115
|
+
type SocialLinked {
|
|
116
|
+
link: JanusSocialLink!
|
|
117
|
+
returnTo: String
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
union SocialSignInResult = SocialSignedIn | SocialSecondFactor | SocialLinked
|
|
121
|
+
|
|
122
|
+
extend type Query {
|
|
123
|
+
"""
|
|
124
|
+
The signed-in user's linked social accounts, oldest first.
|
|
125
|
+
"""
|
|
126
|
+
socialLinks: [JanusSocialLink!]! @authenticated
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
extend type Mutation {
|
|
130
|
+
"""
|
|
131
|
+
Begins a sign-in with `provider`. `returnTo` is a path of this site.
|
|
132
|
+
Answers the URL to send the visitor to and the flow to keep until the
|
|
133
|
+
callback.
|
|
134
|
+
"""
|
|
135
|
+
socialSignInStart(provider: String!, returnTo: String): SocialFlowStart!
|
|
136
|
+
"""
|
|
137
|
+
Completes the flow with the provider's callback URL and the `flow` that
|
|
138
|
+
`socialSignInStart` or `linkSocial` answered. A sign-in sets the session
|
|
139
|
+
cookie, or answers `token` with `answerToken`.
|
|
140
|
+
"""
|
|
141
|
+
socialSignInComplete(callbackUrl: String!, flow: String!): SocialSignInResult!
|
|
142
|
+
"""
|
|
143
|
+
Begins linking an account to the signed-in user, behind a fresh proof.
|
|
144
|
+
"""
|
|
145
|
+
linkSocial(provider: String!, returnTo: String): SocialFlowStart!
|
|
146
|
+
@authenticated
|
|
147
|
+
@fresh(maxAge: 600)
|
|
148
|
+
"""
|
|
149
|
+
Removes one of the user's links. True when this call removed it.
|
|
150
|
+
LAST_SIGN_IN_METHOD when it is the user's only way to sign in.
|
|
151
|
+
"""
|
|
152
|
+
unlinkSocial(provider: String!, accountId: ID!): Boolean!
|
|
153
|
+
@authenticated
|
|
154
|
+
@fresh(maxAge: 600)
|
|
155
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Only a signed-in user reaches this field, or every field of this type or
|
|
3
|
+
interface. With `type`, only a user of one of these user types: any other is
|
|
4
|
+
answered FORBIDDEN.
|
|
5
|
+
"""
|
|
6
|
+
directive @authenticated(
|
|
7
|
+
type: [String!]
|
|
8
|
+
) on OBJECT | INTERFACE | FIELD_DEFINITION
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Only a session that proved who it is less than `maxAge` seconds ago reaches
|
|
12
|
+
this field, or every field of this type or interface: signed in, or confirmed
|
|
13
|
+
since by a step-up. Anonymous is answered UNAUTHENTICATED, an older session
|
|
14
|
+
STEP_UP_REQUIRED. Where several apply, the smallest `maxAge` holds.
|
|
15
|
+
"""
|
|
16
|
+
directive @fresh(maxAge: Int!) on OBJECT | INTERFACE | FIELD_DEFINITION
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
What a denied `@permission` answers.
|
|
20
|
+
"""
|
|
21
|
+
enum JanusPermissionDenial {
|
|
22
|
+
"""
|
|
23
|
+
404: the object is not told to exist. The default.
|
|
24
|
+
"""
|
|
25
|
+
NOT_FOUND
|
|
26
|
+
"""
|
|
27
|
+
403: the object exists, and this user may not do this to it.
|
|
28
|
+
"""
|
|
29
|
+
FORBIDDEN
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
"""
|
|
33
|
+
Only a user holding permission `name` on the object of `type` whose id `id`
|
|
34
|
+
reads reaches this field, or every field of this type or interface. `id` is
|
|
35
|
+
`args.<path>` or `parent.<path>`: `args.id` on a field and `parent.id` on a
|
|
36
|
+
type or an interface when absent. A list of ids requires the permission on
|
|
37
|
+
every one. Repeated, every one must hold, in the order written.
|
|
38
|
+
"""
|
|
39
|
+
directive @permission(
|
|
40
|
+
name: String!
|
|
41
|
+
type: String!
|
|
42
|
+
id: String
|
|
43
|
+
onDeny: JanusPermissionDenial! = NOT_FOUND
|
|
44
|
+
) repeatable on OBJECT | INTERFACE | FIELD_DEFINITION
|
package/package.json
CHANGED
|
@@ -1,6 +1,81 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@softistx/janus-graphql",
|
|
3
|
+
"version": "0.30.1",
|
|
4
|
+
"description": "GraphQL for @softistx/janus: an envelop plugin with the signed-in user on the context, fields guarded by @authenticated, @fresh and @permission, and every error with the status it deserves",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"docs",
|
|
12
|
+
"graphql",
|
|
13
|
+
"README.md",
|
|
14
|
+
"package.json",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"default": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"identity",
|
|
27
|
+
"authentication",
|
|
28
|
+
"authorization",
|
|
29
|
+
"graphql",
|
|
30
|
+
"envelop",
|
|
31
|
+
"graphql-yoga",
|
|
32
|
+
"directives",
|
|
33
|
+
"janus",
|
|
34
|
+
"typescript"
|
|
35
|
+
],
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/softistx/nxgt-janus.git",
|
|
39
|
+
"directory": "packages/janus-graphql"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"registry": "https://registry.npmjs.org/",
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "bun run ../../build.ts",
|
|
47
|
+
"test": "bun test src",
|
|
48
|
+
"typecheck": "bun check",
|
|
49
|
+
"typecheck:tsc": "tsc --noEmit"
|
|
50
|
+
},
|
|
51
|
+
"nxgt": {
|
|
52
|
+
"entrypoints": [
|
|
53
|
+
"src/index.ts"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@envelop/core": "^6.0.1",
|
|
58
|
+
"@graphql-tools/utils": "^13.2.2",
|
|
59
|
+
"@softistx/janus": "^0.73.1",
|
|
60
|
+
"@types/bun": "^1.4.4",
|
|
61
|
+
"@types/ws": "^8.18.2",
|
|
62
|
+
"graphql": "^17.1.0",
|
|
63
|
+
"graphql-ws": "^6.4.3",
|
|
64
|
+
"graphql-yoga": "^6.1.0",
|
|
65
|
+
"ws": "^8.23.0",
|
|
66
|
+
"zod": "^4.6.7"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"@envelop/core": "^5.0.0 || ^6.0.0",
|
|
70
|
+
"@graphql-tools/utils": ">=10.0.0 <14",
|
|
71
|
+
"@softistx/janus": "^0.73.1",
|
|
72
|
+
"graphql": "^16.9.0 || ^17.0.0",
|
|
73
|
+
"graphql-ws": "^6.0.0",
|
|
74
|
+
"typescript": "^6.0.3 || ^7.0.0"
|
|
75
|
+
},
|
|
76
|
+
"peerDependenciesMeta": {
|
|
77
|
+
"graphql-ws": {
|
|
78
|
+
"optional": true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|