func CreateAuthKey(w http.ResponseWriter, req *http.Request) {
	var input inputAuthKeyType
	err := httputils.DecodeBody(w, req.Body, &input)
	if err != nil {
		httputils.ErrorOut(w, http.StatusBadRequest, "incorrect body")
		return
	}

	//
	h, err := hash.NewFromHash(mux.Vars(req)["addr"])
	if err != nil {
		httputils.ErrorOut(w, http.StatusNotFound, accountNotFound)
		return
	}

	newAuthKey := key.NewAuthKey(*h, input.PublicKey, input.Signature, time.Unix(input.Expires, 0), input.Desc)

	// Store auth key into persistent storage
	repo := container.Instance.GetAuthKeyRepo()
	err = repo.Store(newAuthKey)
	if err != nil {
		msg := fmt.Sprintf("error while storing key: %s", err)
		httputils.ErrorOut(w, http.StatusInternalServerError, msg)
		return
	}

	_ = dispatcher.DispatchAuthKeyCreate(*h, newAuthKey)

	// Output key
	_ = httputils.JSONOut(w, http.StatusCreated, jsonOut{
		"auth_key": newAuthKey.Fingerprint,
	})
}
// CreateAuthKey is a handler that will create a new auth key
CreateAuthKey is a handler that will create a new auth key
// CreateAuthKey is a handler that will create a new auth key
func CreateAuthKey(w http.ResponseWriter, req *http.Request) {
	var input inputAuthKeyType
	err := httputils.DecodeBody(w, req.Body, &input)
	if err != nil {
		httputils.ErrorOut(w, http.StatusBadRequest, "incorrect body")
		return
	}
	h, err := hash.NewFromHash(mux.Vars(req)["addr"])
	if err != nil {
		httputils.ErrorOut(w, http.StatusNotFound, accountNotFound)
		return
	}
	newAuthKey := key.NewAuthKey(*h, input.PublicKey, input.Signature, time.Unix(input.Expires, 0), input.Desc)
	 Store auth key into persistent storage
	repo := container.Instance.GetAuthKeyRepo()
	err = repo.Store(newAuthKey)
	if err != nil {
		msg := fmt.Sprintf("error while storing key: %s", err)
		httputils.ErrorOut(w, http.StatusInternalServerError, msg)
		return
	}
	_ = dispatcher.DispatchAuthKeyCreate(*h, newAuthKey)
	 Output key
	_ = httputils.JSONOut(w, http.StatusCreated, jsonOut{
		"auth_key": newAuthKey.Fingerprint,
	})
}
func CreateAuthKey ( w http . ResponseWriter , req * http . Request ) { var input inputAuthKeyType err := httputils . DecodeBody ( w , req . Body , & input ) if err != nil { httputils . ErrorOut ( w , http . StatusBadRequest , " " ) return } h , err := hash . NewFromHash ( mux . Vars ( req ) [ " " ] ) if err != nil { httputils . ErrorOut ( w , http . StatusNotFound , accountNotFound ) return } newAuthKey := key . NewAuthKey ( * h , input . PublicKey , input . Signature , time . Unix ( input . Expires , 0 ) , input . Desc ) repo := container . Instance . GetAuthKeyRepo ( ) err = repo . Store ( newAuthKey ) if err != nil { msg := fmt . Sprintf ( " " , err ) httputils . ErrorOut ( w , http . StatusInternalServerError , msg ) return } _ = dispatcher . DispatchAuthKeyCreate ( * h , newAuthKey ) _ = httputils . JSONOut ( w , http . StatusCreated , jsonOut { " " : newAuthKey . Fingerprint , } ) }
CreateAuthKey is a handler that will create a new auth key
CreateAuthKey is a handler that will create a new auth key
// // Store auth key into persistent storage // Output key