Skip to content
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

[Waiting] mod: Lit protocol token gated casts #92

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

davidfurlong
Copy link
Contributor

@davidfurlong davidfurlong commented Nov 24, 2023

This PR:

  • Adds the lit-protocol and lit-protocol-renderer mini-apps

There's a blocker right now for releasing this Miniapp:
Lit protocol is upgrading to v3 (mainnet) which is called Habanero, and is scheduled for December. The v3 testnet is not persistent, is unstable, and has breaking changes every couple days, requiring a node package update to fix.

Other todos:

  • hot reloading breaks the encryption endpoint locally (somewhere in the lit library), tbd what happens in prod.
  • unclear whether signature needs to have the same chainid as the access control rules (maybe not)
  • needs changesets
  • Deployment needs new env variables
  • Consider whether/how this complies by the iOS app store rules, and add a permission or categorization for it "From 3.1.1 "Apps may allow users to view their own NFTs, provided that NFT ownership does not unlock features or functionality within the app."
  • Required JSON schema array

It creates links using the new gateway: https://github.com/mod-protocol/gateway , which would need to be deployed first

Demo (broken due to cayenne downtime)
Kapture 2023-11-24 at 13 25 30

Depends on #101

Copy link

changeset-bot bot commented Nov 24, 2023

⚠️ No Changeset found

Latest commit: 3543d13

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Nov 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2023 2:52pm
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2023 2:52pm
example-nextjs-shadcn ❌ Failed (Inspect) Nov 27, 2023 2:52pm

Copy link
Contributor

@stephancill stephancill left a comment

Choose a reason for hiding this comment

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

Looking good. Left some notes

```

## `/api/cast-embeds-metadata/by-url`
Copy link
Contributor

Choose a reason for hiding this comment

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

We should consider renaming these endpoints. I suggest /embed-metadata/by-casts and /embed-metadata/by-urls

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed, but that means no backwards compat; will have to let integrators know

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed, but that means no backwards compat; will have to let integrators know

examples/api/next.config.js Outdated Show resolved Hide resolved
return decryptedString;
}

// async function retrieveFromIrys(id: string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be removed if was used for debugging

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm yeah this was an alternate way of doing it, that I thought may make sense in some scenarios

// 1. Encryption
// <Blob> encryptedString
// <Uint8Array(32)> dataToEncryptHash`
const { ciphertext, dataToEncryptHash } = await LitJsSdk.encryptString(
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming encryption is happening on server to save client bundle size?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, also Mini-apps can't load arbitrary JS today

Copy link
Contributor Author

Choose a reason for hiding this comment

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

theoretically this backend function here could be run a secure JS env on a client; not sure how much their lib depends on node apis directly

packages/core/src/manifest.ts Outdated Show resolved Hide resolved
packages/core/src/renderer.ts Outdated Show resolved Hide resolved
turbo.json Outdated Show resolved Hide resolved
Comment on lines +7 to +11
{
type: "textarea",
ref: "plaintext",
placeholder: "Content to token gate",
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why this doesn't use the cast text content?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good question - the cast contents includes mentions (that won't work) and special renderers (like textcuts) that Mini-apps can't directly use. Additionally casts include embeds that we can't easily render if we added them to the encrypted contents, and token gated casts would probably still include or be able to include the cast body; so it'd be a bit confusing to have the cast text appearing/disappearing, or for it to somehow be encrypted when submitted.

In short, I'm not sure our abstractions are particularly close to supporting it in a graceful manner

packages/miniapp-registry/src/index.ts Outdated Show resolved Hide resolved
@davidfurlong davidfurlong force-pushed the feat/token-gated-casts branch from 73aea35 to 3543d13 Compare November 27, 2023 14:47
@davidfurlong davidfurlong changed the title Miniapp: token gated casts Miniapp: Lit protocol token gated casts Dec 1, 2023
@davidfurlong davidfurlong changed the title Miniapp: Lit protocol token gated casts [Blocked] Miniapp: Lit protocol token gated casts Dec 1, 2023
@davidfurlong davidfurlong changed the title [Blocked] Miniapp: Lit protocol token gated casts [Blocked] miniapp: Lit protocol token gated casts Dec 1, 2023
@davidfurlong davidfurlong changed the title [Blocked] miniapp: Lit protocol token gated casts [Waiting] mod: Lit protocol token gated casts Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants