Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | minor changes to variable names |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
ff157b9a48c7e3df8de256cebd5624f0 |
User & Date: | dnc 2019-09-26 14:28:31 |
Context
2019-10-07
| ||
01:09 | model: refactor testimony key introduce TestimonyKey, for store and lookup of testimony introduce Key Identifier (KID) derived from Content Identifier (CID) check-in: 5c379c0bb1 user: dnc tags: trunk | |
2019-09-26
| ||
14:28 | minor changes to variable names check-in: ff157b9a48 user: dnc tags: trunk | |
14:27 | create manifest from io.Reader check-in: 6df3601824 user: dnc tags: trunk | |
Changes
Changes to model/index.go.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import ( "encoding/hex" "fmt" "golang.org/x/crypto/ssh" ) func IndexKey(source CID, publicKey interface{}) (key []string, err error) { var public ssh.PublicKey switch pub := publicKey.(type) { case string: // use hex of ssh encoding of public key public, _, _, _, err = ssh.ParseAuthorizedKey([]byte(pub)) if err != nil { return } case ssh.PublicKey: public = pub default: return nil, fmt.Errorf("unexpected public key type (%T %#v)", publicKey, publicKey) } return []string{ source.String(), hex.EncodeToString(public.Marshal()), }, nil } |
| | | |
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import ( "encoding/hex" "fmt" "golang.org/x/crypto/ssh" ) func IndexKey(source CID, authority interface{}) (key []string, err error) { var public ssh.PublicKey switch pub := authority.(type) { case string: // use hex of ssh encoding of public key public, _, _, _, err = ssh.ParseAuthorizedKey([]byte(pub)) if err != nil { return } case ssh.PublicKey: public = pub default: return nil, fmt.Errorf("unexpected authority (%T %#v) not a public key", authority, authority) } return []string{ source.String(), hex.EncodeToString(public.Marshal()), }, nil } |