MCPcopy Index your code
hub / github.com/tailscale/tailscale / String

Method String

tka/sig.go:108–139  ·  view source on GitHub ↗

String returns a human-readable representation of the NodeKeySignature, making it easy to see nested signatures.

()

Source from the content-addressed store, hash-verified

106// String returns a human-readable representation of the NodeKeySignature,
107// making it easy to see nested signatures.
108func (s NodeKeySignature) String() string {
109 var b strings.Builder
110 var addToBuf func(NodeKeySignature, int)
111 addToBuf = func(sig NodeKeySignature, depth int) {
112 indent := strings.Repeat(" ", depth)
113 b.WriteString(indent + "SigKind: " + sig.SigKind.String() + "\n")
114 if len(sig.Pubkey) > 0 {
115 var pubKey string
116 var np key.NodePublic
117 if err := np.UnmarshalBinary(sig.Pubkey); err != nil {
118 pubKey = fmt.Sprintf("<error: %s>", err)
119 } else {
120 pubKey = np.ShortString()
121 }
122 b.WriteString(indent + "Pubkey: " + pubKey + "\n")
123 }
124 if len(sig.KeyID) > 0 {
125 keyID := key.NLPublicFromEd25519Unsafe(sig.KeyID).CLIString()
126 b.WriteString(indent + "KeyID: " + keyID + "\n")
127 }
128 if len(sig.WrappingPubkey) > 0 {
129 pubKey := key.NLPublicFromEd25519Unsafe(sig.WrappingPubkey).CLIString()
130 b.WriteString(indent + "WrappingPubkey: " + pubKey + "\n")
131 }
132 if sig.Nested != nil {
133 b.WriteString(indent + "Nested:\n")
134 addToBuf(*sig.Nested, depth+1)
135 }
136 }
137 addToBuf(s, 0)
138 return strings.TrimSpace(b.String())
139}
140
141// UnverifiedWrappingPublic returns the public key which must sign a
142// signature which embeds this one, if any.

Callers

nothing calls this directly

Calls 6

UnmarshalBinaryMethod · 0.95
ShortStringMethod · 0.95
WriteStringMethod · 0.80
CLIStringMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected