feat: 초기 프로젝트 설정 및 룰.md 파일 추가

This commit is contained in:
2025-07-28 09:53:31 +09:00
commit 09a4d38512
8165 changed files with 1021855 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,108 @@
# `@peculiar/asn1-android`
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/PeculiarVentures/asn1-schema/master/packages/android/LICENSE.md)
[![npm version](https://badge.fury.io/js/%40peculiar%2Fasn1-android.svg)](https://badge.fury.io/js/%40peculiar%2Fasn1-android)
[![NPM](https://nodei.co/npm/@peculiar/asn1-android.png)](https://nodei.co/npm/@peculiar/asn1-android/)
- [Android key attestation schema](https://source.android.com/security/keystore/attestation#schema)
- [Key attestation extension data schema](https://developer.android.com/privacy-and-security/security-key-attestation#key_attestation_ext_schema)
- [AttestationApplicationId](https://developer.android.com/privacy-and-security/security-key-attestation#key_attestation_ext_schema_attestationid)
## KeyDescription and NonStandardKeyDescription
The `KeyDescription` class in this library represents the ASN.1 schema for the Android Keystore Key Description structure. However, in practice, there are cases where the `AuthorizationList` fields in the `softwareEnforced` and `teeEnforced` fields are not strictly ordered, which can lead to ASN.1 structure reading errors.
Starting with version 300, the schema has been updated to use `keyMintVersion` instead of `keymasterVersion`, `keyMintSecurityLevel` instead of `keymasterSecurityLevel`, and `hardwareEnforced` instead of `teeEnforced`. To support this, we've added the `KeyMintKeyDescription` class which works for both v300 and v400.
To address the non-strict ordering issue, this library provides `NonStandardKeyDescription` and `NonStandardKeyMintKeyDescription` classes that can read such structures. However, when creating extensions, it is recommended to use `KeyDescription` or `KeyMintKeyDescription`, as they guarantee the order of object fields according to the specification.
Here are simplified TypeScript examples:
Example of creating a `KeyDescription` object in TypeScript for the Android Keystore system
```typescript
const attestation = new android.AttestationApplicationId({
packageInfos: [
new android.AttestationPackageInfo({
packageName: new OctetString(Buffer.from("123", "utf8")),
version: 1,
}),
],
signatureDigests: [new OctetString(Buffer.from("123", "utf8"))],
});
// Legacy KeyDescription
const keyDescription = new KeyDescription({
attestationVersion: android.Version.keyMint2,
attestationSecurityLevel: android.SecurityLevel.software,
keymasterVersion: 1,
keymasterSecurityLevel: android.SecurityLevel.software,
attestationChallenge: new OctetString(Buffer.from("123", "utf8")),
uniqueId: new OctetString(Buffer.from("123", "utf8")),
softwareEnforced: new android.AuthorizationList({
creationDateTime: 1506793476000,
attestationApplicationId: new OctetString(AsnConvert.serialize(attestation)),
}),
teeEnforced: new android.AuthorizationList({
purpose: new android.IntegerSet([1]),
algorithm: 1,
keySize: 1,
digest: new android.IntegerSet([1]),
ecCurve: 1,
userAuthType: 1,
origin: 1,
rollbackResistant: null,
}),
});
// KeyMint KeyDescription (works for both v300 and v400)
const keyMintDescription = new KeyMintKeyDescription({
attestationVersion: android.Version.keyMint4, // Use Version.keyMint3 for v300
attestationSecurityLevel: android.SecurityLevel.software,
keyMintVersion: 1,
keyMintSecurityLevel: android.SecurityLevel.trustedEnvironment,
attestationChallenge: new OctetString(Buffer.from("challenge-data", "utf8")),
uniqueId: new OctetString(Buffer.from("unique-id-data", "utf8")),
softwareEnforced: new android.AuthorizationList({
creationDateTime: 1684321765000,
}),
hardwareEnforced: new android.AuthorizationList({
purpose: new android.IntegerSet([1, 2]),
algorithm: 3, // EC
keySize: 256,
attestationIdSecondImei: new OctetString(Buffer.from("second-imei", "utf8")),
moduleHash: new OctetString(Buffer.from("module-hash-value", "utf8")), // Available in v400
rootOfTrust: new android.RootOfTrust({
verifiedBootKey: new OctetString(Buffer.from("boot-key-data", "utf8")),
deviceLocked: true,
verifiedBootState: android.VerifiedBootState.verified,
verifiedBootHash: new OctetString(Buffer.from("boot-hash-data", "utf8")), // Required in v300 and above
}),
}),
});
const raw = AsnConvert.serialize(keyDescription);
const rawKeyMint = AsnConvert.serialize(keyMintDescription);
```
Example of reading a non-standard KeyDescription:
```typescript
// Parse with appropriate class based on version
const keyDescription = AsnConvert.parse(raw, NonStandardKeyDescription);
const keyMintDescription = AsnConvert.parse(rawKeyMint, NonStandardKeyMintKeyDescription); // Works for both v300 and v400
// All versions support both old and new property names
console.log(keyMintDescription.keyMintVersion); // 1
console.log(keyMintDescription.keymasterVersion); // Same as keyMintVersion (1)
console.log(keyMintDescription.hardwareEnforced === keyMintDescription.teeEnforced); // true
// Check v400 specific fields
const moduleHash = keyMintDescription.hardwareEnforced.findProperty("moduleHash");
console.log(moduleHash && Buffer.from(moduleHash).toString("utf8")); // "module-hash-value"
// Converting between versions
const legacyFromKeyMint = keyMintDescription.toLegacyKeyDescription();
const keyMintFromLegacy = KeyMintKeyDescription.fromLegacyKeyDescription(legacyFromKeyMint);
```

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AttestationApplicationId = exports.AttestationPackageInfo = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
class AttestationPackageInfo {
constructor(params = {}) {
Object.assign(this, params);
}
}
exports.AttestationPackageInfo = AttestationPackageInfo;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.OctetString })
], AttestationPackageInfo.prototype, "packageName", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], AttestationPackageInfo.prototype, "version", void 0);
class AttestationApplicationId {
constructor(params = {}) {
Object.assign(this, params);
}
}
exports.AttestationApplicationId = AttestationApplicationId;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: AttestationPackageInfo, repeated: "set" })
], AttestationApplicationId.prototype, "packageInfos", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.OctetString, repeated: "set" })
], AttestationApplicationId.prototype, "signatureDigests", void 0);

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./key_description"), exports);
tslib_1.__exportStar(require("./nonstandard"), exports);
tslib_1.__exportStar(require("./attestation"), exports);

View File

@@ -0,0 +1,297 @@
"use strict";
var IntegerSet_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.KeyMintKeyDescription = exports.KeyDescription = exports.Version = exports.SecurityLevel = exports.AuthorizationList = exports.IntegerSet = exports.RootOfTrust = exports.VerifiedBootState = exports.id_ce_keyDescription = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
exports.id_ce_keyDescription = "1.3.6.1.4.1.11129.2.1.17";
var VerifiedBootState;
(function (VerifiedBootState) {
VerifiedBootState[VerifiedBootState["verified"] = 0] = "verified";
VerifiedBootState[VerifiedBootState["selfSigned"] = 1] = "selfSigned";
VerifiedBootState[VerifiedBootState["unverified"] = 2] = "unverified";
VerifiedBootState[VerifiedBootState["failed"] = 3] = "failed";
})(VerifiedBootState || (exports.VerifiedBootState = VerifiedBootState = {}));
class RootOfTrust {
constructor(params = {}) {
this.verifiedBootKey = new asn1_schema_1.OctetString();
this.deviceLocked = false;
this.verifiedBootState = VerifiedBootState.verified;
Object.assign(this, params);
}
}
exports.RootOfTrust = RootOfTrust;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], RootOfTrust.prototype, "verifiedBootKey", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Boolean })
], RootOfTrust.prototype, "deviceLocked", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], RootOfTrust.prototype, "verifiedBootState", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString, optional: true })
], RootOfTrust.prototype, "verifiedBootHash", void 0);
let IntegerSet = IntegerSet_1 = class IntegerSet extends asn1_schema_1.AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, IntegerSet_1.prototype);
}
};
exports.IntegerSet = IntegerSet;
exports.IntegerSet = IntegerSet = IntegerSet_1 = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Set, itemType: asn1_schema_1.AsnPropTypes.Integer })
], IntegerSet);
class AuthorizationList {
constructor(params = {}) {
Object.assign(this, params);
}
}
exports.AuthorizationList = AuthorizationList;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 1, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "purpose", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 2, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "algorithm", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 3, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "keySize", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 5, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "digest", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 6, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "padding", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 10, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "ecCurve", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 200, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "rsaPublicExponent", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 203, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "mgfDigest", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 303, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "rollbackResistance", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 305, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "earlyBootOnly", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 400, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "activeDateTime", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 401, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "originationExpireDateTime", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 402, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "usageExpireDateTime", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 405, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "usageCountLimit", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 503, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "noAuthRequired", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 504, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "userAuthType", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 505, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "authTimeout", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 506, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "allowWhileOnBody", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 507, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "trustedUserPresenceRequired", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 508, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "trustedConfirmationRequired", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 509, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "unlockedDeviceRequired", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 600, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "allApplications", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 601, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "applicationId", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 701, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "creationDateTime", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 702, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "origin", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 703, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "rollbackResistant", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 704, type: RootOfTrust, optional: true })
], AuthorizationList.prototype, "rootOfTrust", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 705, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "osVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 706, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "osPatchLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 709, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationApplicationId", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 710, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdBrand", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 711, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdDevice", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 712, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdProduct", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 713, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdSerial", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 714, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdImei", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 715, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdMeid", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 716, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdManufacturer", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 717, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdModel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 718, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "vendorPatchLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 719, type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "bootPatchLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 720, type: asn1_schema_1.AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "deviceUniqueAttestation", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 723, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdSecondImei", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ context: 724, type: asn1_schema_1.OctetString, optional: true })
], AuthorizationList.prototype, "moduleHash", void 0);
var SecurityLevel;
(function (SecurityLevel) {
SecurityLevel[SecurityLevel["software"] = 0] = "software";
SecurityLevel[SecurityLevel["trustedEnvironment"] = 1] = "trustedEnvironment";
SecurityLevel[SecurityLevel["strongBox"] = 2] = "strongBox";
})(SecurityLevel || (exports.SecurityLevel = SecurityLevel = {}));
var Version;
(function (Version) {
Version[Version["KM2"] = 1] = "KM2";
Version[Version["KM3"] = 2] = "KM3";
Version[Version["KM4"] = 3] = "KM4";
Version[Version["KM4_1"] = 4] = "KM4_1";
Version[Version["keyMint1"] = 100] = "keyMint1";
Version[Version["keyMint2"] = 200] = "keyMint2";
Version[Version["keyMint3"] = 300] = "keyMint3";
Version[Version["keyMint4"] = 400] = "keyMint4";
})(Version || (exports.Version = Version = {}));
class KeyDescription {
constructor(params = {}) {
this.attestationVersion = Version.KM4;
this.attestationSecurityLevel = SecurityLevel.software;
this.keymasterVersion = 0;
this.keymasterSecurityLevel = SecurityLevel.software;
this.attestationChallenge = new asn1_schema_1.OctetString();
this.uniqueId = new asn1_schema_1.OctetString();
this.softwareEnforced = new AuthorizationList();
this.teeEnforced = new AuthorizationList();
Object.assign(this, params);
}
}
exports.KeyDescription = KeyDescription;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], KeyDescription.prototype, "attestationVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], KeyDescription.prototype, "attestationSecurityLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], KeyDescription.prototype, "keymasterVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], KeyDescription.prototype, "keymasterSecurityLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], KeyDescription.prototype, "attestationChallenge", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], KeyDescription.prototype, "uniqueId", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
], KeyDescription.prototype, "softwareEnforced", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
], KeyDescription.prototype, "teeEnforced", void 0);
class KeyMintKeyDescription {
constructor(params = {}) {
this.attestationVersion = Version.keyMint4;
this.attestationSecurityLevel = SecurityLevel.software;
this.keyMintVersion = 0;
this.keyMintSecurityLevel = SecurityLevel.software;
this.attestationChallenge = new asn1_schema_1.OctetString();
this.uniqueId = new asn1_schema_1.OctetString();
this.softwareEnforced = new AuthorizationList();
this.hardwareEnforced = new AuthorizationList();
Object.assign(this, params);
}
toLegacyKeyDescription() {
return new KeyDescription({
attestationVersion: this.attestationVersion,
attestationSecurityLevel: this.attestationSecurityLevel,
keymasterVersion: this.keyMintVersion,
keymasterSecurityLevel: this.keyMintSecurityLevel,
attestationChallenge: this.attestationChallenge,
uniqueId: this.uniqueId,
softwareEnforced: this.softwareEnforced,
teeEnforced: this.hardwareEnforced,
});
}
static fromLegacyKeyDescription(keyDesc) {
return new KeyMintKeyDescription({
attestationVersion: keyDesc.attestationVersion,
attestationSecurityLevel: keyDesc.attestationSecurityLevel,
keyMintVersion: keyDesc.keymasterVersion,
keyMintSecurityLevel: keyDesc.keymasterSecurityLevel,
attestationChallenge: keyDesc.attestationChallenge,
uniqueId: keyDesc.uniqueId,
softwareEnforced: keyDesc.softwareEnforced,
hardwareEnforced: keyDesc.teeEnforced,
});
}
}
exports.KeyMintKeyDescription = KeyMintKeyDescription;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], KeyMintKeyDescription.prototype, "attestationVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], KeyMintKeyDescription.prototype, "attestationSecurityLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], KeyMintKeyDescription.prototype, "keyMintVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], KeyMintKeyDescription.prototype, "keyMintSecurityLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], KeyMintKeyDescription.prototype, "attestationChallenge", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], KeyMintKeyDescription.prototype, "uniqueId", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
], KeyMintKeyDescription.prototype, "softwareEnforced", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: AuthorizationList })
], KeyMintKeyDescription.prototype, "hardwareEnforced", void 0);

View File

@@ -0,0 +1,104 @@
"use strict";
var NonStandardAuthorizationList_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.NonStandardKeyMintKeyDescription = exports.NonStandardKeyDescription = exports.NonStandardAuthorizationList = exports.NonStandardAuthorization = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const key_description_1 = require("./key_description");
let NonStandardAuthorization = class NonStandardAuthorization extends key_description_1.AuthorizationList {
};
exports.NonStandardAuthorization = NonStandardAuthorization;
exports.NonStandardAuthorization = NonStandardAuthorization = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Choice })
], NonStandardAuthorization);
let NonStandardAuthorizationList = NonStandardAuthorizationList_1 = class NonStandardAuthorizationList extends asn1_schema_1.AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, NonStandardAuthorizationList_1.prototype);
}
findProperty(key) {
const prop = this.find((o) => key in o);
if (prop) {
return prop[key];
}
return undefined;
}
};
exports.NonStandardAuthorizationList = NonStandardAuthorizationList;
exports.NonStandardAuthorizationList = NonStandardAuthorizationList = NonStandardAuthorizationList_1 = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Sequence, itemType: NonStandardAuthorization })
], NonStandardAuthorizationList);
class NonStandardKeyDescription {
get keyMintVersion() {
return this.keymasterVersion;
}
set keyMintVersion(value) {
this.keymasterVersion = value;
}
get keyMintSecurityLevel() {
return this.keymasterSecurityLevel;
}
set keyMintSecurityLevel(value) {
this.keymasterSecurityLevel = value;
}
get hardwareEnforced() {
return this.teeEnforced;
}
set hardwareEnforced(value) {
this.teeEnforced = value;
}
constructor(params = {}) {
this.attestationVersion = key_description_1.Version.KM4;
this.attestationSecurityLevel = key_description_1.SecurityLevel.software;
this.keymasterVersion = 0;
this.keymasterSecurityLevel = key_description_1.SecurityLevel.software;
this.attestationChallenge = new asn1_schema_1.OctetString();
this.uniqueId = new asn1_schema_1.OctetString();
this.softwareEnforced = new NonStandardAuthorizationList();
this.teeEnforced = new NonStandardAuthorizationList();
Object.assign(this, params);
}
}
exports.NonStandardKeyDescription = NonStandardKeyDescription;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], NonStandardKeyDescription.prototype, "attestationVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], NonStandardKeyDescription.prototype, "attestationSecurityLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], NonStandardKeyDescription.prototype, "keymasterVersion", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Enumerated })
], NonStandardKeyDescription.prototype, "keymasterSecurityLevel", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], NonStandardKeyDescription.prototype, "attestationChallenge", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], NonStandardKeyDescription.prototype, "uniqueId", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: NonStandardAuthorizationList })
], NonStandardKeyDescription.prototype, "softwareEnforced", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: NonStandardAuthorizationList })
], NonStandardKeyDescription.prototype, "teeEnforced", void 0);
let NonStandardKeyMintKeyDescription = class NonStandardKeyMintKeyDescription extends NonStandardKeyDescription {
constructor(params = {}) {
if ("keymasterVersion" in params && !("keyMintVersion" in params)) {
params.keyMintVersion = params.keymasterVersion;
}
if ("keymasterSecurityLevel" in params && !("keyMintSecurityLevel" in params)) {
params.keyMintSecurityLevel = params.keymasterSecurityLevel;
}
if ("teeEnforced" in params && !("hardwareEnforced" in params)) {
params.hardwareEnforced = params.teeEnforced;
}
super(params);
}
};
exports.NonStandardKeyMintKeyDescription = NonStandardKeyMintKeyDescription;
exports.NonStandardKeyMintKeyDescription = NonStandardKeyMintKeyDescription = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Sequence })
], NonStandardKeyMintKeyDescription);

View File

@@ -0,0 +1,24 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes } from "@peculiar/asn1-schema";
export class AttestationPackageInfo {
constructor(params = {}) {
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.OctetString })
], AttestationPackageInfo.prototype, "packageName", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], AttestationPackageInfo.prototype, "version", void 0);
export class AttestationApplicationId {
constructor(params = {}) {
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AttestationPackageInfo, repeated: "set" })
], AttestationApplicationId.prototype, "packageInfos", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.OctetString, repeated: "set" })
], AttestationApplicationId.prototype, "signatureDigests", void 0);

View File

@@ -0,0 +1,3 @@
export * from "./key_description";
export * from "./nonstandard";
export * from "./attestation";

View File

