hancock

Check-in [812804e091]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:model: helper to encode testimony key
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 812804e0913da08aba81faf86b7d0259407e7ef7fdedb0ff90e57e8c4fa8428a
User & Date: dnc 2019-12-11 20:19:11
Context
2019-12-11
20:20
model: helpers for tests (in other packages) check-in: 40f95cd722 user: dnc tags: trunk
20:19
model: helper to encode testimony key check-in: 812804e091 user: dnc tags: trunk
2019-11-03
12:01
hancock: call new server interface previously: seperate index and testimony on IPFS now: hancockd server acts as key/value store check-in: 99044d8f59 user: dnc tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to model/index.go.

68
69
70
71
72
73
74





75
76
77
78
79
80
81
		log.Panicf("failed to encode %T: %s", this, err)
	}
	id := Sha256KID(NewSha256CID(enc))
	this.kid = &id
	return this.kid
}






func IndexKey(source CID, authority interface{}) (key []string, err error) {
	var public ssh.PublicKey
	switch pub := authority.(type) {
	case Authority:
		// use hex of ssh encoding of public key
		public, _, _, _, err = ssh.ParseAuthorizedKey([]byte(pub))
		if err != nil {







>
>
>
>
>







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
		log.Panicf("failed to encode %T: %s", this, err)
	}
	id := Sha256KID(NewSha256CID(enc))
	this.kid = &id
	return this.kid
}

func (this *TestimonyKey) Split() []string {
	return []string{this.Content.String(), this.Authority.String()}
}

// deprecated, use TestimonyKey.Split
func IndexKey(source CID, authority interface{}) (key []string, err error) {
	var public ssh.PublicKey
	switch pub := authority.(type) {
	case Authority:
		// use hex of ssh encoding of public key
		public, _, _, _, err = ssh.ParseAuthorizedKey([]byte(pub))
		if err != nil {

Changes to model/testimony.go.

24
25
26
27
28
29
30


31
32
33
34
35
36
37
	"log"

	"golang.org/x/crypto/ssh"
)

// An Authority is public key, encoded as a string (see ssh.ParseAuthorizedKey)
type Authority string



// Type Testimony, when produced by a trusted authority, allows a
// verifier to authenticate a source file.
type Testimony struct {
	// The signer's public key.
	Authority Authority `json:"authority"`








>
>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
	"log"

	"golang.org/x/crypto/ssh"
)

// An Authority is public key, encoded as a string (see ssh.ParseAuthorizedKey)
type Authority string

func (this Authority) String() string { return string(this) }

// Type Testimony, when produced by a trusted authority, allows a
// verifier to authenticate a source file.
type Testimony struct {
	// The signer's public key.
	Authority Authority `json:"authority"`