had a little oopsie with the toHex function
This commit is contained in:
parent
dbe3cb97b2
commit
f8f59abf43
2 changed files with 2 additions and 2 deletions
|
|
@ -7,7 +7,7 @@ import {
|
||||||
import { Device } from "./device.ts";
|
import { Device } from "./device.ts";
|
||||||
|
|
||||||
function toHex(data: Uint8Array): string {
|
function toHex(data: Uint8Array): string {
|
||||||
return Array.from(data).map((b) => b.toString(16)).join("");
|
return Array.from(data).map((b) => b.toString(16).padStart(1, "0")).join("");
|
||||||
}
|
}
|
||||||
async function generateHMAC(key: string, message: string) {
|
async function generateHMAC(key: string, message: string) {
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
<script>
|
<script>
|
||||||
function preventDefault(e) {alert(); e.preventDefault()}
|
function preventDefault(e) {alert(); e.preventDefault()}
|
||||||
function toHex(data) {
|
function toHex(data) {
|
||||||
return Array.from(data).map((b) => b.toString(16)).join("");
|
return Array.from(data).map((b) => b.toString(16).padStart(1, "0")).join("");
|
||||||
}
|
}
|
||||||
async function generateHMAC(key, message) {
|
async function generateHMAC(key, message) {
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue