mirror of
https://github.com/status-im/keycard-go.git
synced 2025-01-31 06:07:03 +00:00
make APDUCommand serialize method public
This commit is contained in:
parent
b2ef28fa0a
commit
fcdba99a1a
@ -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)
|
buf := new(bytes.Buffer)
|
||||||
|
|
||||||
if err := binary.Write(buf, binary.BigEndian, c.Cla); err != nil {
|
if err := binary.Write(buf, binary.BigEndian, c.Cla); err != nil {
|
||||||
|
@ -37,7 +37,7 @@ func TestNewCommand(t *testing.T) {
|
|||||||
cmd := NewCommand(cla, ins, p1, p2, data)
|
cmd := NewCommand(cla, ins, p1, p2, data)
|
||||||
expected := "80 50 01 02 08 84 76 23 36 C5 18 7F E8 00"
|
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.NoError(t, err)
|
||||||
assert.Equal(t, expected, bytesToHexWithSpaces(result))
|
assert.Equal(t, expected, bytesToHexWithSpaces(result))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user