Final Live Session Calculation

View as MarkdownOpen in Claude

To calculate the Live Session Token, we need to create a new HMAC Sha1 object, using the K hex bytes as a key. We then hash our HMAC Sha1 object against our prepend byte string.

The final byte array, converted to a Base64 string, is the computed live session token.

1bytes_hmac_hash_K = HMAC.new(
2 key=hex_bytes_K,
3 msg=prepend_bytes,
4 digestmod=SHA1,
5 ).digest()
6# The computed LST is the base64-encoded HMAC hash of the hex prepend bytestring. Converted here to str.
7computed_lst = base64.b64encode(bytes_hmac_hash_K).decode("utf-8")