Skip to content

Commit e6cfb2a

Browse files
authored
fix: normalize token alias display with consistent masking symbols (#6800)
1 parent aab6e7c commit e6cfb2a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/web/app/src/pages/target-settings.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ import { zodResolver } from '@hookform/resolvers/zod';
5454
import { RadioGroupIndicator } from '@radix-ui/react-radio-group';
5555
import { Link, useRouter } from '@tanstack/react-router';
5656

57+
/**
58+
* We previously used a different character for token masking.
59+
* This function standardizes it by replacing all non-alphanumeric characters
60+
* with bullet points (•) to ensure consistent formatting.
61+
* @param tokenAlias 553••***•••&*******••••••••••••7ab
62+
* @returns 553••••••••••••••••••7ab
63+
*/
64+
function normalizeTokenAlias(tokenAlias: string): string {
65+
return tokenAlias.replaceAll(/[^a-z0-9]/g, '•');
66+
}
67+
5768
export const DeleteTokensDocument = graphql(`
5869
mutation deleteTokens($input: DeleteTokensInput!) {
5970
deleteTokens(input: $input) {
@@ -166,7 +177,7 @@ function RegistryAccessTokens(props: {
166177
checked={checked.includes(token.id)}
167178
/>
168179
</Td>
169-
<Td>{token.alias}</Td>
180+
<Td className="font-mono">{normalizeTokenAlias(token.alias)}</Td>
170181
<Td>{token.name}</Td>
171182
<Td align="right">
172183
{token.lastUsedAt ? (

0 commit comments

Comments
 (0)