Documentation
¶
Index ¶
- Constants
- Variables
- func ActionForOperation(operation Operation) servicepolicy.Action
- func IsRPCError(err error) bool
- func NewIdempotencyKey(operation Operation, accountRef string, requestedAt time.Time) string
- type AccountLookup
- type Adapter
- type AdapterConfig
- type AdapterMode
- type AuditMetadata
- type BackupAnonymous
- type BackupMetadata
- type Challenge
- type Credentials
- type Devices
- type KeyLookup
- type LinkedDeviceEnvelope
- type Messages
- type Operation
- type OperationEnvelope
- type OperationResult
- type OperationTransport
- type ProfileLookup
- type RPCContract
- type RPCError
- type UsernameReservation
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 ¶
Types ¶
type AccountLookup ¶
type AccountLookup interface {
LookupUsernameHash(context.Context, *accountpb.LookupUsernameHashRequest) (*accountpb.LookupUsernameHashResponse, error)
LookupUsernameLink(context.Context, *accountpb.LookupUsernameLinkRequest) (*accountpb.LookupUsernameLinkResponse, error)
}
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) 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 BackupAnonymous ¶ added in v0.6.0
type BackupAnonymous interface {
GetCdnCredentials(context.Context, *backuppb.GetCdnCredentialsRequest) (*backuppb.GetCdnCredentialsResponse, error)
GetSvrBCredentials(context.Context, *backuppb.GetSvrBCredentialsRequest) (*backuppb.GetSvrBCredentialsResponse, error)
GetMessageBackupInfo(context.Context, *backuppb.GetBackupInfoRequest) (*backuppb.GetMessageBackupInfoResponse, error)
GetMediaBackupInfo(context.Context, *backuppb.GetBackupInfoRequest) (*backuppb.GetMediaBackupInfoResponse, error)
}
type BackupMetadata ¶
type BackupMetadata interface {
SetBackupId(context.Context, *backuppb.SetBackupIdRequest) (*backuppb.SetBackupIdResponse, error)
GetBackupAuthCredentials(context.Context, *backuppb.GetBackupAuthCredentialsRequest) (*backuppb.GetBackupAuthCredentialsResponse, error)
}
type Challenge ¶
type Challenge interface {
AnswerChallenge(context.Context, *challengepb.AnswerChallengeRequest) (*challengepb.AnswerChallengeResponse, error)
}
type Credentials ¶
type Credentials interface {
GetExternalServiceCredentials(context.Context, *credentialspb.GetExternalServiceCredentialsRequest) (*credentialspb.GetExternalServiceCredentialsResponse, error)
}
type Devices ¶
type Devices interface {
GetDevices(context.Context, *devicepb.GetDevicesRequest) (*devicepb.GetDevicesResponse, error)
}
type KeyLookup ¶
type KeyLookup interface {
GetPreKeys(context.Context, *keyspb.GetPreKeysAnonymousRequest) (*keyspb.GetPreKeysAnonymousResponse, 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 Messages ¶
type Messages interface {
SendMessage(context.Context, *messagespb.SendAuthenticatedSenderMessageRequest) (*messagespb.SendMessageAuthenticatedSenderResponse, 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" )
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 OperationTransport ¶ added in v0.5.0
type OperationTransport interface {
SubmitOperation(context.Context, OperationEnvelope) (OperationResult, error)
}
type ProfileLookup ¶
type ProfileLookup interface {
GetVersionedProfile(context.Context, *profilepb.GetVersionedProfileAnonymousRequest) (*profilepb.GetVersionedProfileAnonymousResponse, 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 ¶
func NormalizeError ¶
type UsernameReservation ¶ added in v0.6.0
type UsernameReservation interface {
ReserveUsernameHash(context.Context, *accountpb.ReserveUsernameHashRequest) (*accountpb.ReserveUsernameHashResponse, error)
ConfirmUsernameHash(context.Context, *accountpb.ConfirmUsernameHashRequest) (*accountpb.ConfirmUsernameHashResponse, error)
DeleteUsernameHash(context.Context, *accountpb.DeleteUsernameHashRequest) (*accountpb.DeleteUsernameHashResponse, error)
SetUsernameLink(context.Context, *accountpb.SetUsernameLinkRequest) (*accountpb.SetUsernameLinkResponse, error)
DeleteUsernameLink(context.Context, *accountpb.DeleteUsernameLinkRequest) (*accountpb.DeleteUsernameLinkResponse, error)
}
Click to show internal directories.
Click to hide internal directories.