Vendor dependencies and expose control program binaries via nix build. Uses nixpkgs-unstable for Go 1.26 support. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
41 lines
808 B
Go
41 lines
808 B
Go
package webauthn
|
|
|
|
import "bytes"
|
|
|
|
func isByteArrayInSlice(needle []byte, haystack ...[]byte) (valid bool) {
|
|
for _, hay := range haystack {
|
|
if bytes.Equal(needle, hay) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
func isCredentialsAllowedMatchingOwned(allowedCredentialIDs [][]byte, credentials []Credential) (valid bool) {
|
|
var credential Credential
|
|
|
|
allowed:
|
|
for _, allowedCredentialID := range allowedCredentialIDs {
|
|
for _, credential = range credentials {
|
|
if bytes.Equal(credential.ID, allowedCredentialID) {
|
|
continue allowed
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
func isCredentialIDInCredentials(credentialID []byte, credentials []Credential) (valid bool) {
|
|
for _, credential := range credentials {
|
|
if bytes.Equal(credential.ID, credentialID) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|