Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoseAlgorithmIdentifier is typed as a string but the API returns integers #75

Open
germainc opened this issue Jul 25, 2023 · 0 comments

Comments

@germainc
Copy link

API response from /api/webauthn/register/start:

{
  "options": { 
    "pubKeyCredParams": [
      {
        "alg": -36,
        "type": "public-key"
      },
      {
        "alg": -35,
        "type": "public-key"
      },
    ...
  }
}

Golang type:

type PublicKeyCredentialParameters struct {
	Alg  CoseAlgorithmIdentifier `json:"alg,omitempty"`
	Type PublicKeyCredentialType `json:"type,omitempty"`
}

...

type CoseAlgorithmIdentifier string

func (e CoseAlgorithmIdentifier) String() string {
	return string(e)
}

const (
	CoseAlgorithmIdentifier_ES256 CoseAlgorithmIdentifier = "ES256"
	CoseAlgorithmIdentifier_ES384 CoseAlgorithmIdentifier = "ES384"
	CoseAlgorithmIdentifier_ES512 CoseAlgorithmIdentifier = "ES512"
	CoseAlgorithmIdentifier_RS256 CoseAlgorithmIdentifier = "RS256"
	CoseAlgorithmIdentifier_RS384 CoseAlgorithmIdentifier = "RS384"
	CoseAlgorithmIdentifier_RS512 CoseAlgorithmIdentifier = "RS512"
	CoseAlgorithmIdentifier_PS256 CoseAlgorithmIdentifier = "PS256"
	CoseAlgorithmIdentifier_PS384 CoseAlgorithmIdentifier = "PS384"
	CoseAlgorithmIdentifier_PS512 CoseAlgorithmIdentifier = "PS512"
)

Error:

cannot unmarshal number into Go struct field PublicKeyCredentialParameters.options.pubKeyCredParams.alg of type fusionauth.CoseAlgorithmIdentifier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant