← All projects

go

Go implementation of the aice-otp channel contract: Channel interface, typed errors, recipient validator, MockChannel reference, and a YAML conformance harness — no first-party provider adapters.

  • Go 100%
git@gitlab.com:aice-lab/otp/go.git

Latest release

v1.0.0 ·

README

aice-otp — Go

pipeline status coverage report

Go implementation of the aice-otp channel contract defined at https://gitlab.com/aice-lab/otp/spec.

This module provides the Go-side primitives for delivering one-time passcodes through provider-agnostic channels (sms, whatsapp, email). It defines the Channel interface, request/response types, typed errors, and a conformance harness that runs the spec’s vector suite against any adapter implementation.

Concrete provider adapters (e.g. SSL Wireless, Robi, 360dialog, Mailjet) are not bundled here — implement the Channel interface in your own package and run the conformance harness against it.

Status

FeatureState
pkg/otp public surface (Channel, SendRequest, SendResponse, typed errors)Available
Validate (E.164 phones, RFC 5321 mailboxes)Available
internal/mockchannel reference adapter for testsAvailable
internal/conformance runner for spec vectorsAvailable
First-party provider adapters (SMS, WhatsApp, email)Out of scope for this repo

Quickstart

package main

import (
    "context"
    "fmt"

    "gitlab.com/aice-lab/otp/go/pkg/otp"
)

func main() {
    var ch otp.Channel = myProvider{} // your Channel implementation

    resp, err := ch.Send(context.Background(), otp.SendRequest{
        Channel:   otp.ChannelSMS,
        Recipient: "+8801712345678",
        Code:      "123456",
        Locale:    "en-US",
    })
    if err != nil {
        fmt.Println("send failed:", err)
        return
    }

    fmt.Println("delivery:", resp.DeliveryID, "status:", resp.Status)
}

Install

go get gitlab.com/aice-lab/otp/go@latest

Module path: gitlab.com/aice-lab/otp/go. Go 1.23+.

Development

git clone git@gitlab.com:aice-lab/otp/go.git
cd go
go test ./...
go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out

License

Source: FSL-1.1-Apache-2.0 (see LICENSE and LICENSE.FAQ.md).

Documentation

Full documentation: https://otp.aice-lab.org

Contributing

See CONTRIBUTING.md. All commits require DCO sign-off.

Reporting security issues

See SECURITY.md. Do not open public issues for vulnerabilities.

This is a snapshot generated from GitLab. For the live README, see the project page.