coffrify-go

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2026 License: MIT

README

coffrify-go

Official Go SDK for Coffrify — encrypted file transfer infrastructure.

Install

go get github.com/coffrify/coffrify-go

Quickstart

package main

import (
    "context"
    "fmt"
    "log"

    coffrify "github.com/coffrify/coffrify-go/coffrify"
)

func main() {
    client := coffrify.New("cfy_live_...")  // or os.Getenv("COFFRIFY_API_KEY")
    ctx := context.Background()

    transfer, err := client.Transfers.Create(ctx, &coffrify.CreateTransferParams{
        Files: []coffrify.File{
            {Name: "rapport.pdf", Size: 1_240_000, MimeType: "application/pdf"},
        },
        ExpiresInHours: 72,
        MaxDownloads:   10,
        Password:       "secret",
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Share URL:", transfer["share_url"])
}

Webhook verification

import (
    "io"
    "net/http"
    coffrify "github.com/coffrify/coffrify-go/coffrify"
)

func handleWebhook(w http.ResponseWriter, r *http.Request) {
    body, _ := io.ReadAll(r.Body)
    result := coffrify.VerifyWebhook(
        string(body),
        r.Header.Get("X-Coffrify-Signature"),
        os.Getenv("COFFRIFY_WEBHOOK_SECRET"),
        300, // 5 min tolerance
    )
    if !result.Valid {
        http.Error(w, result.Reason, http.StatusBadRequest)
        return
    }
    eventType := result.Event["type"].(string)
    // ...
    w.WriteHeader(http.StatusOK)
}

License

MIT

Directories

Path Synopsis
Package coffrify provides the official Go client for Coffrify — encrypted file transfer infrastructure.
Package coffrify provides the official Go client for Coffrify — encrypted file transfer infrastructure.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL