github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/engine/pgp_common.go (about)

     1  // Copyright 2015 Keybase, Inc. All rights reserved. Use of
     2  // this source code is governed by the included BSD license.
     3  
     4  package engine
     5  
     6  import (
     7  	"fmt"
     8  	"time"
     9  
    10  	"github.com/keybase/client/go/libkb"
    11  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
    12  )
    13  
    14  // OutputSignatureSuccess prints the details of a successful verification.
    15  func OutputSignatureSuccess(m libkb.MetaContext, fingerprint libkb.PGPFingerprint, owner *libkb.User, signatureTime time.Time, warnings libkb.HashSecurityWarnings) error {
    16  	arg := keybase1.OutputSignatureSuccessArg{
    17  		Fingerprint: fingerprint.String(),
    18  		Username:    owner.GetName(),
    19  		SignedAt:    keybase1.ToTime(signatureTime),
    20  		Warnings:    warnings.Strings(),
    21  	}
    22  	return m.UIs().PgpUI.OutputSignatureSuccess(m.Ctx(), arg)
    23  }
    24  
    25  // OutputSignatureNonKeybase prints the details of signature verification
    26  // when signing key is not known to keybase.
    27  func OutputSignatureNonKeybase(m libkb.MetaContext, keyID uint64, signatureTime time.Time, warnings libkb.HashSecurityWarnings) error {
    28  	arg := keybase1.OutputSignatureNonKeybaseArg{
    29  		KeyID:    fmt.Sprintf("%X", keyID),
    30  		SignedAt: keybase1.ToTime(signatureTime),
    31  		Warnings: warnings.Strings(),
    32  	}
    33  	return m.UIs().PgpUI.OutputSignatureNonKeybase(m.Ctx(), arg)
    34  }