Giter Club home page Giter Club logo

tiny.scatter's Issues

我用原生实现了js 的注入ReactNative 怎么实现注入

其实原生也不是算完整的实现了注入,只是我把account写死了,然后在一个DApp 的demo上读取出来了,不太会用怎么去在点击授权的地方调用方法传入account 和私钥,或者说给一个选择列表 让用户选择哪一个账户

ReactNative 上我理解的是 在一个页面里面夹在一个DApp 的URL,然后injectedJavaScript 这个js 怎么写,tiny_scatter.js 加上

`""// 'value' as string. "SIG_K1_..."
function onSignEOSMessageSuccessful(id, value) {
BrigeAPI.sendResponse(id, value)
}

    // 'value' as string. '{"signatures":["SIG_K1_..."]}'
    function onSignEOSSuccessful(id, value) {
        BrigeAPI.sendResponse(id, JSON.parse(value))
    }
    
    // 'error' as string
    function onSignEOSError(id, error) {
        BrigeAPI.sendError(id, {"type": "signature_rejected", "message": error, "code": 402, "isError": true})
    }

    TinyIdentitys.initEOS("\(account)", "\(publicKey)");
    
    const scatter = new TinyScatter();
    scatter.loadPlugin(new TinyEOS());
    
    window.scatter = scatter;
    
    document.dispatchEvent(new CustomEvent('scatterLoaded'));"`

拼接成的字符串注入?
还是怎么操作,望指导

undefined is not an object

undefined is not an object (evaluating 'window.webkit.messageHandles')
现在包这个错,另外问下示例中:XMethod.signEOS.rawValue,这个具体要实现什么?

关于如何处理 scatter 的 sign arbitrary

收到的数据

{
"publicKey":"xxxxxx",
"data":"yyyyyyy",
"whatfor":"wwwww",
"isHash":false
}

publicKey 用于找到对应的私钥,若是注入webview应该可以假定就是当前账户
data 需要签名的数据
whatfor UI显示用
isHash 决定签名方式

  • true 使用 ecc.Signature.signHash
  • false 使用 ecc.sign

返回数据

只需要将签名结果返回, 不是对象也不是数组,就是只 "SIG_K1_..." 这样一个字符串

  • BrigeAPI.sendResponse(1111111, "SIG_K1_...")

关于XWebView

XWebView是 webView.addJavascriptInterface(new JSApi (), "XWebView");里面的“XWebView”吗?

系统兼容

不知道@xuewu是否尝试过低版本系统
魅族 Android 6.0 ,多数Dapp不能使用,newDex进入提示版本过低

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.