feature/data persistence (#1180)

- **feat: add documentation and GitHub Actions workflow for publishing
documentation**
- **docs(concepts): add documentation for chain modules**
- **refactor: Simplify session management with SQLite storage and remove
deprecated code**
- **refactor: Simplify database initialization and remove
DatabaseContext**
- **refactor: move connection handling logic to resolver package**
- **feat: implement session management with database persistence**
- **feat: Ensure config directory exists when creating database path**
- **feat: Add SetUserHandle function to set user handle in session**
- **feat: Add public methods to set session fields with database save**
- **refactor: Remove unused session setter functions**
- **feat: Add getter methods for all Session Model properties**
- **feat: enhance Session model with user name details**
- **feat: add Motr support and update UI elements**
- **<no value>**
- **feat: Add unique handle constraint and method to check handle
existence**
- **docs: update site URL to onsonr.dev**
- **fix: correct import statement for database package**
- **test: updated CI to run tests on pull requests and merge groups**
- **docs: remove reference to develop branch in workflow**
- **feat: add WebAuthn support for user registration**
- **fix: correct smart account attenuation preset name**
- **feat: add ComputeIssuerDID and ComputeSonrAddr functions to ucan
package**
- **test: add unit tests for MPC keyset and keyshare**
- **feat: introduce new script to streamline GitHub issue creation**
This commit is contained in:
Prad Nukala
2024-12-06 21:31:20 -05:00
committed by GitHub
parent 94fb4dceac
commit 38447af730
47 changed files with 1992 additions and 725 deletions
+6 -15
View File
@@ -3,7 +3,6 @@ package handlers
import (
"net/http"
"github.com/cosmos/btcutil/bech32"
"github.com/go-webauthn/webauthn/protocol"
"github.com/go-webauthn/webauthn/protocol/webauthncose"
"github.com/labstack/echo/v4"
@@ -22,23 +21,14 @@ func HandleRegisterView(env config.Env) echo.HandlerFunc {
}
func HandleRegisterStart(c echo.Context) error {
firstName := c.FormValue("first_name")
lastName := c.FormValue("last_name")
handle := c.FormValue("handle")
if firstName == "" || lastName == "" || handle == "" {
return response.RedirectLanding(c)
}
ks, err := mpc.NewKeyset()
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
adr, err := bech32.Encode("idx", ks.Val().GetPublicKey())
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}
req := getLinkCredentialRequest(c, adr, handle, ks.UserJSON())
req := getLinkCredentialRequest(c, ks.Address(), handle, ks.UserJSON())
return response.TemplEcho(c, register.LinkCredentialView(req))
}
@@ -60,14 +50,15 @@ func getLinkCredentialRequest(c echo.Context, addr string, handle string, userKS
RegisterOptions: buildRegisterOptions(buildUserEntity(addr, handle), buildLargeBlob(userKSJSON), buildServiceEntity(c)),
}
}
data := cc.Session()
usr := buildUserEntity(addr, handle)
blob := buildLargeBlob(userKSJSON)
service := buildServiceEntity(c)
return register.LinkCredentialRequest{
Platform: cc.BrowserName(),
Handle: handle,
DeviceModel: cc.BrowserVersion(),
Platform: data.BrowserName,
Handle: data.UserHandle,
DeviceModel: data.BrowserVersion,
Address: addr,
RegisterOptions: buildRegisterOptions(usr, blob, service),
}