oxen-io / oxen-storage-server

Storage server for Oxen Service Nodes
MIT License
28 stars 48 forks source link

Delegated subaccounts #477

Closed jagerman closed 8 months ago

jagerman commented 1 year ago

This removes the (faulty) current subkey support and replaces it with subaccounts.

This is not phased in with a hard fork as the current subkey approach is not used and should not be as it can leak the master private key to the subkey holder if used. (Session clients still shouldn't use it before storage server starts returning 19.4, but it doesn't hurt to have it work before then and is easier than version-gating it).

Subaccounts achieve largely the same thing as subkeys, but instead of attempting to mutate the master key into a subkey, we now simply allow any key to be used for the request as long as it carries a token + signature from the account owner authorizing the subkey to be used.

Additionally this prefixes the subaccount token with the network id (e.g. 03 for 03xxxxx pubkeys) and adds extra bits so that different types of subkeys can be issued:

Alongside subaccount revocation (which replaces the previous subkey revocation) we now have some additional related functionality: