Skip to content

feat: optional walletLabel key card #6468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions modules/key-card/src/drawKeycard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,20 @@ export async function drawKeycard({
const date = new Date().toDateString();
y = moveDown(y, margin);
doc.setFontSize(font.body).setTextColor(color.gray);
const title = curve ? KeyCurveName[curve] + ' key:' : 'wallet named:';
doc.text('Created on ' + date + ' for ' + title, left(0), y);
// copy
y = moveDown(y, 25);
doc.setFontSize(font.subheader).setTextColor(color.black);
doc.text(walletLabel, left(0), y);

if (curve || walletLabel) {
const title = curve ? KeyCurveName[curve] + ' key:' : 'wallet named:';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it makes sense to use wallet id instead of curve for the title?

Actually I don't see a walletID in the keycard which I guess is important though, how can somebody identify the wallet with just user key and wallet label is something which can change down the line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we generate the keycard before we create the wallet, and in the new UI we generate the card before we even prompt for a wallet name. Client can name the file anything they want at anytime

doc.text('Created on ' + date + ' for ' + title, left(0), y);
// copy
y = moveDown(y, 25);
if (walletLabel) {
doc.setFontSize(font.subheader).setTextColor(color.black);
doc.text(walletLabel, left(0), y);
}
} else {
doc.text('Created on ' + date, left(0), y);
y = moveDown(y, 25);
}
if (!curve) {
// Red Bar
y = moveDown(y, 20);
Expand Down
6 changes: 4 additions & 2 deletions modules/key-card/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ export async function generateKeycard(params: GenerateKeycardParams): Promise<vo
const questions = generateFaq(params.coin.fullName);
const qrData = generateQrData(params);
const keycard = await drawKeycard({ ...params, questions, qrData });
keycard.save(`BitGo Keycard for ${params.walletLabel}.pdf`);
const label = params.walletLabel || params.coin.fullName;
keycard.save(`BitGo Keycard for ${label}.pdf`);
} else if ('curve' in params) {
const data = generateParamsForKeyCreation(params);
const keycard = await drawKeycard(data);
keycard.save(`BitGo Keycard for ${params.walletLabel}.pdf`);
const label = params.walletLabel || params.curve;
keycard.save(`BitGo Keycard for ${label}.pdf`);
} else {
throw new Error('Either curve or coin must be provided');
}
Expand Down
2 changes: 1 addition & 1 deletion modules/key-card/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export interface IDrawKeyCard {
keyCardImage?: HTMLImageElement;
qrData: QrData;
questions: FAQ[];
walletLabel: string;
walletLabel?: string;
curve?: KeyCurve;
}

Expand Down
4 changes: 2 additions & 2 deletions modules/web-demo/src/components/KeyCard/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export async function downloadKeycardForDKLsTSS() {
});
}

export async function downloadKeycardForHotLtcWallet() {
export async function downloadKeycardForHotLtcWallet(walletLabel = '') {
const userKeychain: Keychain = {
id: '63e107b5ef7bba0007145e41065b26a6',
pub: 'xpub661MyMwAqRbcFXFJ8wZhWjEiFg9wM89UamPyP3XsnEHg2VJ4m7wE7ALLszakPiEEy5cH9FCAvCrx1cL6rLE6jewaa1ubP8DjqsDtP4R7w5g',
Expand Down Expand Up @@ -142,7 +142,7 @@ export async function downloadKeycardForHotLtcWallet() {
passcodeEncryptionCode: '654321',
passphrase: 'test_wallet_passphrase',
userKeychain,
walletLabel: 'Hot LTC Wallet',
walletLabel,
});
}

Expand Down
7 changes: 5 additions & 2 deletions modules/web-demo/src/components/KeyCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ const KeyCard = () => {
<React.Fragment>
<h3>Key Card</h3>
<br />
<button onClick={downloadKeycardForHotLtcWallet}>
Download for Hot LTC Wallet
<button onClick={() => downloadKeycardForHotLtcWallet('Hot LTC Wallet')}>
Download for Hot LTC Wallet (With Label)
</button>
<button onClick={() => downloadKeycardForHotLtcWallet('')}>
Download for Hot LTC Wallet (Without Label)
</button>
<button onClick={downloadKeycardForDKLsTSS}>
Download for Hot DKLS Wallet
Expand Down