checkKeyContent onlys checks if key content has been used as public key, it is OK to use same key as deploy key for multiple repositories/users.
(content string)
| 356 | // checkKeyContent onlys checks if key content has been used as public key, |
| 357 | // it is OK to use same key as deploy key for multiple repositories/users. |
| 358 | func checkKeyContent(content string) error { |
| 359 | has, err := x.Get(&PublicKey{ |
| 360 | Content: content, |
| 361 | Type: KeyTypeUser, |
| 362 | }) |
| 363 | if err != nil { |
| 364 | return err |
| 365 | } else if has { |
| 366 | return ErrKeyAlreadyExist{0, content} |
| 367 | } |
| 368 | return nil |
| 369 | } |
| 370 | |
| 371 | func addKey(e Engine, key *PublicKey) (err error) { |
| 372 | // Calculate fingerprint. |
no test coverage detected