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.

messages.go 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // Go FIDO U2F Library
  2. // Copyright 2015 The Go FIDO U2F Library Authors. All rights reserved.
  3. // Use of this source code is governed by the MIT
  4. // license that can be found in the LICENSE file.
  5. package u2f
  6. import (
  7. "encoding/json"
  8. )
  9. // JwkKey represents a public key used by a browser for the Channel ID TLS
  10. // extension.
  11. type JwkKey struct {
  12. KTy string `json:"kty"`
  13. Crv string `json:"crv"`
  14. X string `json:"x"`
  15. Y string `json:"y"`
  16. }
  17. // ClientData as defined by the FIDO U2F Raw Message Formats specification.
  18. type ClientData struct {
  19. Typ string `json:"typ"`
  20. Challenge string `json:"challenge"`
  21. Origin string `json:"origin"`
  22. CIDPubKey json.RawMessage `json:"cid_pubkey"`
  23. }
  24. // RegisterRequest as defined by the FIDO U2F Javascript API 1.1.
  25. type RegisterRequest struct {
  26. Version string `json:"version"`
  27. Challenge string `json:"challenge"`
  28. }
  29. // WebRegisterRequest contains the parameters needed for the u2f.register()
  30. // high-level Javascript API function as defined by the
  31. // FIDO U2F Javascript API 1.1.
  32. type WebRegisterRequest struct {
  33. AppID string `json:"appId"`
  34. RegisterRequests []RegisterRequest `json:"registerRequests"`
  35. RegisteredKeys []RegisteredKey `json:"registeredKeys"`
  36. }
  37. // RegisterResponse as defined by the FIDO U2F Javascript API 1.1.
  38. type RegisterResponse struct {
  39. Version string `json:"version"`
  40. RegistrationData string `json:"registrationData"`
  41. ClientData string `json:"clientData"`
  42. }
  43. // RegisteredKey as defined by the FIDO U2F Javascript API 1.1.
  44. type RegisteredKey struct {
  45. Version string `json:"version"`
  46. KeyHandle string `json:"keyHandle"`
  47. AppID string `json:"appId"`
  48. }
  49. // WebSignRequest contains the parameters needed for the u2f.sign()
  50. // high-level Javascript API function as defined by the
  51. // FIDO U2F Javascript API 1.1.
  52. type WebSignRequest struct {
  53. AppID string `json:"appId"`
  54. Challenge string `json:"challenge"`
  55. RegisteredKeys []RegisteredKey `json:"registeredKeys"`
  56. }
  57. // SignResponse as defined by the FIDO U2F Javascript API 1.1.
  58. type SignResponse struct {
  59. KeyHandle string `json:"keyHandle"`
  60. SignatureData string `json:"signatureData"`
  61. ClientData string `json:"clientData"`
  62. }
  63. // TrustedFacets as defined by the FIDO AppID and Facet Specification.
  64. type TrustedFacets struct {
  65. Version struct {
  66. Major int `json:"major"`
  67. Minor int `json:"minor"`
  68. } `json:"version"`
  69. Ids []string `json:"ids"`
  70. }
  71. // TrustedFacetsEndpoint is a container of TrustedFacets.
  72. // It is used as the response for an appId URL endpoint.
  73. type TrustedFacetsEndpoint struct {
  74. TrustedFacets []TrustedFacets `json:"trustedFacets"`
  75. }