基于区块链的毕业设计Welcome to @oneclickdapp/ethereum-auth 👋 – 欢迎使用@oneclickdapp/ethereum auth👋

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Welcome to @oneclickdapp/ethereum-auth 👋 – 欢迎使用@oneclickdapp/ethereum auth👋 是一篇很好的国外资料

Welcome to @oneclickdapp/ethereum-auth 👋

Welcome to @oneclickdapp/ethereum-auth 👋 - 欢迎使用@oneclickdapp/ethereum auth👋 Welcome to @oneclickdapp/ethereum-auth 👋 - 欢迎使用@oneclickdapp/ethereum auth👋

Welcome to @oneclickdapp/ethereum-auth 👋 - 欢迎使用@oneclickdapp/ethereum auth👋

Auth provider for RedwoodJS using Ethererum

  • @ethersproject/providers v5.0.4 docs

This project was inspired from a lengthy tutorial I wrote on adding Ethereum auth to Redwood. If you’re planning to implement your own custom auth to RedwoodJS (aside from Ethereum), you may find it useful. Now the process is much more streamlined. Enjoy!

Setup

If you haven’t created a redwood app yet, you can do so now. See my introductory blog post for more help getting started.

yarn create redwood-app myDapp 

First let’s do some scaffolding and install the necessary packages.

cd myDapp yarn rw generate auth ethereum

Next we need to update our models, by adding address to User mode, and create a new AuthDetail model.

// api/db/schema.prisma model User {   id    String     @id @default(uuid())   address String  @unique   authDetail AuthDetail }  model AuthDetail {   id    String     @id @default(uuid())   nonce String   timestamp DateTime @default(now()) }

Now use the scaffold tool.

yarn rw generate scaffold user

Awesomesauce. Let’s spin up our database!

yarn rw db save yarn rw db up

If you

We’re halfway there. Now let’s create the service to verify Ethereum signatures.

yarn rw generate service ethereumAuth  

Done! Continue normally using the official RedwoodJS docs on authentication: https://redwoodjs.com/docs/authentication

Usage

TODO

Additional Resources

Once you have things working, these resources may be helpful for adapting this package to your use-case. More docs/examples are welcome here!

Implementing Role-based Access Control (RBAC)

https://redwoodjs.com/cookbook/role-based-access-control-rbac

Demo

Contributing

If you’re only editing this package, then you only need to update @oneclickdapp/ethereum-auth in your test redwood app. You can ignore the rest of this section.

If you’re changes affect how RedwoodJS uses this package, then you’ll need to do a bit more work. Things that may be affected include decoders in @redwoodjs/api, frontend tooling in @redwoodjs/auth, and CLI generators in @redwoodjs/cli. Feel free to adjust the commands below depending on which of these packages your changes affect.

Unfortunately, yarn link will not work for redwood local development (sorry!). Please follow the Local Package Registry Emulation method here https://github.com/redwoodjs/redwood/blob/main/CONTRIBUTING.md#local-development

Once verdaccio is running, use this command to build the package you need.

./tasks/publish-local ./packages/auth # or ./tasks/publish-local ./packages/api # or ./tasks/publish-local ./packages/cli

Then in your test redwood app

rm -rf ./node_modules/@redwoodjs/auth rm -rf ./node_modules/@redwoodjs/api rm -rf ./node_modules/@redwoodjs/cli  yarn upgrade @redwoodjs/auth@dev @redwoodjs/api@dev @redwoodjs/api@cli --no-lockfile --registry http://localhost:4873/

TODO

Add a Generator for Redwood CLI

Web side

There is an additional @redwoodjs/web import.

// web/src/index.js import { RedwoodProvider, FatalErrorBoundary } from "@redwoodjs/web";  // Changes to add  import createGraphQLClient import {   RedwoodProvider,   FatalErrorBoundary,   createGraphQLClient } from "@redwoodjs/web";

Then do the standard pattern. If you want to use a different auth server, you can substitute graphQLClient with your own.

import EthereumAuthClient from 'ethereumAuthClient'  const graphQLClient = createGraphQLClient(); const client = new EthereumAuthClient({client: graphQLClient})  <AuthProvider client={ethereumAuthClient} type="Ethereum"> 

Server side

  • [] add decoder
  • [] Generate stubs for the services/auth/auth.js and add ethereumjs-util and eth-sig-util
  • [] Generate stubs for lib/auth.js and add getCurrentUser()
  • [] Update the graphql function with getCurrentUser?

Create a new Ethereum JWT decoder

Add additional wallet providers

  • walletlink v1.0.0
  • @walletconnect/web3-provider v1.0.13

Publishing

yarn publish --dry-run

Author

👤 Patrick Gallagher blockchainbuddha@gmail.com

  • Website: https://patrickgallagher.dev
    • Twitter: @pi0neerpat
    • GitHub: @pi0neerpat

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator


