make APDUCommand serialize method public

This commit is contained in:
Andrea Franz 2018-09-19 15:29:43 +02:00
parent b2ef28fa0a
commit fcdba99a1a
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
2 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ func NewCommand(cla, ins, p1, p2 uint8, data []byte) *Command {
}
}
func (c *Command) serialize() ([]byte, error) {
func (c *Command) Serialize() ([]byte, error) {
buf := new(bytes.Buffer)
if err := binary.Write(buf, binary.BigEndian, c.Cla); err != nil {

View File

@ -37,7 +37,7 @@ func TestNewCommand(t *testing.T) {
cmd := NewCommand(cla, ins, p1, p2, data)
expected := "80 50 01 02 08 84 76 23 36 C5 18 7F E8 00"
result, err := cmd.serialize()
result, err := cmd.Serialize()
assert.NoError(t, err)
assert.Equal(t, expected, bytesToHexWithSpaces(result))
}