Skip to content

Commit

Permalink
feat: adjust public interface
Browse files Browse the repository at this point in the history
  • Loading branch information
matoous committed Apr 23, 2024
1 parent 0795e4a commit c081c9f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ Small package mapping AAGUIDs (Authenticator Attestation Global Unique Identifie
package main

import (
"fmt"

"github.com/sumup/aaguids-go"
)

func main() {
metadata, _ := aaguid.Passkeys["fbfc3007-154e-4ecc-8c0b-6e020557d7bd"]
metadata, _ := aaguid.GetMetadata("fbfc3007-154e-4ecc-8c0b-6e020557d7bd")
fmt.Println(metadata.Name)
}
```
Expand Down
1 change: 0 additions & 1 deletion cmd/test.json

This file was deleted.

20 changes: 18 additions & 2 deletions data.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
package aaguids

import "fmt"

var (
ErrNotFound = fmt.Errorf("not found")
)

// GetMetadata returns [Metadata] for requested aaguid.
func GetMetadata(aaguid string) (*Metadata, error) {
metadata, ok := passkeys[aaguid]
if !ok {
return nil, ErrNotFound
}

return &metadata, nil
}

var (
// Passkeys are passkey provider AAGUIDs.
// passkeys are passkey provider AAGUIDs.
// This list is based on https://github.com/passkeydeveloper/passkey-authenticator-aaguids, it is community driven,
// and might miss certain AAGUIDs from the official metadata file (https://fidoalliance.org/metadata/).
// On the other hand, some commonly used Passkey Providers absent from the official metadata file are included
// here.
Passkeys = map[string]Metadata{
passkeys = map[string]Metadata{
"ea9b8d66-4d01-1d21-3ce4-b6b48cb575d4": {
Name: "Google Password Manager",
IconDark: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDE5MiAxOTIiIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDE5MiAxOTIiIHdpZHRoPSIyNHB4Ij48cmVjdCBmaWxsPSJub25lIiBoZWlnaHQ9IjE5MiIgd2lkdGg9IjE5MiIgeT0iMCIvPjxnPjxwYXRoIGQ9Ik02OS4yOSwxMDZjLTMuNDYsNS45Ny05LjkxLDEwLTE3LjI5LDEwYy0xMS4wMywwLTIwLTguOTctMjAtMjBzOC45Ny0yMCwyMC0yMCBjNy4zOCwwLDEzLjgzLDQuMDMsMTcuMjksMTBoMjUuNTVDOTAuMyw2Ni41NCw3Mi44Miw1Miw1Miw1MkMyNy43NCw1Miw4LDcxLjc0LDgsOTZzMTkuNzQsNDQsNDQsNDRjMjAuODIsMCwzOC4zLTE0LjU0LDQyLjg0LTM0IEg2OS4yOXoiIGZpbGw9IiM0Mjg1RjQiLz48cmVjdCBmaWxsPSIjRkJCQzA0IiBoZWlnaHQ9IjI0IiB3aWR0aD0iNDQiIHg9Ijk0IiB5PSI4NCIvPjxwYXRoIGQ9Ik05NC4zMiw4NEg2OHYwLjA1YzIuNSwzLjM0LDQsNy40Nyw0LDExLjk1cy0xLjUsOC42MS00LDExLjk1VjEwOGgyNi4zMiBjMS4wOC0zLjgyLDEuNjgtNy44NCwxLjY4LTEyUzk1LjQxLDg3LjgyLDk0LjMyLDg0eiIgZmlsbD0iI0VBNDMzNSIvPjxwYXRoIGQ9Ik0xODQsMTA2djI2aC0xNnYtOGMwLTQuNDItMy41OC04LTgtOHMtOCwzLjU4LTgsOHY4aC0xNnYtMjZIMTg0eiIgZmlsbD0iIzM0QTg1MyIvPjxyZWN0IGZpbGw9IiMxODgwMzgiIGhlaWdodD0iMjQiIHdpZHRoPSI0OCIgeD0iMTM2IiB5PSI4NCIvPjwvZz48L3N2Zz4=",
Expand Down
17 changes: 17 additions & 0 deletions data_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package aaguids_test

import (
"fmt"

"github.com/sumup/aaguids-go"
)

func ExampleGetMetadata() {
metadata, err := aaguids.GetMetadata("fbfc3007-154e-4ecc-8c0b-6e020557d7bd")
if err != nil {
panic(err)
}

fmt.Println(metadata.Name)
// Output: iCloud Keychain
}

0 comments on commit c081c9f

Please sign in to comment.