Create SplitMessage() to replace SeparateKeyAndData(...int)

Keep SeparateKeyAndData(_ int, _ int) for backwards compatibility
with go-mobile bindings.
Deprecate SeparateKeyAndData in favor of SplitMessage.
This commit is contained in:
Daniel Huigens 2022-02-28 18:46:48 +01:00
parent 34904b7f9f
commit e1f6ea603a
4 changed files with 15 additions and 8 deletions

View file

@ -140,7 +140,7 @@ func NewPGPSplitMessageFromArmored(encrypted string) (*PGPSplitMessage, error) {
return nil, err
}
return message.SeparateKeyAndData()
return message.SplitMessage()
}
// NewPGPSignature generates a new PGPSignature from the unarmored binary data.
@ -324,9 +324,9 @@ func (msg *PGPSplitMessage) GetPGPMessage() *PGPMessage {
return NewPGPMessage(append(msg.KeyPacket, msg.DataPacket...))
}
// SeparateKeyAndData splits the message into key and data packet(s).
// SplitMessage splits the message into key and data packet(s).
// Parameters are for backwards compatibility and are unused.
func (msg *PGPMessage) SeparateKeyAndData(_ ...int) (*PGPSplitMessage, error) {
func (msg *PGPMessage) SplitMessage() (*PGPSplitMessage, error) {
bytesReader := bytes.NewReader(msg.Data)
packets := packet.NewReader(bytesReader)
splitPoint := int64(0)
@ -352,6 +352,13 @@ Loop:
}, nil
}
// SeparateKeyAndData splits the message into key and data packet(s).
// Parameters are for backwards compatibility and are unused.
// Deprecated in favor of SplitMessage().
func (msg *PGPMessage) SeparateKeyAndData(_ int, _ int) (*PGPSplitMessage, error) {
return msg.SplitMessage()
}
// GetBinary returns the unarmored binary content of the signature as a []byte.
func (sig *PGPSignature) GetBinary() []byte {
return sig.Data