Skip to content

Init Stellar Custom Auth Guide #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

spacesailor24
Copy link
Contributor

This guide walks through the lit-access-control-conditions-stellar code.

There a huge caveat to this implementation:

:::danger
The following code that performs the signature verification for `stellarPublicKey` is unsafe and shouldn't be used in production. Because we're verifying an arbitrary `stellarAuthTxHash` was signed by the corresponding private key for `stellarPublicKey`, and not actually verifying an app specific message was signed, a user could all this Lit Action with any signed transaction and the corresponding public key and be able to authenticate with that address.
Ideally, for a production implementation, you would want to implement the [SEP-10](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0010.md) standard.
:::

Verified

This commit was signed with the committer’s verified signature.
spacesailor24 Wyatt Barnes
Copy link

netlify bot commented May 16, 2024

Deploy Preview for lit-dev-docs ready!

Name Link
🔨 Latest commit 9df7dc9
🔍 Latest deploy log https://app.netlify.com/sites/lit-dev-docs/deploys/66464ba7941d0000080b03ef
😎 Deploy Preview https://deploy-preview-286--lit-dev-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@alexvotofuture
Copy link
Contributor

This guide walks through the lit-access-control-conditions-stellar code.

There a huge caveat to this implementation:

:::danger
The following code that performs the signature verification for `stellarPublicKey` is unsafe and shouldn't be used in production. Because we're verifying an arbitrary `stellarAuthTxHash` was signed by the corresponding private key for `stellarPublicKey`, and not actually verifying an app specific message was signed, a user could all this Lit Action with any signed transaction and the corresponding public key and be able to authenticate with that address.
Ideally, for a production implementation, you would want to implement the [SEP-10](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0010.md) standard.
:::

If the intention of this guide is to be used by novice devs, should we wait to release until it's re-written with that safer approach?

});
await litNodeClient.connect();
```
Once we have a connected client, the next step is authenticating and authorizing ourselves to use the Lit Network. To do this, we're going to instantiate an instance of ethers.js `Wallet`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be helpful to call out that an Ethereum client is necessary to authenticate to Lit (if that's the case), even though we're interacting with Stellar, and that this wallet will not be used for anything related to funds.

nonce: await litNodeClient!.getLatestBlockhash(),
litNodeClient,
});
return await generateAuthSig({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the AuthSig part of this still relevant given Auth Unification?

);
```

And then create a [Session Signature](../../../sdk/authentication/session-sigs/intro.md):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this only work on Cayenne? Will this guide be followable if they're using Manzano/Habanero? If not, we should provide a link to some static doc (Maybe the "Migrating from earlier versions" page?) where they can learn all the changes needed to get it working on those networks and, eventually Datil so we don't have to update this again.

@alexvotofuture
Copy link
Contributor

Seems like the guide addresses the motivation stated at the beginning. I wasn't caught up on the brief for this one, and I don't have much background on Stellar, but from what I can follow in the guide it looks like it would be capable of checking whether an address is listed as potentially approved (via simulation) in a smart contract on Stellar and return a signed confirmation of that through the Lit Action.

One question I have is whether we're responsible for showing the pre-step of creating that address beforehand and adding it to the contract separately, so that you can actually demonstrate a success here. That same address and private key used to upload it to the contract would have to then be passed into the guide code. If that's covered by our users elsewhere cool, but if not we'd want to show that so we can follow it end to end.

Looking good though! Left other comments inline, so once we figure these out (especially that major security caveat you mentioned) and someone else confirms this works we can move to merge. Thanks @spacesailor24 !

@spacesailor24
Copy link
Contributor Author

One question I have is whether we're responsible for showing the pre-step of creating that address beforehand and adding it to the contract separately, so that you can actually demonstrate a success here.

@alexvotofuture It is included in the code README, so I can just copy/paste it into the guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants