aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/utils.cpp
blob: a06cd6f5ba7d79413c2f3708069708677b66fd66 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "utils.h"

namespace NTvmAuth::NUtils {
    TStringBuf RemoveTicketSignature(TStringBuf ticketBody) {
        if (ticketBody.size() < 2 ||
            ticketBody[0] != '3' ||
            ticketBody[1] != ':') {
            return ticketBody;
        }

        size_t pos = ticketBody.rfind(':');
        if (pos == TStringBuf::npos) { // impossible
            return ticketBody;
        }

        return ticketBody.substr(0, pos + 1);
    }
}