BlockchainCommons / did-method-onion

Onion DID Method specification
https://blockchaincommons.github.io/did-method-onion/
Other
5 stars 4 forks source link

Add Links to Implementations #3

Open OR13 opened 3 years ago

OR13 commented 3 years ago

Add links to code / demo for getting started.

OR13 commented 3 years ago

I made a small demo https://github.com/OR13/did-onion.js

It currently only supports the "bare domain" style identifiers.

The saddest part of this was realizing Tor V3 Ed25519 keys are their own special format.

While it is theoretically possible to generate everything from a single key / entropy source.... it seems they have gone out of their way to stop you from doing this.

So instead we generate the service key, and then we generate the did document / its keys.

I have added vanity address mining for fun, but also because generated Tor V3 Addresses / Key Pairs sucks without doing that.

ChristopherA commented 3 years ago

Yes, the Tor keys are their own format, and they really are not convertable.

We settled on using the minisign key format for private keys, and convert them to Tor private keys as a) minisign looks like it can be a universal donor and b) there are other apps beginning to use minisign kyes. @gorazdko has details if you need them.

But I'm also open to another standard for key 25519 encoding.

ChristopherA commented 3 years ago

I'm a bit confused here with your demo at https://github.com/OR13/did-onion.js

So if you go to http://loll65o6clhutxfv4ce4rdvgugcf2aqee2ju6vsrepw6vr6l66bxtsid.onion/ with no path using an onion browser, this spec says the onion server should just give you the DID json?

For some reason, I'd assumed that it was the resolvers responsibility to take a DID did:onion:loll65o6clhutxfv4ce4rdvgugcf2aqee2ju6vsrepw6vr6l66bxtsid (i.e. no path) then request http://loll65o6clhutxfv4ce4rdvgugcf2aqee2ju6vsrepw6vr6l66bxtsid.onion/did.jsonld. This parallels the way http server adds index.html to a bare path.

Thus a did resolution of a bare path DID would default to did.jsonld just like a http resolution of a bare path http actually gets index.html.

I think easy co-existence by default is an important requirement, especially for single DID services. Or do I misunderstand something?

ChristopherA commented 3 years ago

@OR13, I can have @gorazdko add your DID document template as described https://github.com/OR13/did-onion.js to his code if you request /did.jsonld — should he add that?

OR13 commented 3 years ago

yes, go ahead and take anything from that demo.

OR13 commented 3 years ago

regarding: https://github.com/BlockchainCommons/did-method-onion/issues/3#issuecomment-731497031

http://loll65o6clhutxfv4ce4rdvgugcf2aqee2ju6vsrepw6vr6l66bxtsid.onion/ -> index.html, which I have programed to redirect to the DID of the service or the DID in the fragment of the URL... this is just for demonstration purposes...

A proper DID resolver needs to do the DID -> URL conversion and redirect using server side, not client side code.

I did not write a server side resolver, but the code is basically the same as the client, see here: https://github.com/OR13/did-onion.js/blob/master/packages/hidden-service/index.html#L25

The server is currently only supporting the origin without path format here: https://github.com/OR13/did-onion.js/blob/master/packages/hidden-service/server.js#L5

OR13 commented 3 years ago

to be clear, the only required routes for did:onion are:

unrelated, but note the required escaping in markdown for:

OR13 commented 3 years ago

regarding the .jsonld extension... I am sure others will disagree, but I hate it :)

did web does not require it, https://w3c-ccg.github.io/did-method-web/#create-register

JSON-LD is a special case of JSON, and while its probably a good idea of serve the correct mimetype for the did document, I think its nice to have a vanilla.json file, because editors / browsers already know how to handle it.

did web does not currently support multiple representation types... but theoretically it may eventually split them up by files.

DID Core currently has:

here is a demo of how I used them in did:key (I would not consider this too be a the standard way, but I find it useful especially in avoiding conversion to JWK for use with 99% of of the shelf crypto libraries.

https://did.key.transmute.industries/

Hypothetically, a resolver might translate the accept resolution option like so for did:onion

ChristopherA commented 3 years ago

@or13 Is your demo still up? I'm getting "Onionsite Not Found" from Tor Browser.

OR13 commented 3 years ago

@ChristopherA its not up, I run it locally, however... I think you can run it yourself, because I checked in the private keys.