-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/webusb eth #22
base: hotfix/fix_http_header_build_error
Are you sure you want to change the base?
Conversation
src/common/apdu.ts
Outdated
]) | ||
return response; | ||
} | ||
function get_pubkey( path: string, ins: number, verify_flag: boolean) : Buffer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
最好在JS中所有方法都统一成camelCase
src/common/apdu.ts
Outdated
return genApdu(0x80,ins,p1,0x00,Buffer.from(path,"ascii")); | ||
} | ||
function register_address( ins: number, data: Buffer = Buffer.alloc(0)) : Buffer { | ||
return genApdu(0x80,ins,0x00,0x00,data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0x80和 0x00 最好有个常量定义,不然代码读起来比较累
src/errors/index.ts
Outdated
* Error thrown when a devices returned a non success status. | ||
* the error.statusCode is one of the `StatusCodes` exported by this library. | ||
*/ | ||
export function TransportStatusError(statusCode: number): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这边可以尝试用ts 的写法 class TransportStatusError extends Error {}
src/hw-app-eth/Eth.ts
Outdated
fee: string, | ||
} | ||
const eth_apdu = ethApdu(); | ||
const remapTransactionRelatedErrors = (e) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段代码应该是 Ledger 特有的代码,我们应该用不到
src/hw-app-eth/Eth.ts
Outdated
let pri_key = Buffer.from("18e14a7b6a307f426a94f8114701e7c8e774e7f9a47e2c2035db29a206321725","hex"); | ||
let ha256_hash = utils.sha256(utils.sha256(data_to_sign)).substring(2) | ||
let bind_signature = secp256k1.ecdsaSign(Buffer.from(ha256_hash,"hex"),pri_key).signature | ||
let bind_signature_r =(bind_signature[0]>0x80) ? Buffer.concat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
接下来的一些代码看起来和上面很像,不能合并到一起吗?
src/hw-app-eth/utils.ts
Outdated
} | ||
|
||
// TODO use bip32-path library | ||
export function splitPath(path: string): number[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上面还有一个splitPath 这两个方法用哪个?
src/hw-transport-webusb/webusb.ts
Outdated
if (legacy) return legacy; | ||
|
||
const mm = usbProductId >> 8; | ||
console.log("mmmmmmmm:"+mm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
部分没用的日志可以删除掉了
…/webusb-eth # Conflicts: # src/demo.ts # src/hw-transport-mocker/RecordStore.ts
…to feature/webusb-eth
Refactor/webusb eth
No description provided.