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

Clarify manage_data value in SEP-10 #366

Merged
merged 1 commit into from
Aug 6, 2019
Merged

Clarify manage_data value in SEP-10 #366

merged 1 commit into from
Aug 6, 2019

Conversation

tomquisel
Copy link
Contributor

No description provided.

Copy link
Contributor

@msfeldstein msfeldstein left a comment

Choose a reason for hiding this comment

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

LGTM, about as clear as a sentence about byte encoding can get :)

Copy link
Contributor

@abuiles abuiles left a comment

Choose a reason for hiding this comment

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

👍

@@ -81,7 +81,7 @@ On success the endpoint must return `200 OK` HTTP status code and a JSON object
* time bounds: `{min: now(), max: now() + 300 }` (we recommend expiration of 5 minutes to give user time to sign transaction)
* operations: `manage_data(source: client_account, key: '<anchor name> auth', value: random_nonce())`
* The value of key is not important, but can be the name of the anchor followed by `auth`. It can be at most 64 bytes.
* The value must be a 64 byte long base64 encoded cryptographic-quality random string
* The value must be 64 bytes long. It contains a 48 byte cryptographic-quality random string encoded using base64 (for a total of 64 bytes after encoding).
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm reviewing lightsail-network/java-stellar-sdk#243 and the change here is pretty confusing. It looks like you expect 48 random bytes instead of 64 bytes: in other words the expected value is base64(r[48]) (64 bytes long after encoding) vs r[64]. I don't think it decreases security (correct me if I'm wrong) and the client gets 64 bytes in return anyway but it's confusing. Any reason this was changed?

Copy link
Member

Choose a reason for hiding this comment

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

We changed the text here because it's not obvious that a Base64 digit represents 6 bits, to generate a random 64 bytes base64 string, we need 48 random bytes = (64 * 6)/8. This was a result of the PR here: https://github.com/stellar/js-stellar-sdk/pull/396/files

Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't understand why putting 48 base64-encoded bytes in manage_data.value is better than raw 64 bytes... In other words this is the same (in terms of security, brute force attack is hard for both options) but when passing 64 bytes you don't need to base64 encode anything. Basically the code before this: stellar/js-stellar-sdk#396 change worked fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It just means all the characters are readable. It's easier for visual inspection & debugging.

Copy link
Member

Choose a reason for hiding this comment

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

I think the intended advantage is just that it can be easily printed/serialised for debugging purposes. Raw bytes are harder to see.

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

5 participants