You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

entities.go 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package protocol
  2. // From §5.4.1 (https://www.w3.org/TR/webauthn/#dictionary-pkcredentialentity).
  3. // PublicKeyCredentialEntity describes a user account, or a WebAuthn Relying Party,
  4. // with which a public key credential is associated.
  5. type CredentialEntity struct {
  6. // A human-palatable name for the entity. Its function depends on what the PublicKeyCredentialEntity represents:
  7. //
  8. // When inherited by PublicKeyCredentialRpEntity it is a human-palatable identifier for the Relying Party,
  9. // intended only for display. For example, "ACME Corporation", "Wonderful Widgets, Inc." or "ОАО Примертех".
  10. //
  11. // When inherited by PublicKeyCredentialUserEntity, it is a human-palatable identifier for a user account. It is
  12. // intended only for display, i.e., aiding the user in determining the difference between user accounts with similar
  13. // displayNames. For example, "alexm", "alex.p.mueller@example.com" or "+14255551234".
  14. Name string `json:"name"`
  15. // A serialized URL which resolves to an image associated with the entity. For example,
  16. // this could be a user’s avatar or a Relying Party's logo. This URL MUST be an a priori
  17. // authenticated URL. Authenticators MUST accept and store a 128-byte minimum length for
  18. // an icon member’s value. Authenticators MAY ignore an icon member’s value if its length
  19. // is greater than 128 bytes. The URL’s scheme MAY be "data" to avoid fetches of the URL,
  20. // at the cost of needing more storage.
  21. Icon string `json:"icon,omitempty"`
  22. }
  23. // From §5.4.2 (https://www.w3.org/TR/webauthn/#sctn-rp-credential-params).
  24. // The PublicKeyCredentialRpEntity is used to supply additional
  25. // Relying Party attributes when creating a new credential.
  26. type RelyingPartyEntity struct {
  27. CredentialEntity
  28. // A unique identifier for the Relying Party entity, which sets the RP ID.
  29. ID string `json:"id"`
  30. }
  31. // From §5.4.3 (https://www.w3.org/TR/webauthn/#sctn-user-credential-params).
  32. // The PublicKeyCredentialUserEntity is used to supply additional
  33. // user account attributes when creating a new credential.
  34. type UserEntity struct {
  35. CredentialEntity
  36. // A human-palatable name for the user account, intended only for display.
  37. // For example, "Alex P. Müller" or "田中 倫". The Relying Party SHOULD let
  38. // the user choose this, and SHOULD NOT restrict the choice more than necessary.
  39. DisplayName string `json:"displayName,omitempty"`
  40. // ID is the user handle of the user account entity. To ensure secure operation,
  41. // authentication and authorization decisions MUST be made on the basis of this id
  42. // member, not the displayName nor name members. See Section 6.1 of
  43. // [RFC8266](https://www.w3.org/TR/webauthn/#biblio-rfc8266).
  44. ID []byte `json:"id"`
  45. }