51 lines
843 B
Go
51 lines
843 B
Go
package utils
|
|
|
|
import (
|
|
"encoding/binary"
|
|
)
|
|
|
|
type DataTyp uint16
|
|
|
|
const (
|
|
DATA_ACCOUNT DataTyp = iota
|
|
DATA_ACCOUNT_CREATED
|
|
DATA_TRACKING_ID
|
|
DATA_PUBLIC_KEY
|
|
DATA_CUSTODIAL_ID
|
|
DATA_ACCOUNT_PIN
|
|
DATA_ACCOUNT_STATUS
|
|
DATA_TEMPORARY_FIRST_NAME
|
|
DATA_FIRST_NAME
|
|
DATA_TEMPORARY_FAMILY_NAME
|
|
DATA_FAMILY_NAME
|
|
DATA_TEMPORARY_YOB
|
|
DATA_YOB
|
|
DATA_TEMPORARY_LOCATION
|
|
DATA_LOCATION
|
|
DATA_TEMPORARY_GENDER
|
|
DATA_GENDER
|
|
DATA_TEMPORARY_OFFERINGS
|
|
DATA_OFFERINGS
|
|
DATA_RECIPIENT
|
|
DATA_AMOUNT
|
|
DATA_TEMPORARY_PIN
|
|
DATA_VOUCHER_LIST
|
|
DATA_TEMPORARY_SYM
|
|
DATA_ACTIVE_SYM
|
|
DATA_TEMPORARY_BAL
|
|
DATA_ACTIVE_BAL
|
|
DATA_PUBLIC_KEY_REVERSE
|
|
|
|
)
|
|
|
|
func typToBytes(typ DataTyp) []byte {
|
|
var b [2]byte
|
|
binary.BigEndian.PutUint16(b[:], uint16(typ))
|
|
return b[:]
|
|
}
|
|
|
|
func PackKey(typ DataTyp, data []byte) []byte {
|
|
v := typToBytes(typ)
|
|
return append(v, data...)
|
|
}
|