service

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransportH2GRPC   = "h2/grpc"
	AuthAuthenticated = "authenticated"
	AuthAnonymous     = "anonymous"
)

Variables

View Source
var (
	ErrMissingAdapterTransport = errors.New("missing Signal service operation transport")
	ErrUnsupportedAdapterMode  = errors.New("unsupported Signal service adapter mode")
	ErrEndpointNotAllowed      = errors.New("endpoint outside approval allowlist")
)
View Source
var (
	ErrMissingOperationID       = errors.New("missing operation_id")
	ErrMissingOperation         = errors.New("missing operation")
	ErrUnsupportedOperation     = errors.New("unsupported operation")
	ErrMissingIdempotencyKey    = errors.New("missing idempotency_key")
	ErrMissingAccountRef        = errors.New("missing account_ref")
	ErrMissingRequestedAt       = errors.New("missing requested_at")
	ErrMissingLinkedDevice      = errors.New("missing linked-device envelope")
	ErrMissingDeviceDisplayName = errors.New("missing device_display_name")
	ErrMissingConsentRef        = errors.New("missing consent_ref")
	ErrMissingConsentExpiry     = errors.New("missing consent_expires_at")
	ErrMissingRevocationURI     = errors.New("missing revocation_uri")
	ErrMissingUnlinkProofRef    = errors.New("missing unlink_proof_ref")
)
View Source
var ErrForbiddenAuditField = errors.New("forbidden audit field")

Functions

func ActionForOperation added in v0.5.0

func ActionForOperation(operation Operation) servicepolicy.Action

func IsRPCError

func IsRPCError(err error) bool

func NewIdempotencyKey added in v0.5.0

func NewIdempotencyKey(operation Operation, accountRef string, requestedAt time.Time) string

Types

type Adapter added in v0.5.0

type Adapter struct {
	// contains filtered or unexported fields
}

func NewAdapter added in v0.5.0

func NewAdapter(transport OperationTransport, cfg AdapterConfig) (*Adapter, error)

func (*Adapter) Endpoint added in v0.5.0

func (a *Adapter) Endpoint() string

func (*Adapter) Mode added in v0.5.0

func (a *Adapter) Mode() AdapterMode

func (*Adapter) SubmitOperation added in v0.5.0

func (a *Adapter) SubmitOperation(ctx context.Context, env OperationEnvelope) (OperationResult, error)

type AdapterConfig added in v0.5.0

type AdapterConfig struct {
	Mode             AdapterMode
	Endpoint         string
	ApprovalPackage  servicepolicy.ApprovalPackage
	ApprovalTime     time.Time
	RequestedActions []servicepolicy.Action
}

type AdapterMode added in v0.5.0

type AdapterMode string
const (
	AdapterModeFake    AdapterMode = "fake"
	AdapterModeSandbox AdapterMode = "sandbox"
	AdapterModeLive    AdapterMode = "live"
)

type AuditMetadata added in v0.5.0

type AuditMetadata struct {
	AccountHash string
	// contains filtered or unexported fields
}

func NewAuditMetadata added in v0.5.0

func NewAuditMetadata(accountRef string, fields map[string]string) (AuditMetadata, error)

func (AuditMetadata) CopyFields added in v0.5.0

func (m AuditMetadata) CopyFields() map[string]string

type Challenge

type Challenge interface {
	AnswerChallenge(context.Context, *challengepb.AnswerChallengeRequest) (*challengepb.AnswerChallengeResponse, error)
}

type Devices

type Devices interface {
	GetDevices(context.Context, *devicepb.GetDevicesRequest) (*devicepb.GetDevicesResponse, error)
}

type LinkedDeviceEnvelope added in v0.5.0

type LinkedDeviceEnvelope struct {
	DeviceDisplayName string
	ConsentRef        string
	ConsentExpiresAt  time.Time
	RevocationURI     string
	UnlinkProofRef    string
}

func (LinkedDeviceEnvelope) Validate added in v0.5.0

func (e LinkedDeviceEnvelope) Validate() error

type Operation added in v0.5.0

type Operation string
const (
	OperationRegister   Operation = "register"
	OperationLinkDevice Operation = "link_device"
	OperationSend       Operation = "send"
	OperationReceive    Operation = "receive"
	OperationChallenge  Operation = "challenge"
	OperationUsername   Operation = "username"
	OperationBackup     Operation = "backup"
	OperationSVR        Operation = "svr"
)

func (Operation) Valid added in v0.5.0

func (o Operation) Valid() bool

type OperationEnvelope added in v0.5.0

type OperationEnvelope struct {
	OperationID    string
	Operation      Operation
	IdempotencyKey string
	AccountRef     string
	RequestedAt    time.Time
	LinkedDevice   *LinkedDeviceEnvelope
	Audit          AuditMetadata
}

func (OperationEnvelope) Validate added in v0.5.0

func (e OperationEnvelope) Validate() error

type OperationResult added in v0.5.0

type OperationResult struct {
	OperationID  string
	Status       string
	ChallengeRef string
	SecretRefs   map[string]string
	Audit        AuditMetadata
}

type OperationTransport added in v0.5.0

type OperationTransport interface {
	SubmitOperation(context.Context, OperationEnvelope) (OperationResult, error)
}

type RPCContract added in v0.6.0

type RPCContract struct {
	Operation             string
	FullMethodName        string
	Transport             string
	Auth                  string
	UpstreamTag           string
	IntroducedAfter       string
	RequestType           string
	ResponseType          string
	RedactedRequestFields []string
}

func AccountContracts added in v0.6.0

func AccountContracts() []RPCContract

func BackupContracts added in v0.6.0

func BackupContracts() []RPCContract

type RPCError

type RPCError struct {
	Code    string
	Message string
}

func NormalizeError

func NormalizeError(err error) RPCError

Jump to

Keyboard shortcuts

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