Swiftpack.co - irlmob/IRLLicencingMiddleware as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by irlmob.
irlmob/IRLLicencingMiddleware 1.0.1
🛃 Protect your `Vapor application` with a `Middleware` Licencing mechanisms
⭐️ 0
🕓 1 year ago
macOS
.package(url: "https://github.com/irlmob/IRLLicencingMiddleware.git", from: "1.0.1")

IRLLicencingMiddleware

Documentation Language MIT License

🛃 Protect your Vapor application with a Middleware Licencing mechanisms.

Overview

Use this struct to set up license Middleware in a Vapor application. Call the LicencingMiddleware/setup(in:ignoredPathroot:) method to add the middleware to the application.

  • Note: A LicencingMiddleware instance can also include a LicencingCopyrightNotice instance, which will be printed out to the console when LicencingMiddleware/setup(in:ignoredPathroot:) is called.

  • Warning: You should perform this setup as the very first step during your application configuration to protect the usage of the application. It will then validate every Request to the application against a valid licence.

Dependencies

Getting Started

Getting started with IRLLicencingMiddleware is easy. Simply add the code to your project, distribute your Framework or Application as a closed source, and lock your code to be usable only with a valid license and email. Once your client verifies the license, your code will be able to run with confidence, knowing that it is fully licensed and secure.

IRLLicencing primarily uses SwiftPM as its build tool, so we recommend using that as well. If you want to depend on IRLLicencing in your own project, it's as simple as adding a dependencies clause to your Package.swift:

dependencies: [
    .package(url: "https://github.com/irlmob/IRLLicencingMiddleware.git", from: "1.0.1")
]

Swift 5.7 and newer (swift-tools-version:5.7)

    dependencies: [ "IRLLicencingMiddleware" ]

Using Xcode Package support

If your project is set up as an Xcode project and you're using Xcode 11+, you can add IRLLicencingMiddleware as a dependency to your Xcode project by clicking File -> Swift Packages -> Add Package Dependency. In the upcoming dialog, please enter https://github.com/irlmob/IRLLicencingMiddleware.git and click Next twice. Finally, select the targets you are planning to use (here IRLLicencingMiddleware) and click finish. Now will be able to import IRLLicencingMiddleware (as well as all the other targets you have selected) in your project.

Usage

  • Initialize this struct to set up license middleware in your Vapor application, see LicencingMiddleware/init(notice:licence:)
  • Call the LicencingMiddleware/setup(in:ignoredPathroot:) method to add the middleware to the application.

Example:

// configures your application
public func configure(_ app: Application) async throws {
    // Licence
    let publicKey: String =
    """
    -----BEGIN PUBLIC KEY-----
    MM...ABC
    -----END PUBLIC KEY-----
    
    """
    
    // Middleware Injection
    try await LicencingMiddleware(notice:  .init(year: "2023",
                                                 copyright: "Company Inc. Headquarter on the moon",
                                                 copyrighter: "Company Inc.",
                                                 projectName: "Example Project",
                                                 subProjectName: "Frontend App",
                                                 version: "v1.0.0"),
                                   licence: try .fromEnv(with: publicKey))
    .setup(in: app)

    // ... Continue setup ...
   }

MIT License

Copyright (c) 2023 iRLMobile

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

GitHub

link
Stars: 0
Last commit: 10 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

v1.0.1
1 year ago

IRLLicencingMiddleware v1.0.1

Use this middleware to protect your Vapor Application with a licence associated to a domain.

In this version:

  • Documentation
  • Made public

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics