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 ,
@@ -233,16 +234,6 @@ const createSignature = async (data: string): Promise<string> => {
233234 return String ( signature ) ;
234235} ;
235236
236- const calculateSHA256 = async ( data : string ) : Promise < string > => {
237- const hashBuffer = await crypto . subtle . digest (
238- "SHA-256" ,
239- new TextEncoder ( ) . encode ( data ) ,
240- ) ;
241- return Array . from ( new Uint8Array ( hashBuffer ) )
242- . map ( ( b ) => b . toString ( 16 ) . padStart ( 2 , "0" ) )
243- . join ( "" ) ;
244- } ;
245-
246237const handleClaimEvent = async ( data : {
247238 payload : DropPayload ;
248239 alias : string ;
@@ -307,7 +298,7 @@ const handleDropEvent = async (data: {
307298 try {
308299 // Calculate SHA256 hash
309300 logger . log ( "Calculating SHA256 hash for payload" ) ;
310- payload . sha256 = await calculateSHA256 (
301+ payload . sha256 = sha256 (
311302 JSON . stringify ( {
312303 id : payload . id ,
313304 objects : payload . objects ,
You can’t perform that action at this time.
0 commit comments