MaskKey returns the first 8 characters followed by ellipsis
()
| 27 | |
| 28 | // MaskKey returns the first 8 characters followed by ellipsis |
| 29 | func (k *APIKey) MaskKey() string { |
| 30 | if len(k.Key) <= 8 { |
| 31 | return k.Key[:len(k.Key)] + "..." |
| 32 | } |
| 33 | return k.Key[:8] + "..." |
| 34 | } |
| 35 | |
| 36 | // ToResponse converts APIKey to APIKeyResponse with masked key |
| 37 | func (k *APIKey) ToResponse() APIKeyResponse { |