@bitgo-beta/key-card 0.0.1-beta.17 → 0.0.1-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitgo-beta/key-card",
3
- "version": "0.0.1-beta.17",
3
+ "version": "0.0.1-beta.19",
4
4
  "description": "key card generator for BitGo wallets",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -33,14 +33,14 @@
33
33
  ]
34
34
  },
35
35
  "dependencies": {
36
- "@bitgo-beta/sdk-api": "1.1.1-beta.142",
37
- "@bitgo-beta/sdk-core": "1.1.1-beta.142",
38
- "@bitgo-beta/statics": "7.0.1-beta.142",
36
+ "@bitgo-beta/sdk-api": "1.1.1-beta.144",
37
+ "@bitgo-beta/sdk-core": "1.1.1-beta.144",
38
+ "@bitgo-beta/statics": "7.0.1-beta.144",
39
39
  "jspdf": "^2.5.1",
40
40
  "qrcode": "^1.5.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/qrcode": "1.5.0"
44
44
  },
45
- "gitHead": "9c78e0b04aba9c62095f7fb287342f383746efbb"
45
+ "gitHead": "76b60387c8b3094508738276126156e4626f9898"
46
46
  }
@@ -106,18 +106,18 @@ export async function drawKeycard({ activationCode, questions, keyCardImage, qrD
106
106
  let textHeight = 0;
107
107
 
108
108
  if (qr.data.length <= QRBinaryMaxLength) {
109
- const image = await QRCode.toCanvas(qr.data);
109
+ const image = await QRCode.toCanvas(qr.data, { errorCorrectionLevel: 'L' });
110
110
  doc.addImage(image, left(0), y, qrSize, qrSize);
111
111
  } else {
112
112
  // key is too long for one QR code
113
113
  const keys = splitKeys(qr.data, QRBinaryMaxLength);
114
- for (const key of keys) {
115
- const image = await QRCode.toCanvas(key);
114
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
115
+ const image = await QRCode.toCanvas(keys[keyIndex], { errorCorrectionLevel: 'L' });
116
116
  doc.addImage(image, left(0), y, qrSize, qrSize);
117
117
  const textBuffer = 15;
118
118
  moveDown(qrSize + textBuffer);
119
119
  doc.setFontSize(font.body).setTextColor(color.black);
120
- doc.text('Part ' + (index + 1).toString(), left(0), y);
120
+ doc.text('Part ' + (keyIndex + 1).toString(), left(0), y);
121
121
  moveDown(20);
122
122
  }
123
123
  y = topY;
@@ -6,7 +6,7 @@ import * as assert from 'assert';
6
6
  export interface GenerateQrDataParams {
7
7
  // The backup keychain as it is returned from the BitGo API upon creation
8
8
  backupKeychain: Keychain,
9
- // The 3rd party provider of the backup key if neither the user nor BitGo stores it
9
+ // The name of the 3rd party provider of the backup key if neither the user nor BitGo stores it
10
10
  backupKeyProvider?: string;
11
11
  // The key id of the backup key, only used for cold keys
12
12
  backupMasterKey?: string;
@@ -94,8 +94,8 @@ function generateBackupQrData(coin: Readonly<BaseCoin>, backupKeychain: Keychain
94
94
  assert(userToBackupShare);
95
95
  return {
96
96
  title: 'B: User To Backup Key Share',
97
- description: `This is the key share from you for ${backupKeyProvider}. If BitGo Inc goes out of business,` +
98
- `\r\ncontact ${backupKeyProvider} and they will help you recover your funds.`,
97
+ description: `This is the key share from you for ${backupKeyProvider}. If BitGo Inc goes out of\r\nbusiness,` +
98
+ ` contact ${backupKeyProvider} and they will help you recover your funds.`,
99
99
  data: JSON.stringify(userToBackupShare),
100
100
  };
101
101
  }
@@ -132,8 +132,8 @@ function generateBitGoQrData(bitgoKeychain: Keychain, {
132
132
  assert(bitgoToBackupShare);
133
133
  return {
134
134
  title: 'C: BitGo To Backup Key Share',
135
- description: `This is the key share from BitGo Inc for ${backupKeyProvider}. If BitGo Inc goes out of business,` +
136
- `\r\ncontact ${backupKeyProvider} and they will help you recover your funds.`,
135
+ description: `This is the key share from BitGo Inc for ${backupKeyProvider}. If BitGo Inc goes out of\r\nbusiness,` +
136
+ ` contact ${backupKeyProvider} and they will help you recover your funds.`,
137
137
  data: JSON.stringify(bitgoToBackupShare),
138
138
  };
139
139
  }
@@ -178,7 +178,7 @@ export function generateQrData({
178
178
 
179
179
  qrData.passcode = {
180
180
  title: 'D: Encrypted wallet Password',
181
- description: 'This is the wallet password, encrypted client-side with a key held by\r\nBitGo.',
181
+ description: 'This is the wallet password, encrypted client-side with a key held by BitGo.',
182
182
  data: encryptedWalletPasscode,
183
183
  };
184
184
  }
@@ -73,7 +73,7 @@ describe('generateQrData', function () {
73
73
 
74
74
  assert(qrData.passcode);
75
75
  qrData.passcode.title.should.equal('D: Encrypted wallet Password');
76
- qrData.passcode.description.should.equal('This is the wallet password, encrypted client-side with a key held by\r\nBitGo.');
76
+ qrData.passcode.description.should.equal('This is the wallet password, encrypted client-side with a key held by BitGo.');
77
77
  const decryptedData = decrypt(passcodeEncryptionCode, qrData.passcode.data);
78
78
  decryptedData.should.equal(passphrase);
79
79
  });
@@ -200,12 +200,12 @@ describe('generateQrData', function () {
200
200
 
201
201
  assert(qrData.backup);
202
202
  qrData.backup.title.should.equal('B: User To Backup Key Share');
203
- qrData.backup.description.should.equal(`This is the key share from you for ${backupKeyProvider}. If BitGo Inc goes out of business,\r\ncontact ${backupKeyProvider} and they will help you recover your funds.`);
203
+ qrData.backup.description.should.equal(`This is the key share from you for ${backupKeyProvider}. If BitGo Inc goes out of\r\nbusiness, contact ${backupKeyProvider} and they will help you recover your funds.`);
204
204
  qrData.backup.data.should.equal(JSON.stringify(userToBackupKeyShare));
205
205
 
206
206
  assert(qrData.bitgo);
207
207
  qrData.bitgo.title.should.equal('C: BitGo To Backup Key Share');
208
- qrData.bitgo.description.should.equal(`This is the key share from BitGo Inc for ${backupKeyProvider}. If BitGo Inc goes out of business,\r\ncontact ${backupKeyProvider} and they will help you recover your funds.`);
208
+ qrData.bitgo.description.should.equal(`This is the key share from BitGo Inc for ${backupKeyProvider}. If BitGo Inc goes out of\r\nbusiness, contact ${backupKeyProvider} and they will help you recover your funds.`);
209
209
  qrData.bitgo.data.should.equal(JSON.stringify(bitgoToBackupKeyShare));
210
210
  });
211
211
  });