mirror of
https://github.com/danbulant/jose
synced 2026-05-24 20:41:46 +00:00
fix(typescript): fix compiling by adding .d.ts files for runtime modules
This commit is contained in:
parent
076eea11bb
commit
d9cb5734d7
20 changed files with 71 additions and 4 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,6 +1,6 @@
|
|||
# crypto runtime copies
|
||||
src/runtime/*.ts
|
||||
+src/runtime/interfaces.d.ts
|
||||
+src/runtime/*.d.ts
|
||||
|
||||
# cjs clone of the test suite
|
||||
test/cjs
|
||||
|
|
|
|||
|
|
@ -425,8 +425,9 @@
|
|||
"dist/**/*.js",
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.ts",
|
||||
"!src/runtime/*/*.ts",
|
||||
"!src/runtime/*.ts",
|
||||
"src/runtime/interfaces.d.ts"
|
||||
"src/runtime/*.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
|
|
@ -447,7 +448,7 @@
|
|||
"runtime-node-webcrypto": "run-s runtime:clear runtime:browser:* && cp ./src/runtime/node/webcrypto.ts ./src/runtime/ && cp ./src/runtime/node/fetch.ts ./src/runtime/ && cp ./src/runtime/node/base64url.ts ./src/runtime/ && cp ./src/runtime/node/zlib.ts ./src/runtime/ && run-s runtime:refs",
|
||||
"runtime:browser:copy": "cp ./src/runtime/browser/*.ts ./src/runtime",
|
||||
"runtime:clear": "run-s -s runtime:find | xargs -0 rm -f",
|
||||
"runtime:find": "find src/runtime -not -name 'interfaces.d.ts' -maxdepth 1 -type f -print0",
|
||||
"runtime:find": "find src/runtime -not -name '*.d.ts' -maxdepth 1 -type f -print0",
|
||||
"runtime:node:copy": "cp ./src/runtime/node/*.ts ./src/runtime",
|
||||
"runtime:refs": "run-s -s runtime:find | xargs -0 sed -i '' -e \"s/'\\.\\.\\//'\\.\\//g\" -e \"s/'\\.\\/\\.\\./'../g\"",
|
||||
"test": "npm run-script test-rollup && ava",
|
||||
|
|
|
|||
|
|
@ -34,5 +34,5 @@
|
|||
"globals": {
|
||||
"window": "readonly"
|
||||
},
|
||||
"ignorePatterns": ["src/runtime/*/*.ts", "src/runtime/webcrypto.ts", "dist"]
|
||||
"ignorePatterns": ["src/runtime/*/*.ts", "src/runtime/webcrypto.ts", "dist", "src/runtime/*.d.ts"]
|
||||
}
|
||||
|
|
|
|||
3
src/runtime/aesgcmkw.d.ts
vendored
Normal file
3
src/runtime/aesgcmkw.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { AesGcmKwUnwrapFunction, AesGcmKwWrapFunction } from './interfaces.d';
|
||||
export declare const wrap: AesGcmKwWrapFunction;
|
||||
export declare const unwrap: AesGcmKwUnwrapFunction;
|
||||
3
src/runtime/aeskw.d.ts
vendored
Normal file
3
src/runtime/aeskw.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { AesKwUnwrapFunction, AesKwWrapFunction } from './interfaces.d';
|
||||
export declare const wrap: AesKwWrapFunction;
|
||||
export declare const unwrap: AesKwUnwrapFunction;
|
||||
3
src/runtime/base64url.d.ts
vendored
Normal file
3
src/runtime/base64url.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { Base64UrlDecode, Base64UrlEncode } from './interfaces.d';
|
||||
export declare const encode: Base64UrlEncode;
|
||||
export declare const decode: Base64UrlDecode;
|
||||
3
src/runtime/decrypt.d.ts
vendored
Normal file
3
src/runtime/decrypt.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { DecryptFunction } from './interfaces.d';
|
||||
declare const decrypt: DecryptFunction;
|
||||
export default decrypt;
|
||||
3
src/runtime/digest.d.ts
vendored
Normal file
3
src/runtime/digest.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { AsyncOrSync } from '../types.i.d'
|
||||
declare const _default: (digest: string, data: Uint8Array) => AsyncOrSync<Uint8Array>;
|
||||
export default _default;
|
||||
6
src/runtime/ecdhes.d.ts
vendored
Normal file
6
src/runtime/ecdhes.d.ts
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { EcdhAllowedFunction, EcdhESDeriveKeyFunction, EphemeralKeyToPublicJwkFunction, GenerateEpkFunction, PublicJwkToEphemeralKeyFunction } from './interfaces.d';
|
||||
export declare const deriveKey: EcdhESDeriveKeyFunction;
|
||||
export declare const ephemeralKeyToPublicJWK: EphemeralKeyToPublicJwkFunction;
|
||||
export declare const generateEpk: GenerateEpkFunction;
|
||||
export declare const publicJwkToEphemeralKey: PublicJwkToEphemeralKeyFunction;
|
||||
export declare const ecdhAllowed: EcdhAllowedFunction;
|
||||
3
src/runtime/encrypt.d.ts
vendored
Normal file
3
src/runtime/encrypt.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { EncryptFunction } from './interfaces.d';
|
||||
declare const encrypt: EncryptFunction;
|
||||
export default encrypt;
|
||||
2
src/runtime/fetch.d.ts
vendored
Normal file
2
src/runtime/fetch.d.ts
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
declare const _default: (url: URL, timeout: number) => Promise<any>;
|
||||
export default _default;
|
||||
11
src/runtime/generate.d.ts
vendored
Normal file
11
src/runtime/generate.d.ts
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import type { KeyObject } from 'crypto';
|
||||
import type { KeyLike } from '../types.d';
|
||||
export declare function generateSecret(alg: string): Promise<KeyLike>;
|
||||
interface Options {
|
||||
crv?: string;
|
||||
}
|
||||
export declare function generateKeyPair(alg: string, options?: Options): Promise<{
|
||||
privateKey: CryptoKey | KeyObject,
|
||||
publicKey: CryptoKey | KeyObject
|
||||
}>;
|
||||
export {};
|
||||
8
src/runtime/interfaces.d.ts
vendored
8
src/runtime/interfaces.d.ts
vendored
|
|
@ -109,3 +109,11 @@ export interface DecryptFunction {
|
|||
additionalData: Uint8Array,
|
||||
): Promise<Uint8Array>
|
||||
}
|
||||
// TODO:
|
||||
export interface FetchFunction {
|
||||
(url: URL, timeout: number): Promise<any>
|
||||
}
|
||||
// TODO:
|
||||
export interface DigestFunction {
|
||||
(digest: string, data: Uint8Array): AsyncOrSync<Uint8Array>
|
||||
}
|
||||
|
|
|
|||
3
src/runtime/jwk_to_key.d.ts
vendored
Normal file
3
src/runtime/jwk_to_key.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { KeyLike, JWK } from '../types.d';
|
||||
declare const _default: (jwk: JWK) => Promise<KeyLike>;
|
||||
export default _default;
|
||||
3
src/runtime/pbes2kw.d.ts
vendored
Normal file
3
src/runtime/pbes2kw.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { Pbes2KWDecryptFunction, Pbes2KWEncryptFunction } from './interfaces.d';
|
||||
export declare const encrypt: Pbes2KWEncryptFunction;
|
||||
export declare const decrypt: Pbes2KWDecryptFunction;
|
||||
3
src/runtime/random.d.ts
vendored
Normal file
3
src/runtime/random.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { GetRandomValuesFunction } from './interfaces.d';
|
||||
declare const random: GetRandomValuesFunction;
|
||||
export default random;
|
||||
3
src/runtime/rsaes.d.ts
vendored
Normal file
3
src/runtime/rsaes.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { RsaEsDecryptFunction, RsaEsEncryptFunction } from './interfaces.d';
|
||||
export declare const encrypt: RsaEsEncryptFunction;
|
||||
export declare const decrypt: RsaEsDecryptFunction;
|
||||
3
src/runtime/sign.d.ts
vendored
Normal file
3
src/runtime/sign.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { SignFunction } from './interfaces.d';
|
||||
declare const sign: SignFunction;
|
||||
export default sign;
|
||||
3
src/runtime/verify.d.ts
vendored
Normal file
3
src/runtime/verify.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { VerifyFunction } from './interfaces.d';
|
||||
declare const verify: VerifyFunction;
|
||||
export default verify;
|
||||
3
src/runtime/zlib.d.ts
vendored
Normal file
3
src/runtime/zlib.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { InflateFunction, DeflateFunction } from '../types.d';
|
||||
export declare const inflate: InflateFunction;
|
||||
export declare const deflate: DeflateFunction;
|
||||
Loading…
Reference in a new issue