基于区块链的毕业设计@metamask/eth-sig-util – @元掩码/eth-sig-util

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计@metamask/eth-sig-util – @元掩码/eth-sig-util 是一篇很好的国外资料

@metamask/eth-sig-util

A small collection of Ethereum signing functions.

You can find usage examples here

Available on NPM

Installation

yarn add @metamask/eth-sig-util

or

npm install @metamask/eth-sig-util

Methods

concatSig(v, r, s)

All three arguments should be provided as buffers.

Returns a continuous, hex-prefixed hex value for the signature, suitable for inclusion in a JSON transaction’s data field.

normalize(address)

Takes an address of either upper or lower case, with or without a hex prefix, and returns an all-lowercase, hex-prefixed address, suitable for submitting to an ethereum provider.

personalSign (privateKeyBuffer, msgParams)

msgParams should have a data key that is hex-encoded data to sign.

Returns the prefixed signature expected for calls to eth.personalSign.

recoverPersonalSignature (msgParams)

msgParams should have a data key that is hex-encoded data unsigned, and a sig key that is hex-encoded and already signed.

Returns a hex-encoded sender address.

signTypedData (privateKeyBuffer, msgParams, version)

Sign typed data according to EIP-712. The signing differs based upon the version, which is explained in the table below.

Data should be under data key of msgParams. The method returns prefixed signature.

Version Description
V1 This is based on an early version of EIP-712 that lacked some later security improvements, and should generally be neglected in favor of V3.
V3 Based on EIP 712, except that arrays and recursive data structures are not supported
V4 Based on EIP 712, including support for arrays and recursive data types.

recoverTypedSignature ({data, sig}, version)

Recover the address of the account used to sign the provided signature. The version parameter must match the version the signature was created with.

Expects the same data that were used for signing. sig is a prefixed signature.

typedSignatureHash (typedData)

Return hex-encoded hash of typed data params according to EIP712 schema.

extractPublicKey (msgParams)

msgParams should have a data key that is hex-encoded data unsigned, and a sig key that is hex-encoded and already signed.

Returns a hex-encoded public key.

Contributing

Setup

  • Install Node.js version 12
    • If you are using nvm (recommended) running nvm use will automatically choose the right node version for you.
  • Install Yarn v1
  • Run yarn setup to install dependencies and run any requried post-install scripts
    • Warning: Do not use the yarn / yarn install command directly. Use yarn setup instead. The normal install command will skip required post-install scripts, leaving your development environment in an invalid state.

Testing and Linting

Run yarn test to run the tests once. To run tests on file changes, run yarn test:watch.

Run yarn lint to run the linter, or run yarn lint:fix to run the linter and fix any automatically fixable issues.

Release & Publishing

The project follows the same release process as the other libraries in the MetaMask organization. The GitHub Actions action-create-release-pr and action-publish-release are used to automate the release process; see those repositories for more information about how they work.

  1. Choose a release version.

    • The release version should be chosen according to SemVer. Analyze the changes to see whether they include any breaking changes, new features, or deprecations, then choose the appropriate SemVer version. See the SemVer specification for more information.
  2. If this release is backporting changes onto a previous release, then ensure there is a major version branch for that version (e.g. 1.x for a v1 backport release).

    • The major version branch should be set to the most recent release with that major version. For example, when backporting a v1.0.2 release, you’d want to ensure there was a 1.x branch that was set to the v1.0.1 tag.
  3. Trigger the workflow_dispatch event manually for the Create Release Pull Request action to create the release PR.

    • For a backport release, the base branch should be the major version branch that you ensured existed in step 2. For a normal release, the base branch should be the main branch for that repository (which should be the default value).
    • This should trigger the action-create-release-pr workflow to create the release PR.
  4. Update the changelog to move each change entry into the appropriate change category (See here for the full list of change categories, and the correct ordering), and edit them to be more easily understood by users of the package.

    • Generally any changes that don’t affect consumers of the package (e.g. lockfile changes or development environment changes) are omitted. Exceptions may be made for changes that might be of interest despite not having an effect upon the published package (e.g. major test improvements, security improvements, improved documentation, etc.).
    • Try to explain each change in terms that users of the package would understand (e.g. avoid referencing internal variables/concepts).
    • Consolidate related changes into one change entry if it makes it easier to explain.
    • Run yarn auto-changelog validate --rc to check that the changelog is correctly formatted.
  5. Review and QA the release.

    • If changes are made to the base branch, the release branch will need to be updated with these changes and review/QA will need to restart again. As such, it’s probably best to avoid merging other PRs into the base branch while review is underway.
  6. Squash & Merge the release.

    • This should trigger the action-publish-release workflow to tag the final release commit and publish the release on GitHub.
  7. Publish the release on npm.

    • Be very careful to use a clean local environment to publish the release, and follow exactly the same steps used during CI.
    • Use npm publish --dry-run to examine the release contents to ensure the correct files are included. Compare to previous releases if necessary (e.g. using https://unpkg.com/browse/[package name]@[package version]/).
    • Once you are confident the release contents are correct, publish the release using npm publish.

@metamask/eth sig util

以太坊eth签名函数的小集合

您可以在NPM上找到使用示例

添加@metamask/eth sig util

安装方法

or

NPM [email protected]/eth sig util

concatSig(v,r,s)

个性化签名(privateKeyBuffer,msgParams)

所有三个参数都应作为缓冲区提供

返回签名的连续十六进制前缀十六进制值,适合包含在JSON事务的数据字段中

签名类型数据(privateKeyBuffer,sig},版本)

