INNER CODE UNIT · Go

PostMinilockID

cryptag/cryptag · servers/keyserver/main.go:64

func PostMinilockID(db *bolt.DB) func(w http.ResponseWriter, req *http.Request) {
	return func(w http.ResponseWriter, req *http.Request) {
		body, err := ioutil.ReadAll(req.Body)
		if err != nil {
			writeError(w, "Error reading POST data", err)
			return
		}
		defer req.Body.Close()

		var ident Identity
		_ = json.Unmarshal(body, &ident)
		if !ident.Valid() {
			writeErrorStatus(w, "Invalid JSON; populate 'email' and 'minilock_id'",
				http.StatusBadRequest, nil)
			return
		}

		err = CreateMinilockIDByEmail(db, ident.Email, ident.MinilockID)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…