Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds LoadKey command #6

Closed
wants to merge 8 commits into from

Conversation

alex-miller-0
Copy link
Contributor

@alex-miller-0 alex-miller-0 commented May 11, 2019

Cleaner commit history, second try for #5

var data []byte
if isSeed == true {
p1 = P1LoadKeySeed
data = payload
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe I missed it before, but I see we just send data/payload. but as explained in the docs, if P1 is 1 or 2 the data sent must be encoded in tlv using the 0xA1 tag for the template.

https://status.im/keycard_api/apdu_loadkey.html

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so maybe we can have NewCommandLoadKey(type LoadType, data []byte) where LoadType are constants defining keypair/ext-keypair/seed. and based on that we define the right p1 and data format.
What do you think @alex-miller-0 ?
I can also continue with this if you don't have a lot of time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea was to punt data encoding to another layer, since I didn't see an example of TLV encoding in this codebase. If you want that logic here, I probably shouldn't be doing it since I'm not sure what types of data structures or libraries you want to use.

Feel free to close this PR and use any of the code in another 👍

Copy link
Member

@gravityblast gravityblast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just added a couple of comments above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants