29 lines
860 B
Swift
29 lines
860 B
Swift
/// A `Sendable` snapshot of a WebAuthn credential registered to an account.
|
|||
|
|
public struct Passkey: Sendable, Equatable {
|
||
|
|
|
||
|
|
// MARK: Properties
|
||
|
|
|
||
|
|
/// The credential's identifier, base64url-encoded without padding.
|
||
|
|
public let credentialID: String
|
||
|
|
/// The credential's public key, COSE-encoded.
|
||
|
|
public let publicKey: [UInt8]
|
||
|
|
/// The authenticator's signature counter as last seen; a lower one later on signals a cloned authenticator.
|
||
|
|
public let signCount: UInt32
|
||
|
|
/// The account the credential signs in.
|
||
|
|
public let user: User
|
||
|
|
|
||
|
|
// MARK: Initializers
|
||
|
|
|
||
|
|
public init(
|
||
|
|
credentialID: String,
|
||
|
|
publicKey: [UInt8],
|
||
|
|
signCount: UInt32,
|
||
|
|
user: User
|
||
|
|
) {
|
||
|
|
self.credentialID = credentialID
|
||
|
|
self.publicKey = publicKey
|
||
|
|
self.signCount = signCount
|
||
|
|
self.user = user
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|