aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tvmauth/utils.cpp
blob: 16e9cb63b9bee8084e5b10b78a8f11857fdd3c08 (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); 
    } 
}