-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathCredential.swift
47 lines (37 loc) · 1.71 KB
/
Credential.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//===----------------------------------------------------------------------===//
//
// This source file is part of the WebAuthn Swift open source project
//
// Copyright (c) 2022 the WebAuthn Swift project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of WebAuthn Swift project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import Foundation
/// After a successful registration ceremony we pass this data back to the relying party. It contains all needed
/// information about a WebAuthn credential for storage in e.g. a database.
public struct Credential {
/// Value will always be ``CredentialType/publicKey`` (for now)
public let type: CredentialType
/// base64 encoded String of the credential ID bytes
public let id: String
/// The public key for this certificate
public let publicKey: [UInt8]
/// How often the authenticator says the credential was used
/// If this is not implemented by the authenticator this value will always be zero.
public let signCount: UInt32
/// Wether the public key is allowed to be backed up.
/// If a public key is considered backup eligible it is referred to as a multi-device credential (the
/// opposite being single-device credential)
public let backupEligible: Bool
/// If the public key is currently backed up (using another authenticator than the one that generated
/// the credential)
public let isBackedUp: Bool
// MARK: Optional content
public let attestationResult: AttestationResult
public let attestationClientDataJSON: CollectedClientData
}