@@ -0,0 +1,290 @@
var IntegerSet_1;
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from "@peculiar/asn1-schema";
export const id_ce_keyDescription = "1.3.6.1.4.1.11129.2.1.17";
export var VerifiedBootState;
(function (VerifiedBootState) {
VerifiedBootState[VerifiedBootState["verified"] = 0] = "verified";
VerifiedBootState[VerifiedBootState["selfSigned"] = 1] = "selfSigned";
VerifiedBootState[VerifiedBootState["unverified"] = 2] = "unverified";
VerifiedBootState[VerifiedBootState["failed"] = 3] = "failed";
})(VerifiedBootState || (VerifiedBootState = {}));
export class RootOfTrust {
constructor(params = {}) {
this.verifiedBootKey = new OctetString();
this.deviceLocked = false;
this.verifiedBootState = VerifiedBootState.verified;
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: OctetString })
], RootOfTrust.prototype, "verifiedBootKey", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Boolean })
], RootOfTrust.prototype, "deviceLocked", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], RootOfTrust.prototype, "verifiedBootState", void 0);
__decorate([
AsnProp({ type: OctetString, optional: true })
], RootOfTrust.prototype, "verifiedBootHash", void 0);
let IntegerSet = IntegerSet_1 = class IntegerSet extends AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, IntegerSet_1.prototype);
}
};
IntegerSet = IntegerSet_1 = __decorate([
AsnType({ type: AsnTypeTypes.Set, itemType: AsnPropTypes.Integer })
], IntegerSet);
export { IntegerSet };
export class AuthorizationList {
constructor(params = {}) {
Object.assign(this, params);
}
}
__decorate([
AsnProp({ context: 1, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "purpose", void 0);
__decorate([
AsnProp({ context: 2, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "algorithm", void 0);
__decorate([
AsnProp({ context: 3, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "keySize", void 0);
__decorate([
AsnProp({ context: 5, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "digest", void 0);
__decorate([
AsnProp({ context: 6, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "padding", void 0);
__decorate([
AsnProp({ context: 10, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "ecCurve", void 0);
__decorate([
AsnProp({ context: 200, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "rsaPublicExponent", void 0);
__decorate([
AsnProp({ context: 203, type: IntegerSet, optional: true })
], AuthorizationList.prototype, "mgfDigest", void 0);
__decorate([
AsnProp({ context: 303, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "rollbackResistance", void 0);
__decorate([
AsnProp({ context: 305, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "earlyBootOnly", void 0);
__decorate([
AsnProp({ context: 400, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "activeDateTime", void 0);
__decorate([
AsnProp({ context: 401, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "originationExpireDateTime", void 0);
__decorate([
AsnProp({ context: 402, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "usageExpireDateTime", void 0);
__decorate([
AsnProp({ context: 405, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "usageCountLimit", void 0);
__decorate([
AsnProp({ context: 503, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "noAuthRequired", void 0);
__decorate([
AsnProp({ context: 504, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "userAuthType", void 0);
__decorate([
AsnProp({ context: 505, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "authTimeout", void 0);
__decorate([
AsnProp({ context: 506, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "allowWhileOnBody", void 0);
__decorate([
AsnProp({ context: 507, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "trustedUserPresenceRequired", void 0);
__decorate([
AsnProp({ context: 508, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "trustedConfirmationRequired", void 0);
__decorate([
AsnProp({ context: 509, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "unlockedDeviceRequired", void 0);
__decorate([
AsnProp({ context: 600, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "allApplications", void 0);
__decorate([
AsnProp({ context: 601, type: OctetString, optional: true })
], AuthorizationList.prototype, "applicationId", void 0);
__decorate([
AsnProp({ context: 701, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "creationDateTime", void 0);
__decorate([
AsnProp({ context: 702, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "origin", void 0);
__decorate([
AsnProp({ context: 703, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "rollbackResistant", void 0);
__decorate([
AsnProp({ context: 704, type: RootOfTrust, optional: true })
], AuthorizationList.prototype, "rootOfTrust", void 0);
__decorate([
AsnProp({ context: 705, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "osVersion", void 0);
__decorate([
AsnProp({ context: 706, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "osPatchLevel", void 0);
__decorate([
AsnProp({ context: 709, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationApplicationId", void 0);
__decorate([
AsnProp({ context: 710, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdBrand", void 0);
__decorate([
AsnProp({ context: 711, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdDevice", void 0);
__decorate([
AsnProp({ context: 712, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdProduct", void 0);
__decorate([
AsnProp({ context: 713, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdSerial", void 0);
__decorate([
AsnProp({ context: 714, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdImei", void 0);
__decorate([
AsnProp({ context: 715, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdMeid", void 0);
__decorate([
AsnProp({ context: 716, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdManufacturer", void 0);
__decorate([
AsnProp({ context: 717, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdModel", void 0);
__decorate([
AsnProp({ context: 718, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "vendorPatchLevel", void 0);
__decorate([
AsnProp({ context: 719, type: AsnPropTypes.Integer, optional: true })
], AuthorizationList.prototype, "bootPatchLevel", void 0);
__decorate([
AsnProp({ context: 720, type: AsnPropTypes.Null, optional: true })
], AuthorizationList.prototype, "deviceUniqueAttestation", void 0);
__decorate([
AsnProp({ context: 723, type: OctetString, optional: true })
], AuthorizationList.prototype, "attestationIdSecondImei", void 0);
__decorate([
AsnProp({ context: 724, type: OctetString, optional: true })
], AuthorizationList.prototype, "moduleHash", void 0);
export var SecurityLevel;
(function (SecurityLevel) {
SecurityLevel[SecurityLevel["software"] = 0] = "software";
SecurityLevel[SecurityLevel["trustedEnvironment"] = 1] = "trustedEnvironment";
SecurityLevel[SecurityLevel["strongBox"] = 2] = "strongBox";
})(SecurityLevel || (SecurityLevel = {}));
export var Version;
(function (Version) {
Version[Version["KM2"] = 1] = "KM2";
Version[Version["KM3"] = 2] = "KM3";
Version[Version["KM4"] = 3] = "KM4";
Version[Version["KM4_1"] = 4] = "KM4_1";
Version[Version["keyMint1"] = 100] = "keyMint1";
Version[Version["keyMint2"] = 200] = "keyMint2";
Version[Version["keyMint3"] = 300] = "keyMint3";
Version[Version["keyMint4"] = 400] = "keyMint4";
})(Version || (Version = {}));
export class KeyDescription {
constructor(params = {}) {
this.attestationVersion = Version.KM4;
this.attestationSecurityLevel = SecurityLevel.software;
this.keymasterVersion = 0;
this.keymasterSecurityLevel = SecurityLevel.software;
this.attestationChallenge = new OctetString();
this.uniqueId = new OctetString();
this.softwareEnforced = new AuthorizationList();
this.teeEnforced = new AuthorizationList();
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], KeyDescription.prototype, "attestationVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], KeyDescription.prototype, "attestationSecurityLevel", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], KeyDescription.prototype, "keymasterVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], KeyDescription.prototype, "keymasterSecurityLevel", void 0);
__decorate([
AsnProp({ type: OctetString })
], KeyDescription.prototype, "attestationChallenge", void 0);
__decorate([
AsnProp({ type: OctetString })
], KeyDescription.prototype, "uniqueId", void 0);
__decorate([
AsnProp({ type: AuthorizationList })
], KeyDescription.prototype, "softwareEnforced", void 0);
__decorate([
AsnProp({ type: AuthorizationList })
], KeyDescription.prototype, "teeEnforced", void 0);
export class KeyMintKeyDescription {
constructor(params = {}) {
this.attestationVersion = Version.keyMint4;
this.attestationSecurityLevel = SecurityLevel.software;
this.keyMintVersion = 0;
this.keyMintSecurityLevel = SecurityLevel.software;
this.attestationChallenge = new OctetString();
this.uniqueId = new OctetString();
this.softwareEnforced = new AuthorizationList();
this.hardwareEnforced = new AuthorizationList();
Object.assign(this, params);
}
toLegacyKeyDescription() {
return new KeyDescription({
attestationVersion: this.attestationVersion,
attestationSecurityLevel: this.attestationSecurityLevel,
keymasterVersion: this.keyMintVersion,
keymasterSecurityLevel: this.keyMintSecurityLevel,
attestationChallenge: this.attestationChallenge,
uniqueId: this.uniqueId,
softwareEnforced: this.softwareEnforced,
teeEnforced: this.hardwareEnforced,
});
}
static fromLegacyKeyDescription(keyDesc) {
return new KeyMintKeyDescription({
attestationVersion: keyDesc.attestationVersion,
attestationSecurityLevel: keyDesc.attestationSecurityLevel,
keyMintVersion: keyDesc.keymasterVersion,
keyMintSecurityLevel: keyDesc.keymasterSecurityLevel,
attestationChallenge: keyDesc.attestationChallenge,
uniqueId: keyDesc.uniqueId,
softwareEnforced: keyDesc.softwareEnforced,
hardwareEnforced: keyDesc.teeEnforced,
});
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], KeyMintKeyDescription.prototype, "attestationVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], KeyMintKeyDescription.prototype, "attestationSecurityLevel", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], KeyMintKeyDescription.prototype, "keyMintVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], KeyMintKeyDescription.prototype, "keyMintSecurityLevel", void 0);
__decorate([
AsnProp({ type: OctetString })
], KeyMintKeyDescription.prototype, "attestationChallenge", void 0);
__decorate([
AsnProp({ type: OctetString })
], KeyMintKeyDescription.prototype, "uniqueId", void 0);
__decorate([
AsnProp({ type: AuthorizationList })
], KeyMintKeyDescription.prototype, "softwareEnforced", void 0);
__decorate([
AsnProp({ type: AuthorizationList })
], KeyMintKeyDescription.prototype, "hardwareEnforced", void 0);

View File

@@ -0,0 +1,100 @@
var NonStandardAuthorizationList_1;
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from "@peculiar/asn1-schema";
import { AuthorizationList, SecurityLevel, Version } from "./key_description";
let NonStandardAuthorization = class NonStandardAuthorization extends AuthorizationList {
};
NonStandardAuthorization = __decorate([
AsnType({ type: AsnTypeTypes.Choice })
], NonStandardAuthorization);
export { NonStandardAuthorization };
let NonStandardAuthorizationList = NonStandardAuthorizationList_1 = class NonStandardAuthorizationList extends AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, NonStandardAuthorizationList_1.prototype);
}
findProperty(key) {
const prop = this.find((o) => key in o);
if (prop) {
return prop[key];
}
return undefined;
}
};
NonStandardAuthorizationList = NonStandardAuthorizationList_1 = __decorate([
AsnType({ type: AsnTypeTypes.Sequence, itemType: NonStandardAuthorization })
], NonStandardAuthorizationList);
export { NonStandardAuthorizationList };
export class NonStandardKeyDescription {
get keyMintVersion() {
return this.keymasterVersion;
}
set keyMintVersion(value) {
this.keymasterVersion = value;
}
get keyMintSecurityLevel() {
return this.keymasterSecurityLevel;
}
set keyMintSecurityLevel(value) {
this.keymasterSecurityLevel = value;
}
get hardwareEnforced() {
return this.teeEnforced;
}
set hardwareEnforced(value) {
this.teeEnforced = value;
}
constructor(params = {}) {
this.attestationVersion = Version.KM4;
this.attestationSecurityLevel = SecurityLevel.software;
this.keymasterVersion = 0;
this.keymasterSecurityLevel = SecurityLevel.software;
this.attestationChallenge = new OctetString();
this.uniqueId = new OctetString();
this.softwareEnforced = new NonStandardAuthorizationList();
this.teeEnforced = new NonStandardAuthorizationList();
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], NonStandardKeyDescription.prototype, "attestationVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], NonStandardKeyDescription.prototype, "attestationSecurityLevel", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], NonStandardKeyDescription.prototype, "keymasterVersion", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Enumerated })
], NonStandardKeyDescription.prototype, "keymasterSecurityLevel", void 0);
__decorate([
AsnProp({ type: OctetString })
], NonStandardKeyDescription.prototype, "attestationChallenge", void 0);
__decorate([
AsnProp({ type: OctetString })
], NonStandardKeyDescription.prototype, "uniqueId", void 0);
__decorate([
AsnProp({ type: NonStandardAuthorizationList })
], NonStandardKeyDescription.prototype, "softwareEnforced", void 0);
__decorate([
AsnProp({ type: NonStandardAuthorizationList })
], NonStandardKeyDescription.prototype, "teeEnforced", void 0);
let NonStandardKeyMintKeyDescription = class NonStandardKeyMintKeyDescription extends NonStandardKeyDescription {
constructor(params = {}) {
if ("keymasterVersion" in params && !("keyMintVersion" in params)) {
params.keyMintVersion = params.keymasterVersion;
}
if ("keymasterSecurityLevel" in params && !("keyMintSecurityLevel" in params)) {
params.keyMintSecurityLevel = params.keymasterSecurityLevel;
}
if ("teeEnforced" in params && !("hardwareEnforced" in params)) {
params.hardwareEnforced = params.teeEnforced;
}
super(params);
}
};
NonStandardKeyMintKeyDescription = __decorate([
AsnType({ type: AsnTypeTypes.Sequence })
], NonStandardKeyMintKeyDescription);
export { NonStandardKeyMintKeyDescription };

View File

@@ -0,0 +1,31 @@
import { OctetString } from "@peculiar/asn1-schema";
/**
* Implements ASN.1 structure for attestation package info.
*
* ```asn
* AttestationPackageInfo ::= SEQUENCE {
* package_name OCTET_STRING,
* version INTEGER,
* }
* ```
*/
export declare class AttestationPackageInfo {
packageName: OctetString;
version: number;
constructor(params?: Partial<AttestationPackageInfo>);
}
/**
* Implements ASN.1 structure for attestation application id.
*
* ```asn
* AttestationApplicationId ::= SEQUENCE {
* package_infos SET OF AttestationPackageInfo,
* signature_digests SET OF OCTET_STRING,
* }
* ```
*/
export declare class AttestationApplicationId {
packageInfos: AttestationPackageInfo[];
signatureDigests: OctetString[];
constructor(params?: Partial<AttestationApplicationId>);
}

View File

@@ -0,0 +1,3 @@
export * from "./key_description";
export * from "./nonstandard";
export * from "./attestation";

View File

@@ -0,0 +1,244 @@
import { AsnArray, OctetString } from "@peculiar/asn1-schema";
/**
* Extension OID for key description.
*
* ```asn
* id-ce-keyDescription OBJECT IDENTIFIER ::= { 1 3 6 1 4 1 11129 2 1 17 }
* ```
*/
export declare const id_ce_keyDescription = "1.3.6.1.4.1.11129.2.1.17";
/**
* Implements ASN.1 enumeration for verified boot state.
*
* ```asn
* VerifiedBootState ::= ENUMERATED {
* Verified (0),
* SelfSigned (1),
* Unverified (2),
* Failed (3),
* }
* ```
*/
export declare enum VerifiedBootState {
verified = 0,
selfSigned = 1,
unverified = 2,
failed = 3
}
/**
* Implements ASN.1 structure for root of trust.
*
* ```asn
* RootOfTrust ::= SEQUENCE {
* verifiedBootKey OCTET_STRING,
* deviceLocked BOOLEAN,
* verifiedBootState VerifiedBootState,
* verifiedBootHash OCTET_STRING, # KM4
* }
* ```
*/
export declare class RootOfTrust {
verifiedBootKey: OctetString;
deviceLocked: boolean;
verifiedBootState: VerifiedBootState;
/**
* `verifiedBootHash` must present in `KeyDescription` version 3
*/
verifiedBootHash?: OctetString;
constructor(params?: Partial<RootOfTrust>);
}
/**
* Implements ASN.1 structure for set of integers.
*
* ```asn
* IntegerSet ::= SET OF INTEGER
* ```
*/
export declare class IntegerSet extends AsnArray<number> {
constructor(items?: number[]);
}
/**
* Implements ASN.1 structure for authorization list.
*
* ```asn
* AuthorizationList ::= SEQUENCE {
* purpose [1] EXPLICIT SET OF INTEGER OPTIONAL,
* algorithm [2] EXPLICIT INTEGER OPTIONAL,
* keySize [3] EXPLICIT INTEGER OPTIONAL.
* digest [5] EXPLICIT SET OF INTEGER OPTIONAL,
* padding [6] EXPLICIT SET OF INTEGER OPTIONAL,
* ecCurve [10] EXPLICIT INTEGER OPTIONAL,
* rsaPublicExponent [200] EXPLICIT INTEGER OPTIONAL,
* mgfDigest [203] EXPLICIT SET OF INTEGER OPTIONAL,
* rollbackResistance [303] EXPLICIT NULL OPTIONAL, # KM4
* earlyBootOnly [305] EXPLICIT NULL OPTIONAL, # version 4
* activeDateTime [400] EXPLICIT INTEGER OPTIONAL
* originationExpireDateTime [401] EXPLICIT INTEGER OPTIONAL
* usageExpireDateTime [402] EXPLICIT INTEGER OPTIONAL
* usageCountLimit [405] EXPLICIT INTEGER OPTIONAL,
* noAuthRequired [503] EXPLICIT NULL OPTIONAL,
* userAuthType [504] EXPLICIT INTEGER OPTIONAL,
* authTimeout [505] EXPLICIT INTEGER OPTIONAL,
* allowWhileOnBody [506] EXPLICIT NULL OPTIONAL,
* trustedUserPresenceRequired [507] EXPLICIT NULL OPTIONAL, # KM4
* trustedConfirmationRequired [508] EXPLICIT NULL OPTIONAL, # KM4
* unlockedDeviceRequired [509] EXPLICIT NULL OPTIONAL, # KM4
* allApplications [600] EXPLICIT NULL OPTIONAL,
* applicationId [601] EXPLICIT OCTET_STRING OPTIONAL,
* creationDateTime [701] EXPLICIT INTEGER OPTIONAL,
* origin [702] EXPLICIT INTEGER OPTIONAL,
* rollbackResistant [703] EXPLICIT NULL OPTIONAL, # KM2 and KM3 only.
* rootOfTrust [704] EXPLICIT RootOfTrust OPTIONAL,
* osVersion [705] EXPLICIT INTEGER OPTIONAL,
* osPatchLevel [706] EXPLICIT INTEGER OPTIONAL,
* attestationApplicationId [709] EXPLICIT OCTET_STRING OPTIONAL, # KM3
* attestationIdBrand [710] EXPLICIT OCTET_STRING OPTIONAL, # KM3
* attestationIdDevice [711] EXPLICIT OCTET_STRING OPTIONAL, # KM3
* attestationIdProduct [712] EXPLICIT OCTET_STRING OPTIONAL, # KM3
* attestationIdSerial [713] EXPLICIT OCTET_STRING OPTIONAL, # KM3
* attestationIdImei [714] EXPLICIT OCTET_STRING OPTIONAL, # KM3
* attestationIdMeid [715] EXPLICIT OCTET_STRING OPTIONAL, # KM3
* attestationIdManufacturer [716] EXPLICIT OCTET_STRING OPTIONAL, # KM3
* attestationIdModel [717] EXPLICIT OCTET_STRING OPTIONAL, # KM3
* vendorPatchLevel [718] EXPLICIT INTEGER OPTIONAL, # KM4
* bootPatchLevel [719] EXPLICIT INTEGER OPTIONAL, # KM4
* deviceUniqueAttestation [720] EXPLICIT NULL OPTIONAL, # version 4
* attestationIdSecondImei [723] EXPLICIT OCTET_STRING OPTIONAL,
* moduleHash [724] EXPLICIT OCTET_STRING OPTIONAL,
* }
* ```
*/
export declare class AuthorizationList {
purpose?: IntegerSet;
algorithm?: number;
keySize?: number;
digest?: IntegerSet;
padding?: IntegerSet;
ecCurve?: number;
rsaPublicExponent?: number;
mgfDigest?: IntegerSet;
rollbackResistance?: null;
earlyBootOnly?: null;
activeDateTime?: number;
originationExpireDateTime?: number;
usageExpireDateTime?: number;
usageCountLimit?: number;
noAuthRequired?: null;
userAuthType?: number;
authTimeout?: number;
allowWhileOnBody?: null;
trustedUserPresenceRequired?: null;
trustedConfirmationRequired?: null;
unlockedDeviceRequired?: null;
allApplications?: null;
applicationId?: OctetString;
creationDateTime?: number;
origin?: number;
rollbackResistant?: null;
rootOfTrust?: RootOfTrust;
osVersion?: number;
osPatchLevel?: number;
attestationApplicationId?: OctetString;
attestationIdBrand?: OctetString;
attestationIdDevice?: OctetString;
attestationIdProduct?: OctetString;
attestationIdSerial?: OctetString;
attestationIdImei?: OctetString;
attestationIdMeid?: OctetString;
attestationIdManufacturer?: OctetString;
attestationIdModel?: OctetString;
vendorPatchLevel?: number;
bootPatchLevel?: number;
deviceUniqueAttestation?: null;
attestationIdSecondImei?: OctetString;
moduleHash?: OctetString;
constructor(params?: Partial<AuthorizationList>);
}
/**
* Implements ASN.1 structure for security level.
*
* ```asn
* SecurityLevel ::= ENUMERATED {
* Software (0),
* TrustedEnvironment (1),
* StrongBox (2),
* }
* ```
*/
export declare enum SecurityLevel {
software = 0,
trustedEnvironment = 1,
strongBox = 2
}
export declare enum Version {
KM2 = 1,
KM3 = 2,
KM4 = 3,
KM4_1 = 4,
keyMint1 = 100,
keyMint2 = 200,
keyMint3 = 300,
keyMint4 = 400
}
/**
* Implements ASN.1 structure for key description.
*
* ```asn
* KeyDescription ::= SEQUENCE {
* attestationVersion INTEGER, # versions 1, 2, 3, 4, 100, and 200
* attestationSecurityLevel SecurityLevel,
* keymasterVersion INTEGER,
* keymasterSecurityLevel SecurityLevel,
* attestationChallenge OCTET_STRING,
* uniqueId OCTET_STRING,
* softwareEnforced AuthorizationList,
* teeEnforced AuthorizationList,
* }
* ```
*/
export declare class KeyDescription {
attestationVersion: number | Version;
attestationSecurityLevel: SecurityLevel;
keymasterVersion: number;
keymasterSecurityLevel: SecurityLevel;
attestationChallenge: OctetString;
uniqueId: OctetString;
softwareEnforced: AuthorizationList;
teeEnforced: AuthorizationList;
constructor(params?: Partial<KeyDescription>);
}
/**
* Implements ASN.1 structure for KeyMint key description (v300 and v400).
*
* ```asn
* KeyDescription ::= SEQUENCE {
* attestationVersion INTEGER, # versions 300 and 400
* attestationSecurityLevel SecurityLevel,
* keyMintVersion INTEGER,
* keyMintSecurityLevel SecurityLevel,
* attestationChallenge OCTET_STRING,
* uniqueId OCTET_STRING,
* softwareEnforced AuthorizationList,
* hardwareEnforced AuthorizationList,
* }
* ```
*/
export declare class KeyMintKeyDescription {
attestationVersion: number | Version;
attestationSecurityLevel: SecurityLevel;
keyMintVersion: number;
keyMintSecurityLevel: SecurityLevel;
attestationChallenge: OctetString;
uniqueId: OctetString;
softwareEnforced: AuthorizationList;
hardwareEnforced: AuthorizationList;
constructor(params?: Partial<KeyMintKeyDescription>);
/**
* Convert to legacy KeyDescription for backwards compatibility
*/
toLegacyKeyDescription(): KeyDescription;
/**
* Create from legacy KeyDescription for backwards compatibility
*/
static fromLegacyKeyDescription(keyDesc: KeyDescription): KeyMintKeyDescription;
}

View File

@@ -0,0 +1,83 @@
import { AsnArray, OctetString } from "@peculiar/asn1-schema";
import { AuthorizationList, SecurityLevel, Version } from "./key_description";
/**
* This file contains classes to handle non-standard key descriptions and authorizations.
*
* Due to an issue with the asn1-schema library, referenced at https://github.com/PeculiarVentures/asn1-schema/issues/98#issuecomment-1764345351,
* the standard key description does not allow for a non-strict order of fields in the `softwareEnforced` and `teeEnforced` attributes.
*
* To address this and provide greater flexibility, the `NonStandardKeyDescription` and
* `NonStandardAuthorizationList` classes were created, allowing for the use of non-standard authorizations and a flexible field order.
*
* The purpose of these modifications is to ensure compatibility with specific requirements and standards, as well as to offer
* more convenient tools for working with key descriptions and authorizations.
*
* Please refer to the documentation and class comments before using or modifying them.
*/
/**
* Represents a non-standard authorization for NonStandardAuthorizationList. It uses the same
* structure as AuthorizationList, but it is a CHOICE instead of a SEQUENCE, that allows for
* non-strict ordering of fields.
*/
export declare class NonStandardAuthorization extends AuthorizationList {
}
/**
* Represents a list of non-standard authorizations.
* ```asn
* NonStandardAuthorizationList ::= SEQUENCE OF NonStandardAuthorization
* ```
*/
export declare class NonStandardAuthorizationList extends AsnArray<NonStandardAuthorization> {
constructor(items?: NonStandardAuthorization[]);
/**
* Finds the first authorization that contains the specified key.
* @param key The key to search for.
* @returns The first authorization that contains the specified key, or `undefined` if not found.
*/
findProperty<K extends keyof AuthorizationList>(key: K): AuthorizationList[K] | undefined;
}
/**
* The AuthorizationList class allows for non-strict ordering of fields in the
* softwareEnforced and teeEnforced/hardwareEnforced fields.
*
* This behavior is due to an issue with the asn1-schema library, which is
* documented here: https://github.com/PeculiarVentures/asn1-schema/issues/98#issuecomment-1764345351
*
* ```asn
* KeyDescription ::= SEQUENCE {
* attestationVersion INTEGER, # versions 1, 2, 3, 4, 100, 200, 300, and 400
* attestationSecurityLevel SecurityLevel,
* keymasterVersion/keyMintVersion INTEGER,
* keymasterSecurityLevel/keyMintSecurityLevel SecurityLevel,
* attestationChallenge OCTET_STRING,
* uniqueId OCTET_STRING,
* softwareEnforced NonStandardAuthorizationList,
* teeEnforced/hardwareEnforced NonStandardAuthorizationList,
* }
* ```
*/
export declare class NonStandardKeyDescription {
attestationVersion: number | Version;
attestationSecurityLevel: SecurityLevel;
keymasterVersion: number;
keymasterSecurityLevel: SecurityLevel;
attestationChallenge: OctetString;
uniqueId: OctetString;
softwareEnforced: NonStandardAuthorizationList;
teeEnforced: NonStandardAuthorizationList;
get keyMintVersion(): number;
set keyMintVersion(value: number);
get keyMintSecurityLevel(): SecurityLevel;
set keyMintSecurityLevel(value: SecurityLevel);
get hardwareEnforced(): NonStandardAuthorizationList;
set hardwareEnforced(value: NonStandardAuthorizationList);
constructor(params?: Partial<NonStandardKeyDescription>);
}
/**
* New class for v300 and v400 KeyMint non-standard key description.
* This uses the same underlying structure as NonStandardKeyDescription,
* but with renamed properties to match the updated specification.
*/
export declare class NonStandardKeyMintKeyDescription extends NonStandardKeyDescription {
constructor(params?: Partial<NonStandardKeyDescription>);
}

View File

@@ -0,0 +1,15 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

View File

@@ -0,0 +1,12 @@
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,164 @@
# tslib
This is a runtime library for [TypeScript](https://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
This library is primarily used by the `--importHelpers` flag in TypeScript.
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
```ts
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
exports.x = {};
exports.y = __assign({}, exports.x);
```
will instead be emitted as something like the following:
```ts
var tslib_1 = require("tslib");
exports.x = {};
exports.y = tslib_1.__assign({}, exports.x);
```
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead.
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
# Installing
For the latest stable version, run:
## npm
```sh
# TypeScript 3.9.2 or later
npm install tslib
# TypeScript 3.8.4 or earlier
npm install tslib@^1
# TypeScript 2.3.2 or earlier
npm install tslib@1.6.1
```
## yarn
```sh
# TypeScript 3.9.2 or later
yarn add tslib
# TypeScript 3.8.4 or earlier
yarn add tslib@^1
# TypeScript 2.3.2 or earlier
yarn add tslib@1.6.1
```
## bower
```sh
# TypeScript 3.9.2 or later
bower install tslib
# TypeScript 3.8.4 or earlier
bower install tslib@^1
# TypeScript 2.3.2 or earlier
bower install tslib@1.6.1
```
## JSPM
```sh
# TypeScript 3.9.2 or later
jspm install tslib
# TypeScript 3.8.4 or earlier
jspm install tslib@^1
# TypeScript 2.3.2 or earlier
jspm install tslib@1.6.1
```
# Usage
Set the `importHelpers` compiler option on the command line:
```
tsc --importHelpers file.ts
```
or in your tsconfig.json:
```json
{
"compilerOptions": {
"importHelpers": true
}
}
```
#### For bower and JSPM users
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:
```json
{
"compilerOptions": {
"module": "amd",
"importHelpers": true,
"baseUrl": "./",
"paths": {
"tslib" : ["bower_components/tslib/tslib.d.ts"]
}
}
}
```
For JSPM users:
```json
{
"compilerOptions": {
"module": "system",
"importHelpers": true,
"baseUrl": "./",
"paths": {
"tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"]
}
}
}
```
## Deployment
- Choose your new version number
- Set it in `package.json` and `bower.json`
- Create a tag: `git tag [version]`
- Push the tag: `git push --tags`
- Create a [release in GitHub](https://github.com/microsoft/tslib/releases)
- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow
Done.
# Contribute
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
# Documentation
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
* [Programming handbook](http://www.typescriptlang.org/Handbook)
* [Homepage](http://www.typescriptlang.org/)

View File

@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
## Preferred Languages
We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK -->

View File

@@ -0,0 +1,38 @@
// Note: named reexports are used instead of `export *` because
// TypeScript itself doesn't resolve the `export *` when checking
// if a particular helper exists.
export {
__extends,
__assign,
__rest,
__decorate,
__param,
__esDecorate,
__runInitializers,
__propKey,
__setFunctionName,
__metadata,
__awaiter,
__generator,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__createBinding,
__addDisposableResource,
__disposeResources,
__rewriteRelativeImportExtension,
} from '../tslib.js';
export * as default from '../tslib.js';

View File

@@ -0,0 +1,70 @@
import tslib from '../tslib.js';
const {
__extends,
__assign,
__rest,
__decorate,
__param,
__esDecorate,
__runInitializers,
__propKey,
__setFunctionName,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
__rewriteRelativeImportExtension,
} = tslib;
export {
__extends,
__assign,
__rest,
__decorate,
__param,
__esDecorate,
__runInitializers,
__propKey,
__setFunctionName,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
__rewriteRelativeImportExtension,
};
export default tslib;

View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

View File

@@ -0,0 +1,47 @@
{
"name": "tslib",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "2.8.1",
"license": "0BSD",
"description": "Runtime library for TypeScript helper functions",
"keywords": [
"TypeScript",
"Microsoft",
"compiler",
"language",
"javascript",
"tslib",
"runtime"
],
"bugs": {
"url": "https://github.com/Microsoft/TypeScript/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/tslib.git"
},
"main": "tslib.js",
"module": "tslib.es6.js",
"jsnext:main": "tslib.es6.js",
"typings": "tslib.d.ts",
"sideEffects": false,
"exports": {
".": {
"module": {
"types": "./modules/index.d.ts",
"default": "./tslib.es6.mjs"
},
"import": {
"node": "./modules/index.js",
"default": {
"types": "./modules/index.d.ts",
"default": "./tslib.es6.mjs"
}
},
"default": "./tslib.js"
},
"./*": "./*",
"./": "./"
}
}

View File

@@ -0,0 +1,460 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/**
* Used to shim class extends.
*
* @param d The derived class.
* @param b The base class.
*/
export declare function __extends(d: Function, b: Function): void;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
*
* @param t The target object to copy to.
* @param sources One or more source objects from which to copy properties
*/
export declare function __assign(t: any, ...sources: any[]): any;
/**
* Performs a rest spread on an object.
*
* @param t The source value.
* @param propertyNames The property names excluded from the rest spread.
*/
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
/**
* Applies decorators to a target object
*
* @param decorators The set of decorators to apply.
* @param target The target object.
* @param key If specified, the own property to apply the decorators to.
* @param desc The property descriptor, defaults to fetching the descriptor from the target object.
* @experimental
*/
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
/**
* Creates an observing function decorator from a parameter decorator.
*
* @param paramIndex The parameter index to apply the decorator to.
* @param decorator The parameter decorator to apply. Note that the return value is ignored.
* @experimental
*/
export declare function __param(paramIndex: number, decorator: Function): Function;
/**
* Applies decorators to a class or class member, following the native ECMAScript decorator specification.
* @param ctor For non-field class members, the class constructor. Otherwise, `null`.
* @param descriptorIn The `PropertyDescriptor` to use when unable to look up the property from `ctor`.
* @param decorators The decorators to apply
* @param contextIn The `DecoratorContext` to clone for each decorator application.
* @param initializers An array of field initializer mutation functions into which new initializers are written.
* @param extraInitializers An array of extra initializer functions into which new initializers are written.
*/
export declare function __esDecorate(ctor: Function | null, descriptorIn: object | null, decorators: Function[], contextIn: object, initializers: Function[] | null, extraInitializers: Function[]): void;
/**
* Runs field initializers or extra initializers generated by `__esDecorate`.
* @param thisArg The `this` argument to use.
* @param initializers The array of initializers to evaluate.
* @param value The initial value to pass to the initializers.
*/
export declare function __runInitializers(thisArg: unknown, initializers: Function[], value?: any): any;
/**
* Converts a computed property name into a `string` or `symbol` value.
*/
export declare function __propKey(x: any): string | symbol;
/**
* Assigns the name of a function derived from the left-hand side of an assignment.
* @param f The function to rename.
* @param name The new name for the function.
* @param prefix A prefix (such as `"get"` or `"set"`) to insert before the name.
*/
export declare function __setFunctionName(f: Function, name: string | symbol, prefix?: string): Function;
/**
* Creates a decorator that sets metadata.
*
* @param metadataKey The metadata key
* @param metadataValue The metadata value
* @experimental
*/
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
/**
* Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`.
*
* @param thisArg The reference to use as the `this` value in the generator function
* @param _arguments The optional arguments array
* @param P The optional promise constructor argument, defaults to the `Promise` property of the global object.
* @param generator The generator function
*/
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
/**
* Creates an Iterator object using the body as the implementation.
*
* @param thisArg The reference to use as the `this` value in the function
* @param body The generator state-machine based implementation.
*
* @see [./docs/generator.md]
*/
export declare function __generator(thisArg: any, body: Function): any;
/**
* Creates bindings for all enumerable properties of `m` on `exports`
*
* @param m The source object
* @param o The `exports` object.
*/
export declare function __exportStar(m: any, o: any): void;
/**
* Creates a value iterator from an `Iterable` or `ArrayLike` object.
*
* @param o The object.
* @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`.
*/
export declare function __values(o: any): any;
/**
* Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array.
*
* @param o The object to read from.
* @param n The maximum number of arguments to read, defaults to `Infinity`.
*/
export declare function __read(o: any, n?: number): any[];
/**
* Creates an array from iterable spread.
*
* @param args The Iterable objects to spread.
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
*/
export declare function __spread(...args: any[][]): any[];
/**
* Creates an array from array spread.
*
* @param args The ArrayLikes to spread into the resulting array.
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
*/
export declare function __spreadArrays(...args: any[][]): any[];
/**
* Spreads the `from` array into the `to` array.
*
* @param pack Replace empty elements with `undefined`.
*/
export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[];
/**
* Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded,
* and instead should be awaited and the resulting value passed back to the generator.
*
* @param v The value to await.
*/
export declare function __await(v: any): any;
/**
* Converts a generator function into an async generator function, by using `yield __await`
* in place of normal `await`.
*
* @param thisArg The reference to use as the `this` value in the generator function
* @param _arguments The optional arguments array
* @param generator The generator function
*/
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
/**
* Used to wrap a potentially async iterator in such a way so that it wraps the result
* of calling iterator methods of `o` in `__await` instances, and then yields the awaited values.
*
* @param o The potentially async iterator.
* @returns A synchronous iterator yielding `__await` instances on every odd invocation
* and returning the awaited `IteratorResult` passed to `next` every even invocation.
*/
export declare function __asyncDelegator(o: any): any;
/**
* Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object.
*
* @param o The object.
* @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`.
*/
export declare function __asyncValues(o: any): any;
/**
* Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays.
*
* @param cooked The cooked possibly-sparse array.
* @param raw The raw string content.
*/
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
/**
* Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS.
*
* ```js
* import Default, { Named, Other } from "mod";
* // or
* import { default as Default, Named, Other } from "mod";
* ```
*
* @param mod The CommonJS module exports object.
*/
export declare function __importStar<T>(mod: T): T;
/**
* Used to shim default imports in ECMAScript Modules transpiled to CommonJS.
*
* ```js
* import Default from "mod";
* ```
*
* @param mod The CommonJS module exports object.
*/
export declare function __importDefault<T>(mod: T): T | { default: T };
/**
* Emulates reading a private instance field.
*
* @param receiver The instance from which to read the private field.
* @param state A WeakMap containing the private field value for an instance.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldGet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean, get(o: T): V | undefined },
kind?: "f"
): V;
/**
* Emulates reading a private static field.
*
* @param receiver The object from which to read the private static field.
* @param state The class constructor containing the definition of the static field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The descriptor that holds the static field value.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
kind: "f",
f: { value: V }
): V;
/**
* Emulates evaluating a private instance "get" accessor.
*
* @param receiver The instance on which to evaluate the private "get" accessor.
* @param state A WeakSet used to verify an instance supports the private "get" accessor.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "get" accessor function to evaluate.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldGet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean },
kind: "a",
f: () => V
): V;
/**
* Emulates evaluating a private static "get" accessor.
*
* @param receiver The object on which to evaluate the private static "get" accessor.
* @param state The class constructor containing the definition of the static "get" accessor.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "get" accessor function to evaluate.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
kind: "a",
f: () => V
): V;
/**
* Emulates reading a private instance method.
*
* @param receiver The instance from which to read a private method.
* @param state A WeakSet used to verify an instance supports the private method.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The function to return as the private instance method.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldGet<T extends object, V extends (...args: any[]) => unknown>(
receiver: T,
state: { has(o: T): boolean },
kind: "m",
f: V
): V;
/**
* Emulates reading a private static method.
*
* @param receiver The object from which to read the private static method.
* @param state The class constructor containing the definition of the static method.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The function to return as the private static method.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V extends (...args: any[]) => unknown>(
receiver: T,
state: T,
kind: "m",
f: V
): V;
/**
* Emulates writing to a private instance field.
*
* @param receiver The instance on which to set a private field value.
* @param state A WeakMap used to store the private field value for an instance.
* @param value The value to store in the private field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldSet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean, set(o: T, value: V): unknown },
value: V,
kind?: "f"
): V;
/**
* Emulates writing to a private static field.
*
* @param receiver The object on which to set the private static field.
* @param state The class constructor containing the definition of the private static field.
* @param value The value to store in the private field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The descriptor that holds the static field value.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
value: V,
kind: "f",
f: { value: V }
): V;
/**
* Emulates writing to a private instance "set" accessor.
*
* @param receiver The instance on which to evaluate the private instance "set" accessor.
* @param state A WeakSet used to verify an instance supports the private "set" accessor.
* @param value The value to store in the private accessor.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "set" accessor function to evaluate.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldSet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean },
value: V,
kind: "a",
f: (v: V) => void
): V;
/**
* Emulates writing to a private static "set" accessor.
*
* @param receiver The object on which to evaluate the private static "set" accessor.
* @param state The class constructor containing the definition of the static "set" accessor.
* @param value The value to store in the private field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "set" accessor function to evaluate.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
value: V,
kind: "a",
f: (v: V) => void
): V;
/**
* Checks for the existence of a private field/method/accessor.
*
* @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member.
* @param receiver The object for which to test the presence of the private member.
*/
export declare function __classPrivateFieldIn(
state: (new (...args: any[]) => unknown) | { has(o: any): boolean },
receiver: unknown,
): boolean;
/**
* Creates a re-export binding on `object` with key `objectKey` that references `target[key]`.
*
* @param object The local `exports` object.
* @param target The object to re-export from.
* @param key The property key of `target` to re-export.
* @param objectKey The property key to re-export as. Defaults to `key`.
*/
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;
/**
* Adds a disposable resource to a resource-tracking environment object.
* @param env A resource-tracking environment object.
* @param value Either a Disposable or AsyncDisposable object, `null`, or `undefined`.
* @param async When `true`, `AsyncDisposable` resources can be added. When `false`, `AsyncDisposable` resources cannot be added.
* @returns The {@link value} argument.
*
* @throws {TypeError} If {@link value} is not an object, or if either `Symbol.dispose` or `Symbol.asyncDispose` are not
* defined, or if {@link value} does not have an appropriate `Symbol.dispose` or `Symbol.asyncDispose` method.
*/
export declare function __addDisposableResource<T>(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }, value: T, async: boolean): T;
/**
* Disposes all resources in a resource-tracking environment object.
* @param env A resource-tracking environment object.
* @returns A {@link Promise} if any resources in the environment were marked as `async` when added; otherwise, `void`.
*
* @throws {SuppressedError} if an error thrown during disposal would have suppressed a prior error from disposal or the
* error recorded in the resource-tracking environment object.
* @seealso {@link __addDisposableResource}
*/
export declare function __disposeResources(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }): any;
/**
* Transforms a relative import specifier ending in a non-declaration TypeScript file extension to its JavaScript file extension counterpart.
* @param path The import specifier.
* @param preserveJsx Causes '*.tsx' to transform to '*.jsx' instead of '*.js'. Should be true when `--jsx` is set to `preserve`.
*/
export declare function __rewriteRelativeImportExtension(path: string, preserveJsx?: boolean): string;

View File

@@ -0,0 +1 @@
<script src="tslib.es6.js"></script>

View File

@@ -0,0 +1,402 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
export function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
export var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
export function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
export function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
export function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
export function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
export function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
export function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
export function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
export function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
export function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
export var __createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
export function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
export function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
export function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
/** @deprecated */
export function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
export function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
export function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
export function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
export function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
export function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
}
export function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
export function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
export function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
}
export function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
export function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
export function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
export function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
export function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
}
export function __rewriteRelativeImportExtension(path, preserveJsx) {
if (typeof path === "string" && /^\.\.?\//.test(path)) {
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
});
}
return path;
}
export default {
__extends: __extends,
__assign: __assign,
__rest: __rest,
__decorate: __decorate,
__param: __param,
__esDecorate: __esDecorate,
__runInitializers: __runInitializers,
__propKey: __propKey,
__setFunctionName: __setFunctionName,
__metadata: __metadata,
__awaiter: __awaiter,
__generator: __generator,
__createBinding: __createBinding,
__exportStar: __exportStar,
__values: __values,
__read: __read,
__spread: __spread,
__spreadArrays: __spreadArrays,
__spreadArray: __spreadArray,
__await: __await,
__asyncGenerator: __asyncGenerator,
__asyncDelegator: __asyncDelegator,
__asyncValues: __asyncValues,
__makeTemplateObject: __makeTemplateObject,
__importStar: __importStar,
__importDefault: __importDefault,
__classPrivateFieldGet: __classPrivateFieldGet,
__classPrivateFieldSet: __classPrivateFieldSet,
__classPrivateFieldIn: __classPrivateFieldIn,
__addDisposableResource: __addDisposableResource,
__disposeResources: __disposeResources,
__rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
};

View File

@@ -0,0 +1,401 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
export function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
export var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
export function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
export function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
export function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
export function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
export function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
export function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
export function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
export function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
export function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
export var __createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
export function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
export function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
export function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
/** @deprecated */
export function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
export function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
export function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
export function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
export function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
export function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
}
export function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
export function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
export function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
}
export function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
export function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
export function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
export function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
export function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
}
export function __rewriteRelativeImportExtension(path, preserveJsx) {
if (typeof path === "string" && /^\.\.?\//.test(path)) {
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
});
}
return path;
}
export default {
__extends,
__assign,
__rest,
__decorate,
__param,
__esDecorate,
__runInitializers,
__propKey,
__setFunctionName,
__metadata,
__awaiter,
__generator,
__createBinding,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
__rewriteRelativeImportExtension,
};

View File

@@ -0,0 +1 @@
<script src="tslib.js"></script>

View File

@@ -0,0 +1,484 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global global, define, Symbol, Reflect, Promise, SuppressedError, Iterator */
var __extends;
var __assign;
var __rest;
var __decorate;
var __param;
var __esDecorate;
var __runInitializers;
var __propKey;
var __setFunctionName;
var __metadata;
var __awaiter;
var __generator;
var __exportStar;
var __values;
var __read;
var __spread;
var __spreadArrays;
var __spreadArray;
var __await;
var __asyncGenerator;
var __asyncDelegator;
var __asyncValues;
var __makeTemplateObject;
var __importStar;
var __importDefault;
var __classPrivateFieldGet;
var __classPrivateFieldSet;
var __classPrivateFieldIn;
var __createBinding;
var __addDisposableResource;
var __disposeResources;
var __rewriteRelativeImportExtension;
(function (factory) {
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
if (typeof define === "function" && define.amd) {
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
}
else if (typeof module === "object" && typeof module.exports === "object") {
factory(createExporter(root, createExporter(module.exports)));
}
else {
factory(createExporter(root));
}
function createExporter(exports, previous) {
if (exports !== root) {
if (typeof Object.create === "function") {
Object.defineProperty(exports, "__esModule", { value: true });
}
else {
exports.__esModule = true;
}
}
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
}
})
(function (exporter) {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
__extends = function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
__assign = Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
__rest = function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
__decorate = function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param = function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
__esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
__runInitializers = function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
__propKey = function (x) {
return typeof x === "symbol" ? x : "".concat(x);
};
__setFunctionName = function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
__metadata = function (metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
};
__awaiter = function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
__generator = function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
__exportStar = function(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
};
__createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
__values = function (o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
__read = function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
/** @deprecated */
__spread = function () {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
};
/** @deprecated */
__spreadArrays = function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
__spreadArray = function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
__await = function (v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
};
__asyncGenerator = function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
__asyncDelegator = function (o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
};
__asyncValues = function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
__makeTemplateObject = function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
__importStar = function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
__importDefault = function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
__classPrivateFieldGet = function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
__classPrivateFieldSet = function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
__classPrivateFieldIn = function (state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
};
__addDisposableResource = function (env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
};
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
__disposeResources = function (env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
};
__rewriteRelativeImportExtension = function (path, preserveJsx) {
if (typeof path === "string" && /^\.\.?\//.test(path)) {
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
});
}
return path;
};
exporter("__extends", __extends);
exporter("__assign", __assign);
exporter("__rest", __rest);
exporter("__decorate", __decorate);
exporter("__param", __param);
exporter("__esDecorate", __esDecorate);
exporter("__runInitializers", __runInitializers);
exporter("__propKey", __propKey);
exporter("__setFunctionName", __setFunctionName);
exporter("__metadata", __metadata);
exporter("__awaiter", __awaiter);
exporter("__generator", __generator);
exporter("__exportStar", __exportStar);
exporter("__createBinding", __createBinding);
exporter("__values", __values);
exporter("__read", __read);
exporter("__spread", __spread);
exporter("__spreadArrays", __spreadArrays);
exporter("__spreadArray", __spreadArray);
exporter("__await", __await);
exporter("__asyncGenerator", __asyncGenerator);
exporter("__asyncDelegator", __asyncDelegator);
exporter("__asyncValues", __asyncValues);
exporter("__makeTemplateObject", __makeTemplateObject);
exporter("__importStar", __importStar);
exporter("__importDefault", __importDefault);
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
exporter("__classPrivateFieldIn", __classPrivateFieldIn);
exporter("__addDisposableResource", __addDisposableResource);
exporter("__disposeResources", __disposeResources);
exporter("__rewriteRelativeImportExtension", __rewriteRelativeImportExtension);
});
0 && (module.exports = {
__extends: __extends,
__assign: __assign,
__rest: __rest,
__decorate: __decorate,
__param: __param,
__esDecorate: __esDecorate,
__runInitializers: __runInitializers,
__propKey: __propKey,
__setFunctionName: __setFunctionName,
__metadata: __metadata,
__awaiter: __awaiter,
__generator: __generator,
__exportStar: __exportStar,
__createBinding: __createBinding,
__values: __values,
__read: __read,
__spread: __spread,
__spreadArrays: __spreadArrays,
__spreadArray: __spreadArray,
__await: __await,
__asyncGenerator: __asyncGenerator,
__asyncDelegator: __asyncDelegator,
__asyncValues: __asyncValues,
__makeTemplateObject: __makeTemplateObject,
__importStar: __importStar,
__importDefault: __importDefault,
__classPrivateFieldGet: __classPrivateFieldGet,
__classPrivateFieldSet: __classPrivateFieldSet,
__classPrivateFieldIn: __classPrivateFieldIn,
__addDisposableResource: __addDisposableResource,
__disposeResources: __disposeResources,
__rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
});

View File

@@ -0,0 +1,42 @@
{
"name": "@peculiar/asn1-android",
"version": "2.3.16",
"description": "",
"files": [
"build/**/*.{js,d.ts}",
"LICENSE",
"README.md"
],
"bugs": {
"url": "https://github.com/PeculiarVentures/asn1-schema/issues"
},
"homepage": "https://github.com/PeculiarVentures/asn1-schema/tree/master/packages/android#readme",
"keywords": [
"asn"
],
"author": "PeculiarVentures, LLC",
"license": "MIT",
"main": "build/cjs/index.js",
"module": "build/es2015/index.js",
"types": "build/types/index.d.ts",
"publishConfig": {
"access": "public"
},
"scripts": {
"test": "mocha",
"clear": "rimraf build",
"build": "npm run build:module && npm run build:types",
"build:module": "npm run build:cjs && npm run build:es2015",
"build:cjs": "tsc -p tsconfig.compile.json --removeComments --module commonjs --outDir build/cjs",
"build:es2015": "tsc -p tsconfig.compile.json --removeComments --module ES2015 --outDir build/es2015",
"prebuild:types": "rimraf build/types",
"build:types": "tsc -p tsconfig.compile.json --outDir build/types --declaration --emitDeclarationOnly",
"rebuild": "npm run clear && npm run build"
},
"dependencies": {
"@peculiar/asn1-schema": "^2.3.15",
"asn1js": "^3.0.5",
"tslib": "^2.8.1"
},
"gitHead": "a37321bc09c123bc3bc888e0d14bdb7fa99011e1"
}

21
api.hyungi.net/node_modules/@peculiar/asn1-ecc/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,14 @@
# `@peculiar/asn1-ecc`
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/PeculiarVentures/asn1-schema/master/packages/ecc/LICENSE.md)
[![npm version](https://badge.fury.io/js/%40peculiar%2Fasn1-ecc.svg)](https://badge.fury.io/js/%40peculiar%2Fasn1-ecc)
[![NPM](https://nodei.co/npm/@peculiar/asn1-ecc.png)](https://nodei.co/npm/@peculiar/asn1-ecc/)
This module provides ASN.1 schema definitions and parsers for Elliptic Curve Cryptography (ECC) structures. It includes support for various ECC-related standards and specifications, making it easier to work with ECC keys and certificates in JavaScript and TypeScript applications.
| Document | Description |
| ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| [RFC 5915](https://tools.ietf.org/html/rfc5915) | Elliptic Curve Private Key Structure |
| [RFC 5480](https://tools.ietf.org/html/rfc5480) | Elliptic Curve Cryptography Subject Public Key Information |
| [RFC 3279](https://datatracker.ietf.org/doc/html/rfc3279#section-2.3.5) | Algorithms and Identifiers for the Internet X.509 Public Key Infrastructure Certificate: ECDSA and ECDH Keys |

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ecdsaWithSHA512 = exports.ecdsaWithSHA384 = exports.ecdsaWithSHA256 = exports.ecdsaWithSHA224 = exports.ecdsaWithSHA1 = void 0;
const asn1_x509_1 = require("@peculiar/asn1-x509");
const oid = require("./object_identifiers");
function create(algorithm) {
return new asn1_x509_1.AlgorithmIdentifier({ algorithm });
}
exports.ecdsaWithSHA1 = create(oid.id_ecdsaWithSHA1);
exports.ecdsaWithSHA224 = create(oid.id_ecdsaWithSHA224);
exports.ecdsaWithSHA256 = create(oid.id_ecdsaWithSHA256);
exports.ecdsaWithSHA384 = create(oid.id_ecdsaWithSHA384);
exports.ecdsaWithSHA512 = create(oid.id_ecdsaWithSHA512);

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ECParameters = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const rfc3279_1 = require("./rfc3279");
let ECParameters = class ECParameters {
constructor(params = {}) {
Object.assign(this, params);
}
};
exports.ECParameters = ECParameters;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.ObjectIdentifier })
], ECParameters.prototype, "namedCurve", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Null })
], ECParameters.prototype, "implicitCurve", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: rfc3279_1.SpecifiedECDomain })
], ECParameters.prototype, "specifiedCurve", void 0);
exports.ECParameters = ECParameters = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Choice })
], ECParameters);

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ECPrivateKey = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const ec_parameters_1 = require("./ec_parameters");
class ECPrivateKey {
constructor(params = {}) {
this.version = 1;
this.privateKey = new asn1_schema_1.OctetString();
Object.assign(this, params);
}
}
exports.ECPrivateKey = ECPrivateKey;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], ECPrivateKey.prototype, "version", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], ECPrivateKey.prototype, "privateKey", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: ec_parameters_1.ECParameters, context: 0, optional: true })
], ECPrivateKey.prototype, "parameters", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.BitString, context: 1, optional: true })
], ECPrivateKey.prototype, "publicKey", void 0);

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ECDSASigValue = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
class ECDSASigValue {
constructor(params = {}) {
this.r = new ArrayBuffer(0);
this.s = new ArrayBuffer(0);
Object.assign(this, params);
}
}
exports.ECDSASigValue = ECDSASigValue;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], ECDSASigValue.prototype, "r", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], ECDSASigValue.prototype, "s", void 0);

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./algorithms"), exports);
tslib_1.__exportStar(require("./ec_parameters"), exports);
tslib_1.__exportStar(require("./ec_private_key"), exports);
tslib_1.__exportStar(require("./ec_signature_value"), exports);
tslib_1.__exportStar(require("./object_identifiers"), exports);
tslib_1.__exportStar(require("./rfc3279"), exports);

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.id_sect571r1 = exports.id_sect571k1 = exports.id_secp521r1 = exports.id_sect409r1 = exports.id_sect409k1 = exports.id_secp384r1 = exports.id_sect283r1 = exports.id_sect283k1 = exports.id_secp256r1 = exports.id_sect233r1 = exports.id_sect233k1 = exports.id_secp224r1 = exports.id_sect163r2 = exports.id_sect163k1 = exports.id_secp192r1 = exports.id_ecdsaWithSHA512 = exports.id_ecdsaWithSHA384 = exports.id_ecdsaWithSHA256 = exports.id_ecdsaWithSHA224 = exports.id_ecdsaWithSHA1 = exports.id_ecMQV = exports.id_ecDH = exports.id_ecPublicKey = void 0;
exports.id_ecPublicKey = "1.2.840.10045.2.1";
exports.id_ecDH = "1.3.132.1.12";
exports.id_ecMQV = "1.3.132.1.13";
exports.id_ecdsaWithSHA1 = "1.2.840.10045.4.1";
exports.id_ecdsaWithSHA224 = "1.2.840.10045.4.3.1";
exports.id_ecdsaWithSHA256 = "1.2.840.10045.4.3.2";
exports.id_ecdsaWithSHA384 = "1.2.840.10045.4.3.3";
exports.id_ecdsaWithSHA512 = "1.2.840.10045.4.3.4";
exports.id_secp192r1 = "1.2.840.10045.3.1.1";
exports.id_sect163k1 = "1.3.132.0.1";
exports.id_sect163r2 = "1.3.132.0.15";
exports.id_secp224r1 = "1.3.132.0.33";
exports.id_sect233k1 = "1.3.132.0.26";
exports.id_sect233r1 = "1.3.132.0.27";
exports.id_secp256r1 = "1.2.840.10045.3.1.7";
exports.id_sect283k1 = "1.3.132.0.16";
exports.id_sect283r1 = "1.3.132.0.17";
exports.id_secp384r1 = "1.3.132.0.34";
exports.id_sect409k1 = "1.3.132.0.36";
exports.id_sect409r1 = "1.3.132.0.37";
exports.id_secp521r1 = "1.3.132.0.35";
exports.id_sect571k1 = "1.3.132.0.38";
exports.id_sect571r1 = "1.3.132.0.39";

View File

@@ -0,0 +1,76 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpecifiedECDomain = exports.ECPVer = exports.Curve = exports.FieldElement = exports.ECPoint = exports.FieldID = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
let FieldID = class FieldID {
constructor(params = {}) {
Object.assign(this, params);
}
};
exports.FieldID = FieldID;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.ObjectIdentifier })
], FieldID.prototype, "fieldType", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Any })
], FieldID.prototype, "parameters", void 0);
exports.FieldID = FieldID = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Sequence })
], FieldID);
class ECPoint extends asn1_schema_1.OctetString {
}
exports.ECPoint = ECPoint;
class FieldElement extends asn1_schema_1.OctetString {
}
exports.FieldElement = FieldElement;
let Curve = class Curve {
constructor(params = {}) {
Object.assign(this, params);
}
};
exports.Curve = Curve;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.OctetString })
], Curve.prototype, "a", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.OctetString })
], Curve.prototype, "b", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.BitString, optional: true })
], Curve.prototype, "seed", void 0);
exports.Curve = Curve = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Sequence })
], Curve);
var ECPVer;
(function (ECPVer) {
ECPVer[ECPVer["ecpVer1"] = 1] = "ecpVer1";
})(ECPVer || (exports.ECPVer = ECPVer = {}));
let SpecifiedECDomain = class SpecifiedECDomain {
constructor(params = {}) {
this.version = ECPVer.ecpVer1;
Object.assign(this, params);
}
};
exports.SpecifiedECDomain = SpecifiedECDomain;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], SpecifiedECDomain.prototype, "version", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: FieldID })
], SpecifiedECDomain.prototype, "fieldID", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: Curve })
], SpecifiedECDomain.prototype, "curve", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: ECPoint })
], SpecifiedECDomain.prototype, "base", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], SpecifiedECDomain.prototype, "order", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, optional: true })
], SpecifiedECDomain.prototype, "cofactor", void 0);
exports.SpecifiedECDomain = SpecifiedECDomain = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Sequence })
], SpecifiedECDomain);

View File

@@ -0,0 +1,10 @@
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
import * as oid from "./object_identifiers";
function create(algorithm) {
return new AlgorithmIdentifier({ algorithm });
}
export const ecdsaWithSHA1 = create(oid.id_ecdsaWithSHA1);
export const ecdsaWithSHA224 = create(oid.id_ecdsaWithSHA224);
export const ecdsaWithSHA256 = create(oid.id_ecdsaWithSHA256);
export const ecdsaWithSHA384 = create(oid.id_ecdsaWithSHA384);
export const ecdsaWithSHA512 = create(oid.id_ecdsaWithSHA512);

View File

@@ -0,0 +1,21 @@
import { __decorate } from "tslib";
import { AsnType, AsnTypeTypes, AsnProp, AsnPropTypes } from "@peculiar/asn1-schema";
import { SpecifiedECDomain } from "./rfc3279";
let ECParameters = class ECParameters {
constructor(params = {}) {
Object.assign(this, params);
}
};
__decorate([
AsnProp({ type: AsnPropTypes.ObjectIdentifier })
], ECParameters.prototype, "namedCurve", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Null })
], ECParameters.prototype, "implicitCurve", void 0);
__decorate([
AsnProp({ type: SpecifiedECDomain })
], ECParameters.prototype, "specifiedCurve", void 0);
ECParameters = __decorate([
AsnType({ type: AsnTypeTypes.Choice })
], ECParameters);
export { ECParameters };

View File

@@ -0,0 +1,22 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, OctetString } from "@peculiar/asn1-schema";
import { ECParameters } from "./ec_parameters";
export class ECPrivateKey {
constructor(params = {}) {
this.version = 1;
this.privateKey = new OctetString();
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], ECPrivateKey.prototype, "version", void 0);
__decorate([
AsnProp({ type: OctetString })
], ECPrivateKey.prototype, "privateKey", void 0);
__decorate([
AsnProp({ type: ECParameters, context: 0, optional: true })
], ECPrivateKey.prototype, "parameters", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.BitString, context: 1, optional: true })
], ECPrivateKey.prototype, "publicKey", void 0);

View File

@@ -0,0 +1,15 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from "@peculiar/asn1-schema";
export class ECDSASigValue {
constructor(params = {}) {
this.r = new ArrayBuffer(0);
this.s = new ArrayBuffer(0);
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], ECDSASigValue.prototype, "r", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], ECDSASigValue.prototype, "s", void 0);

View File

@@ -0,0 +1,6 @@
export * from "./algorithms";
export * from "./ec_parameters";
export * from "./ec_private_key";
export * from "./ec_signature_value";
export * from "./object_identifiers";
export * from "./rfc3279";

View File

@@ -0,0 +1,23 @@
export const id_ecPublicKey = "1.2.840.10045.2.1";
export const id_ecDH = "1.3.132.1.12";
export const id_ecMQV = "1.3.132.1.13";
export const id_ecdsaWithSHA1 = "1.2.840.10045.4.1";
export const id_ecdsaWithSHA224 = "1.2.840.10045.4.3.1";
export const id_ecdsaWithSHA256 = "1.2.840.10045.4.3.2";
export const id_ecdsaWithSHA384 = "1.2.840.10045.4.3.3";
export const id_ecdsaWithSHA512 = "1.2.840.10045.4.3.4";
export const id_secp192r1 = "1.2.840.10045.3.1.1";
export const id_sect163k1 = "1.3.132.0.1";
export const id_sect163r2 = "1.3.132.0.15";
export const id_secp224r1 = "1.3.132.0.33";
export const id_sect233k1 = "1.3.132.0.26";
export const id_sect233r1 = "1.3.132.0.27";
export const id_secp256r1 = "1.2.840.10045.3.1.7";
export const id_sect283k1 = "1.3.132.0.16";
export const id_sect283r1 = "1.3.132.0.17";
export const id_secp384r1 = "1.3.132.0.34";
export const id_sect409k1 = "1.3.132.0.36";
export const id_sect409r1 = "1.3.132.0.37";
export const id_secp521r1 = "1.3.132.0.35";
export const id_sect571k1 = "1.3.132.0.38";
export const id_sect571r1 = "1.3.132.0.39";

View File

@@ -0,0 +1,71 @@
import { __decorate } from "tslib";
import { AsnType, AsnTypeTypes, AsnProp, AsnPropTypes, OctetString, AsnIntegerArrayBufferConverter, } from "@peculiar/asn1-schema";
let FieldID = class FieldID {
constructor(params = {}) {
Object.assign(this, params);
}
};
__decorate([
AsnProp({ type: AsnPropTypes.ObjectIdentifier })
], FieldID.prototype, "fieldType", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Any })
], FieldID.prototype, "parameters", void 0);
FieldID = __decorate([
AsnType({ type: AsnTypeTypes.Sequence })
], FieldID);
export { FieldID };
export class ECPoint extends OctetString {
}
export class FieldElement extends OctetString {
}
let Curve = class Curve {
constructor(params = {}) {
Object.assign(this, params);
}
};
__decorate([
AsnProp({ type: AsnPropTypes.OctetString })
], Curve.prototype, "a", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.OctetString })
], Curve.prototype, "b", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.BitString, optional: true })
], Curve.prototype, "seed", void 0);
Curve = __decorate([
AsnType({ type: AsnTypeTypes.Sequence })
], Curve);
export { Curve };
export var ECPVer;
(function (ECPVer) {
ECPVer[ECPVer["ecpVer1"] = 1] = "ecpVer1";
})(ECPVer || (ECPVer = {}));
let SpecifiedECDomain = class SpecifiedECDomain {
constructor(params = {}) {
this.version = ECPVer.ecpVer1;
Object.assign(this, params);
}
};
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], SpecifiedECDomain.prototype, "version", void 0);
__decorate([
AsnProp({ type: FieldID })
], SpecifiedECDomain.prototype, "fieldID", void 0);
__decorate([
AsnProp({ type: Curve })
], SpecifiedECDomain.prototype, "curve", void 0);
__decorate([
AsnProp({ type: ECPoint })
], SpecifiedECDomain.prototype, "base", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], SpecifiedECDomain.prototype, "order", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, optional: true })
], SpecifiedECDomain.prototype, "cofactor", void 0);
SpecifiedECDomain = __decorate([
AsnType({ type: AsnTypeTypes.Sequence })
], SpecifiedECDomain);
export { SpecifiedECDomain };

View File

@@ -0,0 +1,22 @@
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
/**
* ECDSA with SHA-1
* Parameters are ABSENT
*/
export declare const ecdsaWithSHA1: AlgorithmIdentifier;
/**
* ECDSA with SHA-224. Parameters are ABSENT
*/
export declare const ecdsaWithSHA224: AlgorithmIdentifier;
/**
* ECDSA with SHA-256. Parameters are ABSENT
*/
export declare const ecdsaWithSHA256: AlgorithmIdentifier;
/**
* ECDSA with SHA-384. Parameters are ABSENT
*/
export declare const ecdsaWithSHA384: AlgorithmIdentifier;
/**
* ECDSA with SHA-512. Parameters are ABSENT
*/
export declare const ecdsaWithSHA512: AlgorithmIdentifier;

View File

@@ -0,0 +1,20 @@
import { SpecifiedECDomain } from "./rfc3279";
/**
* ```asn1
* ECParameters ::= CHOICE {
* namedCurve OBJECT IDENTIFIER
* implicitCurve NULL
* specifiedCurve SpecifiedECDomain
* }
* -- implicitCurve and specifiedCurve MUST NOT be used in PKIX.
* -- Details for SpecifiedECDomain can be found in [X9.62].
* -- Any future additions to this CHOICE should be coordinated
* -- with ANSI X9.
* ```
*/
export declare class ECParameters {
namedCurve?: string;
implicitCurve?: null;
specifiedCurve?: SpecifiedECDomain;
constructor(params?: Partial<ECParameters>);
}

View File

@@ -0,0 +1,19 @@
import { OctetString } from "@peculiar/asn1-schema";
import { ECParameters } from "./ec_parameters";
/**
* ```asn1
* ECPrivateKey ::= SEQUENCE {
* version INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
* privateKey OCTET STRING,
* parameters [0] ECParameters {{ NamedCurve }} OPTIONAL,
* publicKey [1] BIT STRING OPTIONAL
* }
* ```
*/
export declare class ECPrivateKey {
version: number;
privateKey: OctetString;
parameters?: ECParameters;
publicKey?: ArrayBuffer;
constructor(params?: Partial<ECPrivateKey>);
}

View File

@@ -0,0 +1,13 @@
/**
* ```asn1
* ECDSA-Sig-Value ::= SEQUENCE {
* r INTEGER,
* s INTEGER
* }
* ```
*/
export declare class ECDSASigValue {
r: ArrayBuffer;
s: ArrayBuffer;
constructor(params?: Partial<ECDSASigValue>);
}

View File

@@ -0,0 +1,6 @@
export * from "./algorithms";
export * from "./ec_parameters";
export * from "./ec_private_key";
export * from "./ec_signature_value";
export * from "./object_identifiers";
export * from "./rfc3279";

View File

@@ -0,0 +1,169 @@
/**
* ```asn1
* id-ecPublicKey OBJECT IDENTIFIER ::= {
* iso(1) member-body(2) us(840) ansi-X9-62(10045) keyType(2) 1 }
* ```
*/
export declare const id_ecPublicKey = "1.2.840.10045.2.1";
/**
* ```asn1
* id-ecDH OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) schemes(1)
* ecdh(12) }
* ```
*/
export declare const id_ecDH = "1.3.132.1.12";
/**
* ```asn1
* id-ecMQV OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) schemes(1)
* ecmqv(13) }
* ```
*/
export declare const id_ecMQV = "1.3.132.1.13";
/**
* ```asn1
* ecdsa-with-SHA1 OBJECT IDENTIFIER ::= {
* iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4) 1 }
* ```
*/
export declare const id_ecdsaWithSHA1 = "1.2.840.10045.4.1";
/**
* ```asn1
* ecdsa-with-SHA224 OBJECT IDENTIFIER ::= {
* iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
* ecdsa-with-SHA2(3) 1 }
* ```
*/
export declare const id_ecdsaWithSHA224 = "1.2.840.10045.4.3.1";
/**
* ```asn1
* ecdsa-with-SHA256 OBJECT IDENTIFIER ::= {
* iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
* ecdsa-with-SHA2(3) 2 }
* ```
*/
export declare const id_ecdsaWithSHA256 = "1.2.840.10045.4.3.2";
/**
* ```asn1
* ecdsa-with-SHA384 OBJECT IDENTIFIER ::= {
* iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
* ecdsa-with-SHA2(3) 3 }
* ```
*/
export declare const id_ecdsaWithSHA384 = "1.2.840.10045.4.3.3";
/**
* ```asn1
* ecdsa-with-SHA512 OBJECT IDENTIFIER ::= {
* iso(1) member-body(2) us(840) ansi-X9-62(10045) signatures(4)
* ecdsa-with-SHA2(3) 4 }
* ```
*/
export declare const id_ecdsaWithSHA512 = "1.2.840.10045.4.3.4";
/**
* ```asn1
* secp192r1 OBJECT IDENTIFIER ::= {
* iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3)
* prime(1) 1 }
* ```
*/
export declare const id_secp192r1 = "1.2.840.10045.3.1.1";
/**
* ```asn1
* sect163k1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 1 }
* ```
*/
export declare const id_sect163k1 = "1.3.132.0.1";
/**
* ```asn1
* sect163r2 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 15 }
* ```
*/
export declare const id_sect163r2 = "1.3.132.0.15";
/**
* ```asn1
* secp224r1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 33 }
* ```
*/
export declare const id_secp224r1 = "1.3.132.0.33";
/**
* ```asn1
* sect233k1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 26 }
* ```
*/
export declare const id_sect233k1 = "1.3.132.0.26";
/**
* ```asn1
* sect233r1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 27 }
* ```
*/
export declare const id_sect233r1 = "1.3.132.0.27";
/**
* ```asn1
* secp256r1 OBJECT IDENTIFIER ::= {
* iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3)
* prime(1) 7 }
* ```
*/
export declare const id_secp256r1 = "1.2.840.10045.3.1.7";
/**
* ```asn1
* sect283k1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 16 }
* ```
*/
export declare const id_sect283k1 = "1.3.132.0.16";
/**
* ```asn1
* sect283r1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 17 }
* ```
*/
export declare const id_sect283r1 = "1.3.132.0.17";
/**
* ```asn1
* secp384r1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 34 }
* ```
*/
export declare const id_secp384r1 = "1.3.132.0.34";
/**
* ```asn1
* sect409k1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 36 }
* ```
*/
export declare const id_sect409k1 = "1.3.132.0.36";
/**
* ```asn1
* sect409r1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 37 }
* ```
*/
export declare const id_sect409r1 = "1.3.132.0.37";
/**
* ```asn1
* secp521r1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 35 }
* ```
*/
export declare const id_secp521r1 = "1.3.132.0.35";
/**
* ```asn1
* sect571k1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 38 }
* ```
*/
export declare const id_sect571k1 = "1.3.132.0.38";
/**
* ```asn1
* sect571r1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) certicom(132) curve(0) 39 }
* ```
*/
export declare const id_sect571r1 = "1.3.132.0.39";

View File

@@ -0,0 +1,73 @@
import { OctetString } from "@peculiar/asn1-schema";
/**
* ```asn1
* FieldID ::= SEQUENCE {
* fieldType OBJECT IDENTIFIER,
* parameters ANY DEFINED BY fieldType }
* ```
*/
export declare class FieldID {
fieldType: string;
parameters: ArrayBuffer;
constructor(params?: Partial<FieldID>);
}
/**
* ```asn1
* ECPoint ::= OCTET STRING
* ```
*/
export declare class ECPoint extends OctetString {
}
/**
* ```asn1
* FieldElement ::= OCTET STRING
* ```
*/
export declare class FieldElement extends OctetString {
}
/**
* ```asn1
* Curve ::= SEQUENCE {
* a FieldElement,
* b FieldElement,
* seed BIT STRING OPTIONAL }
* ```
*/
export declare class Curve {
a: ArrayBuffer;
b: ArrayBuffer;
seed?: ArrayBuffer;
constructor(params?: Partial<Curve>);
}
/**
* ```asn1
* ECPVer ::= INTEGER {ecpVer1(1)}
* ```
*/
export declare enum ECPVer {
ecpVer1 = 1
}
/**
* ```asn1
* SpecifiedECDomain ::= SEQUENCE {
* version ECPVer, -- version is always 1
* fieldID FieldID, -- identifies the finite field over
* -- which the curve is defined
* curve Curve, -- coefficients a and b of the
* -- elliptic curve
* base ECPoint, -- specifies the base point P
* -- on the elliptic curve
* order INTEGER, -- the order n of the base point
* cofactor INTEGER OPTIONAL -- The integer h = #E(Fq)/n
* }
* ```
*/
export declare class SpecifiedECDomain {
version: ECPVer;
fieldID: FieldID;
curve: Curve;
base: ECPoint;
order: ArrayBuffer;
cofactor?: ArrayBuffer;
constructor(params?: Partial<SpecifiedECDomain>);
}

View File

@@ -0,0 +1,15 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

View File

@@ -0,0 +1,12 @@
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,164 @@
# tslib
This is a runtime library for [TypeScript](https://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
This library is primarily used by the `--importHelpers` flag in TypeScript.
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
```ts
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
exports.x = {};
exports.y = __assign({}, exports.x);
```
will instead be emitted as something like the following:
```ts
var tslib_1 = require("tslib");
exports.x = {};
exports.y = tslib_1.__assign({}, exports.x);
```
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead.
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
# Installing
For the latest stable version, run:
## npm
```sh
# TypeScript 3.9.2 or later
npm install tslib
# TypeScript 3.8.4 or earlier
npm install tslib@^1
# TypeScript 2.3.2 or earlier
npm install tslib@1.6.1
```
## yarn
```sh
# TypeScript 3.9.2 or later
yarn add tslib
# TypeScript 3.8.4 or earlier
yarn add tslib@^1
# TypeScript 2.3.2 or earlier
yarn add tslib@1.6.1
```
## bower
```sh
# TypeScript 3.9.2 or later
bower install tslib
# TypeScript 3.8.4 or earlier
bower install tslib@^1
# TypeScript 2.3.2 or earlier
bower install tslib@1.6.1
```
## JSPM
```sh
# TypeScript 3.9.2 or later
jspm install tslib
# TypeScript 3.8.4 or earlier
jspm install tslib@^1
# TypeScript 2.3.2 or earlier
jspm install tslib@1.6.1
```
# Usage
Set the `importHelpers` compiler option on the command line:
```
tsc --importHelpers file.ts
```
or in your tsconfig.json:
```json
{
"compilerOptions": {
"importHelpers": true
}
}
```
#### For bower and JSPM users
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:
```json
{
"compilerOptions": {
"module": "amd",
"importHelpers": true,
"baseUrl": "./",
"paths": {
"tslib" : ["bower_components/tslib/tslib.d.ts"]
}
}
}
```
For JSPM users:
```json
{
"compilerOptions": {
"module": "system",
"importHelpers": true,
"baseUrl": "./",
"paths": {
"tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"]
}
}
}
```
## Deployment
- Choose your new version number
- Set it in `package.json` and `bower.json`
- Create a tag: `git tag [version]`
- Push the tag: `git push --tags`
- Create a [release in GitHub](https://github.com/microsoft/tslib/releases)
- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow
Done.
# Contribute
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
# Documentation
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
* [Programming handbook](http://www.typescriptlang.org/Handbook)
* [Homepage](http://www.typescriptlang.org/)

View File

@@ -0,0 +1,41 @@
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
## Security
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
## Reporting Security Issues
**Please do not report security vulnerabilities through public GitHub issues.**
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
* Full paths of source file(s) related to the manifestation of the issue
* The location of the affected source code (tag/branch/commit or direct URL)
* Any special configuration required to reproduce the issue
* Step-by-step instructions to reproduce the issue
* Proof-of-concept or exploit code (if possible)
* Impact of the issue, including how an attacker might exploit the issue
This information will help us triage your report more quickly.
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
## Preferred Languages
We prefer all communications to be in English.
## Policy
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
<!-- END MICROSOFT SECURITY.MD BLOCK -->

View File

@@ -0,0 +1,38 @@
// Note: named reexports are used instead of `export *` because
// TypeScript itself doesn't resolve the `export *` when checking
// if a particular helper exists.
export {
__extends,
__assign,
__rest,
__decorate,
__param,
__esDecorate,
__runInitializers,
__propKey,
__setFunctionName,
__metadata,
__awaiter,
__generator,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__createBinding,
__addDisposableResource,
__disposeResources,
__rewriteRelativeImportExtension,
} from '../tslib.js';
export * as default from '../tslib.js';

View File

@@ -0,0 +1,70 @@
import tslib from '../tslib.js';
const {
__extends,
__assign,
__rest,
__decorate,
__param,
__esDecorate,
__runInitializers,
__propKey,
__setFunctionName,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
__rewriteRelativeImportExtension,
} = tslib;
export {
__extends,
__assign,
__rest,
__decorate,
__param,
__esDecorate,
__runInitializers,
__propKey,
__setFunctionName,
__metadata,
__awaiter,
__generator,
__exportStar,
__createBinding,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
__rewriteRelativeImportExtension,
};
export default tslib;

View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

View File

@@ -0,0 +1,47 @@
{
"name": "tslib",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "2.8.1",
"license": "0BSD",
"description": "Runtime library for TypeScript helper functions",
"keywords": [
"TypeScript",
"Microsoft",
"compiler",
"language",
"javascript",
"tslib",
"runtime"
],
"bugs": {
"url": "https://github.com/Microsoft/TypeScript/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/tslib.git"
},
"main": "tslib.js",
"module": "tslib.es6.js",
"jsnext:main": "tslib.es6.js",
"typings": "tslib.d.ts",
"sideEffects": false,
"exports": {
".": {
"module": {
"types": "./modules/index.d.ts",
"default": "./tslib.es6.mjs"
},
"import": {
"node": "./modules/index.js",
"default": {
"types": "./modules/index.d.ts",
"default": "./tslib.es6.mjs"
}
},
"default": "./tslib.js"
},
"./*": "./*",
"./": "./"
}
}

View File

@@ -0,0 +1,460 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/**
* Used to shim class extends.
*
* @param d The derived class.
* @param b The base class.
*/
export declare function __extends(d: Function, b: Function): void;
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
*
* @param t The target object to copy to.
* @param sources One or more source objects from which to copy properties
*/
export declare function __assign(t: any, ...sources: any[]): any;
/**
* Performs a rest spread on an object.
*
* @param t The source value.
* @param propertyNames The property names excluded from the rest spread.
*/
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
/**
* Applies decorators to a target object
*
* @param decorators The set of decorators to apply.
* @param target The target object.
* @param key If specified, the own property to apply the decorators to.
* @param desc The property descriptor, defaults to fetching the descriptor from the target object.
* @experimental
*/
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
/**
* Creates an observing function decorator from a parameter decorator.
*
* @param paramIndex The parameter index to apply the decorator to.
* @param decorator The parameter decorator to apply. Note that the return value is ignored.
* @experimental
*/
export declare function __param(paramIndex: number, decorator: Function): Function;
/**
* Applies decorators to a class or class member, following the native ECMAScript decorator specification.
* @param ctor For non-field class members, the class constructor. Otherwise, `null`.
* @param descriptorIn The `PropertyDescriptor` to use when unable to look up the property from `ctor`.
* @param decorators The decorators to apply
* @param contextIn The `DecoratorContext` to clone for each decorator application.
* @param initializers An array of field initializer mutation functions into which new initializers are written.
* @param extraInitializers An array of extra initializer functions into which new initializers are written.
*/
export declare function __esDecorate(ctor: Function | null, descriptorIn: object | null, decorators: Function[], contextIn: object, initializers: Function[] | null, extraInitializers: Function[]): void;
/**
* Runs field initializers or extra initializers generated by `__esDecorate`.
* @param thisArg The `this` argument to use.
* @param initializers The array of initializers to evaluate.
* @param value The initial value to pass to the initializers.
*/
export declare function __runInitializers(thisArg: unknown, initializers: Function[], value?: any): any;
/**
* Converts a computed property name into a `string` or `symbol` value.
*/
export declare function __propKey(x: any): string | symbol;
/**
* Assigns the name of a function derived from the left-hand side of an assignment.
* @param f The function to rename.
* @param name The new name for the function.
* @param prefix A prefix (such as `"get"` or `"set"`) to insert before the name.
*/
export declare function __setFunctionName(f: Function, name: string | symbol, prefix?: string): Function;
/**
* Creates a decorator that sets metadata.
*
* @param metadataKey The metadata key
* @param metadataValue The metadata value
* @experimental
*/
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
/**
* Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`.
*
* @param thisArg The reference to use as the `this` value in the generator function
* @param _arguments The optional arguments array
* @param P The optional promise constructor argument, defaults to the `Promise` property of the global object.
* @param generator The generator function
*/
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
/**
* Creates an Iterator object using the body as the implementation.
*
* @param thisArg The reference to use as the `this` value in the function
* @param body The generator state-machine based implementation.
*
* @see [./docs/generator.md]
*/
export declare function __generator(thisArg: any, body: Function): any;
/**
* Creates bindings for all enumerable properties of `m` on `exports`
*
* @param m The source object
* @param o The `exports` object.
*/
export declare function __exportStar(m: any, o: any): void;
/**
* Creates a value iterator from an `Iterable` or `ArrayLike` object.
*
* @param o The object.
* @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`.
*/
export declare function __values(o: any): any;
/**
* Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array.
*
* @param o The object to read from.
* @param n The maximum number of arguments to read, defaults to `Infinity`.
*/
export declare function __read(o: any, n?: number): any[];
/**
* Creates an array from iterable spread.
*
* @param args The Iterable objects to spread.
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
*/
export declare function __spread(...args: any[][]): any[];
/**
* Creates an array from array spread.
*
* @param args The ArrayLikes to spread into the resulting array.
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
*/
export declare function __spreadArrays(...args: any[][]): any[];
/**
* Spreads the `from` array into the `to` array.
*
* @param pack Replace empty elements with `undefined`.
*/
export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[];
/**
* Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded,
* and instead should be awaited and the resulting value passed back to the generator.
*
* @param v The value to await.
*/
export declare function __await(v: any): any;
/**
* Converts a generator function into an async generator function, by using `yield __await`
* in place of normal `await`.
*
* @param thisArg The reference to use as the `this` value in the generator function
* @param _arguments The optional arguments array
* @param generator The generator function
*/
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
/**
* Used to wrap a potentially async iterator in such a way so that it wraps the result
* of calling iterator methods of `o` in `__await` instances, and then yields the awaited values.
*
* @param o The potentially async iterator.
* @returns A synchronous iterator yielding `__await` instances on every odd invocation
* and returning the awaited `IteratorResult` passed to `next` every even invocation.
*/
export declare function __asyncDelegator(o: any): any;
/**
* Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object.
*
* @param o The object.
* @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`.
*/
export declare function __asyncValues(o: any): any;
/**
* Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays.
*
* @param cooked The cooked possibly-sparse array.
* @param raw The raw string content.
*/
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
/**
* Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS.
*
* ```js
* import Default, { Named, Other } from "mod";
* // or
* import { default as Default, Named, Other } from "mod";
* ```
*
* @param mod The CommonJS module exports object.
*/
export declare function __importStar<T>(mod: T): T;
/**
* Used to shim default imports in ECMAScript Modules transpiled to CommonJS.
*
* ```js
* import Default from "mod";
* ```
*
* @param mod The CommonJS module exports object.
*/
export declare function __importDefault<T>(mod: T): T | { default: T };
/**
* Emulates reading a private instance field.
*
* @param receiver The instance from which to read the private field.
* @param state A WeakMap containing the private field value for an instance.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldGet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean, get(o: T): V | undefined },
kind?: "f"
): V;
/**
* Emulates reading a private static field.
*
* @param receiver The object from which to read the private static field.
* @param state The class constructor containing the definition of the static field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The descriptor that holds the static field value.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
kind: "f",
f: { value: V }
): V;
/**
* Emulates evaluating a private instance "get" accessor.
*
* @param receiver The instance on which to evaluate the private "get" accessor.
* @param state A WeakSet used to verify an instance supports the private "get" accessor.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "get" accessor function to evaluate.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldGet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean },
kind: "a",
f: () => V
): V;
/**
* Emulates evaluating a private static "get" accessor.
*
* @param receiver The object on which to evaluate the private static "get" accessor.
* @param state The class constructor containing the definition of the static "get" accessor.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "get" accessor function to evaluate.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
kind: "a",
f: () => V
): V;
/**
* Emulates reading a private instance method.
*
* @param receiver The instance from which to read a private method.
* @param state A WeakSet used to verify an instance supports the private method.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The function to return as the private instance method.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldGet<T extends object, V extends (...args: any[]) => unknown>(
receiver: T,
state: { has(o: T): boolean },
kind: "m",
f: V
): V;
/**
* Emulates reading a private static method.
*
* @param receiver The object from which to read the private static method.
* @param state The class constructor containing the definition of the static method.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The function to return as the private static method.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V extends (...args: any[]) => unknown>(
receiver: T,
state: T,
kind: "m",
f: V
): V;
/**
* Emulates writing to a private instance field.
*
* @param receiver The instance on which to set a private field value.
* @param state A WeakMap used to store the private field value for an instance.
* @param value The value to store in the private field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldSet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean, set(o: T, value: V): unknown },
value: V,
kind?: "f"
): V;
/**
* Emulates writing to a private static field.
*
* @param receiver The object on which to set the private static field.
* @param state The class constructor containing the definition of the private static field.
* @param value The value to store in the private field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The descriptor that holds the static field value.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
value: V,
kind: "f",
f: { value: V }
): V;
/**
* Emulates writing to a private instance "set" accessor.
*
* @param receiver The instance on which to evaluate the private instance "set" accessor.
* @param state A WeakSet used to verify an instance supports the private "set" accessor.
* @param value The value to store in the private accessor.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "set" accessor function to evaluate.
*
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
*/
export declare function __classPrivateFieldSet<T extends object, V>(
receiver: T,
state: { has(o: T): boolean },
value: V,
kind: "a",
f: (v: V) => void
): V;
/**
* Emulates writing to a private static "set" accessor.
*
* @param receiver The object on which to evaluate the private static "set" accessor.
* @param state The class constructor containing the definition of the static "set" accessor.
* @param value The value to store in the private field.
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
* @param f The "set" accessor function to evaluate.
*
* @throws {TypeError} If `receiver` is not `state`.
*/
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
receiver: T,
state: T,
value: V,
kind: "a",
f: (v: V) => void
): V;
/**
* Checks for the existence of a private field/method/accessor.
*
* @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member.
* @param receiver The object for which to test the presence of the private member.
*/
export declare function __classPrivateFieldIn(
state: (new (...args: any[]) => unknown) | { has(o: any): boolean },
receiver: unknown,
): boolean;
/**
* Creates a re-export binding on `object` with key `objectKey` that references `target[key]`.
*
* @param object The local `exports` object.
* @param target The object to re-export from.
* @param key The property key of `target` to re-export.
* @param objectKey The property key to re-export as. Defaults to `key`.
*/
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;
/**
* Adds a disposable resource to a resource-tracking environment object.
* @param env A resource-tracking environment object.
* @param value Either a Disposable or AsyncDisposable object, `null`, or `undefined`.
* @param async When `true`, `AsyncDisposable` resources can be added. When `false`, `AsyncDisposable` resources cannot be added.
* @returns The {@link value} argument.
*
* @throws {TypeError} If {@link value} is not an object, or if either `Symbol.dispose` or `Symbol.asyncDispose` are not
* defined, or if {@link value} does not have an appropriate `Symbol.dispose` or `Symbol.asyncDispose` method.
*/
export declare function __addDisposableResource<T>(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }, value: T, async: boolean): T;
/**
* Disposes all resources in a resource-tracking environment object.
* @param env A resource-tracking environment object.
* @returns A {@link Promise} if any resources in the environment were marked as `async` when added; otherwise, `void`.
*
* @throws {SuppressedError} if an error thrown during disposal would have suppressed a prior error from disposal or the
* error recorded in the resource-tracking environment object.
* @seealso {@link __addDisposableResource}
*/
export declare function __disposeResources(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }): any;
/**
* Transforms a relative import specifier ending in a non-declaration TypeScript file extension to its JavaScript file extension counterpart.
* @param path The import specifier.
* @param preserveJsx Causes '*.tsx' to transform to '*.jsx' instead of '*.js'. Should be true when `--jsx` is set to `preserve`.
*/
export declare function __rewriteRelativeImportExtension(path: string, preserveJsx?: boolean): string;

View File

@@ -0,0 +1 @@
<script src="tslib.es6.js"></script>

View File

@@ -0,0 +1,402 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
export function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
export var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
export function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
export function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
export function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
export function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
export function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
export function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
export function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
export function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
export function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
export var __createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
export function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
export function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
export function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
/** @deprecated */
export function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
export function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
export function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
export function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
export function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
export function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
}
export function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
export function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
export function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
}
export function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
export function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
export function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
export function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
export function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
}
export function __rewriteRelativeImportExtension(path, preserveJsx) {
if (typeof path === "string" && /^\.\.?\//.test(path)) {
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
});
}
return path;
}
export default {
__extends: __extends,
__assign: __assign,
__rest: __rest,
__decorate: __decorate,
__param: __param,
__esDecorate: __esDecorate,
__runInitializers: __runInitializers,
__propKey: __propKey,
__setFunctionName: __setFunctionName,
__metadata: __metadata,
__awaiter: __awaiter,
__generator: __generator,
__createBinding: __createBinding,
__exportStar: __exportStar,
__values: __values,
__read: __read,
__spread: __spread,
__spreadArrays: __spreadArrays,
__spreadArray: __spreadArray,
__await: __await,
__asyncGenerator: __asyncGenerator,
__asyncDelegator: __asyncDelegator,
__asyncValues: __asyncValues,
__makeTemplateObject: __makeTemplateObject,
__importStar: __importStar,
__importDefault: __importDefault,
__classPrivateFieldGet: __classPrivateFieldGet,
__classPrivateFieldSet: __classPrivateFieldSet,
__classPrivateFieldIn: __classPrivateFieldIn,
__addDisposableResource: __addDisposableResource,
__disposeResources: __disposeResources,
__rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
};

View File

@@ -0,0 +1,401 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
export function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
export var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
export function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
export function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
export function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
export function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
export function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
export function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
export function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
export function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
export function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
export var __createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
export function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
export function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
export function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
/** @deprecated */
export function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
export function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
export function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
export function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
export function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
export function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
}
export function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
export function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
export function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
}
export function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
export function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
export function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
export function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
export function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
}
export function __rewriteRelativeImportExtension(path, preserveJsx) {
if (typeof path === "string" && /^\.\.?\//.test(path)) {
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
});
}
return path;
}
export default {
__extends,
__assign,
__rest,
__decorate,
__param,
__esDecorate,
__runInitializers,
__propKey,
__setFunctionName,
__metadata,
__awaiter,
__generator,
__createBinding,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
__rewriteRelativeImportExtension,
};

View File

@@ -0,0 +1 @@
<script src="tslib.js"></script>

View File

@@ -0,0 +1,484 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global global, define, Symbol, Reflect, Promise, SuppressedError, Iterator */
var __extends;
var __assign;
var __rest;
var __decorate;
var __param;
var __esDecorate;
var __runInitializers;
var __propKey;
var __setFunctionName;
var __metadata;
var __awaiter;
var __generator;
var __exportStar;
var __values;
var __read;
var __spread;
var __spreadArrays;
var __spreadArray;
var __await;
var __asyncGenerator;
var __asyncDelegator;
var __asyncValues;
var __makeTemplateObject;
var __importStar;
var __importDefault;
var __classPrivateFieldGet;
var __classPrivateFieldSet;
var __classPrivateFieldIn;
var __createBinding;
var __addDisposableResource;
var __disposeResources;
var __rewriteRelativeImportExtension;
(function (factory) {
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
if (typeof define === "function" && define.amd) {
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
}
else if (typeof module === "object" && typeof module.exports === "object") {
factory(createExporter(root, createExporter(module.exports)));
}
else {
factory(createExporter(root));
}
function createExporter(exports, previous) {
if (exports !== root) {
if (typeof Object.create === "function") {
Object.defineProperty(exports, "__esModule", { value: true });
}
else {
exports.__esModule = true;
}
}
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
}
})
(function (exporter) {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
__extends = function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
__assign = Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
__rest = function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
__decorate = function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
__param = function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
__esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
__runInitializers = function (thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
__propKey = function (x) {
return typeof x === "symbol" ? x : "".concat(x);
};
__setFunctionName = function (f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
__metadata = function (metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
};
__awaiter = function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
__generator = function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
__exportStar = function(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
};
__createBinding = Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
__values = function (o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
__read = function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
/** @deprecated */
__spread = function () {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
};
/** @deprecated */
__spreadArrays = function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
__spreadArray = function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
__await = function (v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
};
__asyncGenerator = function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
__asyncDelegator = function (o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
};
__asyncValues = function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
__makeTemplateObject = function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
__importStar = function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
__importDefault = function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
__classPrivateFieldGet = function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
__classPrivateFieldSet = function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
__classPrivateFieldIn = function (state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
};
__addDisposableResource = function (env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
};
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
__disposeResources = function (env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
};
__rewriteRelativeImportExtension = function (path, preserveJsx) {
if (typeof path === "string" && /^\.\.?\//.test(path)) {
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
});
}
return path;
};
exporter("__extends", __extends);
exporter("__assign", __assign);
exporter("__rest", __rest);
exporter("__decorate", __decorate);
exporter("__param", __param);
exporter("__esDecorate", __esDecorate);
exporter("__runInitializers", __runInitializers);
exporter("__propKey", __propKey);
exporter("__setFunctionName", __setFunctionName);
exporter("__metadata", __metadata);
exporter("__awaiter", __awaiter);
exporter("__generator", __generator);
exporter("__exportStar", __exportStar);
exporter("__createBinding", __createBinding);
exporter("__values", __values);
exporter("__read", __read);
exporter("__spread", __spread);
exporter("__spreadArrays", __spreadArrays);
exporter("__spreadArray", __spreadArray);
exporter("__await", __await);
exporter("__asyncGenerator", __asyncGenerator);
exporter("__asyncDelegator", __asyncDelegator);
exporter("__asyncValues", __asyncValues);
exporter("__makeTemplateObject", __makeTemplateObject);
exporter("__importStar", __importStar);
exporter("__importDefault", __importDefault);
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
exporter("__classPrivateFieldIn", __classPrivateFieldIn);
exporter("__addDisposableResource", __addDisposableResource);
exporter("__disposeResources", __disposeResources);
exporter("__rewriteRelativeImportExtension", __rewriteRelativeImportExtension);
});
0 && (module.exports = {
__extends: __extends,
__assign: __assign,
__rest: __rest,
__decorate: __decorate,
__param: __param,
__esDecorate: __esDecorate,
__runInitializers: __runInitializers,
__propKey: __propKey,
__setFunctionName: __setFunctionName,
__metadata: __metadata,
__awaiter: __awaiter,
__generator: __generator,
__exportStar: __exportStar,
__createBinding: __createBinding,
__values: __values,
__read: __read,
__spread: __spread,
__spreadArrays: __spreadArrays,
__spreadArray: __spreadArray,
__await: __await,
__asyncGenerator: __asyncGenerator,
__asyncDelegator: __asyncDelegator,
__asyncValues: __asyncValues,
__makeTemplateObject: __makeTemplateObject,
__importStar: __importStar,
__importDefault: __importDefault,
__classPrivateFieldGet: __classPrivateFieldGet,
__classPrivateFieldSet: __classPrivateFieldSet,
__classPrivateFieldIn: __classPrivateFieldIn,
__addDisposableResource: __addDisposableResource,
__disposeResources: __disposeResources,
__rewriteRelativeImportExtension: __rewriteRelativeImportExtension,
});

View File

@@ -0,0 +1,47 @@
{
"name": "@peculiar/asn1-ecc",
"version": "2.3.15",
"description": "ASN.1 schema of `Elliptic Curve Private Key Structure` (RFC5915)",
"files": [
"build/**/*.{js,d.ts}",
"LICENSE",
"README.md"
],
"bugs": {
"url": "https://github.com/PeculiarVentures/asn1-schema/issues"
},
"homepage": "https://github.com/PeculiarVentures/asn1-schema/tree/master/packages/ecc#readme",
"keywords": [
"asn",
"ecc",
"rfc5915",
"rfc5480",
"rfc3279"
],
"author": "PeculiarVentures, LLC",
"license": "MIT",
"main": "build/cjs/index.js",
"module": "build/es2015/index.js",
"types": "build/types/index.d.ts",
"publishConfig": {
"access": "public"
},
"scripts": {
"test": "mocha",
"clear": "rimraf build",
"build": "npm run build:module && npm run build:types",
"build:module": "npm run build:cjs && npm run build:es2015",
"build:cjs": "tsc -p tsconfig.compile.json --removeComments --module commonjs --outDir build/cjs",
"build:es2015": "tsc -p tsconfig.compile.json --removeComments --module ES2015 --outDir build/es2015",
"prebuild:types": "rimraf build/types",
"build:types": "tsc -p tsconfig.compile.json --outDir build/types --declaration --emitDeclarationOnly",
"rebuild": "npm run clear && npm run build"
},
"dependencies": {
"@peculiar/asn1-schema": "^2.3.15",
"@peculiar/asn1-x509": "^2.3.15",
"asn1js": "^3.0.5",
"tslib": "^2.8.1"
},
"gitHead": "b6c7130efa9bc3ee5e2ea1da5d01aede5182921f"
}

21
api.hyungi.net/node_modules/@peculiar/asn1-rsa/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,8 @@
# `@peculiar/asn1-rsa`
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/PeculiarVentures/asn1-schema/master/packages/rsa/LICENSE.md)
[![npm version](https://badge.fury.io/js/%40peculiar%2Fasn1-rsa.svg)](https://badge.fury.io/js/%40peculiar%2Fasn1-rsa)
[![NPM](https://nodei.co/npm/@peculiar/asn1-rsa.png)](https://nodei.co/npm/@peculiar/asn1-rsa/)
[RFC 8017](https://tools.ietf.org/html/rfc8017) RSA Cryptography Specifications Version 2.2

View File

@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sha512_256WithRSAEncryption = exports.sha512_224WithRSAEncryption = exports.sha512WithRSAEncryption = exports.sha384WithRSAEncryption = exports.sha256WithRSAEncryption = exports.sha224WithRSAEncryption = exports.sha1WithRSAEncryption = exports.md5WithRSAEncryption = exports.md2WithRSAEncryption = exports.rsaEncryption = exports.pSpecifiedEmpty = exports.mgf1SHA1 = exports.sha512_256 = exports.sha512_224 = exports.sha512 = exports.sha384 = exports.sha256 = exports.sha224 = exports.sha1 = exports.md4 = exports.md2 = void 0;
const asn1_schema_1 = require("@peculiar/asn1-schema");
const asn1_x509_1 = require("@peculiar/asn1-x509");
const oid = require("./object_identifiers");
function create(algorithm) {
return new asn1_x509_1.AlgorithmIdentifier({ algorithm, parameters: null });
}
exports.md2 = create(oid.id_md2);
exports.md4 = create(oid.id_md5);
exports.sha1 = create(oid.id_sha1);
exports.sha224 = create(oid.id_sha224);
exports.sha256 = create(oid.id_sha256);
exports.sha384 = create(oid.id_sha384);
exports.sha512 = create(oid.id_sha512);
exports.sha512_224 = create(oid.id_sha512_224);
exports.sha512_256 = create(oid.id_sha512_256);
exports.mgf1SHA1 = new asn1_x509_1.AlgorithmIdentifier({
algorithm: oid.id_mgf1,
parameters: asn1_schema_1.AsnConvert.serialize(exports.sha1),
});
exports.pSpecifiedEmpty = new asn1_x509_1.AlgorithmIdentifier({
algorithm: oid.id_pSpecified,
parameters: asn1_schema_1.AsnConvert.serialize(asn1_schema_1.AsnOctetStringConverter.toASN(new Uint8Array([
0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18,
0x90, 0xaf, 0xd8, 0x07, 0x09,
]).buffer)),
});
exports.rsaEncryption = create(oid.id_rsaEncryption);
exports.md2WithRSAEncryption = create(oid.id_md2WithRSAEncryption);
exports.md5WithRSAEncryption = create(oid.id_md5WithRSAEncryption);
exports.sha1WithRSAEncryption = create(oid.id_sha1WithRSAEncryption);
exports.sha224WithRSAEncryption = create(oid.id_sha512_224WithRSAEncryption);
exports.sha256WithRSAEncryption = create(oid.id_sha512_256WithRSAEncryption);
exports.sha384WithRSAEncryption = create(oid.id_sha384WithRSAEncryption);
exports.sha512WithRSAEncryption = create(oid.id_sha512WithRSAEncryption);
exports.sha512_224WithRSAEncryption = create(oid.id_sha512_224WithRSAEncryption);
exports.sha512_256WithRSAEncryption = create(oid.id_sha512_256WithRSAEncryption);

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./parameters"), exports);
tslib_1.__exportStar(require("./algorithms"), exports);
tslib_1.__exportStar(require("./object_identifiers"), exports);
tslib_1.__exportStar(require("./other_prime_info"), exports);
tslib_1.__exportStar(require("./rsa_private_key"), exports);
tslib_1.__exportStar(require("./rsa_public_key"), exports);

View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.id_mgf1 = exports.id_md5 = exports.id_md2 = exports.id_sha512_256 = exports.id_sha512_224 = exports.id_sha512 = exports.id_sha384 = exports.id_sha256 = exports.id_sha224 = exports.id_sha1 = exports.id_sha512_256WithRSAEncryption = exports.id_sha512_224WithRSAEncryption = exports.id_sha512WithRSAEncryption = exports.id_sha384WithRSAEncryption = exports.id_sha256WithRSAEncryption = exports.id_ssha224WithRSAEncryption = exports.id_sha224WithRSAEncryption = exports.id_sha1WithRSAEncryption = exports.id_md5WithRSAEncryption = exports.id_md2WithRSAEncryption = exports.id_RSASSA_PSS = exports.id_pSpecified = exports.id_RSAES_OAEP = exports.id_rsaEncryption = exports.id_pkcs_1 = void 0;
exports.id_pkcs_1 = "1.2.840.113549.1.1";
exports.id_rsaEncryption = `${exports.id_pkcs_1}.1`;
exports.id_RSAES_OAEP = `${exports.id_pkcs_1}.7`;
exports.id_pSpecified = `${exports.id_pkcs_1}.9`;
exports.id_RSASSA_PSS = `${exports.id_pkcs_1}.10`;
exports.id_md2WithRSAEncryption = `${exports.id_pkcs_1}.2`;
exports.id_md5WithRSAEncryption = `${exports.id_pkcs_1}.4`;
exports.id_sha1WithRSAEncryption = `${exports.id_pkcs_1}.5`;
exports.id_sha224WithRSAEncryption = `${exports.id_pkcs_1}.14`;
exports.id_ssha224WithRSAEncryption = exports.id_sha224WithRSAEncryption;
exports.id_sha256WithRSAEncryption = `${exports.id_pkcs_1}.11`;
exports.id_sha384WithRSAEncryption = `${exports.id_pkcs_1}.12`;
exports.id_sha512WithRSAEncryption = `${exports.id_pkcs_1}.13`;
exports.id_sha512_224WithRSAEncryption = `${exports.id_pkcs_1}.15`;
exports.id_sha512_256WithRSAEncryption = `${exports.id_pkcs_1}.16`;
exports.id_sha1 = "1.3.14.3.2.26";
exports.id_sha224 = "2.16.840.1.101.3.4.2.4";
exports.id_sha256 = "2.16.840.1.101.3.4.2.1";
exports.id_sha384 = "2.16.840.1.101.3.4.2.2";
exports.id_sha512 = "2.16.840.1.101.3.4.2.3";
exports.id_sha512_224 = "2.16.840.1.101.3.4.2.5";
exports.id_sha512_256 = "2.16.840.1.101.3.4.2.6";
exports.id_md2 = "1.2.840.113549.2.2";
exports.id_md5 = "1.2.840.113549.2.5";
exports.id_mgf1 = `${exports.id_pkcs_1}.8`;

View File

@@ -0,0 +1,34 @@
"use strict";
var OtherPrimeInfos_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OtherPrimeInfos = exports.OtherPrimeInfo = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
class OtherPrimeInfo {
constructor(params = {}) {
this.prime = new ArrayBuffer(0);
this.exponent = new ArrayBuffer(0);
this.coefficient = new ArrayBuffer(0);
Object.assign(this, params);
}
}
exports.OtherPrimeInfo = OtherPrimeInfo;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], OtherPrimeInfo.prototype, "prime", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], OtherPrimeInfo.prototype, "exponent", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], OtherPrimeInfo.prototype, "coefficient", void 0);
let OtherPrimeInfos = OtherPrimeInfos_1 = class OtherPrimeInfos extends asn1_schema_1.AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, OtherPrimeInfos_1.prototype);
}
};
exports.OtherPrimeInfos = OtherPrimeInfos;
exports.OtherPrimeInfos = OtherPrimeInfos = OtherPrimeInfos_1 = tslib_1.__decorate([
(0, asn1_schema_1.AsnType)({ type: asn1_schema_1.AsnTypeTypes.Sequence, itemType: OtherPrimeInfo })
], OtherPrimeInfos);

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./rsaes_oaep"), exports);
tslib_1.__exportStar(require("./rsassa_pss"), exports);
tslib_1.__exportStar(require("./rsassa_pkcs1_v1_5"), exports);

View File

@@ -0,0 +1,33 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RSAES_OAEP = exports.RsaEsOaepParams = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const asn1_x509_1 = require("@peculiar/asn1-x509");
const object_identifiers_1 = require("../object_identifiers");
const algorithms_1 = require("../algorithms");
class RsaEsOaepParams {
constructor(params = {}) {
this.hashAlgorithm = new asn1_x509_1.AlgorithmIdentifier(algorithms_1.sha1);
this.maskGenAlgorithm = new asn1_x509_1.AlgorithmIdentifier({
algorithm: object_identifiers_1.id_mgf1,
parameters: asn1_schema_1.AsnConvert.serialize(algorithms_1.sha1),
});
this.pSourceAlgorithm = new asn1_x509_1.AlgorithmIdentifier(algorithms_1.pSpecifiedEmpty);
Object.assign(this, params);
}
}
exports.RsaEsOaepParams = RsaEsOaepParams;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier, context: 0, defaultValue: algorithms_1.sha1 })
], RsaEsOaepParams.prototype, "hashAlgorithm", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier, context: 1, defaultValue: algorithms_1.mgf1SHA1 })
], RsaEsOaepParams.prototype, "maskGenAlgorithm", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier, context: 2, defaultValue: algorithms_1.pSpecifiedEmpty })
], RsaEsOaepParams.prototype, "pSourceAlgorithm", void 0);
exports.RSAES_OAEP = new asn1_x509_1.AlgorithmIdentifier({
algorithm: object_identifiers_1.id_RSAES_OAEP,
parameters: asn1_schema_1.AsnConvert.serialize(new RsaEsOaepParams()),
});

View File

@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DigestInfo = void 0;
const tslib_1 = require("tslib");
const asn1_x509_1 = require("@peculiar/asn1-x509");
const asn1_schema_1 = require("@peculiar/asn1-schema");
class DigestInfo {
constructor(params = {}) {
this.digestAlgorithm = new asn1_x509_1.AlgorithmIdentifier();
this.digest = new asn1_schema_1.OctetString();
Object.assign(this, params);
}
}
exports.DigestInfo = DigestInfo;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier })
], DigestInfo.prototype, "digestAlgorithm", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.OctetString })
], DigestInfo.prototype, "digest", void 0);

View File

@@ -0,0 +1,37 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RSASSA_PSS = exports.RsaSaPssParams = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const asn1_x509_1 = require("@peculiar/asn1-x509");
const object_identifiers_1 = require("../object_identifiers");
const algorithms_1 = require("../algorithms");
class RsaSaPssParams {
constructor(params = {}) {
this.hashAlgorithm = new asn1_x509_1.AlgorithmIdentifier(algorithms_1.sha1);
this.maskGenAlgorithm = new asn1_x509_1.AlgorithmIdentifier({
algorithm: object_identifiers_1.id_mgf1,
parameters: asn1_schema_1.AsnConvert.serialize(algorithms_1.sha1),
});
this.saltLength = 20;
this.trailerField = 1;
Object.assign(this, params);
}
}
exports.RsaSaPssParams = RsaSaPssParams;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier, context: 0, defaultValue: algorithms_1.sha1 })
], RsaSaPssParams.prototype, "hashAlgorithm", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_x509_1.AlgorithmIdentifier, context: 1, defaultValue: algorithms_1.mgf1SHA1 })
], RsaSaPssParams.prototype, "maskGenAlgorithm", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, context: 2, defaultValue: 20 })
], RsaSaPssParams.prototype, "saltLength", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, context: 3, defaultValue: 1 })
], RsaSaPssParams.prototype, "trailerField", void 0);
exports.RSASSA_PSS = new asn1_x509_1.AlgorithmIdentifier({
algorithm: object_identifiers_1.id_RSASSA_PSS,
parameters: asn1_schema_1.AsnConvert.serialize(new RsaSaPssParams()),
});

