SecretHash returns a SHA256 hash of the token secret.
()
| 136 | |
| 137 | // SecretHash returns a SHA256 hash of the token secret. |
| 138 | func (t *Token) SecretHash() []byte { |
| 139 | hashed := sha256.Sum256(t.Secret[:]) |
| 140 | return hashed[:] |
| 141 | } |
| 142 | |
| 143 | // Prefix returns a safe, partial display string for the token, e.g., "rill_usr_abcdefghij". |
| 144 | // This works even if t.Secret is empty (all zeroes), as long as t.ID is set. |
no outgoing calls