29 lines
579 B
Go
29 lines
579 B
Go
package ots
|
|
|
|
import "fmt"
|
|
|
|
type Attestation struct {
|
|
BitcoinBlockHeight uint64
|
|
CalendarServerURL string
|
|
}
|
|
|
|
func (att Attestation) Name() string {
|
|
if att.BitcoinBlockHeight != 0 {
|
|
return "bitcoin"
|
|
} else if att.CalendarServerURL != "" {
|
|
return "pending"
|
|
} else {
|
|
return "unknown/broken"
|
|
}
|
|
}
|
|
|
|
func (att Attestation) Human() string {
|
|
if att.BitcoinBlockHeight != 0 {
|
|
return fmt.Sprintf("bitcoin(%d)", att.BitcoinBlockHeight)
|
|
} else if att.CalendarServerURL != "" {
|
|
return fmt.Sprintf("pending(%s)", att.CalendarServerURL)
|
|
} else {
|
|
return "unknown/broken"
|
|
}
|
|
}
|