View File

@@ -0,0 +1,51 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RSAPrivateKey = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
const other_prime_info_1 = require("./other_prime_info");
class RSAPrivateKey {
constructor(params = {}) {
this.version = 0;
this.modulus = new ArrayBuffer(0);
this.publicExponent = new ArrayBuffer(0);
this.privateExponent = new ArrayBuffer(0);
this.prime1 = new ArrayBuffer(0);
this.prime2 = new ArrayBuffer(0);
this.exponent1 = new ArrayBuffer(0);
this.exponent2 = new ArrayBuffer(0);
this.coefficient = new ArrayBuffer(0);
Object.assign(this, params);
}
}
exports.RSAPrivateKey = RSAPrivateKey;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer })
], RSAPrivateKey.prototype, "version", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "modulus", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "publicExponent", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "privateExponent", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "prime1", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "prime2", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "exponent1", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "exponent2", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "coefficient", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: other_prime_info_1.OtherPrimeInfos, optional: true })
], RSAPrivateKey.prototype, "otherPrimeInfos", void 0);

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RSAPublicKey = void 0;
const tslib_1 = require("tslib");
const asn1_schema_1 = require("@peculiar/asn1-schema");
class RSAPublicKey {
constructor(params = {}) {
this.modulus = new ArrayBuffer(0);
this.publicExponent = new ArrayBuffer(0);
Object.assign(this, params);
}
}
exports.RSAPublicKey = RSAPublicKey;
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], RSAPublicKey.prototype, "modulus", void 0);
tslib_1.__decorate([
(0, asn1_schema_1.AsnProp)({ type: asn1_schema_1.AsnPropTypes.Integer, converter: asn1_schema_1.AsnIntegerArrayBufferConverter })
], RSAPublicKey.prototype, "publicExponent", void 0);

