fixes to gpg key and twt proofs

This commit is contained in:
Jon Lundy 2020-12-02 09:24:07 -07:00
parent b294d4fdc8
commit 05df6253db
3 changed files with 10 additions and 12 deletions

View File

@ -14,7 +14,7 @@ version:
@echo $(VERSION)
tag:
git tag -a v$(VERSION) -m "Version: $(VERSION)"
git push --tag
git push --follow-tags
release:
@make tag BUMP=patch
run:

View File

@ -146,9 +146,11 @@ func ReadKey(r io.Reader, useArmored bool) (e *Entity, err error) {
var buf bytes.Buffer
var w io.Writer = &buf
e = &Entity{}
defer func(){ if e != nil { e.ArmorText = buf.String() }}()
if !useArmored {
var aw io.WriteCloser
aw, err = armor.Encode(&buf, "PGP PUBLIC KEY BLOCK", nil)
@ -159,11 +161,6 @@ func ReadKey(r io.Reader, useArmored bool) (e *Entity, err error) {
w = aw
}
defer func() {
if e != nil {
e.ArmorText = buf.String()
}
}()
r = io.TeeReader(r, w)

View File

@ -210,7 +210,7 @@ func NewProof(ctx context.Context, uri, fingerprint string) ProofResolver {
if sp := strings.SplitN(p.URI.Path, "/", 3); len(sp) == 3 {
p.Icon = "fas fa-comment-alt"
p.Service = "Twtxt"
p.Name = "loading..."
p.Name = fmt.Sprintf("...@%s", p.URI.Host)
p.Link = fmt.Sprintf("https://%s", p.URI.Host)
url := fmt.Sprintf("https://%s/api/v1/conv", p.URI.Host)
@ -338,10 +338,11 @@ func (t *twtxtResolve) Resolve(ctx context.Context) error {
return err
}
if len(twt.Twts) > 0 {
t.proof.Name = twt.Twts[0].Twter.Nick
t.proof.Link += "/user/" + twt.Twts[0].Twter.Nick
nick := twt.Twts[0].Twter.Nick
t.proof.Name = fmt.Sprintf("%s@%s", nick, t.proof.URI.Host)
t.proof.Link += "/user/" + nick
ck := fmt.Sprintf("[Verifying my OpenPGP key: openpgp4fpr:%s]", strings.ToLower(t.proof.Fingerprint))
ck := fmt.Sprintf("[Verifying my OpenPGP key: openpgp4fpr:%s]", t.proof.Fingerprint)
if strings.Contains(twt.Twts[0].Text, ck) {
t.proof.Status = ProofVerified
return nil