Skip to content

Commit

Permalink
Merge pull request #106 from PeculiarVentures/update-deps
Browse files Browse the repository at this point in the history
Update dependencies and improve code structure
  • Loading branch information
microshine authored Dec 23, 2024
2 parents adf4c45 + 2aac251 commit d12e78e
Show file tree
Hide file tree
Showing 313 changed files with 5,094 additions and 4,030 deletions.
11 changes: 0 additions & 11 deletions .eslintrc.yaml

This file was deleted.

8 changes: 1 addition & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ jobs:
- name: Run test with coverage
run: npm run coverage

# Fixes problem with incorrect SF paths. See https://github.com/coverallsapp/github-action/issues/125
- name: Update lcov.info
run: |
sed -E "s/SF:(.+file:(.+))/SF:\2/g" ./coverage/lcov.info > coverage/lcov.new.info
mv ./coverage/lcov.new.info ./coverage/lcov.info
- name: Coveralls
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": true,
"trailingComma": "all",
"singleQuote": false,
"printWidth": 100
}
12 changes: 12 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommended,
{
ignores: ['packages/*/build/**', 'packages/*/*.mjs'],
},
);
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
// eslint-disable-next-line no-undef
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/packages'],
testMatch: ['**/*.spec.ts', '**/test/**/*.ts'],
moduleNameMapper: {
'^@peculiar/asn1-(.*)$': '<rootDir>/packages/$1/src'
}
};
57 changes: 15 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,67 +5,40 @@
"packages/*"
],
"devDependencies": {
"@types/mocha": "^10.0.2",
"@types/node": "^20.8.6",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"eslint": "^8.51.0",
"lerna": "^7.3.1",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"@eslint/js": "^9.17.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.2",
"eslint": "^9.17.0",
"jest": "^29.7.0",
"lerna": "^8.1.9",
"prettier": "^3.4.2",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.2.2"
"typescript": "^5.7.2",
"typescript-eslint": "^8.18.1"
},
"scripts": {
"test": "mocha",
"test": "jest",
"build": "lerna run build",
"rebuild": "lerna run rebuild",
"clear": "lerna run --parallel clear",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint --fix . --ext .ts",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"create": "ts-node scripts/create_package.ts",
"prepub": "yarn run build",
"pub": "lerna publish",
"bootstrap": "yarn",
"bootstrap:upgrade": "yarn upgrade-interactive --latest",
"upgrade": "yarn upgrade-interactive --latest",
"coverage": "nyc npm test"
},
"nyc": {
"extension": [
".ts",
".tsx"
],
"include": [
"packages/*/src/**/*.ts"
],
"exclude": [
"**/*.d.ts"
],
"reporter": [
"lcov",
"text-summary"
]
},
"mocha": {
"require": [
"tsconfig-paths/register",
"ts-node/register"
],
"extension": [
"ts"
],
"spec": [
"packages/*/test/**/*.ts"
]
"coverage": "jest --coverage"
},
"resolutions": {
"cliui": "^8.0.1",
"path-scurry": "^2.0.0"
},
"dependencies": {
"@types/rimraf": "^4.0.5",
"rimraf": "^5.0.5"
"rimraf": "^6.0.1"
}
}
2 changes: 1 addition & 1 deletion packages/adobe-acrobat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"@peculiar/asn1-schema": "^2.3.13",
"@peculiar/asn1-x509": "^2.3.13",
"asn1js": "^3.0.5",
"tslib": "^2.6.2"
"tslib": "^2.8.1"
}
}
6 changes: 3 additions & 3 deletions packages/adobe-acrobat/src/archive_rev_info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { AsnPropTypes, AsnProp } from "@peculiar/asn1-schema";
import { Version } from "./version";

/**
* ```
* ```asn1
* adbe-archiveRevInfo OBJECT IDENTIFIER ::= { adbe(1.2.840.113583) acrobat(1) security(1) x509Ext(9) 2 }
* ```
*/
export const id_adbe_archiveRevInfo = "1.2.840.113583.1.1.9.2";

/**
* ```
* ```asn1
* ArchiveRevInfo ::= SEQUENCE {
* version INTEGER { v1(1) }, -- extension version
* }
Expand All @@ -22,4 +22,4 @@ export class ArchiveRevInfo {
public constructor(params: Partial<ArchiveRevInfo> = {}) {
Object.assign(this, params);
}
}
}
8 changes: 4 additions & 4 deletions packages/adobe-acrobat/src/timestamp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { GeneralName } from "@peculiar/asn1-x509";
import { Version } from "./version";

/**
* ```
* ```asn1
* adbe- OBJECT IDENTIFIER ::= { adbe(1.2.840.113583) acrobat(1) security(1) x509Ext(9) 1 }
* ```
*/
export const id_adbe_timestamp = "1.2.840.113583.1.1.9.1";

