api.fabaccess-api/main.capnp

66 lines
2.3 KiB
Cap'n Proto
Raw Normal View History

2021-02-01 23:23:12 +01:00
@0xbf017710be5a54ff;
using CSharp = import "programming_language/csharp.capnp";
2020-10-19 01:52:15 +02:00
$CSharp.namespace("FabAccessAPI.Schema");
2022-11-01 11:54:01 +01:00
using import "auth.capnp".Authentication;
2024-03-01 15:39:30 +01:00
using import "auth.capnp".Mechanism;
2022-11-01 11:54:01 +01:00
using import "resources.capnp".Resources;
using import "users.capnp".Users;
2022-11-04 15:23:25 +01:00
using import "user.capnp".User;
using import "permissions.capnp".Permissions;
2021-02-01 23:23:12 +01:00
2024-03-01 15:39:30 +01:00
const currentVersion :Version = (major = 1, minor = 0);
2022-10-31 15:19:56 +01:00
struct Version
{
2024-03-01 15:39:30 +01:00
major @0 :Int32;
minor @1 :Int32;
2022-10-31 15:19:56 +01:00
}
interface Bootstrap
2021-02-01 23:23:12 +01:00
{
2022-10-31 15:19:56 +01:00
getAPIVersion @0 () -> Version;
2024-03-27 19:43:37 +01:00
# Returns the API version implemented by the server. As a client, you can compare this version with the local currentVersion.
2022-10-31 15:19:56 +01:00
getServerRelease @1 () -> ( name :Text, release :Text );
2022-11-01 11:54:01 +01:00
# Returns the server implementation name and version/build number Designed only for human-facing
# debugging output so should be informative over machine-readable.
# Example: ("bffhd", "0.3.1-f397e1e [rustc 1.57.0 (f1edd0429 2021-11-29)]")
2022-10-31 15:19:56 +01:00
2024-03-27 19:43:37 +01:00
getServerInfo @2 () -> ( spacename :Text, instanceurl :Text );
# Returns information about the server, which can be used to resolve MDNS to DNS and display the server name to the user.
2024-04-15 16:28:23 +02:00
mechanisms @3 () -> ( mechs :List(Mechanism), cbtypes :List(Text) );
# Get a list of Mechanisms this server allows in this context.
2024-04-15 16:28:23 +02:00
# TODO: Channel Bindings
# TODO: List of groups of mechs
2021-02-01 23:23:12 +01:00
2024-03-27 19:43:37 +01:00
createSession @4 ( mechanism :Text ) -> ( authentication :Authentication );
2022-11-01 11:54:01 +01:00
# Create a new session with the server that you wish to authenticate using `mechanism`. If the
# mechanism is a client-first mechanism you can then immediately call Authentication::step with
# initial data in a pipelined fashion. If the mechanism is server-first you must call
# Authentication::step with a NULL `data` parameter.
2024-03-27 19:43:37 +01:00
# register @5 () -> ();
# Placeholder for a future capability for users to register themselves.
}
struct Session {
2022-11-01 11:54:01 +01:00
# An API session with the server. The below capabilities are set to NULL if the authenticated
# user doesn't have permission to access the system in question, or if the server does not
# implement it.
2024-03-27 19:43:37 +01:00
2022-11-04 15:23:25 +01:00
whoami @0 :User;
2024-03-27 19:43:37 +01:00
# Returns the currently authenticated user.
2021-10-01 20:06:06 +02:00
2022-11-04 15:23:25 +01:00
resources @1 :Resources;
# Access to the resources configured.
2021-10-01 20:06:06 +02:00
2022-11-04 15:23:25 +01:00
users @2 :Users;
# User administration.
permissions @3 :Permissions;
}