File tree 2 files changed +2
-2
lines changed
2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { subtle } from "uncrypto" ;
1
2
import { base64 , base64Url } from "./base64" ;
2
3
import type { EncodingFormat , SHAFamily , TypedArray } from "./type" ;
3
4
@@ -11,7 +12,7 @@ export function createHash<Encoding extends EncodingFormat = "none">(
11
12
) : Promise < Encoding extends "none" ? ArrayBuffer : string > => {
12
13
const encoder = new TextEncoder ( ) ;
13
14
const data = typeof input === "string" ? encoder . encode ( input ) : input ;
14
- const hashBuffer = await crypto . subtle . digest ( algorithm , data ) ;
15
+ const hashBuffer = await subtle . digest ( algorithm , data ) ;
15
16
16
17
if ( encoding === "hex" ) {
17
18
const hashArray = Array . from ( new Uint8Array ( hashBuffer ) ) ;
Original file line number Diff line number Diff line change 1
1
import { describe , expect , it } from "vitest" ;
2
2
import { createHMAC } from "./hmac" ;
3
- import { base64Url } from "./base64" ;
4
3
5
4
describe ( "hmac module" , ( ) => {
6
5
const algorithm = "SHA-256" ;
You can’t perform that action at this time.
0 commit comments