Skip to content

Commit

Permalink
Fix a typo.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 693368431
Change-Id: I83aa758f0247e0574f63a6809bc0ec9e6b081ca6
  • Loading branch information
LizaTretyakova authored and copybara-github committed Nov 5, 2024
1 parent 111457e commit 6a4ff75
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ func (c *Config) RegisterPrimitiveConstructor(keyType reflect.Type, constructor
return nil
}

// RegisterKeyManger registers a key manager for a key type URL.
// RegisterKeyManager registers a key manager for a key type URL.
//
// Not thread-safe.
//
// This is an internal API.
func (c *Config) RegisterKeyManger(keyTypeURL string, km registry.KeyManager, _ internalapi.Token) error {
func (c *Config) RegisterKeyManager(keyTypeURL string, km registry.KeyManager, _ internalapi.Token) error {
if _, ok := c.keysetManagers[keyTypeURL]; ok {
return fmt.Errorf("RegisterKeyManger: attempt to register a different key manager for %v", keyTypeURL)
return fmt.Errorf("RegisterKeyManager: attempt to register a different key manager for %v", keyTypeURL)
}
c.keysetManagers[keyTypeURL] = km
return nil
Expand Down
24 changes: 12 additions & 12 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ func TestConfigPrimitiveFromKeDataWorks(t *testing.T) {
}
token := internalapi.Token{}

err = testConfig.RegisterKeyManger(typeURL0, &stubKeyManager0{}, token)
err = testConfig.RegisterKeyManager(typeURL0, &stubKeyManager0{}, token)
if err != nil {
t.Fatalf("testConfig.RegisterKeyManger() err = %v, want nil", err)
t.Fatalf("testConfig.RegisterKeyManager() err = %v, want nil", err)
}

keyData := &tinkpb.KeyData{
Expand Down Expand Up @@ -169,13 +169,13 @@ func TestMultipleKeyManagers(t *testing.T) {
}
token := internalapi.Token{}

err = testConfig.RegisterKeyManger(typeURL0, &stubKeyManager0{}, token)
err = testConfig.RegisterKeyManager(typeURL0, &stubKeyManager0{}, token)
if err != nil {
t.Fatalf("testConfig.RegisterKeyManger() err = %v, want nil", err)
t.Fatalf("testConfig.RegisterKeyManager() err = %v, want nil", err)
}
err = testConfig.RegisterKeyManger(typeURL1, &stubKeyManager1{}, token)
err = testConfig.RegisterKeyManager(typeURL1, &stubKeyManager1{}, token)
if err != nil {
t.Fatalf("testConfig.RegisterKeyManger() err = %v, want nil", err)
t.Fatalf("testConfig.RegisterKeyManager() err = %v, want nil", err)
}

p0, err := testConfig.PrimitiveFromKeyData(&tinkpb.KeyData{TypeUrl: typeURL0, Value: []byte("key")}, token)
Expand Down Expand Up @@ -220,14 +220,14 @@ func TestRegisterDifferentKeyManagers(t *testing.T) {
}
token := internalapi.Token{}

err = testConfig.RegisterKeyManger(typeURL0, &stubKeyManager0{}, token)
err = testConfig.RegisterKeyManager(typeURL0, &stubKeyManager0{}, token)
if err != nil {
t.Fatalf("testConfig.RegisterKeyManger() err = %v, want nil", err)
t.Fatalf("testConfig.RegisterKeyManager() err = %v, want nil", err)
}

// Register another primitiveCreator for the same key type fails.
if err = testConfig.RegisterKeyManger(typeURL0, &stubKeyManager1{}, token); err == nil {
t.Errorf("testConfig.RegisterKeyManger() err = nil, want error")
if err = testConfig.RegisterKeyManager(typeURL0, &stubKeyManager1{}, token); err == nil {
t.Errorf("testConfig.RegisterKeyManager() err = nil, want error")
}
}

Expand Down Expand Up @@ -259,8 +259,8 @@ func TestUnregisteredKeyManager(t *testing.T) {
}
token := internalapi.Token{}

if err = testConfig.RegisterKeyManger(typeURL0, &stubKeyManager0{}, token); err != nil {
t.Fatalf("testConfig.RegisterKeyManger() err = %v, want nil", err)
if err = testConfig.RegisterKeyManager(typeURL0, &stubKeyManager0{}, token); err != nil {
t.Fatalf("testConfig.RegisterKeyManager() err = %v, want nil", err)
}

if _, err := testConfig.PrimitiveFromKeyData(&tinkpb.KeyData{TypeUrl: typeURL1, Value: []byte("key")}, token); err == nil {
Expand Down

0 comments on commit 6a4ff75

Please sign in to comment.