MultipeerKit Documentation Beta

Structure Multipeer​Configuration.​Security

public struct Security

Configures security-related aspects of the multipeer connection.

Nested Type Aliases


public typealias InvitationHandler = (Peer, Data?, @escaping (Bool) -> Void) -> Void



public init(identity: [Any]?, encryptionPreference: MCEncryptionPreference, invitationHandler: @escaping InvitationHandler)



var identity: [Any]?

An array of information that can be used to identify the peer to other nearby peers.

The first object in this array should be a SecIdentity object that provides the local peer’s identity.

The remainder of the array should contain zero or more additional SecCertificate objects that provide any intermediate certificates that nearby peers might require when verifying the local peer’s identity. These certificates should be sent in certificate chain order.

Check Apple's MCSession docs for more information.


var encryptionPreference: MCEncryptionPreference

Configure the level of encryption to be used for communications.


var invitationHandler: InvitationHandler

A custom closure to be used when handling invitations received by remote peers.

It receives the Peer that sent the invitation, a custom Data value that's a context that can be used to customize the invitation, and a closure to be called with true to accept the invitation or false to reject it.

The default implementation accepts all invitations.


let `default`

The default security configuration, which has no identity, uses no encryption and accepts all invitations.