service: add owner key to a signed payload of SessionToken

This commit is contained in:
Leonard Lyubich 2020-05-15 16:05:02 +03:00
parent bc413f6280
commit 1896264f8c
2 changed files with 32 additions and 3 deletions

View file

@ -174,11 +174,11 @@ func NewVerifiedSessionToken(token SessionToken) DataWithSignature {
}
}
func tokenInfoSize(v SessionKeySource) int {
func tokenInfoSize(v SessionTokenInfo) int {
if v == nil {
return 0
}
return fixedTokenDataSize + len(v.GetSessionKey())
return fixedTokenDataSize + len(v.GetSessionKey()) + len(v.GetOwnerKey())
}
// Fills passed buffer with signing token information bytes.
@ -208,7 +208,9 @@ func copyTokenSignedData(buf []byte, token SessionTokenInfo) {
tokenEndianness.PutUint64(buf[off:], token.ExpirationEpoch())
off += 8
copy(buf[off:], token.GetSessionKey())
off += copy(buf[off:], token.GetSessionKey())
copy(buf[off:], token.GetOwnerKey())
}
// SignedData concatenates signed data with session token information. Returns concatenation result.