MCPcopy Create free account
hub / github.com/Mister-leo/fssh / List

Method List

internal/agent/secure_agent.go:72–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70}
71
72func (a *secureAgent) List() ([]*xagent.Key, error) {
73 // 动态加载最新的密钥列表
74 metas, err := a.loadMetas()
75 if err != nil {
76 return nil, err
77 }
78
79 var ks []*xagent.Key
80 for _, m := range metas {
81 if m.PubKey == "" {
82 continue
83 }
84 pb, err := base64.StdEncoding.DecodeString(m.PubKey)
85 if err != nil {
86 continue
87 }
88 pk, err := ssh.ParsePublicKey(pb)
89 if err != nil {
90 continue
91 }
92 ks = append(ks, &xagent.Key{Format: pk.Type(), Blob: pk.Marshal(), Comment: m.Alias})
93 }
94 return ks, nil
95}
96
97func (a *secureAgent) Sign(pubkey ssh.PublicKey, data []byte) (*ssh.Signature, error) {
98 fp := ssh.FingerprintSHA256(pubkey)

Callers

nothing calls this directly

Calls 1

loadMetasMethod · 0.95

Tested by

no test coverage detected