Skip to content

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

@germainc

Description

@germainc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions