@types/peertube__http-signature #66932
Unanswered
lexi-the-cute
asked this question in
Request a new @types package
Replies: 1 comment
-
I believe I managed to create a type declaration for it. I have no idea if I did anything wrong though, probably // import http from 'node:http'
const package = {
// parser.js
parser: {
parseRequest: function parseRequest(request: http.ClientRequest, options: {
clockSkew?: number = 300,
headers?: string[] = ["date", "x-date"],
// authorizationHeaderName: string,
algorithms?: string[] = ["all"],
strict?: boolean = false
}): any {}
},
// signer.js
signer: {
isSigner: function isSigner(obj: any): boolean {},
createSigner: function createSigner(options: {
keyId: string, // required
key: string | Buffer, // required
algorithm?: string, // required for HMAC
keyPassphrase?: string // required for HMAC
} | any): any {},
signRequest: function signRequest(request: http.ClientRequest, options: {
keyId: string, // required
key: string, // required
headers?: string[],
algorithm?: string,
httpVersion?: string,
strict?: boolean,
expiresIn?: number,
keyPassphrase?: string,
hideAlgorithm?: boolean
}): boolean {}
},
// utils.js
utils: {
// HASH_ALGOS: {
// sha1: boolean,
// sha256: boolean,
// sha512: boolean
// },
// PK_ALGOS: {
// rsa: boolean,
// dsa: boolean,
// ecdsa: boolean,
// ed25519: boolean
// },
// HEADER: {
// AUTH: string,
// SIG: string
// },
HttpSignatureError: function HttpSignatureError(message: any, caller: any): void {},
InvalidAlgorithmError: function InvalidAlgorithmError(message: string): void {},
validateAlgorithm: function validateAlgorithm(algorithm: string, publicKeyType: string | undefined): string[] {},
sshKeyToPEM: function sshKeyToPEM(key: string): string {},
fingerprint: function fingerprint(key: string): string {},
pemToRsaSSHKey: function pemToRsaSSHKey(pem: string, comment: string): string {}
},
// verify.js
verify: {
verifySignature: function verifySignature(parsedSignature: any, pubkey: string): boolean {},
verifyHMAC: function verifyHMAC(parsedSignature: any, secret: string): boolean {}
}
}
declare module '@peertube/http-signature' {
// index.js
export declare var parse: typeof package.parser.parseRequest;
export declare var parseRequest: typeof package.parser.parseRequest;
export declare var sign: typeof package.parser.parseRequest;
export declare var signRequest: typeof package.signer.signRequest;
export declare var createSigner: typeof package.signer.createSigner;
export declare var isSigner: typeof package.signer.isSigner;
export declare var sshKeyToPEM: typeof package.utils.sshKeyToPEM;
export declare var sshKeyFingerprint: typeof package.utils.fingerprint;
export declare var pemToRsaSSHKey: typeof package.utils.pemToRsaSSHKey;
export declare var verify: typeof package.verify.verifySignature;
export declare var verifySignature: typeof package.verify.verifySignature;
export declare var verifyHMAC: typeof package.verify.verifyHMAC;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hai!
I would like to request definitions for the package,
@peertube/http-signature
.My IDE suggests installing
@types/peertube__http-signature
if it exists. I tried finding a different package which already had type support, but was unsuccessful. I've also tried converting the package itself to typescript, however, I've been unable to get tapjs to cooperate.I'll just set a blank definition for now in my project and would like to request definitions for this specific version of http-signature. This one seems to be more up to date than the original package
Thanks,
Alexis
Beta Was this translation helpful? Give feedback.
All reactions