mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge pull request #22425 from DefinitelyTyped/not-needed-xadesjs
xadesjs: Provides its own types
This commit is contained in:
@@ -1194,6 +1194,12 @@
|
||||
"sourceRepoURL": "https://code.google.com/p/x2js/",
|
||||
"asOfVersion": "3.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "xadesjs",
|
||||
"typingsPackageName": "xadesjs",
|
||||
"sourceRepoURL": "https://github.com/PeculiarVentures/xadesjs",
|
||||
"asOfVersion": "2.0.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "xlsx",
|
||||
"typingsPackageName": "xlsx",
|
||||
|
||||
1085
types/xadesjs/index.d.ts
vendored
1085
types/xadesjs/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"xadesjs-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
let xmlString = "<root><child1/><child2/><child3/></root>";
|
||||
let xmlDoc = new DOMParser().parseFromString(xmlString, "application/xml");
|
||||
let signedXml = new xadesjs.SignedXml(xmlDoc);
|
||||
|
||||
let alg = {
|
||||
name: "ECDSA",
|
||||
namedCurve: "P-256"
|
||||
};
|
||||
xadesjs.Application.crypto.subtle.generateKey(
|
||||
alg,
|
||||
false,
|
||||
["sign", "verify"]
|
||||
)
|
||||
.then((keys: CryptoKeyPair) => {
|
||||
signedXml.SigningKey = keys.privateKey;
|
||||
|
||||
// Add the key to the SignedXml document.
|
||||
// Create a reference to be signed.
|
||||
let reference = new xadesjs.Reference();
|
||||
reference.Uri = "";
|
||||
// Add an enveloped transformation to the reference.
|
||||
reference.AddTransform(new xadesjs.XmlDsigEnvelopedSignatureTransform());
|
||||
// Add the reference to the SignedXml object.
|
||||
signedXml.AddReference(reference);
|
||||
// Set prefix for Signature namespace
|
||||
signedXml.Prefix = "ds";
|
||||
|
||||
// Compute the signature.
|
||||
return signedXml.ComputeSignature({ name: "ECDSA", hash: { name: "SHA-256" } } as any);
|
||||
})
|
||||
.then(function () {
|
||||
// Append signature
|
||||
let xmlDigitalSignature = signedXml.GetXml();
|
||||
xmlDoc.documentElement.appendChild(xmlDigitalSignature);
|
||||
|
||||
// Serialize XML document
|
||||
let signedDocument = new XMLSerializer().serializeToString(xmlDoc);
|
||||
return Promise.resolve(signedDocument);
|
||||
})
|
||||
.then((doc: string) => {
|
||||
console.log("Signed document:", doc);
|
||||
})
|
||||
// .catch((e: any) => {
|
||||
// console.error("Error", e);
|
||||
// });
|
||||
Reference in New Issue
Block a user