Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit 1799eed

Browse files
committed
feat: Add GET /session/auth
1 parent 8ce6465 commit 1799eed

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

polyproto/core/routes/federated_identity.tsp

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ namespace polyproto.core.Routes.FederatedIdentity {
3535
@body newIdCert: {
3636
@doc("The generated [ID-Cert](/Protocol%20Specifications/core/#71-home-server-signed-certificates-for-public-client-identity-keys-id-cert) in PEM format.")
3737
@example("------BEGIN CERTIFICATE------...")
38-
id_cert: string;
38+
idCert: string;
3939

40-
@doc("An authorization secret, called a \"session token\", valid for this `id_cert`/session.")
40+
@doc("An authorization secret, called a \"session token\", valid for this `idCert`/session.")
4141
token: string;
4242
};
4343
};
@@ -54,7 +54,7 @@ namespace polyproto.core.Routes.FederatedIdentity {
5454
@added(Version.`v1.0-beta.3`)
5555
@post
5656
op uploadEncryptedPKM(
57-
@body @minItems(1) pkm: polyproto.core.Models.EncryptedPKM[],
57+
@body @minItems(1) pkm: polyproto.core.models.EncryptedPKM[],
5858
):
5959
| {
6060
@statusCode statusCode: 201;
@@ -87,7 +87,7 @@ namespace polyproto.core.Routes.FederatedIdentity {
8787
@get
8888
op getEncryptedPKM(@query serials?: uint64[]): {
8989
@statusCode statusCode: 200;
90-
@body encryptedPKMs: polyproto.core.Models.EncryptedPKM[];
90+
@body encryptedPKMs: polyproto.core.models.EncryptedPKM[];
9191
} | {
9292
@doc("Returned, if no `serial_numbers` are provided and the client has not uploaded any key material.")
9393
@statusCode
@@ -158,7 +158,7 @@ namespace polyproto.core.Routes.FederatedIdentity {
158158
@header(#{ name: "X-P2-Sensitive-Solution" })
159159
sensitiveSolution: string,
160160

161-
@query session_id: string,
161+
@query sessionId: string,
162162
): {
163163
@statusCode statusCode: 204;
164164

@@ -200,14 +200,14 @@ namespace polyproto.core.Routes.FederatedIdentity {
200200
@summary("Get Server ID-Cert")
201201
op serverIdCert(
202202
@query timestamp?: uint64,
203-
): polyproto.core.Models.CacheableIDCert;
203+
): polyproto.core.models.CacheableIDCert;
204204

205205
/**
206206
* Request the ID-Certs of a specific actor. The specified actor must be registered on this server.
207207
* @param fid The ID of the actor whose ID-Cert(s) should be returned.
208208
* @param notBefore: Return only ID-Certs from at or after a specific point in time. UNIX 64 bit timestamp.
209209
* @param notAfter: Return only ID-Certs from at or before a specific point in time. UNIX 64 bit timestamp.
210-
* @param session_id Optionally, return only the ID-Certs matching a specific `session_id`.
210+
* @param sessionId Optionally, return only the ID-Certs matching a specific `sessionId`.
211211
* @returns JSON-Array of Object(s).
212212
*/
213213
@route("/idcert/actor")
@@ -218,10 +218,10 @@ namespace polyproto.core.Routes.FederatedIdentity {
218218
@path fid: string,
219219
@query notBefore?: uint64,
220220
@query notAfter?: uint64,
221-
@query session_id?: string,
221+
@query sessionId?: string,
222222
): {
223223
@statusCode statusCode: 200;
224-
@body response: polyproto.core.Models.CacheableIDCert[];
224+
@body response: polyproto.core.models.CacheableIDCert[];
225225
};
226226

227227
/**
@@ -235,26 +235,39 @@ namespace polyproto.core.Routes.FederatedIdentity {
235235
@added(Version.`v1.0-beta.3`)
236236
@useAuth(BearerAuth)
237237
@summary("Update session ID-Cert")
238-
op updateSessionCert(@body id_cert: string): {
238+
op updateSessionCert(@body idCert: string): {
239239
@statusCode statusCode: 201;
240240
} | {
241241
@statusCode statusCode: 400;
242242
};
243243

244244
/**
245245
* Authenticate on a foreign server, creating a session with an authentication token. Requires
246-
* completing a key trial for the ID-Cert the session is supposed to be generated for.
246+
* completing a key trial for the ID-Cert of which the session is supposed to be generated for.
247247
*/
248248
@route("/session/auth")
249249
@post
250-
@added(Version.`v1.0-beta.3`)
250+
@added(Version.`v1.0-beta.4`)
251251
@summary("Authenticate on a foreign server")
252252
op requestToken(
253253
@body
254-
completedChallengeString: polyproto.core.Models.KeyTrialCompleted,
254+
completedChallengeString: polyproto.core.models.KeyTrialCompleted,
255255
): {
256256
@body _: string;
257257
@statusCode statusCode: 200;
258258
};
259+
260+
/**
261+
* Manually request a KeyTrial, useful for obtaining a session token. Returns
262+
* a key trial.
263+
*/
264+
@route("/session/auth")
265+
@get
266+
@added(Version.`v1.0-beta.3`)
267+
@summary("Authenticate on a foreign server")
268+
op requestChallenge(): {
269+
@body _: polyproto.core.models.KeyTrial;
270+
@statusCode statusCode: 200;
271+
};
259272
}
260273
}

0 commit comments

Comments
 (0)