-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement SecurityShieldBuilder which is UniFFI exported, and all logic needed to power it (rules for roles).
- Loading branch information
1 parent
8d10a02
commit 5fdde66
Showing
127 changed files
with
12,140 additions
and
2,676 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
...rgon/Extensions/Methods/Profile/MFA/SecurityStructureOfFactorSources+Wrap+Functions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,2 @@ | ||
import Foundation | ||
import SargonUniFFI | ||
|
||
extension SecurityStructureOfFactorSources { | ||
public init( | ||
metadata: SecurityStructureMetadata, | ||
numberOfDaysUntilAutoConfirmation: UInt16, | ||
matrixOfFactors: MatrixOfFactorSources | ||
) { | ||
assert(matrixOfFactors.primaryRole.thresholdFactors.count >= matrixOfFactors.primaryRole.threshold) | ||
assert(matrixOfFactors.recoveryRole.thresholdFactors.count >= matrixOfFactors.recoveryRole.threshold) | ||
assert(matrixOfFactors.confirmationRole.thresholdFactors.count >= matrixOfFactors.confirmationRole.threshold) | ||
self = newSecurityStructureOfFactorSourcesAutoInDays( | ||
metadata: metadata, | ||
numberOfDaysUntilAutoConfirmation: numberOfDaysUntilAutoConfirmation, | ||
matrixOfFactors: matrixOfFactors | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
apple/Sources/Sargon/Extensions/Swiftified/Profile/MFA/SecurityShieldBuilder+Swifified.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import SargonUniFFI | ||
|
||
extension SecurityShieldBuilder { | ||
public typealias Factor = FactorSourceID | ||
|
||
/// Confirmation Role | ||
public var numberOfDaysUntilAutoConfirm: UInt16 { | ||
get { getNumberOfDaysUntilAutoConfirm() } | ||
set { | ||
precondition(newValue > 0, "Number of days until auto confirm must be greater than zero.") | ||
setNumberOfDaysUntilAutoConfirm(numberOfDays: UInt16(newValue)) | ||
} | ||
} | ||
|
||
public var threshold: UInt8 { | ||
get { getPrimaryThreshold() } | ||
set { setThreshold(threshold: newValue) } | ||
} | ||
|
||
public var primaryRoleThresholdFactors: [Factor] { | ||
getPrimaryThresholdFactors() | ||
} | ||
|
||
public var primaryRoleOverrideFactors: [Factor] { | ||
getPrimaryOverrideFactors() | ||
} | ||
|
||
public var recoveryRoleFactors: [Factor] { | ||
getRecoveryFactors() | ||
} | ||
|
||
public var confirmationRoleFactors: [Factor] { | ||
getConfirmationFactors() | ||
} | ||
|
||
/// Name of the shield | ||
public var name: String { | ||
get { | ||
getName() | ||
} | ||
set { | ||
setName(name: newValue) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.