Skip to content

swift-libp2p/swift-libp2p-noise

Repository files navigation

LibP2PNoise

Swift Package Manager compatible Build & Test (macos and linux)

A LibP2P Stream Security protocol

Table of Contents

Overview

Noise is a connection security protocol. It provides a secure transport channel for swift-libp2p based on the Noise Protocol Framework. Following an initial plaintext handshake, all data exchanged between peers using swift-libp2p-noise is encrypted and protected from eavesdropping.

⚠️ Warning

This package has NOT been extensively tested in real world applications and should NOT be used in production environments. Although the actual cryptography is handled by swift-crypto, the handshake logic could, and probably does, contain a myriad of bugs. Please feel free to look over the code and submit improvements where you see fit.

Note:

Install

Include the following dependency in your Package.swift file

let package = Package(
    ...
    dependencies: [
        ...
        .package(name: "LibP2PNoise", url: "https://github.com/swift-libp2p/swift-libp2p-noise.git", .upToNextMajor(from: "0.1.0"))
    ],
    ...
        .target(
            ...
            dependencies: [
                ...
                .product(name: "LibP2PNoise", package: "swift-libp2p-noise"),
            ]),
    ...
)

Usage

Example

import LibP2PNoise

/// Tell libp2p that it can use noise to secure connections...
app.security.use( .noise )

API

Not Applicable

Contributing

Contributions are welcomed! This code is very much a proof of concept. I can guarantee you there's a better / safer way to accomplish the same results. Any suggestions, improvements, or even just critques, are welcome!

Let's make this code better together! 🤝

Credits

License

MIT © 2022 Breth Inc.