View File

@@ -0,0 +1,36 @@
import { AsnConvert, AsnOctetStringConverter } from "@peculiar/asn1-schema";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
import * as oid from "./object_identifiers";
function create(algorithm) {
return new AlgorithmIdentifier({ algorithm, parameters: null });
}
export const md2 = create(oid.id_md2);
export const md4 = create(oid.id_md5);
export const sha1 = create(oid.id_sha1);
export const sha224 = create(oid.id_sha224);
export const sha256 = create(oid.id_sha256);
export const sha384 = create(oid.id_sha384);
export const sha512 = create(oid.id_sha512);
export const sha512_224 = create(oid.id_sha512_224);
export const sha512_256 = create(oid.id_sha512_256);
export const mgf1SHA1 = new AlgorithmIdentifier({
algorithm: oid.id_mgf1,
parameters: AsnConvert.serialize(sha1),
});
export const pSpecifiedEmpty = new AlgorithmIdentifier({
algorithm: oid.id_pSpecified,
parameters: AsnConvert.serialize(AsnOctetStringConverter.toASN(new Uint8Array([
0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18,
0x90, 0xaf, 0xd8, 0x07, 0x09,
]).buffer)),
});
export const rsaEncryption = create(oid.id_rsaEncryption);
export const md2WithRSAEncryption = create(oid.id_md2WithRSAEncryption);
export const md5WithRSAEncryption = create(oid.id_md5WithRSAEncryption);
export const sha1WithRSAEncryption = create(oid.id_sha1WithRSAEncryption);
export const sha224WithRSAEncryption = create(oid.id_sha512_224WithRSAEncryption);
export const sha256WithRSAEncryption = create(oid.id_sha512_256WithRSAEncryption);
export const sha384WithRSAEncryption = create(oid.id_sha384WithRSAEncryption);
export const sha512WithRSAEncryption = create(oid.id_sha512WithRSAEncryption);
export const sha512_224WithRSAEncryption = create(oid.id_sha512_224WithRSAEncryption);
export const sha512_256WithRSAEncryption = create(oid.id_sha512_256WithRSAEncryption);

