From 9caf737bc74b32aabaf0254bacc1acb96a403bbe Mon Sep 17 00:00:00 2001 From: Aron Wussler Date: Tue, 7 Apr 2020 15:19:48 +0200 Subject: [PATCH] Add documentation for SHA256 fingerprints --- CHANGELOG.md | 12 ++++++++++++ helper/mobile.go | 2 ++ 2 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8a6a27..54713dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed test `TestMultipleKeyMessageEncryption` +### Added +- SHA256 fingerprint support +```go +(key *Key) GetSHA256Fingerprints() (fingerprints []string) + +// Helper +GetSHA256Fingerprints(publicKey string) ([]string, error) + +// Helper, mobile only, returns fingerprints encoded as JSON +GetJsonSHA256Fingerprints(publicKey string) ([]byte, error) +``` + ## [2.0.0] - 2020-01-06 Since the open-sourcing of the library in May the API has been updated, listening to internal and external feedback, in order to have a flexible library, that can be used in a simple settings, diff --git a/helper/mobile.go b/helper/mobile.go index 825cca3..4ad95fd 100644 --- a/helper/mobile.go +++ b/helper/mobile.go @@ -68,6 +68,8 @@ func EncryptAttachment(plainData []byte, fileName string, keyRing *crypto.KeyRin return decrypted, nil } +// GetJsonSHA256Fingerprints returns the SHA256 fingeprints of key and subkeys, encoded in JSON, since gomobile can not +// handle arrays func GetJsonSHA256Fingerprints(publicKey string) ([]byte, error) { key, err := crypto.NewKeyFromArmored(publicKey) if err != nil {