Skip to content

Commit 1372d58

Browse files
committed
use maj
1 parent 76f4022 commit 1372d58

File tree

8 files changed

+24
-24
lines changed

8 files changed

+24
-24
lines changed

clients/algoliasearch-client-csharp/algoliasearch/Utils/ClientExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,14 @@ public static IEnumerable<SynonymHit> BrowseSynonyms(this SearchClient client, s
264264
/// Generate a virtual API Key without any call to the server.
265265
/// </summary>
266266
/// <param name="client"></param>
267-
/// <param name="parentApiKey">Parent API Key</param>
267+
/// <param name="parentAPIKey">Parent API Key</param>
268268
/// <param name="restriction">Restriction to add the key</param>
269269
/// <returns></returns>
270-
public static string GenerateSecuredApiKey(this SearchClient client, string parentApiKey,
270+
public static string GenerateSecuredApiKey(this SearchClient client, string parentAPIKey,
271271
SecuredAPIKeyRestrictions restriction)
272272
{
273273
var queryParams = restriction.ToQueryString();
274-
var hash = HmacShaHelper.GetHash(parentApiKey, queryParams);
274+
var hash = HmacShaHelper.GetHash(parentAPIKey, queryParams);
275275
return HmacShaHelper.Base64Encode($"{hash}{queryParams}");
276276
}
277277

clients/algoliasearch-client-swift/Sources/Search/Extra/SearchHelpers.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,15 +440,15 @@ public extension SearchClient {
440440
}
441441

442442
/// Generate a secured API key
443-
/// - parameter parentApiKey: The parent API key
443+
/// - parameter parentAPIKey: The parent API key
444444
/// - parameter restriction: The restrictions
445445
/// - returns: String?
446446
func generateSecuredApiKey(
447-
parentApiKey: String,
447+
parentAPIKey: String,
448448
with restriction: SecuredAPIKeyRestrictions = SecuredAPIKeyRestrictions()
449449
) throws -> String? {
450450
let queryParams = try restriction.toURLEncodedString()
451-
let hash = queryParams.hmac256(withKey: parentApiKey)
451+
let hash = queryParams.hmac256(withKey: parentAPIKey)
452452
return "\(hash)\(queryParams)".data(using: .utf8)?.base64EncodedString()
453453
}
454454

templates/go/search_helpers.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ func (c *APIClient) WaitForApiKeyWithContext(
296296

297297
// GenerateSecuredApiKey generates a public API key intended to restrict access
298298
// to certain records. This new key is built upon the existing key named
299-
// `parentApiKey` and the following options:
300-
func (c *APIClient) GenerateSecuredApiKey(parentApiKey string, restrictions *SecuredAPIKeyRestrictions) (string, error) {
301-
h := hmac.New(sha256.New, []byte(parentApiKey))
299+
// `parentAPIKey` and the following options:
300+
func (c *APIClient) GenerateSecuredApiKey(parentAPIKey string, restrictions *SecuredAPIKeyRestrictions) (string, error) {
301+
h := hmac.New(sha256.New, []byte(parentAPIKey))
302302
303303
message, err := encodeRestrictions(restrictions)
304304
if err != nil {

templates/javascript/clients/client/api/helpers.mustache

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,20 +264,20 @@ searchForFacets(
264264
},
265265

266266
/**
267-
* Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
267+
* Helper: Generates a secured API key based on the given `parentAPIKey` and given `restrictions`.
268268
*
269-
* @summary Helper: Generates a secured API key based on the given `parentApiKey` and given `restrictions`.
269+
* @summary Helper: Generates a secured API key based on the given `parentAPIKey` and given `restrictions`.
270270
* @param generateSecuredApiKey - The `generateSecuredApiKey` object.
271-
* @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one.
271+
* @param generateSecuredApiKey.parentAPIKey - The base API key from which to generate the new secured one.
272272
* @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key.
273273
*/
274274
generateSecuredApiKey({
275-
parentApiKey,
275+
parentAPIKey,
276276
restrictions = {},
277277
}: GenerateSecuredApiKeyOptions): string {
278278
const queryParameters = serializeQueryParameters(restrictions);
279279
return Buffer.from(
280-
createHmac('sha256', parentApiKey)
280+
createHmac('sha256', parentAPIKey)
281281
.update(queryParameters)
282282
.digest('hex') + queryParameters
283283
).toString('base64');

templates/javascript/clients/client/model/clientMethodProps.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export type GenerateSecuredApiKeyOptions = {
104104
/**
105105
* The base API key from which to generate the new secured one.
106106
*/
107-
parentApiKey: string;
107+
parentAPIKey: string;
108108
109109
/**
110110
* A set of properties defining the restrictions of the secured API key.

templates/javascript/tests/requests/helpers.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
describe('generateSecuredApiKey', () => {
22
test('generates a key without restrictions', () => {
3-
const resp = client.generateSecuredApiKey({ parentApiKey: 'foo' });
3+
const resp = client.generateSecuredApiKey({ parentAPIKey: 'foo' });
44
expect(resp).toEqual(
55
'NjgzNzE2ZDlkN2Y4MmVlZDE3NGM2Y2FlYmUwODZlZTkzMzc2Yzc5ZDdjNjFkZDY3MGVhMDBmN2Y4ZDZlYjBhOA=='
66
);
77
});
88

99
test('generates a key with restrictions', () => {
1010
const resp = client.generateSecuredApiKey({
11-
parentApiKey: 'foo',
11+
parentAPIKey: 'foo',
1212
restrictions: {
1313
validUntil: 100,
1414
restrictIndices: ['bar'],
@@ -28,7 +28,7 @@ describe('generateSecuredApiKey', () => {
2828
describe('getSecuredApiKeyRemainingValidity', () => {
2929
test('is able to check the remaining validity of a key', () => {
3030
const resp = client.generateSecuredApiKey({
31-
parentApiKey: 'foo',
31+
parentAPIKey: 'foo',
3232
restrictions: { validUntil: 42 },
3333
});
3434
expect(resp).toEqual(
@@ -154,4 +154,4 @@ describe('replaceAllObjects', () => {
154154
moveOperationResponse: { taskID: 21, updatedAt: 'foobar' },
155155
});
156156
});
157-
});
157+
});

templates/php/api.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,12 +498,12 @@ use {{invokerPackage}}\Support\Helpers;
498498
/**
499499
* Helper: Generate a secured API Key.
500500
*
501-
* @param string $parentApiKey Parent API Key
501+
* @param string $parentAPIKey Parent API Key
502502
* @param array $restrictions API Key's restrictions
503503
*
504504
* @return string
505505
*/
506-
public static function generateSecuredApiKey($parentApiKey, $restrictions)
506+
public static function generateSecuredApiKey($parentAPIKey, $restrictions)
507507
{
508508
$formattedRestrictions = [];
509509
@@ -525,7 +525,7 @@ use {{invokerPackage}}\Support\Helpers;
525525
$urlEncodedRestrictions = http_build_query($formattedRestrictions, encoding_type: PHP_QUERY_RFC3986);
526526

527527

528-
$content = hash_hmac('sha256', $urlEncodedRestrictions, $parentApiKey).$urlEncodedRestrictions;
528+
$content = hash_hmac('sha256', $urlEncodedRestrictions, $parentAPIKey).$urlEncodedRestrictions;
529529

530530
return base64_encode($content);
531531
}

tests/output/swift/Tests/handwritten/SecuredAPIKeyHelpers.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class SecuredApiKeyHelpersTests: XCTestCase {
1515
let client = try SearchClient(appID: "my-app-id", apiKey: "my-api-key")
1616

1717
let securedApiKey = try client.generateSecuredApiKey(
18-
parentApiKey: "parent-api-key"
18+
parentAPIKey: "parent-api-key"
1919
)
2020

2121
guard let securedApiKey else {
@@ -35,7 +35,7 @@ class SecuredApiKeyHelpersTests: XCTestCase {
3535
let client = try SearchClient(appID: "my-app-id", apiKey: "my-api-key")
3636

3737
let securedApiKey = try client.generateSecuredApiKey(
38-
parentApiKey: "parent-api-key",
38+
parentAPIKey: "parent-api-key",
3939
with: SecuredAPIKeyRestrictions(
4040
searchParams: SearchParamsObject(hitsPerPage: 2),
4141
validUntil: Int64(now + .seconds(13)),

0 commit comments

Comments
 (0)