/**
* ```
* ```asn1
* Timestamp ::= SEQUENCE {
* version INTEGER { v1(1) }, -- extension version
* location GeneralName (In v1 GeneralName can be only uniformResourceIdentifier)
Expand All @@ -24,10 +24,10 @@ export class Timestamp {
public version: Version = Version.v1;

@AsnProp({ type: GeneralName })
public location: GeneralName = new GeneralName()
public location: GeneralName = new GeneralName();

@AsnProp({ type: AsnPropTypes.Boolean, defaultValue: false, optional: true })
public requiresAuth = false
public requiresAuth = false;

public constructor(params: Partial<Timestamp> = {}) {
Object.assign(this, params);
Expand Down
2 changes: 1 addition & 1 deletion packages/adobe-acrobat/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export enum Version {
v1 = 1,
}
}
20 changes: 10 additions & 10 deletions packages/adobe-acrobat/test/test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import * as assert from "assert";
import * as assert from "node:assert";
import { AsnConvert } from "@peculiar/asn1-schema";
import { Timestamp, Version } from "../src";

context("adobe-acrobat", () => {

context("Timestamp", () => {

describe("adobe-acrobat", () => {
describe("Timestamp", () => {
it("parse", () => {
const hex = "304c0201018644687474703a2f2f6161746c2d74696d657374616d702e676c6f62616c7369676e2e636f6d2f7473612f616f68666577617432333839353335666e6173676e6c67356d3233010100";
const hex =
"304c0201018644687474703a2f2f6161746c2d74696d657374616d702e676c6f62616c7369676e2e636f6d2f7473612f616f68666577617432333839353335666e6173676e6c67356d3233010100";

const timestamp = AsnConvert.parse(Buffer.from(hex, "hex"), Timestamp);
assert.strictEqual(timestamp.version, Version.v1);
assert.strictEqual(timestamp.location.uniformResourceIdentifier, "http://aatl-timestamp.globalsign.com/tsa/aohfewat2389535fnasgnlg5m23");
assert.strictEqual(
timestamp.location.uniformResourceIdentifier,
"http://aatl-timestamp.globalsign.com/tsa/aohfewat2389535fnasgnlg5m23",
);
assert.strictEqual(timestamp.requiresAuth, false);
});

});

});
});
2 changes: 1 addition & 1 deletion packages/android/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"dependencies": {
"@peculiar/asn1-schema": "^2.3.13",
"asn1js": "^3.0.5",
"tslib": "^2.6.2"
"tslib": "^2.8.1"
}
}
14 changes: 9 additions & 5 deletions packages/android/src/key_description.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString } from "@peculiar/asn1-schema";
import {
AsnProp,
AsnPropTypes,
AsnArray,
AsnType,
AsnTypeTypes,
OctetString,
} from "@peculiar/asn1-schema";

/**
* Extension OID for key description.
Expand Down Expand Up @@ -41,7 +48,6 @@ export enum VerifiedBootState {
* ```
*/
export class RootOfTrust {

@AsnProp({ type: OctetString })
public verifiedBootKey: OctetString = new OctetString();

Expand Down Expand Up @@ -71,14 +77,12 @@ export class RootOfTrust {
*/
@AsnType({ type: AsnTypeTypes.Set, itemType: AsnPropTypes.Integer })
export class IntegerSet extends AsnArray<number> {

constructor(items?: number[]) {
super(items);

// Set the prototype explicitly.
Object.setPrototypeOf(this, IntegerSet.prototype);
}

}

/**
Expand Down Expand Up @@ -329,4 +333,4 @@ export class KeyDescription {
public constructor(params: Partial<KeyDescription> = {}) {
Object.assign(this, params);
}
}
}
15 changes: 11 additions & 4 deletions packages/android/src/nonstandard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString } from "@peculiar/asn1-schema";
import {
AsnProp,
AsnPropTypes,
AsnArray,
AsnType,
AsnTypeTypes,
OctetString,
} from "@peculiar/asn1-schema";
import { AuthorizationList, SecurityLevel, Version } from "./key_description";

/**
Expand All @@ -22,7 +29,7 @@ import { AuthorizationList, SecurityLevel, Version } from "./key_description";
* non-strict ordering of fields.
*/
@AsnType({ type: AsnTypeTypes.Choice })
export class NonStandardAuthorization extends AuthorizationList { }
export class NonStandardAuthorization extends AuthorizationList {}

/**
* Represents a list of non-standard authorizations.
Expand All @@ -45,7 +52,7 @@ export class NonStandardAuthorizationList extends AsnArray<NonStandardAuthorizat
* @returns The first authorization that contains the specified key, or `undefined` if not found.
*/
findProperty<K extends keyof AuthorizationList>(key: K): AuthorizationList[K] | undefined {
const prop = this.find((o => key in o));
const prop = this.find((o) => key in o);
if (prop) {
return prop[key];
}
Expand Down Expand Up @@ -101,4 +108,4 @@ export class NonStandardKeyDescription {
public constructor(params: Partial<NonStandardKeyDescription> = {}) {
Object.assign(this, params);
}
}
}
Loading

0 comments on commit d12e78e

Please sign in to comment.