2024-09-05 16:12:38 +02:00
|
|
|
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
|
2024-09-05 18:50:02 +02:00
|
|
|
DATA_ACCOUNT_PIN
|
2024-09-06 07:35:01 +02:00
|
|
|
DATA_ACCOUNT_STATUS
|
|
|
|
DATA_FIRST_NAME
|
|
|
|
DATA_FAMILY_NAME
|
|
|
|
DATA_YOB
|
|
|
|
DATA_LOCATION
|
|
|
|
DATA_GENDER
|
|
|
|
DATA_OFFERINGS
|
|
|
|
DATA_RECIPIENT
|
|
|
|
DATA_AMOUNT
|
2024-09-05 16:12:38 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func typToBytes(typ DataTyp) []byte {
|
2024-09-05 16:41:27 +02:00
|
|
|
var b [2]byte
|
|
|
|
binary.BigEndian.PutUint16(b[:], uint16(typ))
|
|
|
|
return b[:]
|
2024-09-05 16:12:38 +02:00
|
|
|
}
|
|
|
|
|
2024-09-07 15:25:29 +02:00
|
|
|
func PackKey(typ DataTyp, data []byte) []byte {
|
2024-09-05 16:12:38 +02:00
|
|
|
v := typToBytes(typ)
|
|
|
|
return append(v, data...)
|
|
|
|
}
|