欢迎使用@oneclickdapp/ethereum auth👋

Welcome to @oneclickdapp/ethereum-auth 👋 - 欢迎使用@oneclickdapp/ethereum auth👋Welcome to @oneclickdapp/ethereum-auth 👋 - 欢迎使用@oneclickdapp/ethereum auth👋

使用etherum为RedwoodJS提供身份验证这个项目的灵感来自于我写的一篇关于向Redwood添加以太坊eth身份验证的冗长教程。如果您计划实现自己的自定义RedwoodJS身份验证(除了以太坊eth),您可能会发现它很有用。现在这个过程更加简化了。好好享受!

如果您还没有创建红木应用程序,现在就可以创建。请参阅我的介绍性博客文章,以获取更多入门帮助。

  • @ethersprroject/providers v5.0.4 docs

首先,让我们搭建一些脚手架并安装必要的软件包。

设置

接下来,我们需要通过向用户模式添加地址来更新模型,并创建一个新的AuthDetail模型。

yarn create redwood-app myDapp 

现在使用scaffold工具。

cd myDapp yarn rw generate auth ethereum

辣酱。让我们启动数据库!

// api/db/schema.prisma model User {   id    String     @id @default(uuid())   address String  @unique   authDetail AuthDetail }  model AuthDetail {   id    String     @id @default(uuid())   nonce String   timestamp DateTime @default(now()) }

如果你

yarn rw generate scaffold user

我们已经走到一半了。现在让我们创建服务来验证以太坊eth签名。

yarn rw db save yarn rw db up

完成!继续正常使用官方RedwoodJS文档进行身份验证:https://redwoodjs.com/docs/authentication

TODO

yarn rw generate service ethereumAuth  

一旦您的工作正常,这些资源可能有助于使此包适应您的用例。这里欢迎更多的文档/示例!

使用

https://redwoodjs.com/cookbook/role-based-access-control-rbac

附加资源

如果您只编辑此软件包,则只需在测试红木应用程序中更新@oneclickdapp/ethereum auth。您可以忽略本节的其余部分。

实现基于角色的访问控制(RBAC)

如果更改影响RedwoodJS使用此包的方式,则需要做更多的工作。可能受到影响的内容包括@redwoodjs/api中的解码器、@redwoodjs/auth中的前端工具以及@redwoodjs/CLI中的CLI生成器。根据您的更改所影响的包,可以随意调整下面的命令。

✨ 演示

贡献

不幸的是,yarn link不适用于redwood local development(抱歉!)。请遵循本地包注册表模拟方法https://github.com/redwoodjs/redwood/blob/main/contribution.md#本地-开发

运行verdaccio后,使用此命令构建所需的包。

然后在您的test redwood app中有一个额外的@redwoodjs/web导入。

然后执行标准模式。如果您想使用不同的身份验证服务器,可以用自己的graphQLClient代替。

./tasks/publish-local ./packages/auth # or ./tasks/publish-local ./packages/api # or ./tasks/publish-local ./packages/cli

👤 帕特里克·加拉赫blockchainfoddha@gmail.com

rm -rf ./node_modules/@redwoodjs/auth rm -rf ./node_modules/@redwoodjs/api rm -rf ./node_modules/@redwoodjs/cli  yarn upgrade @redwoodjs/auth@dev @redwoodjs/api@dev @redwoodjs/api@cli --no-lockfile --registry http://localhost:4873/

TODO

为Redwood CLI添加生成器

Web端

给一个⭐️如果这个项目对你有帮助!

// web/src/index.js import { RedwoodProvider, FatalErrorBoundary } from "@redwoodjs/web";  // Changes to add  import createGraphQLClient import {   RedwoodProvider,   FatalErrorBoundary,   createGraphQLClient } from "@redwoodjs/web";

此自述文件是使用❤️ 通过自述md generator

import EthereumAuthClient from 'ethereumAuthClient'  const graphQLClient = createGraphQLClient(); const client = new EthereumAuthClient({client: graphQLClient})  <AuthProvider client={ethereumAuthClient} type="Ethereum"> 

服务器端

  • []添加解码器
  • []为服务生成存根/auth/授权.js并添加ethereumjs util和eth sig util,为lib生成存根/授权.js并添加getCurrentUser()
  • []用getCurrentUser更新graphql函数?
  • walletlink v1.0.0

创建新的以太坊ethJWT解码器

添加其他钱包提供商

  • @walletconnect/web3 provider v1.0.13
  • 网站:https://patrickgallagher.dev推特:@pi0neerpat GitHub:@pi0neerpat

发布

yarn publish --dry-run

作者

👤 Patrick Gallagher blockchainbuddha@gmail.com

  • 推特:@pi0neerpat

展示您的支持

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/19472.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Welcome to @oneclickdapp/ethereum-auth 👋 – 欢迎使用@oneclickdapp/ethereum auth👋

提供最优质的资源集合

立即查看 了解详情