true if a resolved provider was installed, false if this
call no-op'd for any of the reasons above — callers that need some form
of refresh either way (e.g. after a certificate rotation) can fall back to
a plain invalidate() when this returns false.
Resolve the private key via
certificateManager.getPrivateKey()(decrypting with the manager's configuredprivateKeyPassphrase/privateKeyProviderif needed) and install it assecureObject's provider.No-ops — leaves the current provider untouched — when:
hasUserProvidedProvideristrue(the secure object was constructed with a user-suppliedcertificateKeyPairProvider— the existing escape hatch; the caller owns key resolution entirely), orcertificateFileis"<in-memory>"/"<unknown>"), orcertificateManagerdoes not expose an asyncgetPrivateKey()(e.g. a bareICertificateStorerather than a fullOPCUACertificateManager), orcertificateManagerexposesisPrivateKeyManaged()and it returnsfalse— noprivateKeyPassphrase/privateKeyProviderconfigured, so the on-disk key is always plaintext and a plainDiskCertificateKeyPairProvideralready handles it correctly (crucially, including re-reading a manually replaced key afterinvalidate()— a ResolvedCertificateKeyPairProvider deliberately does not do that, see its doc — so swapping to one when there is nothing to decrypt would be a regression, not just unnecessary work), orsecureObject.privateKeyFileis not the certificate manager's own managed key path (certificateManager.privateKey, i.e.own/private/private_key.pem).getPrivateKey()only ever resolves that file — a caller that overrodeprivateKeyFileto point elsewhere (a key entirely outside the PKI folder) is opting out of certificate-manager-managed key handling, and that external file is read as plaintext exactly as before.Propagates
PrivateKeyPassphraseRequiredError(fromnode-opcua-crypto) unchanged when the on-disk key is encrypted and no, or the wrong, passphrase is configured on the certificate manager. Callers typically catch this to raise a more actionable, product-specific error message.