update botp
This commit is contained in:
parent
aa28eaa713
commit
621984664d
|
@ -26,7 +26,7 @@ exports.sha1Hmac = function (key, bytes) {
|
||||||
function useWebCrypto() {
|
function useWebCrypto() {
|
||||||
return (window.crypto.subtle||window.crypto.webkitSubtle).importKey(
|
return (window.crypto.subtle||window.crypto.webkitSubtle).importKey(
|
||||||
"raw"
|
"raw"
|
||||||
, key.buffer
|
, key
|
||||||
, { name: "HMAC"
|
, { name: "HMAC"
|
||||||
, hash: { name: "SHA-1" }
|
, hash: { name: "SHA-1" }
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,10 @@ exports.sha1Hmac = function (key, bytes) {
|
||||||
["sign", "verify"] //can be any combination of "sign" and "verify"
|
["sign", "verify"] //can be any combination of "sign" and "verify"
|
||||||
)
|
)
|
||||||
*/
|
*/
|
||||||
.then(function (key) {
|
.then(function (cryptoKey) {
|
||||||
return (window.crypto.subtle||window.crypto.webkitSubtle).sign(
|
return (window.crypto.subtle||window.crypto.webkitSubtle).sign(
|
||||||
{ name: "HMAC" }
|
{ name: "HMAC" }
|
||||||
, key // from generateKey or importKey above
|
, cryptoKey // from generateKey or importKey above
|
||||||
, new Uint8Array(bytes) // ArrayBuffer of data you want to sign
|
, new Uint8Array(bytes) // ArrayBuffer of data you want to sign
|
||||||
)
|
)
|
||||||
.then(function(signature){
|
.then(function(signature){
|
||||||
|
|
Loading…
Reference in New Issue