View File

@@ -0,0 +1,6 @@
export * from "./parameters";
export * from "./algorithms";
export * from "./object_identifiers";
export * from "./other_prime_info";
export * from "./rsa_private_key";
export * from "./rsa_public_key";

View File

@@ -0,0 +1,25 @@
export const id_pkcs_1 = "1.2.840.113549.1.1";
export const id_rsaEncryption = `${id_pkcs_1}.1`;
export const id_RSAES_OAEP = `${id_pkcs_1}.7`;
export const id_pSpecified = `${id_pkcs_1}.9`;
export const id_RSASSA_PSS = `${id_pkcs_1}.10`;
export const id_md2WithRSAEncryption = `${id_pkcs_1}.2`;
export const id_md5WithRSAEncryption = `${id_pkcs_1}.4`;
export const id_sha1WithRSAEncryption = `${id_pkcs_1}.5`;
export const id_sha224WithRSAEncryption = `${id_pkcs_1}.14`;
export const id_ssha224WithRSAEncryption = id_sha224WithRSAEncryption;
export const id_sha256WithRSAEncryption = `${id_pkcs_1}.11`;
export const id_sha384WithRSAEncryption = `${id_pkcs_1}.12`;
export const id_sha512WithRSAEncryption = `${id_pkcs_1}.13`;
export const id_sha512_224WithRSAEncryption = `${id_pkcs_1}.15`;
export const id_sha512_256WithRSAEncryption = `${id_pkcs_1}.16`;
export const id_sha1 = "1.3.14.3.2.26";
export const id_sha224 = "2.16.840.1.101.3.4.2.4";
export const id_sha256 = "2.16.840.1.101.3.4.2.1";
export const id_sha384 = "2.16.840.1.101.3.4.2.2";
export const id_sha512 = "2.16.840.1.101.3.4.2.3";
export const id_sha512_224 = "2.16.840.1.101.3.4.2.5";
export const id_sha512_256 = "2.16.840.1.101.3.4.2.6";
export const id_md2 = "1.2.840.113549.2.2";
export const id_md5 = "1.2.840.113549.2.5";
export const id_mgf1 = `${id_pkcs_1}.8`;

