types

package
v0.0.0-...-12813c1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ATTACHMENT_BUFFER_SIZE = 8192

ATTACHMENT_BUFFER_SIZE is the size of the buffer in bytes used for decrypting attachments. Larger values of this will consume more memory, but may decrease the overall time taken to decrypt an attachment.

Variables

View Source
var (
	MessageCSVHeaders = []string{
		"_ID",
		"DATE_SENT",
		"DATE_RECEIVED",
		"DATE_SERVER",
		"THREAD_ID",
		"RECIPIENT_ID",
		"RECIPIENT_DEVICE_ID",
		"TYPE",
		"BODY",
		"READ",
		"CT_L",
		"EXP",
		"M_TYPE",
		"M_SIZE",
		"ST",
		"TR_ID",
		"SUBSCRIPTION_ID",
		"RECEIPT_TIMESTAMP",
		"DELIVERY_RECEIPT_COUNT",
		"READ_RECEIPT_COUNT",
		"VIEWED_RECEIPT_COUNT",
		"MISMATCHED_IDENTITIES",
		"NETWORK_FAILURES",
		"EXPIRES_IN",
		"EXPIRE_STARTED",
		"NOTIFIED",
		"QUOTE_ID",
		"QUOTE_AUTHOR",
		"QUOTE_BODY",
		"QUOTE_MISSING",
		"QUOTE_MENTIONS",
		"QUOTE_TYPE",
		"SHARED_CONTACTS",
		"UNIDENTIFIED",
		"LINK_PREVIEWS",
		"VIEW_ONCE",
		"REACTIONS_UNREAD",
		"REACTIONS_LAST_SEEN",
		"REMOTE_DELETED",
		"MENTIONS_SELF",
		"NOTIFIED_TIMESTAMP",
		"SERVER_GUID",
		"MESSAGE_RANGES",
		"STORY_TYPE",
		"PARENT_STORY_ID",
		"EXPORT_STATE",
		"EXPORTED",
		"SCHEDULED_DATE",
	}

	RecipientCSVHeaders = []string{
		"_ID",
		"UUID",
		"USERNAME",
		"PHONE",
		"EMAIL",
		"GROUP_ID",
		"GROUP_TYPE",
		"BLOCKED",
		"MESSAGE_RINGTONE",
		"MESSAGE_VIBRATE",
		"CALL_RINGTONE",
		"CALL_VIBRATE",
		"NOTIFICATION_CHANNEL",
		"MUTE_UNTIL",
		"COLOR",
		"SEEN_INVITE_REMINDER",
		"DEFAULT_SUBSCRIPTION_ID",
		"MESSAGE_EXPIRATION_TIME",
		"REGISTERED",
		"SYSTEM_DISPLAY_NAME",
		"SYSTEM_PHOTO_URI",
		"SYSTEM_PHONE_LABEL",
		"SYSTEM_PHONE_TYPE",
		"SYSTEM_CONTACT_URI",
		"SYSTEM_INFO_PENDING",
		"PROFILE_KEY",
		"PROFILE_KEY_CREDENTIAL",
		"SIGNAL_PROFILE_NAME",
		"PROFILE_FAMILY_NAME",
		"PROFILE_JOINED_NAME",
		"SIGNAL_PROFILE_AVATAR",
		"PROFILE_SHARING",
		"LAST_PROFILE_FETCH",
		"UNIDENTIFIED_ACCESS_MODE",
		"FORCE_SMS_DELETION",
		"STORAGE_SERVICE_KEY",
		"DIRTY",
		"MENTION_SETTING",
		"STORAGE_PROTO",
		"CAPABILITIES",
		"LAST_GV1_MIGRATE_REMINDER",
		"LAST_SESSION_RESET",
		"WALLPAPER",
		"WALLPAPER_FILE",
		"ABOUT",
		"ABOUT_EMOJI",
		"SYSTEM_FAMILY_NAME",
		"SYSTEM_GIVEN_NAME",
		"EXTRAS",
		"GROUPS_IN_COMMON",
		"CHAT_COLORS",
		"CUSTOM_CHAT_COLORS",
		"BADGES",
		"PNI",
		"DISTRIBUTION_LIST_ID",
		"NEEDS_PNI_SIGNATURE",
		"UNREGISTERED_TIMESTAMP",
		"HIDDEN",
		"REPORTING_TOKEN",
		"SYSTEM_NICKNAME",
	}

	ThreadCSVHeaders = []string{
		"_ID",
		"DATE",
		"MEANINGFUL_MESSAGES",
		"RECIPIENT_ID",
		"READ",
		"TYPE",
		"ERROR",
		"SNIPPET",
		"SNIPPET_TYPE",
		"SNIPPET_URI",
		"SNIPPET_CONTENT_TYPE",
		"SNIPPET_EXTRAS",
		"UNREAD_COUNT",
		"ARCHIVED",
		"STATUS",
		"DELIVERY_RECEIPT_COUNT",
		"READ_RECEIPT_COUNT",
		"EXPIRES_IN",
		"LAST_SEEN",
		"HAS_SENT",
		"LAST_SCROLLED",
		"PINNED",
		"UNREAD_SELF_MENTION_COUNT",
	}

	CallCSVHeaders = []string{
		"_ID",
		"CALL_ID",
		"MESSAGE_ID",
		"PEER",
		"TYPE",
		"DIRECTION",
		"EVENT",
	}

	GroupsCSVHeaders = []string{
		"_ID",
		"GROUP_ID",
		"RECIPIENT_ID",
		"TITLE",
		"AVATAR_ID",
		"AVATAR_KEY",
		"AVATAR_CONTENT_TYPE",
		"AVATAR_RELAY",
		"TIMESTAMP",
		"ACTIVE",
		"AVATAR_DIGEST",
		"MMS",
		"MASTER_KEY",
		"REVISION",
		"DECRYPTED_GROUP",
		"EXPECTED_V2_ID",
		"FORMER_V1_MEMBERS",
		"DISTRIBUTION_ID",
		"DISPLAY_AS_STORY",
		"AUTH_SERVICE_ID",
		"LAST_FORCE_UPDATE_TIMESTAMP",
	}

	GroupMembershipCSVHeaders = []string{
		"_ID",
		"GROUP_ID",
		"RECIPIENT_ID",
		"UNIQUE",
	}

	GroupReceiptsCSVHeaders = []string{
		"_ID",
		"MMS_ID",
		"ADDRESS",
		"STATUS",
		"TIMESTAMP",
		"UNIDENTIFIED",
	}
)

