Skip to content
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

签名验证方法 报错 #3

Open
lanxiao89 opened this issue Aug 16, 2018 · 1 comment
Open

签名验证方法 报错 #3

lanxiao89 opened this issue Aug 16, 2018 · 1 comment

Comments

@lanxiao89
Copy link

image

image
应该用什么编码?

@JoinAnywhere
Copy link

nodejs 的签名方法有问题
虽然没找到原始的签名要求文档,但是看在线demo,最终gzcompress的串,需要转换为base64, 然后再替换期中的 +, /, - 三个符号

function base64Encode(str) {
if(typeof str == 'object') {
return str.toString('base64');
}
str = str.replace(/+/g,'*').replace(///g,'-').replace(/=/g,'_');
let result = Buffer.from(str).toString('base64');
return result;
}

这一段应该改成
function base64Encode(str) {
if(typeof str == 'object') {
str = str.toString('base64');
}
str = str.replace(/+/g,'*').replace(///g,'-').replace(/=/g,'_');

return str;

}

实际已在项目中验证这个改动,不然 roomsig 的获取会报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants