Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is currently no way to sign arbitrary data without retrieving a private key over the network, which is fundamentally a bad idea. Currently both FAT and PegNet sign their custom transaction entries by querying the private key of an address over the api, then signing locally.
This would add a "sign-data" method to the wallet that takes an FA address and arbitrary byte data as parameters:
factom/wallet/wsapi/structs.go
Lines 47 to 50 in 5c3c980
and returns a public key + signature pair:
factom/wallet/wsapi/structs.go
Lines 210 to 213 in 5c3c980
The downside here is that you have to transfer the data to the wallet in order to sign it but with the advantage of never having to retrieve the private key over a potentially unsecure connection. If you need to sign a lot of data, you can still use the alternate method or just sign a hash of the data instead.
I think this would make the ecosystem a lot safer and the wallet a lot more useful for layer 2 applications.
The PR also includes a corresponding factom go client function to call this API endpoint:
factom/sign.go
Lines 7 to 12 in 5c3c980