vapor / apns

Helpful extensions and abstractions for using APNSwift
MIT License
115 stars 30 forks source link

Unable to Instantiate APNSClientConfiguration with tls certificate as in doc #55

Closed ladiesman218 closed 8 months ago

ladiesman218 commented 8 months ago

According to documentation https://docs.vapor.codes/advanced/apns/#configuration

image

But this cause errors in Xcode

image

And there is only one function named tls in APNSClientConfiguration struct, which looks like this:

public static func tls(
    privateKey: NIOSSLPrivateKeySource,
    certificateChain: [NIOSSLCertificateSource]
) -> Self {
    Self(method: .tls(privateKey: privateKey, certificateChain: certificateChain))
}

Is the documentation outdated?

kylebrowning commented 8 months ago

YEs it is, you should be able to just load the key however you want, but we removed the convenience method for loading it from disk, as that's not proper standard practice

ladiesman218 commented 8 months ago
image

I don't really know how to fix this...It's thrown from here.

Condition says if self.certificateChain.count > 0 then it gonna throw this error, so I tried set certificateChain to an empty array:

let apnsConfig = APNSClientConfiguration(
      authenticationMethod: .tls(
             privateKey: privateKey,
             certificateChain: [chain]
         ),
      environment: .sandbox
)

This time the error message changed to: "TLSConfiguration.privateKey is not supported. You can still use this configuration..."

kylebrowning commented 8 months ago

That is an https://github.com/AsyncHttpClient/async-http-client question, I would ask over there

hakarim740-com-ra commented 2 weeks ago

YEs it is, you should be able to just load the key however you want, but we removed the convenience method for loading it from disk, as that's not proper standard practice @kylebrowning

What someone with a TLS certificate do if the JWT token is not available?

kylebrowning commented 2 weeks ago

YEs it is, you should be able to just load the key however you want, but we removed the convenience method for loading it from disk, as that's not proper standard practice

@kylebrowning

What someone with a TLS certificate do if the JWT token is not available?

Load it however you want and pass it as a string.