mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 07:57:32 +00:00
feat: implement register Passkey user API v2 (#5873)
* command/crypto: DRY the code - reuse the the algorithm switch to create a secret generator - add a verifyCryptoCode function * command: crypto code tests * migrate webauthn package * finish integration tests with webauthn mock client
This commit is contained in:
@@ -4,12 +4,10 @@ import (
|
||||
"io"
|
||||
"regexp"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/crypto"
|
||||
"github.com/zitadel/zitadel/internal/errors"
|
||||
caos_errs "github.com/zitadel/zitadel/internal/errors"
|
||||
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
||||
)
|
||||
|
||||
@@ -73,19 +71,8 @@ type ConfirmURLData struct {
|
||||
OrgID string
|
||||
}
|
||||
|
||||
// RenderConfirmURLTemplate parses and renders tmplStr.
|
||||
// RenderConfirmURLTemplate parses and renders tmpl.
|
||||
// userID, code and orgID are passed into the [ConfirmURLData].
|
||||
// "%s%s?userID=%s&code=%s&orgID=%s"
|
||||
func RenderConfirmURLTemplate(w io.Writer, tmplStr, userID, code, orgID string) error {
|
||||
tmpl, err := template.New("").Parse(tmplStr)
|
||||
if err != nil {
|
||||
return caos_errs.ThrowInvalidArgument(err, "USERv2-ooD8p", "Errors.User.Email.InvalidURLTemplate")
|
||||
}
|
||||
|
||||
data := &ConfirmURLData{userID, code, orgID}
|
||||
if err = tmpl.Execute(w, data); err != nil {
|
||||
return caos_errs.ThrowInvalidArgument(err, "USERv2-ohSi5", "Errors.User.Email.InvalidURLTemplate")
|
||||
}
|
||||
|
||||
return nil
|
||||
func RenderConfirmURLTemplate(w io.Writer, tmpl, userID, code, orgID string) error {
|
||||
return renderURLTemplate(w, tmpl, &ConfirmURLData{userID, code, orgID})
|
||||
}
|
||||
|
Reference in New Issue
Block a user