MCPcopy Create free account
hub / github.com/koding/kite / Write

Function Write

kitekey/kitekey.go:65–81  ·  view source on GitHub ↗

Write over the kite.key file.

(kiteKey string)

Source from the content-addressed store, hash-verified

63
64// Write over the kite.key file.
65func Write(kiteKey string) error {
66 keyPath, err := kiteKeyPath()
67 if err != nil {
68 return err
69 }
70
71 err = os.MkdirAll(filepath.Dir(keyPath), 0700)
72 if err != nil {
73 return err
74 }
75
76 // Need to remove the previous key first because we can't write over
77 // when previous file's mode is 0400.
78 os.Remove(keyPath)
79
80 return ioutil.WriteFile(keyPath, []byte(kiteKey), 0400)
81}
82
83// Parse the kite.key file and return it as JWT token.
84func Parse() (*jwt.Token, error) {

Callers

nothing calls this directly

Calls 1

kiteKeyPathFunction · 0.85

Tested by

no test coverage detected