Update the changelog with new helpers description (#93)

Co-authored-by: marin thiercelin <marin.thiercelin@pm.me>
This commit is contained in:
marinthiercelin 2020-10-29 09:00:34 -07:00 committed by GitHub
parent 062cca9201
commit 9503b68f0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,25 +46,37 @@ DecryptBinaryMessageArmored(privateKey string, passphrase []byte, ciphertext str
(key *Key) ToPublic() (publicKey *Key, err error) (key *Key) ToPublic() (publicKey *Key, err error)
``` ```
- Helpers to handle detached signatures - Helpers to handle encryption (both with armored and unarmored cipher) + encrypted detached signatures in one call.
```go ```go
EncryptSignArmoredDetached( EncryptSignArmoredDetached(
publicKey, privateKey string, publicKey, privateKey string,
passphrase, plainData []byte, passphrase, plainData []byte,
) (ciphertext, signature string, err error) ) (ciphertextArmored, encryptedSignatureArmored string, err error)
DecryptVerifyArmoredDetached( DecryptVerifyArmoredDetached(
publicKey, privateKey string, publicKey, privateKey string,
passphrase []byte, passphrase []byte,
ciphertext string, ciphertextArmored string,
armoredSignature string, encryptedSignatureArmored string,
) (plainData []byte, err error) ) (plainData []byte, err error)
``` ```
```go
EncryptSignBinaryDetached(
publicKey, privateKey string,
passphrase, plainData []byte,
) (encryptedData []byte, encryptedSignatureArmored string, err error)
- `EncryptSignArmoredDetachedMobileResult` Struct (with its helper) to allow detached signature + encryption in one pass DecryptVerifyBinaryDetached(
publicKey, privateKey string,
passphrase []byte,
encryptedData []byte,
encryptedSignatureArmored string,
) (plainData []byte, err error)
```
- Wrappers for `EncryptSignArmoredDetached` and `EncryptSignBinaryDetached` helpers, to be usable with gomobile (that doesn't support multiple retun values). These wrappers return custom structs instead.
```go ```go
type EncryptSignArmoredDetachedMobileResult struct { type EncryptSignArmoredDetachedMobileResult struct {
Ciphertext, Signature string CiphertextArmored, EncryptedSignatureArmored string
} }
EncryptSignArmoredDetachedMobile( EncryptSignArmoredDetachedMobile(
@ -72,6 +84,44 @@ EncryptSignArmoredDetachedMobile(
passphrase, plainData []byte, passphrase, plainData []byte,
) (wrappedTuple *EncryptSignArmoredDetachedMobileResult, err error) ) (wrappedTuple *EncryptSignArmoredDetachedMobileResult, err error)
``` ```
```go
type EncryptSignBinaryDetachedMobileResult struct {
EncryptedData []byte
EncryptedSignatureArmored string
}
EncryptSignBinaryDetachedMobile(
publicKey, privateKey string,
passphrase, plainData []byte,
) (wrappedTuple *EncryptSignBinaryDetachedMobileResult, err error)
```
- helpers to encrypt/decrypt session keys with armored keys:
```go
EncryptSessionKey(
publicKey string,
sessionKey *crypto.SessionKey,
) (encryptedSessionKey []byte, err error)
DecryptSessionKey(
privateKey string,
passphrase, encryptedSessionKey []byte,
) (sessionKey *crypto.SessionKey, err error)
```
- helpers to encrypt/decrypt binary files with armored keys:
```go
EncryptAttachmentWithKey(
publicKey string,
filename string,
plainData []byte,
) (message *crypto.PGPSplitMessage, err error)
DecryptAttachmentWithKey(
privateKey string,
passphrase, keyPacket, dataPacket []byte,
) (attachment []byte, err error)
```
- `NewPlainMessageFromFile` Function to create new `PlainMessage`s with a filename: - `NewPlainMessageFromFile` Function to create new `PlainMessage`s with a filename:
```go ```go