Documentation
¶
Overview ¶
Package factors makes Windows's authentication factors usable by github.com/go-authn/mfa.
Its two factors come from two different packages, which is the whole shape of Windows: go-mswin/winrt asks Windows Hello, and go-mswin/webauthn asks a security key through webauthn.dll. Neither binding knows what a policy is, and neither should — a program that only wants a Hello prompt must not end up importing one.
r, err := mfa.Verify(ctx, mfa.Policy{Count: 2},
factors.WindowsHello("unlock the vault"),
factors.SecurityKey("example.test", credentialID),
)
⛔ Windows cannot offer an inherence factor ¶
This is the finding that shapes the package, and it is worth stating plainly rather than papering over.
Windows Hello accepts a face, a fingerprint, or a **PIN**, and the person chooses. Nothing in UserConsentVerifier or in a WebAuthn assertion reports WHICH — the assertion's "user verified" bit is set the same way for all three. A PIN is something known; a face is something one is. So a factor that claimed mfa.Inherence here would be claiming to know something Windows never said.
WindowsHello therefore reports mfa.Unknown, and a policy asking for distinct KINDS will never count it towards them. That is not a limitation of this package working around an API; it is the API declining to say, reported faithfully. macOS can do better — LocalAuthentication has a biometrics-only policy, so github.com/go-macos/factors offers a real inherence factor — and the difference between the two platforms is real, not an oversight here.
The consequence is worth knowing before designing around it: mfa.Policy{Count: 2, DistinctKinds: true} cannot be satisfied on Windows by these two factors alone. A caller who needs two kinds must supply the knowledge factor themselves, and then it is theirs to be honest about.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("factors: these are Windows factors")
ErrUnsupported is what both factors report off Windows. It is wrapped as unavailable rather than as a refusal: a Mac has not failed anyone's Windows Hello, it has no Windows Hello. The macOS adapters are go-macos/factors.
Functions ¶
func SecurityKey ¶
SecurityKey is a registered credential on a carried authenticator.
The request is constrained to a cross-platform authenticator, so Windows Hello cannot answer it. That constraint is what makes mfa.Possession a true statement: without it, Windows would be free to satisfy the request with the machine itself, and "something you have" would mean the computer already in front of the person.
credentialID is what a registration returned. Registering is not done here; see go-mswin/webauthn.
func VerifiedSecurityKey ¶
VerifiedSecurityKey is the same, with the key asked to establish who holds it.
The kind does not change. Whatever the key asked for -- its own PIN, its own fingerprint reader -- never reaches this machine and identifies nobody to us; it protects the key. Counting it as a second factor would let one object masquerade as two.
func WindowsHello ¶
WindowsHello is the authenticator built into this machine, as a factor.
reason is what Windows shows the person in its own prompt, so it should say what is being unlocked.
Its kind is mfa.Unknown, honestly: see the package documentation. What it proves is that somebody satisfied this machine's own check, which is worth having — it is simply not a KIND that can be shown to differ from a passphrase.
func WithOrigin ¶
WithOrigin overrides the origin sent in the client data.
It defaults to "https://" + rpID, which is what a program that is not a web page wants. A browser-like caller with a real page has a real origin and should say so, because Windows checks that the two agree.
Types ¶
This section is empty.