File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,19 @@ impl<C: BlsSignatureImpl> Bls<C>
6464 JsError :: new ( & format ! ( "Failed to serialize signature to JSON: {}" , e) )
6565 ) ?;
6666
67- let signature_bytes = signature_json. as_bytes ( ) . to_vec ( ) ;
68- Ok ( Uint8Array :: from ( signature_bytes. as_slice ( ) ) )
67+ // Parse the signature JSON to get the ProofOfPossession value
68+ let signature_json: serde_json:: Value = serde_json:: from_str ( & signature_json) ?;
69+ let proof_of_possession = signature_json
70+ . get ( "ProofOfPossession" )
71+ . ok_or_else ( || JsError :: new ( "Missing ProofOfPossession field" ) ) ?
72+ . as_str ( )
73+ . ok_or_else ( || JsError :: new ( "ProofOfPossession is not a string" ) ) ?;
74+
75+ // Convert hex string to bytes
76+ let proof_bytes = hex:: decode ( proof_of_possession)
77+ . map_err ( |e| JsError :: new ( & format ! ( "Failed to decode hex: {}" , e) ) ) ?;
78+
79+ Ok ( Uint8Array :: from ( proof_bytes. as_slice ( ) ) )
6980 }
7081
7182 pub fn verify (
You can’t perform that action at this time.
0 commit comments