目录
目录README.md

SwiftyHawk

Swift Version PackageManager Platforms License Twitter: @cpageler93

SwiftyHawk is a Swift implementation of Hawk HTTP authentication scheme.

Install

Carthage

To install SwiftyHawk with Carthage, setup Carthage for your project as described in the Quick Start.

Then add this line to your Cartfile:

github "cpageler93/SwiftyHawk" ~> 0.1.4

Swift Package Manager

To install SwiftyHawk with Swift Package Manager add SwiftyHawk to your Package.swift

// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "Dependencies",
    products: [
        .library(name: "Dependencies", targets: ["Dependencies"]),
    ],
    dependencies: [
        .package(url: "https://github.com/cpageler93/SwiftyHawk", from: "0.1.4")
    ],
    targets: [
        .target(name: "Dependencies", dependencies: ["SwiftyHawk"])
    ]
)

Usage

// init credentials
let hawkCredentials = Hawk.Credentials(id: "your hawk id", key: "your hawk key", algoritm: .sha256)

// modify each outgoing http request
let headerResult = try? Hawk.Client.header(uri: "baseurl + path",
                                           method: "GET", // POST, PATCH, ...
                                           credentials: hawkCredentials,
                                           nonce: "FOOBAR")
httpRequest.headers["Authorization"] = headerResult?.headerValue ?? ""

Need Help?

Please submit an issue on GitHub.

License

This project is licensed under the terms of the MIT license. See the LICENSE file.

关于
51.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号