File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,15 +20,15 @@ describe("API key utilities", () => {
2020 expect ( root . apiKey ) . toMatch ( new RegExp ( `^${ prefix } [A-Za-z0-9]{24}$` ) ) ;
2121 expect ( root . keyHash ) . toBe ( hashApiKey ( root . apiKey ) ) ;
2222 expect ( root . lastFour ) . toBe ( root . apiKey . slice ( - 4 ) ) ;
23- expect ( additional . apiKey ) . toMatch ( new RegExp ( `^${ prefix } ak_ [A-Za-z0-9]{24}$` ) ) ;
23+ expect ( additional . apiKey ) . toMatch ( new RegExp ( `^${ prefix } sk_ [A-Za-z0-9]{24}$` ) ) ;
2424 expect ( additional . keyHash ) . toBe ( hashApiKey ( additional . apiKey ) ) ;
2525 expect ( additional . lastFour ) . toBe ( additional . apiKey . slice ( - 4 ) ) ;
2626 expect ( apiKeyPrefix ( environmentType ) ) . toBe ( prefix ) ;
2727 expect ( obfuscateApiKey ( environmentType , root . lastFour ) ) . toBe (
2828 `${ prefix } ••••••••${ root . lastFour } `
2929 ) ;
3030 expect ( obfuscateApiKey ( environmentType , additional . lastFour , "additional" ) ) . toBe (
31- `${ prefix } ak_ ••••••••${ additional . lastFour } `
31+ `${ prefix } sk_ ••••••••${ additional . lastFour } `
3232 ) ;
3333 } ) ;
3434
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export function generateRootApiKey(environmentType: RuntimeEnvironmentType) {
2525}
2626
2727export function generateAdditionalApiKey ( environmentType : RuntimeEnvironmentType ) {
28- return generatedApiKey ( `${ apiKeyPrefix ( environmentType ) } ak_ ${ apiKeyId ( ) } ` ) ;
28+ return generatedApiKey ( `${ apiKeyPrefix ( environmentType ) } sk_ ${ apiKeyId ( ) } ` ) ;
2929}
3030
3131export function apiKeyPrefix ( environmentType : RuntimeEnvironmentType ) : string {
@@ -46,6 +46,6 @@ export function obfuscateApiKey(
4646 lastFour : string ,
4747 kind : "root" | "additional" = "root"
4848) : string {
49- const discriminator = kind === "additional" ? "ak_ " : "" ;
49+ const discriminator = kind === "additional" ? "sk_ " : "" ;
5050 return `${ apiKeyPrefix ( environmentType ) } ${ discriminator } ••••••••${ lastFour } ` ;
5151}
You can’t perform that action at this time.
0 commit comments