Giter Site home page Giter Site logo

go-sign's Introduction

签名解决方法

好处

  • 数据完整性验证: 数字签名可以用来验证数据的完整性,确保数据在传输或存储过程中没有被篡改。
  • 身份认证: 数字签名可以用来验证数据的发送者身份,确保接收者可以确定数据来自可信的发送者。

算法

支持签名:

支持 http grpc js 端调用

http示例

http客户端,服务端

JS通过WebAssembly交互示例

js调用go签名

  • 关于使用tinygo的wasm文件编译(仓库wasm文件已编译好)
 GOARCH=wasm GOOS=js   tinygo build -o js/example/main.wasm  -target wasm    js/example/wasm.go
  • 签名方法
// 示例数据对象,必须为对象,数据随意,支持无限级
const data = {
    value: 42,
    val:"wo de我",
};

// 固定示例配置对象
const config = {
    t: 12345, //时间戳
    nonce: "wefw23swdwef", //随机数
    secret: 'mysecret', //密钥,视算法定,现为hmac-sha256
};
var res = signEncode.call(this, data, config);
console.log(res)
{
    "signature": "MTZlNGJkNmU3NThkM2FlMjRjM2U0ZDVkOTU5MTYxMjVkMWRlZDllZDg1OGNjZDBiNjliMTQwODFkYjhkNmE0NA==",
    "str": "nonce=wefw23swdwef&t=12345&val=wo+de%E6%88%91&value=42",
    "err": ""
}

grpc示例

开发中

go-sign's People

Watchers

jan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.