Skip to content

Commit 5a68fc7

Browse files
authored
Update Readme to show PEM example encapsulation.
1 parent fa54364 commit 5a68fc7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

README.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,15 @@ let res = try apns.send(notification, to: "de1d666223de85db0186f654852cc96055112
200200
```
201201

202202
### Using PEM instead of P8
203+
#### Note: this is blocking
203204
```swift
204-
var apnsConfig = try APNSwiftConfiguration(keyIdentifier: "9UC9ZLQ8YW",
205-
teamIdentifier: "ABBM6U9RM5",
206-
signer: APNSwiftSigner.init(buffer: ByteBufferAllocator().buffer(capacity: Data().count)),
207-
topic: "com.grasscove.Fern",
208-
environment: .sandbox)
209-
210-
let key = try NIOSSLPrivateKey(file: "/Users/kylebrowning/Projects/swift/Fern/development_com.grasscove.Fern.pkey", format: .pem)
211-
apnsConfig.tlsConfiguration.privateKey = NIOSSLPrivateKeySource.privateKey(key)
212-
apnsConfig.tlsConfiguration.certificateVerification = .noHostnameVerification
213-
apnsConfig.tlsConfiguration.certificateChain = try! [.certificate(.init(file: "/Users/kylebrowning/Projects/swift/Fern/development_com.grasscove.Fern.pem", format: .pem))]
205+
var apnsConfig = try APNSwiftConfiguration(
206+
privateKeyPath: "/Users/kylebrowning/Projects/swift/Fern/development_com.grasscove.Fern.pkey",
207+
pemPath: "/Users/kylebrowning/Projects/swift/Fern/development_com.grasscove.Fern.pem",
208+
topic: "com.grasscove.Fern",
209+
environment: .sandbox
210+
)
211+
let apns = try APNSwiftConnection.connect(configuration: apnsConfig, on: group.next()).wait()
214212
```
215213
### Need a completely custom arbtirary payload and dont like being typecast?
216214
APNSwift provides the ability to send rawBytes `ByteBuffer` as a payload.

0 commit comments

Comments
 (0)