Documentation ¶
Overview ¶
Package mobile provides tools for mobile compatibility.
Index ¶
- func FreeOSMemory()
- type DetachedSignaturePGPSplitReader
- type Go2AndroidReader
- type Go2IOSReader
- type KeyPacketSplitWriter
- func (sw *KeyPacketSplitWriter) EncryptedDetachedSignature() *crypto.PGPMessage
- func (sw *KeyPacketSplitWriter) KeyPackets() []byte
- func (sw *KeyPacketSplitWriter) Keys() crypto.Writer
- func (sw *KeyPacketSplitWriter) Signature() crypto.Writer
- func (sw *KeyPacketSplitWriter) Write(b []byte) (n int, err error)
- type Mobile2GoReader
- type Mobile2GoWriter
- type Mobile2GoWriterWithSHA256
- type MobileReadResult
- type MobileReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FreeOSMemory ¶
func FreeOSMemory()
FreeOSMemory can be used to explicitly call the garbage collector and return the unused memory to the OS.
Types ¶
type DetachedSignaturePGPSplitReader ¶
type DetachedSignaturePGPSplitReader struct {
// contains filtered or unexported fields
}
DetachedSignaturePGPSplitReader implements the crypto.PGPSplitReader interface.
func NewDetachedSignaturePGPSplitReader ¶
func NewDetachedSignaturePGPSplitReader(keyPacket []byte, dataReader crypto.Reader, encSignature *crypto.PGPMessage) *DetachedSignaturePGPSplitReader
func (*DetachedSignaturePGPSplitReader) Read ¶
func (ds *DetachedSignaturePGPSplitReader) Read(b []byte) (n int, err error)
func (*DetachedSignaturePGPSplitReader) Signature ¶
func (ds *DetachedSignaturePGPSplitReader) Signature() crypto.Reader
type Go2AndroidReader ¶
type Go2AndroidReader struct {
// contains filtered or unexported fields
}
Go2AndroidReader is used to wrap a native golang Reader in the golang runtime, to be usable in the android app runtime (via gomobile).
func NewGo2AndroidReader ¶
func NewGo2AndroidReader(reader crypto.Reader) *Go2AndroidReader
NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile). It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
type Go2IOSReader ¶
type Go2IOSReader struct {
// contains filtered or unexported fields
}
Go2IOSReader is used to wrap a native golang Reader in the golang runtime, to be usable in the iOS app runtime (via gomobile) as a MobileReader.
func NewGo2IOSReader ¶
func NewGo2IOSReader(reader crypto.Reader) *Go2IOSReader
NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
func (*Go2IOSReader) Read ¶
func (r *Go2IOSReader) Read(max int) (result *MobileReadResult, err error)
Read reads at most <max> bytes from the wrapped Reader and returns the read data as a MobileReadResult.
type KeyPacketSplitWriter ¶
type KeyPacketSplitWriter struct {
// contains filtered or unexported fields
}
KeyPacketSplitWriter implements the crypto.PGPSplitWriter interface for splitting encryptions output into different packets. Internally buffers the key packets and potential detached encrypted signatures.
func NewKeyPacketSplitWriter ¶
func NewKeyPacketSplitWriter(dataWriter crypto.Writer) *KeyPacketSplitWriter
func (*KeyPacketSplitWriter) EncryptedDetachedSignature ¶
func (sw *KeyPacketSplitWriter) EncryptedDetachedSignature() *crypto.PGPMessage
EncryptedDetachedSignature returns the internally buffered encrypted detached signature.
func (*KeyPacketSplitWriter) KeyPackets ¶
func (sw *KeyPacketSplitWriter) KeyPackets() []byte
KeyPackets returns the internally buffered key packets.
func (*KeyPacketSplitWriter) Keys ¶
func (sw *KeyPacketSplitWriter) Keys() crypto.Writer
func (*KeyPacketSplitWriter) Signature ¶
func (sw *KeyPacketSplitWriter) Signature() crypto.Writer
type Mobile2GoReader ¶
type Mobile2GoReader struct {
// contains filtered or unexported fields
}
Mobile2GoReader is used to wrap a MobileReader in the mobile app runtime, to be usable in the golang runtime (via gomobile) as a native Reader.
func NewMobile2GoReader ¶
func NewMobile2GoReader(reader MobileReader) *Mobile2GoReader
NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
type Mobile2GoWriter ¶
type Mobile2GoWriter struct {
// contains filtered or unexported fields
}
Mobile2GoWriter is used to wrap a writer in the mobile app runtime, to be usable in the golang runtime (via gomobile).
func NewMobile2GoWriter ¶
func NewMobile2GoWriter(writer crypto.Writer) *Mobile2GoWriter
NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
type Mobile2GoWriterWithSHA256 ¶
type Mobile2GoWriterWithSHA256 struct {
// contains filtered or unexported fields
}
Mobile2GoWriterWithSHA256 is used to wrap a writer in the mobile app runtime, to be usable in the golang runtime (via gomobile). It also computes the SHA256 hash of the data being written on the fly.
func NewMobile2GoWriterWithSHA256 ¶
func NewMobile2GoWriterWithSHA256(writer crypto.Writer) *Mobile2GoWriterWithSHA256
NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile). The wrapper also computes the SHA256 hash of the data being written on the fly.
func (*Mobile2GoWriterWithSHA256) GetSHA256 ¶
func (w *Mobile2GoWriterWithSHA256) GetSHA256() []byte
GetSHA256 returns the SHA256 hash of the data that's been written so far.
func (*Mobile2GoWriterWithSHA256) Write ¶
func (w *Mobile2GoWriterWithSHA256) Write(b []byte) (n int, err error)
Write writes the data in the provided buffer in the wrapped writer. It clones the provided data to prevent errors with garbage collectors. It also computes the SHA256 hash of the data being written on the fly.
type MobileReadResult ¶
type MobileReadResult struct { N int // N, The number of bytes read IsEOF bool // IsEOF, If true, then the reader has reached the end of the data to read. Data []byte // Data, the data that has been read }
MobileReadResult is what needs to be returned by MobileReader.Read. The read data is passed as a return value rather than passed as an argument to the reader. This avoids problems introduced by gomobile that prevent the use of native golang readers.
func NewMobileReadResult ¶
func NewMobileReadResult(n int, eof bool, data []byte) *MobileReadResult
NewMobileReadResult initialize a MobileReadResult with the correct values. It clones the data to avoid the garbage collector freeing the data too early.
type MobileReader ¶
type MobileReader interface {
Read(max int) (result *MobileReadResult, err error)
}
MobileReader is the interface that readers in the mobile runtime must use and implement. This is a workaround to some of the gomobile limitations.