Skip to content

Commit 9bf85d6

Browse files
fix: validate envelope child visible signatures
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 88606b3 commit 9bf85d6

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

src/services/SigningRequirementValidator.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44
*/
55

66
import { ACTION_CODES } from '../helpers/ActionMapping.ts'
7+
import { hasVisibleElementsForCurrentUser } from './visibleElementsService'
78

89
interface SignStore {
910
errors: Array<{ code?: number; [key: string]: unknown }>
1011
document?: {
1112
signers?: Array<{ me?: boolean; signRequestId?: number }> | null
1213
visibleElements?: Array<{ signRequestId?: number }> | null
14+
files?: Array<{
15+
signers?: Array<{ me?: boolean; signRequestId?: number }> | null
16+
visibleElements?: Array<{ signRequestId?: number }> | null
17+
}> | null
1318
}
1419
}
1520

@@ -110,14 +115,8 @@ export class SigningRequirementValidator {
110115
return false
111116
}
112117

113-
const signer = this.signStore.document?.signers?.find(row => row.me) || {}
114-
const signRequestId = (signer as { signRequestId?: number }).signRequestId
115-
116-
if (!signRequestId) {
117-
return false
118-
}
119-
120-
const visibleElements = this.signStore.document?.visibleElements || []
121-
return visibleElements.some(row => row.signRequestId === signRequestId)
118+
return hasVisibleElementsForCurrentUser(
119+
(this.signStore.document ?? {}) as Parameters<typeof hasVisibleElementsForCurrentUser>[0],
120+
)
122121
}
123122
}

0 commit comments

Comments
 (0)