File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 },
88 "dependencies" : {
99 "@caido/primevue" : " 0.1.2" ,
10+ "js-sha256" : " ^0.11.1" ,
1011 "mitt" : " 3.0.1" ,
1112 "openpgp" : " 6.1.1" ,
1213 "pinia" : " 3.0.2" ,
Original file line number Diff line number Diff line change 1+ import { sha256 } from "js-sha256" ;
12import {
23 createMessage ,
34 decrypt ,
@@ -99,7 +100,7 @@ const processMessages = async (
99100 const payload = JSON . parse ( decryptedData ) as DropPayload ;
100101
101102 // Verify SHA256 hash
102- const calculatedHash = await calculateSHA256 (
103+ const calculatedHash = sha256 (
103104 JSON . stringify ( {
104105 id : payload . id ,
105106 objects : payload . objects ,
@@ -225,16 +226,6 @@ const createSignature = async (data: string): Promise<string> => {
225226 return String ( signature ) ;
226227} ;
227228
228- const calculateSHA256 = async ( data : string ) : Promise < string > => {
229- const hashBuffer = await crypto . subtle . digest (
230- "SHA-256" ,
231- new TextEncoder ( ) . encode ( data ) ,
232- ) ;
233- return Array . from ( new Uint8Array ( hashBuffer ) )
234- . map ( ( b ) => b . toString ( 16 ) . padStart ( 2 , "0" ) )
235- . join ( "" ) ;
236- } ;
237-
238229const handleClaimEvent = async ( data : {
239230 payload : DropPayload ;
240231 alias : string ;
@@ -321,7 +312,7 @@ const handleDropEvent = async (data: {
321312 try {
322313 // Calculate SHA256 hash
323314 logger . log ( "Calculating SHA256 hash for payload" ) ;
324- payload . sha256 = await calculateSHA256 (
315+ payload . sha256 = sha256 (
325316 JSON . stringify ( {
326317 id : payload . id ,
327318 objects : payload . objects ,
You can’t perform that action at this time.
0 commit comments