CSV column headers.

View Source
var ProtoCommitHash = "d6610f0"

ProtoCommitHash is the commit hash of the Signal Protobuf spec.

Functions

func StatementToStringArray

func StatementToStringArray(sql *signal.SqlStatement) []string

StatementToStringArray formats a SqlStatement fairly literally as an array. Null parameters are left empty.

Types

type BackupFile

type BackupFile struct {
	FileSize  int64
	CipherKey []byte
	MacKey    []byte
	Mac       hash.Hash
	IV        []byte
	Counter   uint32
	// contains filtered or unexported fields
}

BackupFile stores information about a given backup file.

Decrypting a backup is done by consuming the underlying file buffer. Attemtping to read from a BackupFile after it is consumed will return an error.

Closing the underlying file handle is the responsibilty of the programmer if implementing the iteration manually, or is done as part of the Consume method.

func NewBackupFile

func NewBackupFile(path, password string) (*BackupFile, error)

NewBackupFile initialises a backup file for reading using the provided path and password.

func (*BackupFile) Close

func (bf *BackupFile) Close() error

func (*BackupFile) Consume

func (bf *BackupFile) Consume(fns ConsumeFuncs) error

Consume iterates over the backup file using the fields in the provided ConsumeFuncs. When a BackupFrame is encountered, the matching function will run.

If any image-related functions are nil (e.g., AttachmentFunc) the default will be to discard the next *n* bytes, where n is the Attachment.Length.

The underlying file is closed at the end of the method, and the backup file should be considered spent.

func (*BackupFile) DecryptAttachment

func (bf *BackupFile) DecryptAttachment(length uint32, out io.Writer) error

DecryptAttachment reads the attachment immediately next in the file's bytes, using a streaming intermediate buffer of size ATTACHMENT_BUFFER_SIZE.

func (*BackupFile) Frame

func (bf *BackupFile) Frame() (*signal.BackupFrame, error)

Frame returns the next frame in the file.

func (*BackupFile) Slurp

func (bf *BackupFile) Slurp() ([]*signal.BackupFrame, error)

Slurp consumes the entire BackupFile and returns a list of all frames contained in the file. Note that after calling this function, the underlying file buffer will be empty and the file should be considered dropped. Calling any function on the backup file after calling Slurp will fail.

Note that any attachments in the backup file will not be handled.

Closes the underlying file handler afterwards. The backup file should be considered exhausted.

type ConsumeFuncs

type ConsumeFuncs struct {
	AttachmentFunc func(*signal.Attachment) error
	AvatarFunc     func(*signal.Avatar) error
	StatementFunc  func(*signal.SqlStatement) error
}

ConsumeFuncs stores parameters for a Consume operation.

func DiscardConsumeFuncs

func DiscardConsumeFuncs(bf *BackupFile) ConsumeFuncs

type MultiWriter

type MultiWriter struct {
	io.Writer
	// contains filtered or unexported fields
}

MultiWriter is a convenience wrapper around an io.Writer to allow multiple consecutive (safe) writes.

func (*MultiWriter) Error

func (w *MultiWriter) Error() error

Error returns the final error message of the writer.

func (*MultiWriter) W

func (w *MultiWriter) W(p []byte)

W writes a slice of bytes to the underlying writer, or silently fails if there was a previous error.

Jump to

Keyboard shortcuts

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