Skip to content

TLS example? #194

Answered by JetForMe
JetForMe asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks to @gwynne in the Vapor Discord, I've put together this working sample…

import APNS
import Foundation
import Logging
import NIOSSL


func
testSimplePush()
    async
    throws
{
    //  Find your private key & cert file, exported from Keychain as .p12…
    
    let certs = URL(fileURLWithPath: #filePath, isDirectory: false)
        .deletingLastPathComponent()
        .deletingLastPathComponent()
        .deletingLastPathComponent()
        .deletingLastPathComponent()
        .appendingPathComponent("Certs")
        .appendingPathComponent("Certificates.p12")
    Self.logger.info("Certs: \(certs.path)")
    
    let certBundle = try NIOSSLPKCS12Bundle(file: certs.path)
    let cl…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by JetForMe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant