@@ -52,29 +52,31 @@ export const cleanStringValues = (obj: { [key: string]: any }): any =>
5252export const parsePkpSignResponse = (
5353 responseData : PKPSignEndpointResponse [ ]
5454) : EcdsaSignedMessageShareParsed [ ] => {
55-
5655 const ecdsaSignedMessageShares = responseData . map ( ( { signatureShare } ) => {
57-
5856 // Determine if the object is lifted or contains a nested structure
5957 // Example scenarios this logic handles:
60- // 1. If `signatureShare` is nested (e.g., { EcdsaSignedMessageShare: { ... } }),
58+ // 1. If `signatureShare` is nested (e.g., { EcdsaSignedMessageShare: { ... } }),
6159 // it will extract the nested object (i.e., the value of `EcdsaSignedMessageShare`).
62- // NOTE: against `f8047310fd4ac97ac01ff07a7cd1213808a3396e` in this case
60+ // NOTE: against `f8047310fd4ac97ac01ff07a7cd1213808a3396e` in this case
6361 // 2. If `signatureShare` is directly lifted (e.g., { digest: "...", result: "...", share_id: "..." }),
6462 // it will treat `signatureShare` itself as the resolved object.
65- // NOTE: against `60318791258d273df8209b912b386680d25d0df3` in this case
66- // 3. If `signatureShare` is null, not an object, or does not match expected patterns,
63+ // NOTE: against `60318791258d273df8209b912b386680d25d0df3` in this case
64+ // 3. If `signatureShare` is null, not an object, or does not match expected patterns,
6765 // it will throw an error later for invalid structure.
6866 const resolvedShare =
69- typeof signatureShare === "object" &&
70- ! Array . isArray ( signatureShare ) &&
71- Object . keys ( signatureShare ) . length === 1 &&
72- typeof signatureShare [ Object . keys ( signatureShare ) [ 0 ] as keyof typeof signatureShare ] === "object"
73- ? signatureShare [ Object . keys ( signatureShare ) [ 0 ] as keyof typeof signatureShare ]
67+ typeof signatureShare === 'object' &&
68+ ! Array . isArray ( signatureShare ) &&
69+ Object . keys ( signatureShare ) . length === 1 &&
70+ typeof signatureShare [
71+ Object . keys ( signatureShare ) [ 0 ] as keyof typeof signatureShare
72+ ] === 'object'
73+ ? signatureShare [
74+ Object . keys ( signatureShare ) [ 0 ] as keyof typeof signatureShare
75+ ]
7476 : signatureShare ;
7577
76- if ( ! resolvedShare || typeof resolvedShare !== " object" ) {
77- throw new Error ( " Invalid signatureShare structure." ) ;
78+ if ( ! resolvedShare || typeof resolvedShare !== ' object' ) {
79+ throw new Error ( ' Invalid signatureShare structure.' ) ;
7880 }
7981
8082 const camelCaseShare = convertKeysToCamelCase ( resolvedShare ) ;
0 commit comments