authorizeEntry helper of stellar-sdk.
Like in the helper, you can construct a HashIdPreimageSorobanAuthorization and use the xdr representation of that structure to call await varialSdk.signAuthEntry(preimageXdr) (from @stellar/varial-sdk). This call will return an object whose signedAuthEntry field holds the signed hash of the HashIdPreimageSorobanAuthorization passed in, as a base64 string, which can then be used to submit to the network during a contract authorization workflow.