mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
- **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**
66 lines
1.7 KiB
Go
66 lines
1.7 KiB
Go
package webauth
|
|
|
|
import (
|
|
"github.com/go-webauthn/webauthn/protocol"
|
|
"github.com/go-webauthn/webauthn/protocol/webauthncose"
|
|
"github.com/labstack/echo/v4"
|
|
"github.com/onsonr/sonr/pkg/common"
|
|
)
|
|
|
|
func buildRegisterOptions(user protocol.UserEntity, blob common.LargeBlob, service protocol.RelyingPartyEntity) protocol.PublicKeyCredentialCreationOptions {
|
|
return protocol.PublicKeyCredentialCreationOptions{
|
|
Timeout: 10000,
|
|
Attestation: protocol.PreferDirectAttestation,
|
|
AuthenticatorSelection: protocol.AuthenticatorSelection{
|
|
AuthenticatorAttachment: "platform",
|
|
ResidentKey: protocol.ResidentKeyRequirementPreferred,
|
|
UserVerification: "preferred",
|
|
},
|
|
RelyingParty: service,
|
|
User: user,
|
|
Extensions: protocol.AuthenticationExtensions{
|
|
"largeBlob": blob,
|
|
},
|
|
Parameters: []protocol.CredentialParameter{
|
|
{
|
|
Type: "public-key",
|
|
Algorithm: webauthncose.AlgES256,
|
|
},
|
|
{
|
|
Type: "public-key",
|
|
Algorithm: webauthncose.AlgES256K,
|
|
},
|
|
{
|
|
Type: "public-key",
|
|
Algorithm: webauthncose.AlgEdDSA,
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
func buildLargeBlob(userKeyshareJSON string) common.LargeBlob {
|
|
return common.LargeBlob{
|
|
Support: "required",
|
|
Write: userKeyshareJSON,
|
|
}
|
|
}
|
|
|
|
func buildUserEntity(userAddress string, userHandle string) protocol.UserEntity {
|
|
return protocol.UserEntity{
|
|
ID: userAddress,
|
|
DisplayName: userHandle,
|
|
CredentialEntity: protocol.CredentialEntity{
|
|
Name: userAddress,
|
|
},
|
|
}
|
|
}
|
|
|
|
func buildServiceEntity(c echo.Context) protocol.RelyingPartyEntity {
|
|
return protocol.RelyingPartyEntity{
|
|
CredentialEntity: protocol.CredentialEntity{
|
|
Name: "Sonr.ID",
|
|
},
|
|
ID: c.Request().Host,
|
|
}
|
|
}
|