Help us shape the future of Go! Take the 2026 Go Developer Survey

message

package
v1.0.65 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeOff        = "off"
	ModeThirdParty = "third_party"
	ModeRequired   = "required"
	ModeDegraded   = "degraded"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchDecryptItem

type BatchDecryptItem struct {
	MessageID      string
	ConversationID string
	Ciphertext     string
}

type BatchDecryptItemResult

type BatchDecryptItemResult struct {
	MessageID        string
	ConversationID   string
	Status           string
	PlaintextContent string
	KeyVersion       int
	Reason           string
}

type BatchDecryptResult

type BatchDecryptResult struct {
	Items    []BatchDecryptItemResult
	Failures []BatchDecryptItemResult
}

type Cipher

type Cipher interface {
	EncryptMessage(ctx context.Context, corpID, staffID string, plaintext []byte) ([]byte, error)
	DecryptMessage(ctx context.Context, corpID, staffID string, ciphertext []byte) ([]byte, error)
}

type Client

type Client struct {
	Identity     func(context.Context, string) (Identity, error)
	OpenSession  func(context.Context, SessionOptions) (*Session, error)
	BackendReady func() bool
	PolicyCache  *PolicyCache
}

func DefaultClient

func DefaultClient() *Client

func (*Client) BatchDecryptInbound

func (c *Client) BatchDecryptInbound(ctx context.Context, rt Runtime, opts Options, items []BatchDecryptItem) (BatchDecryptResult, error)

func (*Client) DecryptInbound

func (c *Client) DecryptInbound(ctx context.Context, rt Runtime, opts Options) (DecryptResult, error)

func (*Client) PolicyDecision

func (c *Client) PolicyDecision(ctx context.Context, rt Runtime, opts Options) (PolicyDecision, error)

type DecryptResult

type DecryptResult struct {
	Layer          string
	Plaintext      string
	DingCiphertext string
	KeyVersion     int
}

type Identity

type Identity struct {
	CorpID  string
	StaffID string
}

type Options

type Options struct {
	Identity            string
	MsgType             string
	OpenConversationID  string
	ReceiverOpenTalkID  string
	RequirePolicy       bool
	Layer               string
	Ciphertext          string
	ConfigDir           string
	CLIVersion          string
	KeyServer           string
	AllowedRedirectHost string
	KeystoreDir         string
	Now                 func() time.Time
}

type Policy

type Policy struct {
	Mode                string
	Provider            string
	KeyServer           string
	AllowedRedirectHost string
	StaffIDTransform    string
	TTL                 time.Duration
	Reason              string
}

type PolicyCache

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

func NewPolicyCache

func NewPolicyCache(now func() time.Time) *PolicyCache

func (*PolicyCache) Get

func (c *PolicyCache) Get(key string) (Policy, bool)

func (*PolicyCache) Set

func (c *PolicyCache) Set(key string, policy Policy)

type PolicyDecision

type PolicyDecision struct {
	Policy  Policy
	Enabled bool
}

type Runtime

type Runtime interface {
	CallMCPReadData(product, tool string, params map[string]any) (map[string]any, error)
	CallMCPWriteDataStrict(product, tool string, params map[string]any) (map[string]any, error)
	DryRun() bool
}

Runtime is the narrow MCP surface required by the DWS message crypto layer.

type Session

type Session struct {
	Cipher  Cipher
	CorpID  string
	StaffID string
	Close   func() error
}

type SessionOptions

type SessionOptions struct {
	ConfigDir           string
	CLIVersion          string
	KeyServer           string
	AllowedRedirectHost string
	KeystoreDir         string
}

Jump to

Keyboard shortcuts

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