From e08e97a490a61a4603f0cfbca106f82113b2c9a6 Mon Sep 17 00:00:00 2001 From: mrz1836 Date: Tue, 4 Jan 2022 22:59:19 -0500 Subject: [PATCH] Updated new struct names from go-paymail --- cmd/capabilities.go | 2 +- cmd/common.go | 17 ++++++++++------- cmd/p2p.go | 4 ++-- cmd/resolve.go | 2 +- cmd/validate.go | 4 ++-- cmd/verify.go | 2 +- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/cmd/capabilities.go b/cmd/capabilities.go index 963cf63..66ae1c7 100644 --- a/cmd/capabilities.go +++ b/cmd/capabilities.go @@ -57,7 +57,7 @@ Read more at: `+chalk.Cyan.Color("http://bsvalias.org/02-02-capability-discovery } // Get the capabilities - var capabilities *paymail.Capabilities + var capabilities *paymail.CapabilitiesResponse capabilities, err = getCapabilities(domain, false) if err != nil { if strings.Contains(err.Error(), "context deadline exceeded") { diff --git a/cmd/common.go b/cmd/common.go index 4ee15df..230cdd2 100644 --- a/cmd/common.go +++ b/cmd/common.go @@ -36,7 +36,7 @@ func newPaymailClient(tracing bool, nameServer string) (*paymail.Client, error) } // getPki will get a pki response (logging and basic error handling) -func getPki(pkiURL, alias, domain string, allowCache bool) (pki *paymail.PKI, err error) { +func getPki(pkiURL, alias, domain string, allowCache bool) (pki *paymail.PKIResponse, err error) { // Start the request displayHeader(chalker.DEFAULT, fmt.Sprintf("Retrieving public key information for %s...", chalk.Cyan.Color(alias+"@"+domain))) @@ -165,7 +165,7 @@ func getSrvRecord(domain string, validate bool, allowCache bool) (srv *net.SRV, } // getCapabilities will check SRV first, then attempt default domain:port check (logging and basic error handling) -func getCapabilities(domain string, allowCache bool) (capabilities *paymail.Capabilities, err error) { +func getCapabilities(domain string, allowCache bool) (capabilities *paymail.CapabilitiesResponse, err error) { capabilityDomain := "" capabilityPort := paymail.DefaultPort @@ -241,7 +241,8 @@ func getCapabilities(domain string, allowCache bool) (capabilities *paymail.Capa } // resolveAddress will resolve an address (logging and basic error handling) -func resolveAddress(resolveURL, alias, domain, senderHandle, signature, purpose string, amount uint64) (response *paymail.Resolution, err error) { +func resolveAddress(resolveURL, alias, domain, senderHandle, + signature, purpose string, amount uint64) (response *paymail.ResolutionResponse, err error) { // Start the request displayHeader(chalker.DEFAULT, fmt.Sprintf("Resolving address for %s...", chalk.Cyan.Color(alias+"@"+domain))) @@ -281,7 +282,8 @@ func resolveAddress(resolveURL, alias, domain, senderHandle, signature, purpose } // getP2PPaymentDestination will start a new p2p transaction request (logging and basic error handling) -func getP2PPaymentDestination(destinationURL, alias, domain string, satoshis uint64) (response *paymail.PaymentDestination, err error) { +func getP2PPaymentDestination(destinationURL, alias, + domain string, satoshis uint64) (response *paymail.PaymentDestinationResponse, err error) { // Start the request displayHeader(chalker.DEFAULT, fmt.Sprintf("Starting new P2P payment request for %s...", chalk.Cyan.Color(alias+"@"+domain))) @@ -314,7 +316,8 @@ func getP2PPaymentDestination(destinationURL, alias, domain string, satoshis uin } // getPublicProfile will get a public profile (logging and basic error handling) -func getPublicProfile(profileURL, alias, domain string, allowCache bool) (profile *paymail.PublicProfile, err error) { +func getPublicProfile(profileURL, alias, + domain string, allowCache bool) (profile *paymail.PublicProfileResponse, err error) { // Start the request displayHeader(chalker.DEFAULT, fmt.Sprintf("Retrieving public profile for %s...", chalk.Cyan.Color(alias+"@"+domain))) @@ -646,7 +649,7 @@ func getBaemail(alias, domain string, allowCache bool) (response *baemail.Respon } // verifyPubKey will verify a given pubkey against a paymail address (logging and basic error handling) -func verifyPubKey(verifyURL, alias, domain, pubKey string) (response *paymail.Verification, err error) { +func verifyPubKey(verifyURL, alias, domain, pubKey string) (response *paymail.VerificationResponse, err error) { // Start the request displayHeader(chalker.DEFAULT, fmt.Sprintf("Verifing pubkey for %s...", chalk.Cyan.Color(alias+"@"+domain))) @@ -723,7 +726,7 @@ func displayHeader(level, text string) { } // GetPublicInfo will get all the public info for a given paymail -func (p *PaymailDetails) GetPublicInfo(capabilities *paymail.Capabilities) (err error) { +func (p *PaymailDetails) GetPublicInfo(capabilities *paymail.CapabilitiesResponse) (err error) { // Requirements if len(p.Handle) == 0 { diff --git a/cmd/p2p.go b/cmd/p2p.go index ed59ac3..cd144d8 100644 --- a/cmd/p2p.go +++ b/cmd/p2p.go @@ -89,7 +89,7 @@ Read more at: `+chalk.Cyan.Color("https://docs.moneybutton.com/docs/paymail-07-p parts := strings.Split(paymailAddress, "@") // Fire the P2P request - var p2pResponse *paymail.PaymentDestination + var p2pResponse *paymail.PaymentDestinationResponse if p2pResponse, err = getP2PPaymentDestination(destinationURL, parts[0], domain, satoshis); err != nil { chalker.Log(chalker.ERROR, fmt.Sprintf("P2P payment destination request failed: %s", err.Error())) return @@ -97,7 +97,7 @@ Read more at: `+chalk.Cyan.Color("https://docs.moneybutton.com/docs/paymail-07-p // Attempt to get a public profile if the capability is found profileURL := capabilities.GetString(paymail.BRFCPublicProfile, "") - var profile *paymail.PublicProfile + var profile *paymail.PublicProfileResponse if len(profileURL) > 0 && !skipPublicProfile { if profile, err = getPublicProfile(profileURL, parts[0], domain, true); err != nil { chalker.Log(chalker.ERROR, fmt.Sprintf("Get public profile failed: %s", err.Error())) diff --git a/cmd/resolve.go b/cmd/resolve.go index dbaed8b..d9a70a3 100644 --- a/cmd/resolve.go +++ b/cmd/resolve.go @@ -139,7 +139,7 @@ Read more at: `+chalk.Cyan.Color("http://bsvalias.org/04-01-basic-address-resolu } // Get the PKI for the given address - var senderPki *paymail.PKI + var senderPki *paymail.PKIResponse if senderPki, err = getPki(senderPkiURL, senderAlias, senderDomain, true); err != nil { chalker.Log(chalker.ERROR, fmt.Sprintf("Find PKI Failed: %s", err.Error())) return diff --git a/cmd/validate.go b/cmd/validate.go index dc2101e..124bb41 100644 --- a/cmd/validate.go +++ b/cmd/validate.go @@ -135,7 +135,7 @@ Read more at: `+chalk.Cyan.Color("http://bsvalias.org/index.html")), } // Get the capabilities - var capabilities *paymail.Capabilities + var capabilities *paymail.CapabilitiesResponse if capabilities, err = getCapabilities(domain, false); err != nil { if strings.Contains(err.Error(), "context deadline exceeded") { chalker.Log(chalker.WARN, fmt.Sprintf("No capabilities found for: %s", domain)) @@ -160,7 +160,7 @@ Read more at: `+chalk.Cyan.Color("http://bsvalias.org/index.html")), if len(paymailAddress) > 0 && len(pkiURL) > 0 { // Get the PKI for the given address - var pki *paymail.PKI + var pki *paymail.PKIResponse if pki, err = getPki(pkiURL, alias, domain, false); err != nil { chalker.Log(chalker.ERROR, fmt.Sprintf("Error: %s", err.Error())) return diff --git a/cmd/verify.go b/cmd/verify.go index ee5c489..930e196 100644 --- a/cmd/verify.go +++ b/cmd/verify.go @@ -105,7 +105,7 @@ Read more at: `+chalk.Cyan.Color("http://bsvalias.org/05-verify-public-key-owner } // Fire the verify request - var verify *paymail.Verification + var verify *paymail.VerificationResponse if verify, err = verifyPubKey(verifyURL, alias, domain, pubKey); err != nil { chalker.Log(chalker.ERROR, fmt.Sprintf("verify pubkey request failed: %s", err.Error())) return