采用大写或小写地址,带或不带十六进制前缀,并返回适合提交给以太坊eth提供商的全小写十六进制前缀地址

类型信号灰分(类型数据)

msgParams应该有一个十六进制编码的数据密钥来签名

返回调用eth.personalSign所需的前缀签名

提取公钥(msgParams)

msgParams应该有一个十六进制编码的无符号数据密钥和一个十六进制编码且已签名的sig密钥

返回十六进制编码的发件人地址

贡献

根据EIP-712对类型数据进行签名。签名根据版本不同而不同,如下表所示

数据应位于msgParams的数据键下。该方法返回带前缀的签名

Version Description
V1 这是基于早期版本的EIP-712,该版本缺乏一些后期的安全改进,通常应忽略该版本而代之以V3
V3 基于EIP 712,但不支持基于EIP 712的数组和递归数据结构,包括对数组和递归数据类型的支持
V4 Based on EIP 712, including support for arrays and recursive data types.

设置

恢复用于签署所提供签名的帐户地址。version参数必须与创建签名时使用的版本匹配

需要与签名时使用的数据相同的数据。sig是一个带前缀的签名

测试和起毛;发布

根据EIP712模式返回类型化数据参数的十六进制编码哈希

extractPublicKey (msgParams)

msgParams应该有一个十六进制编码的无符号数据密钥和一个十六进制编码且已签名的sig密钥

返回十六进制编码的公钥

Contributing

Setup

  • 安装Node.js版本12如果您使用的是nvm(推荐),运行nvm的用户将自动为您选择正确的节点版本
  • 安装Thread v1
  • 运行Thread安装程序以安装依赖项并运行任何所需的安装后脚本警告:不要直接使用Thread/Thread安装命令。使用纱线设置代替。普通的install命令将跳过所需的安装后脚本,使您的开发环境处于无效状态

Testing and Linting

运行纱线测试以运行测试一次。要对文件更改运行测试,请运行纱线测试:观察

运行纱线棉绒以运行棉绒,或运行纱线棉绒:修复以运行棉绒并修复任何自动修复的问题

Release & Publishing

该项目遵循与MetaMask组织中其他库相同的发布过程。GitHub操作创建发布pr和操作发布发布用于自动化发布过程;有关它们如何工作的更多信息,请参阅这些存储库

  1. 选择发布版本。应根据SemVer选择发布版本。分析更改以查看是否包括任何重大更改、新功能或弃用,然后选择适当的SemVer版本。有关更多信息,请参阅SemVer规范
  2. 如果此版本正在将更改反向移植到以前的版本上,那么请确保该版本有一个主要的版本分支(例如,v1反向移植版本有1.x)。主版本分支应设置为具有该主版本的最新版本。例如,在对v1.0.2版本进行后移植时,您需要确保有一个1.x分支被设置为v1.0.1标记
  3. 为创建发布请求操作手动触发工作流u调度事件,以创建发布请购单。对于后端口发布,基本分支应为您在步骤2中确保存在的主要版本分支。对于正常发布,基本分支应该是该存储库的主分支(默认值)。这将触发“创建发布pr工作流”操作以创建发布pr。
  4. 更新变更日志,将每个变更条目移动到相应的变更类别中(参见此处了解变更类别的完整列表和正确顺序),并对其进行编辑,以便于软件包用户理解。通常,不影响包使用者的任何更改(例如锁文件更改或开发环境更改)都会被忽略。尽管对已发布的软件包没有影响,但对可能感兴趣的更改(例如,主要测试改进、安全改进、改进的文档等)可能会有例外。尝试用软件包用户能够理解的术语解释每个更改(例如,避免引用内部变量/概念)。将相关更改合并到一个更改条目中(如果这样更易于解释)。运行自动更改日志验证–rc以检查更改日志的格式是否正确
  5. 审查并保证发布。如果对基本分支进行了更改,则需要使用这些更改更新发布分支,并且需要重新启动review/QA。因此,在进行审查时,最好避免将其他PRs合并到基本分支中
  6. 这将触发操作发布发布工作流,以标记最终发布提交并在GitHub上发布发布
  7. 要非常小心地使用干净的本地环境来发布版本,并严格遵循CI过程中使用的相同步骤

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

www.interchains.cc

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

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

提供最优质的资源集合

立即查看 了解详情