MCPcopy Index your code
hub / github.com/koding/kite / AddKey

Method AddKey

kontrol/postgres.go:396–413  ·  view source on GitHub ↗

* --- Key Pair ----------------- */

(keyPair *KeyPair)

Source from the content-addressed store, hash-verified

394*/
395
396func (p *Postgres) AddKey(keyPair *KeyPair) error {
397 if err := keyPair.Validate(); err != nil {
398 return err
399 }
400
401 psql := sq.StatementBuilder.PlaceholderFormat(sq.Dollar)
402 sqlQuery, args, err := psql.Insert("kite.key").Columns(
403 "id",
404 "public",
405 "private",
406 ).Values(keyPair.ID, keyPair.Public, keyPair.Private).ToSql()
407 if err != nil {
408 return err
409 }
410
411 _, err = p.DB.Exec(sqlQuery, args...)
412 return err
413}
414
415func (p *Postgres) DeleteKey(keyPair *KeyPair) error {
416 res, err := p.DB.Exec(`UPDATE kite.key SET deleted_at = (now() at time zone 'utc') WHERE id = $1`,

Callers

nothing calls this directly

Calls 2

ValuesMethod · 0.80
ValidateMethod · 0.45

Tested by

no test coverage detected