ssbc / ssb-keys

keyfile operations for ssb
36 stars 26 forks source link

add tests for sign and verify with a weird obj #82

Open staltz opened 4 years ago

staltz commented 4 years ago

I don't know if anyone out there uses ssb-keys this way, but this is currently supported:

ssbKeys.signObj(keys, someBuffer, anotherBuffer)

That is, the object being signed is a Buffer. Now, this currently executes without errors because every Buffer is an object. But should we forbid this usage?

Created as a draft to indicate I don't want to merge yet before we discuss about it.

davegomez commented 4 years ago

The most extended form of an object to sign in signObject I have seen so far is this:

{
    "address": "net:192.168 ... MpNw="
}

I would say that for type safety sakes, only "real objects" should be allowed in these two functions. In this case, having a less easy developer experience worth it.