All files / realm/blong-access/gateway/access accessSessionClose.ts

100% Statements 27/27
100% Branches 2/2
100% Functions 1/1
100% Lines 27/27

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 281x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 1x  
import {validation} from '@feasibleone/blong';
 
/**
 * Protected RPC endpoint closing (revoking) a session.
 *
 * Wired as the "Close Session" toolbar action on the `access.session` browse
 * page. The session id arrives as the base64 wire representation of the
 * `binary(16)` `sessionId` column.
 */
export default validation(
    async ({lib: {type}}) =>
        function accessSessionClose() {
            return {
                params: type.Object({
                    // Optional: when omitted, the caller's CURRENT session
                    // (`$meta.auth.sessionId`) is closed.
                    sessionId: type.Optional(type.String()),
                }),
                result: type.Object(
                    {
                        success: type.Boolean(),
                    },
                    {additionalProperties: true},
                ),
            };
        },
);