@@ -71,7 +71,7 @@ public struct PublicKeyCredentialCreationOptions: Encodable, Sendable {
71
71
72
72
// MARK: - Credential parameters
73
73
/// From §5.3 (https://w3c.github.io/TR/webauthn/#dictionary-credential-params)
74
- public struct PublicKeyCredentialParameters : Hashable , Encodable , Sendable {
74
+ public struct PublicKeyCredentialParameters : Hashable , Codable , Sendable {
75
75
/// The type of credential to be created. At the time of writing always ``CredentialType/publicKey``.
76
76
public let type : CredentialType
77
77
/// The cryptographic signature algorithm with which the newly generated credential will be used, and thus also
@@ -111,7 +111,7 @@ extension Set where Element == PublicKeyCredentialParameters {
111
111
/// From §5.4.2 (https://www.w3.org/TR/webauthn/#sctn-rp-credential-params).
112
112
/// The PublicKeyCredentialRelyingPartyEntity dictionary is used to supply additional Relying Party attributes when
113
113
/// creating a new credential.
114
- public struct PublicKeyCredentialRelyingPartyEntity : Identifiable , Encodable , Sendable {
114
+ public struct PublicKeyCredentialRelyingPartyEntity : Identifiable , Codable , Sendable {
115
115
/// A unique identifier for the Relying Party entity.
116
116
public let id : String
117
117
@@ -126,7 +126,7 @@ public struct PublicKeyCredentialRelyingPartyEntity: Identifiable, Encodable, Se
126
126
/// creating a new credential.
127
127
///
128
128
/// When encoding using `Encodable`, `id` is base64url encoded.
129
- public struct PublicKeyCredentialUserEntity : Identifiable , Encodable , Sendable {
129
+ public struct PublicKeyCredentialUserEntity : Identifiable , Codable , Sendable {
130
130
/// Generated by the Relying Party, unique to the user account, and must not contain personally identifying
131
131
/// information about the user.
132
132
///
@@ -150,6 +150,14 @@ public struct PublicKeyCredentialUserEntity: Identifiable, Encodable, Sendable {
150
150
self . displayName = displayName
151
151
}
152
152
153
+ public init ( from decoder: Decoder ) throws {
154
+ let container = try decoder. container ( keyedBy: CodingKeys . self)
155
+
156
+ self . id = try container. decodeBytesFromURLEncodedBase64 ( forKey: . id)
157
+ self . name = try container. decode ( String . self, forKey: . name)
158
+ self . displayName = try container. decode ( String . self, forKey: . displayName)
159
+ }
160
+
153
161
public func encode( to encoder: Encoder ) throws {
154
162
var container = encoder. container ( keyedBy: CodingKeys . self)
155
163
0 commit comments