View File

@@ -0,0 +1,30 @@
var OtherPrimeInfos_1;
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter, AsnArray, AsnType, AsnTypeTypes, } from "@peculiar/asn1-schema";
export class OtherPrimeInfo {
constructor(params = {}) {
this.prime = new ArrayBuffer(0);
this.exponent = new ArrayBuffer(0);
this.coefficient = new ArrayBuffer(0);
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], OtherPrimeInfo.prototype, "prime", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], OtherPrimeInfo.prototype, "exponent", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], OtherPrimeInfo.prototype, "coefficient", void 0);
let OtherPrimeInfos = OtherPrimeInfos_1 = class OtherPrimeInfos extends AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, OtherPrimeInfos_1.prototype);
}
};
OtherPrimeInfos = OtherPrimeInfos_1 = __decorate([
AsnType({ type: AsnTypeTypes.Sequence, itemType: OtherPrimeInfo })
], OtherPrimeInfos);
export { OtherPrimeInfos };

View File

@@ -0,0 +1,3 @@
export * from "./rsaes_oaep";
export * from "./rsassa_pss";
export * from "./rsassa_pkcs1_v1_5";

View File

@@ -0,0 +1,29 @@
import { __decorate } from "tslib";
import { AsnProp, AsnConvert } from "@peculiar/asn1-schema";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
import { id_mgf1, id_RSAES_OAEP } from "../object_identifiers";
import { sha1, mgf1SHA1, pSpecifiedEmpty } from "../algorithms";
export class RsaEsOaepParams {
constructor(params = {}) {
this.hashAlgorithm = new AlgorithmIdentifier(sha1);
this.maskGenAlgorithm = new AlgorithmIdentifier({
algorithm: id_mgf1,
parameters: AsnConvert.serialize(sha1),
});
this.pSourceAlgorithm = new AlgorithmIdentifier(pSpecifiedEmpty);
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AlgorithmIdentifier, context: 0, defaultValue: sha1 })
], RsaEsOaepParams.prototype, "hashAlgorithm", void 0);
__decorate([
AsnProp({ type: AlgorithmIdentifier, context: 1, defaultValue: mgf1SHA1 })
], RsaEsOaepParams.prototype, "maskGenAlgorithm", void 0);
__decorate([
AsnProp({ type: AlgorithmIdentifier, context: 2, defaultValue: pSpecifiedEmpty })
], RsaEsOaepParams.prototype, "pSourceAlgorithm", void 0);
export const RSAES_OAEP = new AlgorithmIdentifier({
algorithm: id_RSAES_OAEP,
parameters: AsnConvert.serialize(new RsaEsOaepParams()),
});

