DeviceIDFromString parses a device ID from a string. The string is expected to be in the canonical format, with check digits.
(s string)
| 50 | // DeviceIDFromString parses a device ID from a string. The string is expected |
| 51 | // to be in the canonical format, with check digits. |
| 52 | func DeviceIDFromString(s string) (DeviceID, error) { |
| 53 | var n DeviceID |
| 54 | err := n.UnmarshalText([]byte(s)) |
| 55 | return n, err |
| 56 | } |
| 57 | |
| 58 | // DeviceIDFromBytes converts a 32 byte slice to a DeviceID. A slice of the |
| 59 | // wrong length results in an error. |