String canonically encodes the token as string.
()
| 128 | |
| 129 | // String canonically encodes the token as string. |
| 130 | func (t *Token) String() string { |
| 131 | payload := make([]byte, 40) |
| 132 | copy(payload[0:16], t.ID[:]) |
| 133 | copy(payload[16:40], t.Secret[:]) |
| 134 | return fmt.Sprintf("%s_%s_%s", Prefix, t.Type, marshalBase62(payload)) |
| 135 | } |
| 136 | |
| 137 | // SecretHash returns a SHA256 hash of the token secret. |
| 138 | func (t *Token) SecretHash() []byte { |