Reference
connection-check
A check at the door: hold a connection before the player joins, ask the client for a cookie, admit or refuse.
Declarations from the script contract strawberry:plugin, version 0.2.0, without source comments.
WIT declarations
use event.{extension-event};
use player.{verification};
use uuid.{uuid};
enum edition {
java,
bedrock,
}
variant check-error {
gone,
invalid-key(string),
unsupported,
busy,
}
resource checked-connection {
id: func() -> u64;
name: func() -> string;
uuid: func() -> uuid;
verification: func() -> verification;
edition: func() -> edition;
locale: func() -> string;
transferred: func() -> bool;
address-key: func() -> option<string>;
request-cookie: func(key: string) -> result<_, check-error>;
admit: func() -> result<_, check-error>;
refuse: func(message: string) -> result<_, check-error>;
}
record cookie-answer {
key: string,
payload: option<list<u8>>,
}
connection: func(event: borrow<extension-event>) -> option<checked-connection>;
cookie: func(event: borrow<extension-event>) -> option<tuple<checked-connection, cookie-answer>>;