mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
pkcs11js: Provides its own types (#15597)
This commit is contained in:
@@ -264,6 +264,12 @@
|
||||
"sourceRepoURL": "https://github.com/pixijs/pixi-spine",
|
||||
"asOfVersion": "1.4.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "pkcs11js",
|
||||
"typingsPackageName": "pkcs11js",
|
||||
"sourceRepoURL": "https://github.com/PeculiarVentures/pkcs11js",
|
||||
"asOfVersion": "1.0.4"
|
||||
},
|
||||
{
|
||||
"libraryName": "poly2tri.js",
|
||||
"typingsPackageName": "poly2tri",
|
||||
|
||||
1
types/graphene-pk11/index.d.ts
vendored
1
types/graphene-pk11/index.d.ts
vendored
@@ -4,7 +4,6 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
/// <reference types="pkcs11js" />
|
||||
|
||||
/**
|
||||
* A simple layer for interacting with PKCS #11 / PKCS11 / CryptoKI for Node
|
||||
|
||||
5
types/graphene-pk11/package.json
Normal file
5
types/graphene-pk11/package.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"pkcs11js": "^1.0.8"
|
||||
}
|
||||
}
|
||||
1229
types/pkcs11js/index.d.ts
vendored
1229
types/pkcs11js/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,45 +0,0 @@
|
||||
import * as pkcs11js from "pkcs11js";
|
||||
|
||||
const libPath = "C:\\tmp\\rtpkcs11ecp.dll";
|
||||
|
||||
let pkcs11 = new pkcs11js.PKCS11();
|
||||
pkcs11.load(libPath);
|
||||
|
||||
pkcs11.C_Initialize();
|
||||
|
||||
try {
|
||||
// Getting info about PKCS11 Module
|
||||
let module_info = pkcs11.C_GetInfo();
|
||||
|
||||
// Getting list of slots
|
||||
let slots = pkcs11.C_GetSlotList(true);
|
||||
let slot = slots[0];
|
||||
|
||||
// Getting info about slot
|
||||
let slot_info = pkcs11.C_GetSlotInfo(slot);
|
||||
// Getting info about token
|
||||
let token_info = pkcs11.C_GetTokenInfo(slot);
|
||||
|
||||
// Getting info about Mechanism
|
||||
let mechs = pkcs11.C_GetMechanismList(slot);
|
||||
let mech_info = pkcs11.C_GetMechanismInfo(slot, mechs[0]);
|
||||
|
||||
let session = pkcs11.C_OpenSession(slot, pkcs11js.CKF_RW_SESSION | pkcs11js.CKF_SERIAL_SESSION);
|
||||
|
||||
// Getting info about Session
|
||||
let info = pkcs11.C_GetSessionInfo(session);
|
||||
pkcs11.C_Login(session, 1, "12345678");
|
||||
|
||||
/**
|
||||
* Your app code here
|
||||
*/
|
||||
|
||||
pkcs11.C_Logout(session);
|
||||
pkcs11.C_CloseSession(session);
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
finally {
|
||||
pkcs11.C_Finalize();
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"pkcs11js-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user