mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-11 13:29:12 +00:00
* feat: add new supported attestation formats to genesis * feat: refactor keyType to keytype enum * refactor: remove unused imports and code * refactor: update main.go to use src package * refactor: move web-related structs from to * refactor: move client middleware package to root * refactor: remove unused IndexedDB dependency * feat: update worker implementation to use * feat: add Caddyfile and Caddy configuration for vault service * refactor(config): move keyshare and address to Motr config * fix: validate service origin in AllocateVault * chore: remove IndexedDB configuration * feat: add support for IPNS-based vault access
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package handlers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/go-webauthn/webauthn/protocol"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func checkSubjectIsValid(e echo.Context) error {
|
|
credentialID := e.FormValue("credentialID")
|
|
return e.JSON(200, credentialID)
|
|
}
|
|
|
|
func handleCredentialAssertion(e echo.Context) error {
|
|
return e.JSON(200, "HandleCredentialAssertion")
|
|
}
|
|
|
|
func handleCredentialCreation(e echo.Context) error {
|
|
// Get the serialized credential data from the form
|
|
credentialDataJSON := e.FormValue("credentialData")
|
|
|
|
// Deserialize the JSON into a temporary struct
|
|
var ccr protocol.CredentialCreationResponse
|
|
err := json.Unmarshal([]byte(credentialDataJSON), &ccr)
|
|
if err != nil {
|
|
return e.JSON(500, err.Error())
|
|
}
|
|
//
|
|
// // Parse the CredentialCreationResponse
|
|
// parsedData, err := ccr.Parse()
|
|
// if err != nil {
|
|
// return e.JSON(500, err.Error())
|
|
// }
|
|
//
|
|
// // Create the Credential
|
|
// // credential := orm.NewCredential(parsedData, e.Request().Host, "")
|
|
//
|
|
// // Set additional fields
|
|
// credential.Controller = "" // Set this to the appropriate controller value
|
|
return e.JSON(200, fmt.Sprintf("REGISTER: %s", string(ccr.ID)))
|
|
}
|