Replies: 3 comments
-
While collaborating on potential LSAT authentication schemes and use cases, @guggero think we may have come up with a protocol where discharge macaroons could be used in conjunction with LSATs for a kind of OAuth-like system. To echo @aakselrod’s comment, this will certainly need some security analysis. That said, a few months ago, before the LSAT announcement, I built a proof of concept system that does something similar, using discharge macaroons issued by a server with access to a lightning node. The functionality is built into a Nodejs middleware that can be put in front of API routes where you require payment (the middleware is called boltwall, LSAT version in progress) and implemented in a live application called Prism Reader. The goal for the protocol is to enable a platform, called a resource server (like Prism Reader) to check with another user’s lightning node, or an authorization server (the terminology for the roles is from RFC 6749 - The OAuth 2.0 Authorization Framework) that the client has permission to access some endpoint in the event that, for example, the endpoint provides data that “belongs” to the authorization server for which it wants to get paid before allowing access. This allows for systems that avoid the need for trusting a third party to collect payments and provide regular payouts since the resource server just needs to check with the authorizing server that they received payment (by validating a discharge macaroon). Using discharge macaroons also allows the authorizing server (i.e. the lightning node) to add their own caveats, further attenuating a macaroon. They could, for example, say:
One problem with the way this is currently implemented in boltwall is that it requires a large degree of coordination between the authorizing and resource servers in order to become aware of a shared “Caveat Key” used to sign and verify the discharge macaroon. In normal OAuth and OAuth-like systems, there is usually some kind of registration step and/or a handshake to establish these shared tokens. This might make sense when you have 1 platform using just a handful of OAuth services (e.g. Google, Facebook, and GitHub login). This becomes much more burdensome if, for example, every user on Medium.com or Twitter were required to support this type of interaction in order to receive payments. The solution @guggero and I came up with is an Integrated Encryption Scheme that uses the known public key of the authorizing server’s node ( Note that this is not currently possible with LND as it does not expose its private key in any way to perform the necessary KDF and ECC operations needed. @guggero has a PoC update to LND that will enable the protocol posted here: #3777 The IES protocol would look something like this:
A code implementation of the above can be found and tested here #3777 (for lnd) and here (for client implementation in Node.js). You must build the branch of lnd with the Below is a diagram illustrating in more detail the authorization flow between client, resource server, and authorization server including the use of LSATs. It is designed assuming a server running a boltwall middleware compatible with LSATs. |
Beta Was this translation helpful? Give feedback.
-
+1 IES protocol. |
Beta Was this translation helpful? Give feedback.
-
Converting this to a discussion. Issues can be created if and when any one picks this one up for development. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently,
lnd
doesn't use third-party caveats at all. This is a very powerful feature for using external state as auth information for a request; however, its use requires some detailed security analysis. Third party caveats allow external services to discharge them, thus allowing such features as:Beta Was this translation helpful? Give feedback.
All reactions