| 52 | } |
| 53 | |
| 54 | func newVersion(repo repository.RepoClock, name string, email string, login string, avatarURL string, keys []*Key) (*version, error) { |
| 55 | clocks, err := repo.AllClocks() |
| 56 | if err != nil { |
| 57 | return nil, err |
| 58 | } |
| 59 | |
| 60 | times := make(map[string]lamport.Time) |
| 61 | for name, clock := range clocks { |
| 62 | times[name] = clock.Time() |
| 63 | } |
| 64 | |
| 65 | return &version{ |
| 66 | id: entity.UnsetId, |
| 67 | name: name, |
| 68 | email: email, |
| 69 | login: login, |
| 70 | avatarURL: avatarURL, |
| 71 | times: times, |
| 72 | unixTime: time.Now().Unix(), |
| 73 | keys: keys, |
| 74 | nonce: makeNonce(20), |
| 75 | }, nil |
| 76 | } |
| 77 | |
| 78 | type versionJSON struct { |
| 79 | // Additional field to version the data |