Skip to content

NVMNovem/github-access-vapor

Repository files navigation

GitHubAccessVapor

GitHubAccessVapor is a Swift package for integrating GitHub App setup and installation-token generation into Vapor projects.

It provides a lightweight API to configure a GitHub access server, validate token requests, and issue GitHub installation tokens.

Platform Compatibility

This Swift package is designed to run on:

  • macOS
  • Linux

Installation

Add github-access-vapor as a dependency to your Package.swift:

// Package.swift (snippet)
dependencies: [
    .package(url: "https://github.com/NVMNovem/github-access-vapor", from: "1.0.0")
]

targets: [
    .target(
        name: "MyApp",
        dependencies: [
            .product(name: "GitHubAccessVapor", package: "github-access-vapor")
        ]
    )
]

Basic usage

Configure your Vapor app:

import Vapor
import GitHubAccess

public func configure(_ app: Application) async throws {
    try await app.configureAccessServer(project: "MyApp", accent: "34C759")
}

Set the required environment variables before starting the server:

export GITHUB_APP_ID="<your-github-app-id>"
export GITHUB_PRIVATE_KEY_PATH="/absolute/path/to/private-key.pem"

Request an installation token:

curl -X POST http://localhost:4321/github/token \
  -H "Content-Type: application/json" \
  -d '{"installationId": 12345678}'

Expected response:

{
  "token": "ghs_...",
  "expiresAt": "2026-04-19T12:34:56Z"
}

About

[Package] - A package for quickly and simply creating Github Access Servers

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages