hancock

Check-in [811a5508bb]
Login

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

Overview
Comment:cmd/hancock: less verbose
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 811a5508bb997803445b82ff4a5f5113bffa9448b1b9b51394bd1023ca290079
User & Date: dnc 2019-05-23 16:26:41
Context
2019-05-23
16:53
go mod compatibility check-in: ee9d5b8297 user: dnc tags: trunk
16:26
cmd/hancock: less verbose check-in: 811a5508bb user: dnc tags: trunk
16:26
edited description and README check-in: 64a89cc5b7 user: dnc tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to cmd/hancock/testimony.go.

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
...
189
190
191
192
193
194
195



196

197
198
199
200
201
202
203
			if *outFlag != "" {
				// name the testimony file based on the original file, and the signing key
				//filename := fmt.Sprintf("%s-%x.testimony", man.CID, public.Marshal())
				filepath := filepath.Join(*outFlag, filename)

				err = ioutil.WriteFile(filepath, enc, 0644)
				command.Check(err)
				command.V(1).Infof("%q wrote %s", man.Path, filepath)
			}

			if *ipfsFlag != "" {
				err = ipfsAdd(*ipfsFlag, enc, filename)
				if err != nil {
					command.Error(errors.Wrapf(err, "%q IPFS add failed (%s)", man.Path, *ipfsFlag))
				}
................................................................................
					switch resp.StatusCode {
					case http.StatusOK, http.StatusCreated, http.StatusAccepted:
						// success
					default:
						command.Errorf("failed to post testimony (%q) to index (%s %s)", man.Path, urlPath, resp.Status)
					}




					command.V(1).Infof("testimony (%q) posted to index (%s)", man.Path, index)


				case "file":
					// save to directory
					indexValue := model.NewSha256CID(enc)
					indexKey, err := model.IndexKey(man.CID, testimony.Public)
					path := filepath.Join(u.Path, filepath.Join(indexKey...))
					err = os.MkdirAll(filepath.Dir(path), os.ModePerm)







|







 







>
>
>
|
>







159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
...
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
			if *outFlag != "" {
				// name the testimony file based on the original file, and the signing key
				//filename := fmt.Sprintf("%s-%x.testimony", man.CID, public.Marshal())
				filepath := filepath.Join(*outFlag, filename)

				err = ioutil.WriteFile(filepath, enc, 0644)
				command.Check(err)
				command.V(2).Infof("%q wrote %s", man.Path, filepath)
			}

			if *ipfsFlag != "" {
				err = ipfsAdd(*ipfsFlag, enc, filename)
				if err != nil {
					command.Error(errors.Wrapf(err, "%q IPFS add failed (%s)", man.Path, *ipfsFlag))
				}
................................................................................
					switch resp.StatusCode {
					case http.StatusOK, http.StatusCreated, http.StatusAccepted:
						// success
					default:
						command.Errorf("failed to post testimony (%q) to index (%s %s)", man.Path, urlPath, resp.Status)
					}

					if command.V(1) {
						command.Infof("%q testimony published", man.Path)
					} else if command.V(2) {
						command.V(1).Infof("%q testimony posted to index (%s)", man.Path, index)
					}

				case "file":
					// save to directory
					indexValue := model.NewSha256CID(enc)
					indexKey, err := model.IndexKey(man.CID, testimony.Public)
					path := filepath.Join(u.Path, filepath.Join(indexKey...))
					err = os.MkdirAll(filepath.Dir(path), os.ModePerm)

Changes to cmd/hancock/verify.go.

200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
							//	command.Infof("path mismatch (local: %q, testimony: %q)", filepath, manifest.Path)
							//	continue
							//}

							command.V(1).Infof("%q authenticated by %q", filepath, authority.name)
							verified = true // TODO(dnc): consider a count of weighted authorities, rather than simple verified or not
						default:
							command.V(1).Info(filepath, u.Path, resp.Status)
							continue
						} // end ipfs status
					default:
						command.V(1).Info(filepath, u.Path, resp.Status)
					} // end index status
				} // end index loop
			} // end authority loop

			if !verified {
				// command.Error sets exit status code (not zero)
				command.Errorf("%q not verified", filepath)







|



|







200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
							//	command.Infof("path mismatch (local: %q, testimony: %q)", filepath, manifest.Path)
							//	continue
							//}

							command.V(1).Infof("%q authenticated by %q", filepath, authority.name)
							verified = true // TODO(dnc): consider a count of weighted authorities, rather than simple verified or not
						default:
							command.V(2).Info(filepath, u.String(), resp.Status)
							continue
						} // end ipfs status
					default:
						command.V(2).Info(filepath, u.String(), resp.Status)
					} // end index status
				} // end index loop
			} // end authority loop

			if !verified {
				// command.Error sets exit status code (not zero)
				command.Errorf("%q not verified", filepath)