Skip to content

Commit 4b7c8a0

Browse files
committed
CredentialID
1 parent 391d631 commit 4b7c8a0

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ func ExampleDevice_Assertion() {
5252
log.Printf("Attestation:\n")
5353
log.Printf("AuthData: %s\n", hex.EncodeToString(attest.AuthData))
5454
log.Printf("ClientDataHash: %s\n", hex.EncodeToString(attest.ClientDataHash))
55-
log.Printf("ID: %s\n", hex.EncodeToString(attest.CredID))
56-
log.Printf("Type: %s\n", attest.CredType)
55+
log.Printf("ID: %s\n", hex.EncodeToString(attest.CredentialID))
56+
log.Printf("Type: %s\n", attest.CredentialType)
5757
log.Printf("Sig: %s\n", hex.EncodeToString(attest.Sig))
5858

5959
hmacSalt := libfido2.RandBytes(32)
6060
assertion, err := device.Assertion(
6161
"keys.pub",
6262
cdh,
63-
attest.CredID,
63+
attest.CredentialID,
6464
"12345", // Pin
6565
&libfido2.AssertionOpts{
6666
Extensions: []libfido2.Extension{libfido2.HMACSecret},

examples_test.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ func ExampleDevice_MakeCredential() {
9595
log.Printf("Attestation:\n")
9696
log.Printf("AuthData: %s\n", hex.EncodeToString(attest.AuthData))
9797
log.Printf("ClientDataHash: %s\n", hex.EncodeToString(attest.ClientDataHash))
98-
log.Printf("ID: %s\n", hex.EncodeToString(attest.CredID))
99-
log.Printf("Type: %d\n", attest.CredType)
98+
log.Printf("ID: %s\n", hex.EncodeToString(attest.CredentialID))
99+
log.Printf("Type: %d\n", attest.CredentialType)
100100
log.Printf("Sig: %s\n", hex.EncodeToString(attest.Sig))
101101

102102
// Output:
@@ -151,14 +151,14 @@ func ExampleDevice_Assertion() {
151151
log.Printf("Attestation:\n")
152152
log.Printf("AuthData: %s\n", hex.EncodeToString(attest.AuthData))
153153
log.Printf("ClientDataHash: %s\n", hex.EncodeToString(attest.ClientDataHash))
154-
log.Printf("ID: %s\n", hex.EncodeToString(attest.CredID))
155-
log.Printf("Type: %s\n", attest.CredType)
154+
log.Printf("ID: %s\n", hex.EncodeToString(attest.CredentialID))
155+
log.Printf("Type: %s\n", attest.CredentialType)
156156
log.Printf("Sig: %s\n", hex.EncodeToString(attest.Sig))
157157

158158
assertion, err := device.Assertion(
159159
"keys.pub",
160160
cdh,
161-
attest.CredID,
161+
attest.CredentialID,
162162
"12345", // Pin
163163
&libfido2.AssertionOpts{
164164
Extensions: []libfido2.Extension{libfido2.HMACSecretExtension},
@@ -346,12 +346,12 @@ func ExampleDevice_MakeCredential_hmacSecret() {
346346
log.Fatal(err)
347347
}
348348

349-
log.Printf("Credential ID: %s\n", hex.EncodeToString(attest.CredID))
349+
log.Printf("Credential ID: %s\n", hex.EncodeToString(attest.CredentialID))
350350
}
351351

352352
type testVector struct {
353-
CredID string
354-
Secret string
353+
CredentialID string
354+
Secret string
355355
}
356356

357357
func ExampleDevice_Assertion_hmacSecret() {
@@ -379,12 +379,12 @@ func ExampleDevice_Assertion_hmacSecret() {
379379

380380
testVectors := map[string]testVector{
381381
"SoloKey 4.0/SoloKeys": testVector{
382-
CredID: "91874f4c3d580370bf5b5301130ecc034f5927d955f5399ebad267f5666c78598942d489f10d4f4780fad392eb2962d065bdd3574375e80c42218dadd199ed3ffe7deb010000",
383-
Secret: "dd67d3aa73b13b7bb71ad0fe13cf8a247632a3508d7c9906ef6dc823906c3103",
382+
CredentialID: "91874f4c3d580370bf5b5301130ecc034f5927d955f5399ebad267f5666c78598942d489f10d4f4780fad392eb2962d065bdd3574375e80c42218dadd199ed3ffe7deb010000",
383+
Secret: "dd67d3aa73b13b7bb71ad0fe13cf8a247632a3508d7c9906ef6dc823906c3103",
384384
},
385385
"Security Key by Yubico/Yubico": testVector{
386-
CredID: "c4fe75012ed137a0afcaa59ab36f0722b9b05849b2203fc4ba4f304033015eaafdbee823ee42dce88b4ae4d943926de3cc93e797004d108ed2465c675ae568e6",
387-
Secret: "f3d37d52ca7a12cf05c34bd3c13ddc3288b723018697347e6ac5ea79b7d3cc83",
386+
CredentialID: "c4fe75012ed137a0afcaa59ab36f0722b9b05849b2203fc4ba4f304033015eaafdbee823ee42dce88b4ae4d943926de3cc93e797004d108ed2465c675ae568e6",
387+
Secret: "f3d37d52ca7a12cf05c34bd3c13ddc3288b723018697347e6ac5ea79b7d3cc83",
388388
},
389389
}
390390

@@ -393,7 +393,7 @@ func ExampleDevice_Assertion_hmacSecret() {
393393
log.Fatalf("No test vector found for %s", name)
394394
}
395395

396-
credID, err := hex.DecodeString(testVector.CredID)
396+
credentialID, err := hex.DecodeString(testVector.CredentialID)
397397
if err != nil {
398398
log.Fatal(err)
399399
}
@@ -402,7 +402,7 @@ func ExampleDevice_Assertion_hmacSecret() {
402402
assertion, err := device.Assertion(
403403
rpID,
404404
cdh,
405-
credID,
405+
credentialID,
406406
pin,
407407
&libfido2.AssertionOpts{
408408
Extensions: []libfido2.Extension{libfido2.HMACSecretExtension},

fido2.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ type User struct {
8888
type Attestation struct {
8989
ClientDataHash []byte
9090
AuthData []byte
91-
CredID []byte
92-
CredType CredentialType
91+
CredentialID []byte
92+
CredentialType CredentialType
9393
PubKey []byte
9494
Cert []byte
9595
Sig []byte
@@ -493,8 +493,8 @@ func attestation(cCred *C.fido_cred_t) (*Attestation, error) {
493493
at := &Attestation{
494494
AuthData: authData,
495495
ClientDataHash: clientDataHashOut,
496-
CredID: id,
497-
CredType: typOut,
496+
CredentialID: id,
497+
CredentialType: typOut,
498498
PubKey: pubKey,
499499
Cert: cert,
500500
Sig: sig,
@@ -574,7 +574,7 @@ type AssertionOpts struct {
574574
func (d *Device) Assertion(
575575
rpID string,
576576
clientDataHash []byte,
577-
credID []byte,
577+
credentialID []byte,
578578
pin string,
579579
opts *AssertionOpts) (*Assertion, error) {
580580

@@ -594,8 +594,8 @@ func (d *Device) Assertion(
594594
if cErr := C.fido_assert_set_clientdata_hash(cAssert, cBytes(clientDataHash), cLen(clientDataHash)); cErr != C.FIDO_OK {
595595
return nil, errors.Wrapf(errFromCode(cErr), "failed to set client data hash")
596596
}
597-
if credID != nil {
598-
if cErr := C.fido_assert_allow_cred(cAssert, cBytes(credID), cLen(credID)); cErr != C.FIDO_OK {
597+
if credentialID != nil {
598+
if cErr := C.fido_assert_allow_cred(cAssert, cBytes(credentialID), cLen(credentialID)); cErr != C.FIDO_OK {
599599
return nil, errors.Wrapf(errFromCode(cErr), "failed to set allowed credentials")
600600
}
601601
}

0 commit comments

Comments
 (0)