Merge 26051774464013a50c06f04ce22cd0dabd75431c into 19e4dfbbc08e65d2cd14dc806370ec0753c5ea12

This commit is contained in:
Junxiao Shi 2025-01-30 03:27:41 +00:00 committed by GitHub
commit b4c8e427a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 49 additions and 11 deletions

48
index.d.ts vendored
View File

@ -1 +1,47 @@
export * from "@root/asn1"; export {};
interface Element<V extends string | Uint8Array> {
type: number;
lengthSize: number;
length: number;
value?: V | undefined;
children?: Array<Element<V>> | undefined;
}
export type ElementHex = Element<string>;
export type ElementBuffer = Element<Uint8Array>;
export interface ElementInput {
type: number;
value?: string | Uint8Array | undefined;
children?: ElementInput[] | undefined;
}
export type ArrJson = [string, string | ArrJson[]];
export type ArrBuffer = [number, Uint8Array | ArrBuffer[]];
export type ArrInput = [string | number, string | Uint8Array | ArrInput[]];
export function parseVerbose(buf: Uint8Array, opts?: { json?: false | undefined }): ElementBuffer;
export function parseVerbose(buf: Uint8Array, opts: { json: true }): ElementHex;
export function parse(opts: { der: Uint8Array; verbose?: false | undefined; json?: true | undefined }): ArrJson;
export function parse(opts: { der: Uint8Array; verbose?: false | undefined; json: false }): ArrBuffer;
export function parse(opts: { der: Uint8Array; verbose: true; json?: true | undefined }): ElementHex;
export function parse(opts: { der: Uint8Array; verbose: true; json: false }): ElementBuffer;
export function pack(asn1: ElementInput | ArrInput, opts?: { json?: false | undefined }): Uint8Array;
export function pack(asn1: ElementInput | ArrInput, opts: { json: true }): string;
export function Any(hexType: string | number, ...hexBytes: string[]): string;
export function UInt(hexBigInt: string): string;
export function BitStr(hexBitStream: string): string;

9
package-lock.json generated
View File

@ -9,8 +9,7 @@
"version": "1.0.2", "version": "1.0.2",
"license": "MPL-2.0", "license": "MPL-2.0",
"dependencies": { "dependencies": {
"@root/encoding": "^1.0.1", "@root/encoding": "^1.0.1"
"@types/root__asn1": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"@root/pem": "^1.0.4" "@root/pem": "^1.0.4"
@ -28,12 +27,6 @@
"integrity": "sha512-rEUDiUsHtild8GfIjFE9wXtcVxeS+ehCJQBwbQQ3IVfORKHK93CFnRtkr69R75lZFjcmKYVc+AXDB+AeRFOULA==", "integrity": "sha512-rEUDiUsHtild8GfIjFE9wXtcVxeS+ehCJQBwbQQ3IVfORKHK93CFnRtkr69R75lZFjcmKYVc+AXDB+AeRFOULA==",
"dev": true, "dev": true,
"license": "MPL-2.0" "license": "MPL-2.0"
},
"node_modules/@types/root__asn1": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@types/root__asn1/-/root__asn1-1.0.5.tgz",
"integrity": "sha512-halz3HrALf1N4pUJrtQrH6mdWPczXwshoWjuxmx49riKMJv2MZGKXnauk0RjlnRzM0rlwiAJRlMT9FtSjnF2kw==",
"license": "MIT"
} }
} }
} }

View File

@ -32,7 +32,6 @@
"@root/pem": "^1.0.4" "@root/pem": "^1.0.4"
}, },
"dependencies": { "dependencies": {
"@root/encoding": "^1.0.1", "@root/encoding": "^1.0.1"
"@types/root__asn1": "^1.0.0"
} }
} }