Skip to content

Commit e511b2c

Browse files
committed
Refactor generateAPIKeyAndSignature to use functional options for key generation
Signed-off-by: Andy Lo-A-Foe <[email protected]>
1 parent f733d00 commit e511b2c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

internal/services/tenant/resource_tenant_key.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,15 @@ func generateAPIKeyAndSignature(d *schema.ResourceData) (string, string, error)
114114
}
115115

116116
// Use GenerateDeterministicAPIKey for a deterministic, non-time-dependent key
117-
apiKey, signature, err := keys.GenerateDeterministicAPIKey(
118-
"2",
117+
apiKey, signature, err := keys.GenerateDeterministicAPIKey("2",
119118
signingKey,
120-
organization,
121-
environment,
122-
region,
123-
project,
124-
scopes,
125-
expirationTime,
126-
salt,
119+
keys.WithOrganization(organization),
120+
keys.WithEnvironment(environment),
121+
keys.WithRegion(region),
122+
keys.WithProject(project),
123+
keys.WithScopes(scopes),
124+
keys.WithToken(salt), // Use salt as the token for deterministic generation
125+
keys.WithExpires(expirationTime.Unix()),
127126
)
128127
if err != nil {
129128
return "", "", err

0 commit comments

Comments
 (0)