fixes to gpg key and twt proofs
This commit is contained in:
parent
b294d4fdc8
commit
05df6253db
2
Makefile
2
Makefile
|
@ -14,7 +14,7 @@ version:
|
||||||
@echo $(VERSION)
|
@echo $(VERSION)
|
||||||
tag:
|
tag:
|
||||||
git tag -a v$(VERSION) -m "Version: $(VERSION)"
|
git tag -a v$(VERSION) -m "Version: $(VERSION)"
|
||||||
git push --tag
|
git push --follow-tags
|
||||||
release:
|
release:
|
||||||
@make tag BUMP=patch
|
@make tag BUMP=patch
|
||||||
run:
|
run:
|
||||||
|
|
|
@ -146,24 +146,21 @@ func ReadKey(r io.Reader, useArmored bool) (e *Entity, err error) {
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
|
||||||
var w io.Writer = &buf
|
var w io.Writer = &buf
|
||||||
|
|
||||||
e = &Entity{}
|
e = &Entity{}
|
||||||
|
|
||||||
|
defer func(){ if e != nil { e.ArmorText = buf.String() }}()
|
||||||
|
|
||||||
|
|
||||||
if !useArmored {
|
if !useArmored {
|
||||||
var aw io.WriteCloser
|
var aw io.WriteCloser
|
||||||
aw, err = armor.Encode(&buf, "PGP PUBLIC KEY BLOCK", nil)
|
aw, err = armor.Encode(&buf, "PGP PUBLIC KEY BLOCK", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return e, fmt.Errorf("Read key: %w", err)
|
return e, fmt.Errorf("Read key: %w", err)
|
||||||
}
|
}
|
||||||
defer aw.Close()
|
defer aw.Close()
|
||||||
|
|
||||||
w = aw
|
w = aw
|
||||||
}
|
}
|
||||||
defer func() {
|
|
||||||
if e != nil {
|
|
||||||
e.ArmorText = buf.String()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
r = io.TeeReader(r, w)
|
r = io.TeeReader(r, w)
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ func NewProof(ctx context.Context, uri, fingerprint string) ProofResolver {
|
||||||
if sp := strings.SplitN(p.URI.Path, "/", 3); len(sp) == 3 {
|
if sp := strings.SplitN(p.URI.Path, "/", 3); len(sp) == 3 {
|
||||||
p.Icon = "fas fa-comment-alt"
|
p.Icon = "fas fa-comment-alt"
|
||||||
p.Service = "Twtxt"
|
p.Service = "Twtxt"
|
||||||
p.Name = "loading..."
|
p.Name = fmt.Sprintf("...@%s", p.URI.Host)
|
||||||
p.Link = fmt.Sprintf("https://%s", p.URI.Host)
|
p.Link = fmt.Sprintf("https://%s", p.URI.Host)
|
||||||
|
|
||||||
url := fmt.Sprintf("https://%s/api/v1/conv", 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
|
return err
|
||||||
}
|
}
|
||||||
if len(twt.Twts) > 0 {
|
if len(twt.Twts) > 0 {
|
||||||
t.proof.Name = twt.Twts[0].Twter.Nick
|
nick := twt.Twts[0].Twter.Nick
|
||||||
t.proof.Link += "/user/" + 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) {
|
if strings.Contains(twt.Twts[0].Text, ck) {
|
||||||
t.proof.Status = ProofVerified
|
t.proof.Status = ProofVerified
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user