keycard-sdk 3.0.0 → 3.1.0
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/README.md +2 -2
- package/dist/apdu-command.js +15 -15
- package/dist/apdu-command.js.map +1 -1
- package/dist/apdu-exception.d.ts +1 -1
- package/dist/apdu-exception.js +19 -46
- package/dist/apdu-exception.js.map +1 -1
- package/dist/apdu-response.d.ts +2 -2
- package/dist/apdu-response.js +35 -42
- package/dist/apdu-response.js.map +1 -1
- package/dist/application-info.js +41 -39
- package/dist/application-info.js.map +1 -1
- package/dist/application-status.js +9 -11
- package/dist/application-status.js.map +1 -1
- package/dist/ber-tlv.d.ts +1 -0
- package/dist/ber-tlv.js +31 -31
- package/dist/ber-tlv.js.map +1 -1
- package/dist/bip32key.d.ts +1 -1
- package/dist/bip32key.js +60 -60
- package/dist/bip32key.js.map +1 -1
- package/dist/card-channel.d.ts +2 -2
- package/dist/card-channel.js +1 -2
- package/dist/card-listener.d.ts +1 -1
- package/dist/card-listener.js +1 -2
- package/dist/cash-application-info.js +16 -18
- package/dist/cash-application-info.js.map +1 -1
- package/dist/cash-commandset.d.ts +2 -2
- package/dist/cash-commandset.js +15 -65
- package/dist/cash-commandset.js.map +1 -1
- package/dist/certificate.d.ts +13 -0
- package/dist/certificate.js +78 -0
- package/dist/certificate.js.map +1 -0
- package/dist/commandset.d.ts +8 -7
- package/dist/commandset.js +245 -435
- package/dist/commandset.js.map +1 -1
- package/dist/constants.d.ts +9 -0
- package/dist/constants.js +11 -5
- package/dist/constants.js.map +1 -1
- package/dist/crypto-utils.d.ts +3 -6
- package/dist/crypto-utils.js +14 -25
- package/dist/crypto-utils.js.map +1 -1
- package/dist/ethereum.js +4 -11
- package/dist/ethereum.js.map +1 -1
- package/dist/global-platform-commandset.d.ts +33 -0
- package/dist/global-platform-commandset.js +169 -0
- package/dist/global-platform-commandset.js.map +1 -0
- package/dist/global-platform-constants.d.ts +22 -0
- package/dist/global-platform-constants.js +24 -0
- package/dist/global-platform-constants.js.map +1 -0
- package/dist/global-platform-crypto.d.ts +9 -0
- package/dist/global-platform-crypto.js +80 -0
- package/dist/global-platform-crypto.js.map +1 -0
- package/dist/global-platform.d.ts +19 -0
- package/dist/global-platform.js +21 -0
- package/dist/global-platform.js.map +1 -0
- package/dist/ident-comandset.d.ts +8 -0
- package/dist/ident-comandset.js +18 -0
- package/dist/ident-comandset.js.map +1 -0
- package/dist/identifiers.d.ts +6 -0
- package/dist/identifiers.js +9 -0
- package/dist/identifiers.js.map +1 -0
- package/dist/index.d.ts +24 -16
- package/dist/index.js +40 -38
- package/dist/index.js.map +1 -1
- package/dist/key-path.js +48 -52
- package/dist/key-path.js.map +1 -1
- package/dist/load.d.ts +11 -0
- package/dist/load.js +71 -0
- package/dist/load.js.map +1 -0
- package/dist/mnemonic-english-dictionary.js +2 -5
- package/dist/mnemonic-english-dictionary.js.map +1 -1
- package/dist/mnemonic.d.ts +1 -1
- package/dist/mnemonic.js +34 -41
- package/dist/mnemonic.js.map +1 -1
- package/dist/pairing.js +17 -23
- package/dist/pairing.js.map +1 -1
- package/dist/pcsc-card-channel.d.ts +7 -7
- package/dist/pcsc-card-channel.js +27 -79
- package/dist/pcsc-card-channel.js.map +1 -1
- package/dist/recoverable-signature.d.ts +11 -6
- package/dist/recoverable-signature.js +59 -35
- package/dist/recoverable-signature.js.map +1 -1
- package/dist/scp02-channel.d.ts +14 -0
- package/dist/scp02-channel.js +54 -0
- package/dist/scp02-channel.js.map +1 -0
- package/dist/scp02-keys.d.ts +6 -0
- package/dist/scp02-keys.js +11 -0
- package/dist/scp02-keys.js.map +1 -0
- package/dist/scp02-session.d.ts +8 -0
- package/dist/scp02-session.js +14 -0
- package/dist/scp02-session.js.map +1 -0
- package/dist/scp02-wrapper.d.ts +7 -0
- package/dist/scp02-wrapper.js +37 -0
- package/dist/scp02-wrapper.js.map +1 -0
- package/dist/secure-channel.d.ts +4 -4
- package/dist/secure-channel.js +171 -289
- package/dist/secure-channel.js.map +1 -1
- package/dist/types/recoverable-signature-types.d.ts +9 -0
- package/dist/types/recoverable-signature-types.js +2 -0
- package/dist/types/recoverable-signature-types.js.map +1 -0
- package/example/example.ts +127 -0
- package/example/global-platform-example.ts +62 -0
- package/jest.config.js +8 -0
- package/package.json +24 -16
- package/src/apdu-command.ts +36 -0
- package/src/apdu-exception.ts +32 -0
- package/src/apdu-response.ts +71 -0
- package/src/application-info.ts +84 -0
- package/src/application-status.ts +18 -0
- package/src/ber-tlv.ts +78 -0
- package/src/bip32key.ts +138 -0
- package/src/card-channel.ts +6 -0
- package/src/card-listener.ts +6 -0
- package/src/cash-application-info.ts +24 -0
- package/src/cash-commandset.ts +24 -0
- package/src/certificate.ts +97 -0
- package/src/commandset.ts +326 -0
- package/src/constants.ts +33 -0
- package/src/crypto-utils.ts +50 -0
- package/src/ethereum.ts +7 -0
- package/src/global-platform-commandset.ts +215 -0
- package/src/global-platform-constants.ts +26 -0
- package/src/global-platform-crypto.ts +87 -0
- package/src/global-platform.ts +22 -0
- package/src/ident-comandset.ts +23 -0
- package/src/identifiers.ts +9 -0
- package/src/index.ts +45 -0
- package/src/key-path.ts +107 -0
- package/src/load.ts +89 -0
- package/src/mnemonic-english-dictionary.ts +2052 -0
- package/src/mnemonic.ts +66 -0
- package/src/pairing.ts +31 -0
- package/src/pcsc-card-channel.ts +44 -0
- package/src/recoverable-signature.ts +77 -0
- package/src/scp02-channel.ts +73 -0
- package/src/scp02-keys.ts +11 -0
- package/src/scp02-session.ts +17 -0
- package/src/scp02-wrapper.ts +44 -0
- package/src/secure-channel.ts +250 -0
- package/src/types/recoverable-signature-types.ts +9 -0
- package/test/apdu-command.test.ts +11 -0
- package/test/apdu-response.test.ts +46 -0
- package/test/certificate.test.ts +18 -0
- package/test/key-path.test.ts +21 -0
- package/test/mnemonic.test.ts +34 -0
- package/test/pairing.test.ts +14 -0
- package/tsconfig.json +33 -0
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@ Keycard SDK is a Typescript implementation of the Keycard API.
|
|
|
6
6
|
|
|
7
7
|
You can install Keycard SDK using npm.
|
|
8
8
|
|
|
9
|
-
`npm install
|
|
9
|
+
`npm install keycard-sdk`
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
For usage examples please check `example/example.ts` which shows most of the SDK functionality. You can also check [Keycard Desktop](https://github.com/choppu/keycard-desktop) application which can be used to manage Keycard.
|
|
13
|
+
For usage examples please check `example/example.ts` and `example/global-platform-example.ts` which shows most of the SDK functionality. You can also check [Keycard Desktop](https://github.com/choppu/keycard-desktop) application which can be used to manage Keycard.
|
|
14
14
|
|
|
15
15
|
For full documentation please check [Keycard Docs](https://keycard.tech/docs/) page. Since this SDK follows the same structure of the official Java SDK you can use it as a reference.
|
package/dist/apdu-command.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const APDU_FIXED_PARAMS_SIZE = 5;
|
|
2
|
+
export class APDUCommand {
|
|
3
|
+
cla;
|
|
4
|
+
ins;
|
|
5
|
+
p1;
|
|
6
|
+
p2;
|
|
7
|
+
data;
|
|
8
|
+
needsLE;
|
|
9
|
+
constructor(cla, ins, p1, p2, data, needsLE = false) {
|
|
8
10
|
this.cla = cla;
|
|
9
11
|
this.ins = ins;
|
|
10
12
|
this.p1 = p1;
|
|
@@ -12,12 +14,12 @@ var APDUCommand = /** @class */ (function () {
|
|
|
12
14
|
this.data = new Uint8Array(data);
|
|
13
15
|
this.needsLE = needsLE;
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
serialize() {
|
|
18
|
+
let apduBufLength = APDU_FIXED_PARAMS_SIZE + this.data.byteLength;
|
|
17
19
|
if (this.needsLE)
|
|
18
20
|
apduBufLength++;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
let outputArr = new Uint8Array(apduBufLength);
|
|
22
|
+
let i = 0;
|
|
21
23
|
outputArr[i++] = this.cla;
|
|
22
24
|
outputArr[i++] = this.ins;
|
|
23
25
|
outputArr[i++] = this.p1;
|
|
@@ -25,8 +27,6 @@ var APDUCommand = /** @class */ (function () {
|
|
|
25
27
|
outputArr[i++] = this.data.byteLength;
|
|
26
28
|
outputArr.set(this.data, i);
|
|
27
29
|
return outputArr;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
}());
|
|
31
|
-
exports.APDUCommand = APDUCommand;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
32
|
//# sourceMappingURL=apdu-command.js.map
|
package/dist/apdu-command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apdu-command.js","sourceRoot":"","sources":["../src/apdu-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apdu-command.js","sourceRoot":"","sources":["../src/apdu-command.ts"],"names":[],"mappings":"AAAA,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAEjC,MAAM,OAAO,WAAW;IACtB,GAAG,CAAS;IACZ,GAAG,CAAS;IACZ,EAAE,CAAS;IACX,EAAE,CAAS;IACX,IAAI,CAAa;IACjB,OAAO,CAAU;IAEjB,YAAY,GAAW,EAAE,GAAW,EAAE,EAAU,EAAE,EAAU,EAAE,IAAgB,EAAE,OAAO,GAAG,KAAK;QAC7F,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,SAAS;QACP,IAAI,aAAa,GAAG,sBAAsB,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;QAClE,IAAI,IAAI,CAAC,OAAO;YAAE,aAAa,EAAE,CAAC;QAElC,IAAI,SAAS,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;QAC9C,IAAI,CAAC,GAAG,CAAC,CAAC;QAEV,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;QAC1B,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;QAC1B,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QACzB,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QACzB,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;QACtC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAE5B,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
package/dist/apdu-exception.d.ts
CHANGED
package/dist/apdu-exception.js
CHANGED
|
@@ -1,55 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
exports.__esModule = true;
|
|
16
|
-
exports.CardIOError = exports.WrongPINException = exports.APDUException = void 0;
|
|
17
|
-
var APDUException = /** @class */ (function (_super) {
|
|
18
|
-
__extends(APDUException, _super);
|
|
19
|
-
function APDUException(message, sw) {
|
|
20
|
-
if (sw === void 0) { sw = 0; }
|
|
21
|
-
var _this = this;
|
|
1
|
+
export class APDUException extends Error {
|
|
2
|
+
sw;
|
|
3
|
+
constructor(message, sw = 0) {
|
|
22
4
|
if (sw) {
|
|
23
|
-
|
|
5
|
+
super(message + ", 0x" + sw.toString(16));
|
|
24
6
|
}
|
|
25
7
|
else {
|
|
26
|
-
|
|
8
|
+
super(message);
|
|
27
9
|
}
|
|
28
|
-
|
|
29
|
-
return _this;
|
|
10
|
+
this.sw = sw;
|
|
30
11
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var _this = _super.call(this, "Error: Wrong PIN") || this;
|
|
38
|
-
_this.retryAttempts = retryAttempts;
|
|
39
|
-
return _this;
|
|
12
|
+
}
|
|
13
|
+
export class WrongPINException extends APDUException {
|
|
14
|
+
retryAttempts;
|
|
15
|
+
constructor(retryAttempts) {
|
|
16
|
+
super("Error: Wrong PIN");
|
|
17
|
+
this.retryAttempts = retryAttempts;
|
|
40
18
|
}
|
|
41
|
-
|
|
19
|
+
getRetryAttempts() {
|
|
42
20
|
return this.retryAttempts;
|
|
43
|
-
};
|
|
44
|
-
return WrongPINException;
|
|
45
|
-
}(APDUException));
|
|
46
|
-
exports.WrongPINException = WrongPINException;
|
|
47
|
-
var CardIOError = /** @class */ (function (_super) {
|
|
48
|
-
__extends(CardIOError, _super);
|
|
49
|
-
function CardIOError(err) {
|
|
50
|
-
return _super.call(this, "CardIO Error: " + err) || this;
|
|
51
21
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
22
|
+
}
|
|
23
|
+
export class CardIOError extends Error {
|
|
24
|
+
constructor(err) {
|
|
25
|
+
super("CardIO Error: " + err);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
55
28
|
//# sourceMappingURL=apdu-exception.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apdu-exception.js","sourceRoot":"","sources":["../src/apdu-exception.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apdu-exception.js","sourceRoot":"","sources":["../src/apdu-exception.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,EAAE,CAAS;IAEX,YAAY,OAAe,EAAE,EAAE,GAAG,CAAC;QACjC,IAAG,EAAE,EAAE,CAAC;YACN,KAAK,CAAC,OAAO,GAAG,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,OAAO,CAAC,CAAC;QACjB,CAAC;QAED,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAClD,aAAa,CAAS;IAEtB,YAAY,aAAqB;QAC/B,KAAK,CAAC,kBAAkB,CAAC,CAAC;QAC1B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;CACF;AAED,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YAAY,GAAU;QACpB,KAAK,CAAC,gBAAgB,GAAG,GAAG,CAAC,CAAC;IAChC,CAAC;CACF"}
|
package/dist/apdu-response.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class APDUResponse {
|
|
|
7
7
|
private parse;
|
|
8
8
|
constructor(apdu: Uint8Array);
|
|
9
9
|
isOK(): boolean;
|
|
10
|
-
checkSW(codes: number | number[], message?:
|
|
11
|
-
checkOK(message?:
|
|
10
|
+
checkSW(codes: number | number[], message?: string | null): APDUResponse;
|
|
11
|
+
checkOK(message?: string | null): APDUResponse;
|
|
12
12
|
checkAuthOK(): APDUResponse;
|
|
13
13
|
}
|
package/dist/apdu-response.js
CHANGED
|
@@ -1,34 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { APDUException, WrongPINException } from "./apdu-exception.js";
|
|
2
|
+
import { Constants } from "./constants.js";
|
|
3
|
+
const SW_WRONG_PIN_MASK = 0x63C0;
|
|
4
|
+
export class APDUResponse {
|
|
5
|
+
apdu;
|
|
6
|
+
data;
|
|
7
|
+
sw;
|
|
8
|
+
sw1;
|
|
9
|
+
sw2;
|
|
10
|
+
parse(apdu) {
|
|
11
|
+
let length = apdu.byteLength;
|
|
12
|
+
this.sw1 = apdu[length - 2] & 0xff;
|
|
13
|
+
this.sw2 = apdu[length - 1] & 0xff;
|
|
14
|
+
this.sw = (this.sw1 << 8) | this.sw2;
|
|
15
|
+
this.data = new Uint8Array(apdu.slice(0, (length - 2)));
|
|
16
|
+
}
|
|
17
|
+
constructor(apdu) {
|
|
14
18
|
if (apdu.byteLength < 2) {
|
|
15
19
|
throw new Error("APDU response must be at least 2 bytes");
|
|
16
20
|
}
|
|
17
21
|
this.apdu = apdu;
|
|
18
22
|
this.parse(this.apdu);
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.sw = (this.sw1 << 8) | this.sw2;
|
|
25
|
-
this.data = new Uint8Array(apdu.slice(0, (length - 2)));
|
|
26
|
-
};
|
|
27
|
-
APDUResponse.prototype.isOK = function () {
|
|
28
|
-
return this.sw == SW_OK;
|
|
29
|
-
};
|
|
30
|
-
APDUResponse.prototype.checkSW = function (codes, message) {
|
|
31
|
-
if (message === void 0) { message = null; }
|
|
24
|
+
isOK() {
|
|
25
|
+
return this.sw == Constants.SW_OK;
|
|
26
|
+
}
|
|
27
|
+
checkSW(codes, message) {
|
|
32
28
|
if (Array.isArray(codes)) {
|
|
33
29
|
if (codes.includes(this.sw)) {
|
|
34
30
|
return this;
|
|
@@ -40,32 +36,29 @@ var APDUResponse = /** @class */ (function () {
|
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
38
|
if (message) {
|
|
43
|
-
throw new
|
|
39
|
+
throw new APDUException(message, this.sw);
|
|
44
40
|
}
|
|
45
41
|
else {
|
|
46
42
|
switch (this.sw) {
|
|
47
|
-
case SW_SECURITY_CONDITION_NOT_SATISFIED:
|
|
48
|
-
throw new
|
|
49
|
-
case SW_AUTHENTICATION_METHOD_BLOCKED:
|
|
50
|
-
throw new
|
|
43
|
+
case Constants.SW_SECURITY_CONDITION_NOT_SATISFIED:
|
|
44
|
+
throw new APDUException("Security condition not satisfied", this.sw);
|
|
45
|
+
case Constants.SW_AUTHENTICATION_METHOD_BLOCKED:
|
|
46
|
+
throw new APDUException("Authentication method blocked", this.sw);
|
|
51
47
|
default:
|
|
52
|
-
throw new
|
|
48
|
+
throw new APDUException("Unexpected error SW", this.sw);
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
APDUResponse.prototype.checkAuthOK = function () {
|
|
51
|
+
}
|
|
52
|
+
checkOK(message = null) {
|
|
53
|
+
return this.checkSW(Constants.SW_OK, message);
|
|
54
|
+
}
|
|
55
|
+
checkAuthOK() {
|
|
61
56
|
if ((this.sw & SW_WRONG_PIN_MASK) == SW_WRONG_PIN_MASK) {
|
|
62
|
-
throw new
|
|
57
|
+
throw new WrongPINException(this.sw2 & 0x0F);
|
|
63
58
|
}
|
|
64
59
|
else {
|
|
65
60
|
return this.checkOK();
|
|
66
61
|
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
}());
|
|
70
|
-
exports.APDUResponse = APDUResponse;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
71
64
|
//# sourceMappingURL=apdu-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apdu-response.js","sourceRoot":"","sources":["../src/apdu-response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apdu-response.js","sourceRoot":"","sources":["../src/apdu-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,MAAM,OAAO,YAAY;IACvB,IAAI,CAAa;IACjB,IAAI,CAAc;IAClB,EAAE,CAAU;IACZ,GAAG,CAAU;IACb,GAAG,CAAU;IAEN,KAAK,CAAC,IAAgB;QAC3B,IAAI,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;QAE7B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;QACnC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;QACnC,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,YAAY,IAAgB;QAC1B,IAAI,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,EAAE,IAAI,SAAS,CAAC,KAAK,CAAC;IACpC,CAAC;IAED,OAAO,CA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@ -1,24 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { BERTLV } from "./ber-tlv.js";
|
|
2
|
+
import { CryptoUtils } from "./crypto-utils.js";
|
|
3
|
+
import { Constants } from "./constants.js";
|
|
4
|
+
const TLV_UID = 0x8f;
|
|
5
|
+
const TLV_KEY_UID = 0x8e;
|
|
6
|
+
const TLV_CAPABILITIES = 0x8d;
|
|
7
|
+
const CAPABILITY_SECURE_CHANNEL = 0x01;
|
|
8
|
+
const CAPABILITY_KEY_MANAGEMENT = 0x02;
|
|
9
|
+
const CAPABILITY_CREDENTIALS_MANAGEMENT = 0x04;
|
|
10
|
+
const CAPABILITY_NDEF = 0x08;
|
|
11
|
+
const CAPABILITIES_ALL = CAPABILITY_SECURE_CHANNEL | CAPABILITY_KEY_MANAGEMENT | CAPABILITY_CREDENTIALS_MANAGEMENT | CAPABILITY_NDEF;
|
|
12
|
+
export class ApplicationInfo {
|
|
13
|
+
initializedCard;
|
|
14
|
+
instanceUID;
|
|
15
|
+
secureChannelPubKey;
|
|
16
|
+
appVersion;
|
|
17
|
+
freePairingSlots;
|
|
18
|
+
keyUID;
|
|
19
|
+
capabilities;
|
|
20
|
+
constructor(tlvData) {
|
|
21
|
+
let tlv = new BERTLV(tlvData);
|
|
22
|
+
let topTag = tlv.readTag();
|
|
19
23
|
tlv.unreadLastTag();
|
|
20
|
-
if (topTag ==
|
|
21
|
-
this.secureChannelPubKey = tlv.readPrimitive(
|
|
24
|
+
if (topTag == Constants.TLV_PUB_KEY) {
|
|
25
|
+
this.secureChannelPubKey = tlv.readPrimitive(Constants.TLV_PUB_KEY);
|
|
22
26
|
this.initializedCard = false;
|
|
23
27
|
this.capabilities = CAPABILITY_CREDENTIALS_MANAGEMENT;
|
|
24
28
|
if (this.secureChannelPubKey.length > 0) {
|
|
@@ -26,13 +30,13 @@ var ApplicationInfo = /** @class */ (function () {
|
|
|
26
30
|
}
|
|
27
31
|
return;
|
|
28
32
|
}
|
|
29
|
-
tlv.enterConstructed(
|
|
33
|
+
tlv.enterConstructed(Constants.TLV_APPLICATION_INFO_TEMPLATE);
|
|
30
34
|
this.instanceUID = tlv.readPrimitive(TLV_UID);
|
|
31
|
-
this.secureChannelPubKey = tlv.readPrimitive(
|
|
35
|
+
this.secureChannelPubKey = tlv.readPrimitive(Constants.TLV_PUB_KEY);
|
|
32
36
|
this.appVersion = tlv.readInt();
|
|
33
37
|
this.freePairingSlots = tlv.readInt();
|
|
34
38
|
this.keyUID = tlv.readPrimitive(TLV_KEY_UID);
|
|
35
|
-
if (tlv.readTag() !=
|
|
39
|
+
if (tlv.readTag() != Constants.END_OF_TLV) {
|
|
36
40
|
tlv.unreadLastTag();
|
|
37
41
|
this.capabilities = tlv.readPrimitive(TLV_CAPABILITIES)[0];
|
|
38
42
|
}
|
|
@@ -41,25 +45,23 @@ var ApplicationInfo = /** @class */ (function () {
|
|
|
41
45
|
}
|
|
42
46
|
this.initializedCard = true;
|
|
43
47
|
}
|
|
44
|
-
|
|
48
|
+
hasMasterKey() {
|
|
45
49
|
return this.keyUID.length != 0;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
50
|
+
}
|
|
51
|
+
getAppVersionString() {
|
|
52
|
+
return CryptoUtils.getAppVersionString(this.appVersion);
|
|
53
|
+
}
|
|
54
|
+
hasSecureChannelCapability() {
|
|
51
55
|
return (this.capabilities & CAPABILITY_SECURE_CHANNEL) == CAPABILITY_SECURE_CHANNEL;
|
|
52
|
-
}
|
|
53
|
-
|
|
56
|
+
}
|
|
57
|
+
hasKeyManagementCapability() {
|
|
54
58
|
return (this.capabilities & CAPABILITY_KEY_MANAGEMENT) == CAPABILITY_KEY_MANAGEMENT;
|
|
55
|
-
}
|
|
56
|
-
|
|
59
|
+
}
|
|
60
|
+
hasCredentialsManagementCapability() {
|
|
57
61
|
return (this.capabilities & CAPABILITY_CREDENTIALS_MANAGEMENT) == CAPABILITY_CREDENTIALS_MANAGEMENT;
|
|
58
|
-
}
|
|
59
|
-
|
|
62
|
+
}
|
|
63
|
+
hasNDEFCapability() {
|
|
60
64
|
return (this.capabilities & CAPABILITY_NDEF) == CAPABILITY_NDEF;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
}());
|
|
64
|
-
exports.ApplicationInfo = ApplicationInfo;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
65
67
|
//# sourceMappingURL=application-info.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-info.js","sourceRoot":"","sources":["../src/application-info.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"application-info.js","sourceRoot":"","sources":["../src/application-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG1C,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,WAAW,GAAG,IAAI,CAAC;AACzB,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AACvC,MAAM,iCAAiC,GAAG,IAAI,CAAC;AAC/C,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,MAAM,gBAAgB,GAAG,yBAAyB,GAAG,yBAAyB,GAAG,iCAAiC,GAAG,eAAe,CAAC;AAErI,MAAM,OAAO,eAAe;IAC1B,eAAe,CAAU;IACzB,WAAW,CAAc;IACzB,mBAAmB,CAAa;IAChC,UA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AAC,CAAC;QAC7D,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,mBAAmB;QACjB,OAAO,WAAW,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;IAED,0BAA0B;QACxB,OAAO,CAAC,IAAI,CAAC,YAAY,GAAG,yBAAyB,CAAC,IAAI,yBAAyB,CAAC;IACtF,CAAC;IAED,0BAA0B;QACxB,OAAO,CAAC,IAAI,CAAC,YAAY,GAAG,yBAAyB,CAAC,IAAI,yBAAyB,CAAC;IACtF,CAAC;IAED,kCAAkC;QAChC,OAAO,CAAC,IAAI,CAAC,YAAY,GAAG,iCAAiC,CAAC,IAAI,iCAAiC,CAAC;IACtG,CAAC;IAED,iBAAiB;QACf,OAAO,CAAC,IAAI,CAAC,YAAY,GAAG,eAAe,CAAC,IAAI,eAAe,CAAC;IAClE,CAAC;CACF"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { BERTLV } from "./ber-tlv.js";
|
|
2
|
+
const TLV_APPLICATION_STATUS_TEMPLATE = 0xa3;
|
|
3
|
+
export class ApplicationStatus {
|
|
4
|
+
pinRetryCount;
|
|
5
|
+
pukRetryCount;
|
|
6
|
+
hasMasterKey;
|
|
7
|
+
constructor(tlvData) {
|
|
8
|
+
let tlv = new BERTLV(tlvData);
|
|
9
9
|
tlv.enterConstructed(TLV_APPLICATION_STATUS_TEMPLATE);
|
|
10
10
|
this.pinRetryCount = tlv.readInt();
|
|
11
11
|
this.pukRetryCount = tlv.readInt();
|
|
12
12
|
this.hasMasterKey = tlv.readBoolean();
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
}());
|
|
16
|
-
exports.ApplicationStatus = ApplicationStatus;
|
|
14
|
+
}
|
|
17
15
|
//# sourceMappingURL=application-status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-status.js","sourceRoot":"","sources":["../src/application-status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"application-status.js","sourceRoot":"","sources":["../src/application-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,MAAM,+BAA+B,GAAG,IAAI,CAAC;AAE7C,MAAM,OAAO,iBAAiB;IAC5B,aAAa,CAAS;IACtB,aAAa,CAAS;IACtB,YAAY,CAAU;IAEtB,YAAY,OAAmB;QAC7B,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9B,GAAG,CAAC,gBAAgB,CAAC,+BAA+B,CAAC,CAAC;QAEtD,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IACxC,CAAC;CACF"}
|
package/dist/ber-tlv.d.ts
CHANGED
package/dist/ber-tlv.js
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function BERTLV(buffer) {
|
|
1
|
+
import { Constants } from "./constants.js";
|
|
2
|
+
const TLV_BOOL = 0x01;
|
|
3
|
+
export class BERTLV {
|
|
4
|
+
buffer;
|
|
5
|
+
position;
|
|
6
|
+
constructor(buffer) {
|
|
8
7
|
this.buffer = buffer;
|
|
9
8
|
this.position = 0;
|
|
10
9
|
}
|
|
11
|
-
|
|
10
|
+
enterConstructed(tag) {
|
|
12
11
|
this.checkTag(tag, this.readTag());
|
|
13
12
|
return this.readLength();
|
|
14
|
-
}
|
|
15
|
-
|
|
13
|
+
}
|
|
14
|
+
readPrimitive(tag) {
|
|
16
15
|
this.checkTag(tag, this.readTag());
|
|
17
|
-
|
|
16
|
+
let len = this.readLength();
|
|
18
17
|
this.position += len;
|
|
19
18
|
return this.buffer.subarray((this.position - len), this.position);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
}
|
|
20
|
+
readBoolean() {
|
|
21
|
+
let val = this.readPrimitive(TLV_BOOL);
|
|
23
22
|
return val[0] == 0xff;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
}
|
|
24
|
+
readInt() {
|
|
25
|
+
let val = this.readPrimitive(Constants.TLV_INT);
|
|
27
26
|
switch (val.byteLength) {
|
|
28
27
|
case 1:
|
|
29
28
|
return val[0];
|
|
@@ -36,29 +35,30 @@ var BERTLV = /** @class */ (function () {
|
|
|
36
35
|
default:
|
|
37
36
|
throw new Error("Integers of length " + val.byteLength + " are unsupported");
|
|
38
37
|
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return (this.position < this.buffer.byteLength) ? this.buffer[this.position++] :
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
}
|
|
39
|
+
readTag() {
|
|
40
|
+
return (this.position < this.buffer.byteLength) ? this.buffer[this.position++] : Constants.END_OF_TLV;
|
|
41
|
+
}
|
|
42
|
+
readLength() {
|
|
43
|
+
let len = this.buffer[this.position++];
|
|
45
44
|
if (len == 0x81) {
|
|
46
45
|
len = this.buffer[this.position++];
|
|
47
46
|
}
|
|
48
47
|
return len;
|
|
49
|
-
}
|
|
50
|
-
|
|
48
|
+
}
|
|
49
|
+
unreadLastTag() {
|
|
51
50
|
if (this.position < this.buffer.byteLength) {
|
|
52
51
|
this.position--;
|
|
53
52
|
}
|
|
54
|
-
}
|
|
55
|
-
|
|
53
|
+
}
|
|
54
|
+
checkTag(expected, actual) {
|
|
56
55
|
if (expected != actual) {
|
|
57
56
|
this.unreadLastTag();
|
|
58
57
|
throw new Error("Expected tag: 0x" + expected.toString(16) + ", received: 0x" + actual.toString(16));
|
|
59
58
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
}
|
|
60
|
+
peekUnread() {
|
|
61
|
+
return this.buffer.subarray(this.position);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
64
|
//# sourceMappingURL=ber-tlv.js.map
|
package/dist/ber-tlv.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ber-tlv.js","sourceRoot":"","sources":["../src/ber-tlv.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ber-tlv.js","sourceRoot":"","sources":["../src/ber-tlv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB,MAAM,OAAO,MAAM;IACjB,MAAM,CAAa;IACnB,QAAQ,CAAS;IAEjB,YAAY,MAAkB;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,gBAAgB,CAAC,GAAW;QAC1B,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAED,aAAa,CAAC,GAAW;QACvB,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACnC,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC5B,IAAI,CAAC,QAAQ,IAAI,GAAG,CAAC;QACrB,OAAO,IAAI,CAAC,MAAM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,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC;IACxG,CAAC;IAED,UAAU;QACR,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEvC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YAChB,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAED,aAAa;QACX,IAAI,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YAC3C,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,QAAgB,EAAE,MAAc;QACvC,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QACvG,CAAC;IACH,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
package/dist/bip32key.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare class BIP32KeyPair {
|
|
|
3
3
|
publicKey: Uint8Array;
|
|
4
4
|
chainCode: Uint8Array;
|
|
5
5
|
calculatePublicKey(): void;
|
|
6
|
-
constructor(privateKey: Uint8Array, chainCode: Uint8Array, publicKey: Uint8Array);
|
|
6
|
+
constructor(privateKey: Uint8Array, chainCode: Uint8Array, publicKey: Uint8Array | null);
|
|
7
7
|
isExtended(): boolean;
|
|
8
8
|
static fromBinarySeed(binarySeed: Uint8Array): BIP32KeyPair;
|
|
9
9
|
static fromTLV(tlvData: Uint8Array): BIP32KeyPair;
|