ComputeSessionID returns a 12-char hex ID from sha256(sha256(apiKey) + "|" + userAgent).
(apiKey, userAgent string)
| 111 | |
| 112 | // ComputeSessionID returns a 12-char hex ID from sha256(sha256(apiKey) + "|" + userAgent). |
| 113 | func ComputeSessionID(apiKey, userAgent string) string { |
| 114 | keyHash := sha256.Sum256([]byte(apiKey)) |
| 115 | combined := hex.EncodeToString(keyHash[:]) + "|" + userAgent |
| 116 | h := sha256.Sum256([]byte(combined)) |
| 117 | return hex.EncodeToString(h[:])[:12] |
| 118 | } |
| 119 | |
| 120 | // Summary returns a lightweight summary of this session. |
| 121 | func (s *Session) Summary() SessionSummary { |
no outgoing calls