View File

@@ -0,0 +1,16 @@
import { __decorate } from "tslib";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
import { AsnProp, OctetString } from "@peculiar/asn1-schema";
export class DigestInfo {
constructor(params = {}) {
this.digestAlgorithm = new AlgorithmIdentifier();
this.digest = new OctetString();
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AlgorithmIdentifier })
], DigestInfo.prototype, "digestAlgorithm", void 0);
__decorate([
AsnProp({ type: OctetString })
], DigestInfo.prototype, "digest", void 0);

View File

@@ -0,0 +1,33 @@
import { __decorate } from "tslib";
import { AsnProp, AsnConvert, AsnPropTypes } from "@peculiar/asn1-schema";
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
import { id_mgf1, id_RSASSA_PSS } from "../object_identifiers";
import { sha1, mgf1SHA1 } from "../algorithms";
export class RsaSaPssParams {
constructor(params = {}) {
this.hashAlgorithm = new AlgorithmIdentifier(sha1);
this.maskGenAlgorithm = new AlgorithmIdentifier({
algorithm: id_mgf1,
parameters: AsnConvert.serialize(sha1),
});
this.saltLength = 20;
this.trailerField = 1;
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AlgorithmIdentifier, context: 0, defaultValue: sha1 })
], RsaSaPssParams.prototype, "hashAlgorithm", void 0);
__decorate([
AsnProp({ type: AlgorithmIdentifier, context: 1, defaultValue: mgf1SHA1 })
], RsaSaPssParams.prototype, "maskGenAlgorithm", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, context: 2, defaultValue: 20 })
], RsaSaPssParams.prototype, "saltLength", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, context: 3, defaultValue: 1 })
], RsaSaPssParams.prototype, "trailerField", void 0);
export const RSASSA_PSS = new AlgorithmIdentifier({
algorithm: id_RSASSA_PSS,
parameters: AsnConvert.serialize(new RsaSaPssParams()),
});

View File

@@ -0,0 +1,47 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from "@peculiar/asn1-schema";
import { OtherPrimeInfos } from "./other_prime_info";
export class RSAPrivateKey {
constructor(params = {}) {
this.version = 0;
this.modulus = new ArrayBuffer(0);
this.publicExponent = new ArrayBuffer(0);
this.privateExponent = new ArrayBuffer(0);
this.prime1 = new ArrayBuffer(0);
this.prime2 = new ArrayBuffer(0);
this.exponent1 = new ArrayBuffer(0);
this.exponent2 = new ArrayBuffer(0);
this.coefficient = new ArrayBuffer(0);
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer })
], RSAPrivateKey.prototype, "version", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "modulus", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "publicExponent", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "privateExponent", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "prime1", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "prime2", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "exponent1", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "exponent2", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPrivateKey.prototype, "coefficient", void 0);
__decorate([
AsnProp({ type: OtherPrimeInfos, optional: true })
], RSAPrivateKey.prototype, "otherPrimeInfos", void 0);

View File

@@ -0,0 +1,15 @@
import { __decorate } from "tslib";
import { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from "@peculiar/asn1-schema";
export class RSAPublicKey {
constructor(params = {}) {
this.modulus = new ArrayBuffer(0);
this.publicExponent = new ArrayBuffer(0);
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPublicKey.prototype, "modulus", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })
], RSAPublicKey.prototype, "publicExponent", void 0);

View File

@@ -0,0 +1,22 @@
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
export declare const md2: AlgorithmIdentifier;
export declare const md4: AlgorithmIdentifier;
export declare const sha1: AlgorithmIdentifier;
export declare const sha224: AlgorithmIdentifier;
export declare const sha256: AlgorithmIdentifier;
export declare const sha384: AlgorithmIdentifier;
export declare const sha512: AlgorithmIdentifier;
export declare const sha512_224: AlgorithmIdentifier;
export declare const sha512_256: AlgorithmIdentifier;
export declare const mgf1SHA1: AlgorithmIdentifier;
export declare const pSpecifiedEmpty: AlgorithmIdentifier;
export declare const rsaEncryption: AlgorithmIdentifier;
export declare const md2WithRSAEncryption: AlgorithmIdentifier;
export declare const md5WithRSAEncryption: AlgorithmIdentifier;
export declare const sha1WithRSAEncryption: AlgorithmIdentifier;
export declare const sha224WithRSAEncryption: AlgorithmIdentifier;
export declare const sha256WithRSAEncryption: AlgorithmIdentifier;
export declare const sha384WithRSAEncryption: AlgorithmIdentifier;
export declare const sha512WithRSAEncryption: AlgorithmIdentifier;
export declare const sha512_224WithRSAEncryption: AlgorithmIdentifier;
export declare const sha512_256WithRSAEncryption: AlgorithmIdentifier;

View File

@@ -0,0 +1,6 @@
export * from "./parameters";
export * from "./algorithms";
export * from "./object_identifiers";
export * from "./other_prime_info";
export * from "./rsa_private_key";
export * from "./rsa_public_key";

View File

@@ -0,0 +1,176 @@
/**
* ```asn1
* pkcs-1 OBJECT IDENTIFIER ::= {
iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1
* ```
*/
export declare const id_pkcs_1 = "1.2.840.113549.1.1";
/**
* ```asn1
* rsaEncryption OBJECT IDENTIFIER ::= { pkcs-1 1 }
* ```
*/
export declare const id_rsaEncryption = "1.2.840.113549.1.1.1";
/**
* ```asn1
* id-RSAES-OAEP OBJECT IDENTIFIER ::= { pkcs-1 7 }
* ```
*/
export declare const id_RSAES_OAEP = "1.2.840.113549.1.1.7";
/**
* ```asn1
* id-pSpecified OBJECT IDENTIFIER ::= { pkcs-1 9 }
* ```
*/
export declare const id_pSpecified = "1.2.840.113549.1.1.9";
/**
* ```asn1
* id-RSASSA-PSS OBJECT IDENTIFIER ::= { pkcs-1 10 }
* ```
*/
export declare const id_RSASSA_PSS = "1.2.840.113549.1.1.10";
/**
* ```asn1
* md2WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 2 }
* ```
*/
export declare const id_md2WithRSAEncryption = "1.2.840.113549.1.1.2";
/**
* ```asn1
* md5WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 4 }
* ```
*/
export declare const id_md5WithRSAEncryption = "1.2.840.113549.1.1.4";
/**
* ```asn1
* sha1WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 5 }
* ```
*/
export declare const id_sha1WithRSAEncryption = "1.2.840.113549.1.1.5";
/**
* ```asn1
* sha224WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 14 }
* ```
*/
export declare const id_sha224WithRSAEncryption = "1.2.840.113549.1.1.14";
/**
* ```asn1
* sha224WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 14 }
* ```
* @deprecated Should be removed later
*/
export declare const id_ssha224WithRSAEncryption = "1.2.840.113549.1.1.14";
/**
* ```asn1
* sha256WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 11 }
* ```
*/
export declare const id_sha256WithRSAEncryption = "1.2.840.113549.1.1.11";
/**
* ```asn1
* sha384WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 12 }
* ```
*/
export declare const id_sha384WithRSAEncryption = "1.2.840.113549.1.1.12";
/**
* ```asn1
* sha512WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 13 }
* ```
*/
export declare const id_sha512WithRSAEncryption = "1.2.840.113549.1.1.13";
/**
* ```asn1
* sha512-224WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 15 }
* ```
*/
export declare const id_sha512_224WithRSAEncryption = "1.2.840.113549.1.1.15";
/**
* ```asn1
* sha512-256WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 16 }
* ```
*/
export declare const id_sha512_256WithRSAEncryption = "1.2.840.113549.1.1.16";
/**
* ```asn1
* id-sha1 OBJECT IDENTIFIER ::= {
* iso(1) identified-organization(3) oiw(14) secsig(3) algorithms(2)
* 26
* ```
*/
export declare const id_sha1 = "1.3.14.3.2.26";
/**
* ```asn1
* id-sha224 OBJECT IDENTIFIER ::= {
* joint-iso-itu-t (2) country (16) us (840) organization (1)
* gov (101) csor (3) nistalgorithm (4) hashalgs (2) 4
* }
* ```
*/
export declare const id_sha224 = "2.16.840.1.101.3.4.2.4";
/**
* ```asn1
* id-sha256 OBJECT IDENTIFIER ::= {
* joint-iso-itu-t (2) country (16) us (840) organization (1)
* gov (101) csor (3) nistalgorithm (4) hashalgs (2) 1
* }
* ```
*/
export declare const id_sha256 = "2.16.840.1.101.3.4.2.1";
/**
* ```asn1
* id-sha384 OBJECT IDENTIFIER ::= {
* joint-iso-itu-t (2) country (16) us (840) organization (1)
* gov (101) csor (3) nistalgorithm (4) hashalgs (2) 2
* }
* ```
*/
export declare const id_sha384 = "2.16.840.1.101.3.4.2.2";
/**
* ```asn1
* id-sha512 OBJECT IDENTIFIER ::= {
* joint-iso-itu-t (2) country (16) us (840) organization (1)
* gov (101) csor (3) nistalgorithm (4) hashalgs (2) 3
* }
* ```
*/
export declare const id_sha512 = "2.16.840.1.101.3.4.2.3";
/**
* ```asn1
* id-sha512-224 OBJECT IDENTIFIER ::= {
* joint-iso-itu-t (2) country (16) us (840) organization (1)
* gov (101) csor (3) nistalgorithm (4) hashalgs (2) 5
* }
* ```
*/
export declare const id_sha512_224 = "2.16.840.1.101.3.4.2.5";
/**
* ```asn1
* id-sha512-256 OBJECT IDENTIFIER ::= {
* joint-iso-itu-t (2) country (16) us (840) organization (1)
* gov (101) csor (3) nistalgorithm (4) hashalgs (2) 6
* }
* ```
*/
export declare const id_sha512_256 = "2.16.840.1.101.3.4.2.6";
/**
* ```asn1
* id-md2 OBJECT IDENTIFIER ::= {
* iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 2
* }
* ```
*/
export declare const id_md2 = "1.2.840.113549.2.2";
/**
* ```asn1
* id-md5 OBJECT IDENTIFIER ::= {
* iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2) 5
* }
* ```
*/
export declare const id_md5 = "1.2.840.113549.2.5";
/**
* ```asn1
* id-mgf1 OBJECT IDENTIFIER ::= { pkcs-1 8 }
* ```
*/
export declare const id_mgf1 = "1.2.840.113549.1.1.8";

View File

@@ -0,0 +1,24 @@
import { AsnArray } from "@peculiar/asn1-schema";
/**
* ```asn1
* OtherPrimeInfo ::= SEQUENCE {
* prime INTEGER, -- ri
* exponent INTEGER, -- di
* coefficient INTEGER -- ti
* }
* ```
*/
export declare class OtherPrimeInfo {
prime: ArrayBuffer;
exponent: ArrayBuffer;
coefficient: ArrayBuffer;
constructor(params?: Partial<OtherPrimeInfo>);
}
/**
* ```asn1
* OtherPrimeInfos ::= SEQUENCE SIZE(1..MAX) OF OtherPrimeInfo
* ```
*/
export declare class OtherPrimeInfos extends AsnArray<OtherPrimeInfo> {
constructor(items?: OtherPrimeInfo[]);
}

View File

@@ -0,0 +1,3 @@
export * from "./rsaes_oaep";
export * from "./rsassa_pss";
export * from "./rsassa_pkcs1_v1_5";

View File

@@ -0,0 +1,22 @@
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
/**
* ```asn1
* RSAES-OAEP-params ::= SEQUENCE {
* hashAlgorithm [0] HashAlgorithm DEFAULT sha1,
* maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT mgf1SHA1,
* pSourceAlgorithm [2] PSourceAlgorithm DEFAULT pSpecifiedEmpty
* }
* ```
*/
export declare class RsaEsOaepParams {
hashAlgorithm: AlgorithmIdentifier;
maskGenAlgorithm: AlgorithmIdentifier;
pSourceAlgorithm: AlgorithmIdentifier;
constructor(params?: Partial<RsaEsOaepParams>);
}
/**
* ```asn1
* { OID id-RSAES-OAEP PARAMETERS RSAES-OAEP-params } |
* ```
*/
export declare const RSAES_OAEP: AlgorithmIdentifier;

View File

@@ -0,0 +1,15 @@
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
import { OctetString } from "@peculiar/asn1-schema";
/**
* ```asn1
* DigestInfo ::= SEQUENCE {
* digestAlgorithm DigestAlgorithm,
* digest OCTET STRING
* }
* ```
*/
export declare class DigestInfo {
digestAlgorithm: AlgorithmIdentifier;
digest: OctetString;
constructor(params?: Partial<DigestInfo>);
}

View File

@@ -0,0 +1,30 @@
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
/**
* ```asn1
* TrailerField ::= INTEGER { trailerFieldBC(1) }
* ```
*/
export type TrailerField = number;
/**
* ```asn1
* RSASSA-PSS-params ::= SEQUENCE {
* hashAlgorithm [0] HashAlgorithm DEFAULT sha1,
* maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT mgf1SHA1,
* saltLength [2] INTEGER DEFAULT 20,
* trailerField [3] TrailerField DEFAULT trailerFieldBC
* }
* ```
*/
export declare class RsaSaPssParams {
hashAlgorithm: AlgorithmIdentifier;
maskGenAlgorithm: AlgorithmIdentifier;
saltLength: number;
trailerField: TrailerField;
constructor(params?: Partial<RsaSaPssParams>);
}
/**
* ```asn1
* { OID id-RSASSA-PSS PARAMETERS RSASSA-PSS-params }
* ```
*/
export declare const RSASSA_PSS: AlgorithmIdentifier;

View File

@@ -0,0 +1,39 @@
import { OtherPrimeInfos } from "./other_prime_info";
/**
* ```asn1
* Version ::= INTEGER { two-prime(0), multi(1) }
* (CONSTRAINED BY
* {-- version MUST
* be multi if otherPrimeInfos present --})
* ```
*/
export type Version = number;
/**
* ```asn1
* RSAPrivateKey ::= SEQUENCE {
* version Version,
* modulus INTEGER, -- n
* publicExponent INTEGER, -- e
* privateExponent INTEGER, -- d
* prime1 INTEGER, -- p
* prime2 INTEGER, -- q
* exponent1 INTEGER, -- d mod (p-1)
* exponent2 INTEGER, -- d mod (q-1)
* coefficient INTEGER, -- (inverse of q) mod p
* otherPrimeInfos OtherPrimeInfos OPTIONAL
* }
* ```
*/
export declare class RSAPrivateKey {
version: Version;
modulus: ArrayBuffer;
publicExponent: ArrayBuffer;
privateExponent: ArrayBuffer;
prime1: ArrayBuffer;
prime2: ArrayBuffer;
exponent1: ArrayBuffer;
exponent2: ArrayBuffer;
coefficient: ArrayBuffer;
otherPrimeInfos?: OtherPrimeInfos;
constructor(params?: Partial<RSAPrivateKey>);
}

View File

@@ -0,0 +1,13 @@
/**
* ```asn1
* RSAPublicKey ::= SEQUENCE {
* modulus INTEGER, -- n
* publicExponent INTEGER -- e
* }
* ```
*/
export declare class RSAPublicKey {
modulus: ArrayBuffer;
publicExponent: ArrayBuffer;
constructor(params?: Partial<RSAPublicKey>);
}

View File

@@ -0,0 +1,15 @@
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

Some files were not shown because too many files have changed in this diff Show More