(att interface{})
| 429 | } |
| 430 | |
| 431 | func DecodeAttachment(att interface{}) ([]byte, error) { |
| 432 | switch att := att.(type) { |
| 433 | case []byte: |
| 434 | return att, nil |
| 435 | case string: |
| 436 | return base64.StdEncoding.DecodeString(att) |
| 437 | default: |
| 438 | return nil, base.HTTPErrorf(400, "invalid attachment data (type %T)", att) |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | func Sha1DigestKey(data []byte) string { |
| 443 | digester := sha1.New() |