graphene-pk11
Advanced tools
Comparing version 2.3.1 to 2.3.2
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.attribute = void 0; | ||
const template_1 = require("../template"); | ||
function attribute(name, defaultValue) { | ||
return (target, propertyKey) => { | ||
(0, template_1.getAttribute)(name); | ||
const descriptor = Object.getOwnPropertyDescriptor(target, propertyKey) || {}; | ||
@@ -7,0 +9,0 @@ descriptor.get = function () { |
@@ -28,3 +28,3 @@ "use strict"; | ||
tslib_1.__decorate([ | ||
(0, core_1.attribute)("spi") | ||
(0, core_1.attribute)("ski") | ||
], WtlsCertificate.prototype, "subjectKeyIdentifier", void 0); | ||
@@ -31,0 +31,0 @@ tslib_1.__decorate([ |
@@ -43,7 +43,7 @@ "use strict"; | ||
tslib_1.__decorate([ | ||
(0, core_1.attribute)("wrapTrusted", false) | ||
(0, core_1.attribute)("wrapWithTrusted", false) | ||
], PrivateKey.prototype, "wrapTrusted", void 0); | ||
tslib_1.__decorate([ | ||
(0, core_1.attribute)("alwaysAuthenticate", false) | ||
(0, core_1.attribute)("alwaysAuth", false) | ||
], PrivateKey.prototype, "alwaysAuthenticate", void 0); | ||
exports.PrivateKey = PrivateKey; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.registerAttribute = exports.Template = void 0; | ||
exports.registerAttribute = exports.Template = exports.getAttribute = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -73,5 +73,5 @@ const pkcs11 = tslib_1.__importStar(require("pkcs11js")); | ||
secondaryAuth: { v: pkcs11.CKA_SECONDARY_AUTH, t: TYPE_BOOL }, | ||
authPinFlags: { v: pkcs11.CKA_AUTH_PIN_FLAGS, t: TYPE_BUFFER }, | ||
alwaysAuth: { v: pkcs11.CKA_ALWAYS_AUTHENTICATE, t: TYPE_BUFFER }, | ||
wrapWithTrusted: { v: pkcs11.CKA_WRAP_WITH_TRUSTED, t: TYPE_BUFFER }, | ||
authPinFlags: { v: pkcs11.CKA_AUTH_PIN_FLAGS, t: TYPE_NUMBER }, | ||
alwaysAuth: { v: pkcs11.CKA_ALWAYS_AUTHENTICATE, t: TYPE_BOOL }, | ||
wrapWithTrusted: { v: pkcs11.CKA_WRAP_WITH_TRUSTED, t: TYPE_BOOL }, | ||
wrapTemplate: { v: pkcs11.CKA_WRAP_TEMPLATE, t: TYPE_BUFFER }, | ||
@@ -153,2 +153,3 @@ unwrapTemplate: { v: pkcs11.CKA_UNWRAP_TEMPLATE, t: TYPE_BUFFER }, | ||
} | ||
exports.getAttribute = getAttribute; | ||
class Template { | ||
@@ -155,0 +156,0 @@ static toPkcs11(tmpl) { |
@@ -0,3 +1,5 @@ | ||
import { getAttribute } from "../template"; | ||
export function attribute(name, defaultValue) { | ||
return (target, propertyKey) => { | ||
getAttribute(name); | ||
const descriptor = Object.getOwnPropertyDescriptor(target, propertyKey) || {}; | ||
@@ -4,0 +6,0 @@ descriptor.get = function () { |
@@ -25,3 +25,3 @@ import { __decorate } from "tslib"; | ||
__decorate([ | ||
attribute("spi") | ||
attribute("ski") | ||
], WtlsCertificate.prototype, "subjectKeyIdentifier", void 0); | ||
@@ -28,0 +28,0 @@ __decorate([ |
@@ -40,6 +40,6 @@ import { __decorate } from "tslib"; | ||
__decorate([ | ||
attribute("wrapTrusted", false) | ||
attribute("wrapWithTrusted", false) | ||
], PrivateKey.prototype, "wrapTrusted", void 0); | ||
__decorate([ | ||
attribute("alwaysAuthenticate", false) | ||
attribute("alwaysAuth", false) | ||
], PrivateKey.prototype, "alwaysAuthenticate", void 0); |
@@ -69,5 +69,5 @@ import * as pkcs11 from "pkcs11js"; | ||
secondaryAuth: { v: pkcs11.CKA_SECONDARY_AUTH, t: TYPE_BOOL }, | ||
authPinFlags: { v: pkcs11.CKA_AUTH_PIN_FLAGS, t: TYPE_BUFFER }, | ||
alwaysAuth: { v: pkcs11.CKA_ALWAYS_AUTHENTICATE, t: TYPE_BUFFER }, | ||
wrapWithTrusted: { v: pkcs11.CKA_WRAP_WITH_TRUSTED, t: TYPE_BUFFER }, | ||
authPinFlags: { v: pkcs11.CKA_AUTH_PIN_FLAGS, t: TYPE_NUMBER }, | ||
alwaysAuth: { v: pkcs11.CKA_ALWAYS_AUTHENTICATE, t: TYPE_BOOL }, | ||
wrapWithTrusted: { v: pkcs11.CKA_WRAP_WITH_TRUSTED, t: TYPE_BOOL }, | ||
wrapTemplate: { v: pkcs11.CKA_WRAP_TEMPLATE, t: TYPE_BUFFER }, | ||
@@ -141,3 +141,3 @@ unwrapTemplate: { v: pkcs11.CKA_UNWRAP_TEMPLATE, t: TYPE_BUFFER }, | ||
} | ||
function getAttribute(name) { | ||
export function getAttribute(name) { | ||
for (const key in attribute) { | ||
@@ -144,0 +144,0 @@ if (key === name) { |
@@ -407,3 +407,20 @@ /// <reference types="node" /> | ||
export declare type AttributeItemType = "number" | "boolean" | "string" | "buffer" | "date"; | ||
interface IAttributeItem { | ||
/** | ||
* Value of Attribute type (CKA_...) | ||
*/ | ||
v: number; | ||
/** | ||
* Type of Attribute | ||
*/ | ||
t: AttributeItemType; | ||
} | ||
/** | ||
* Gets attribute item by name | ||
* @param name Attribute name | ||
* @returns Attribute item | ||
* @throws {@link Error} if attribute name is not registered | ||
*/ | ||
export declare function getAttribute(name: string): IAttributeItem; | ||
/** | ||
* Static class that allows to convert graphene template to pkcs11js template and back | ||
@@ -432,1 +449,2 @@ */ | ||
export declare function registerAttribute(name: string, value: number, type: AttributeItemType): void; | ||
export {}; |
{ | ||
"name": "graphene-pk11", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"description": "A simple layer for interacting with PKCS #11 / PKCS11 / CryptoKI for Node in TypeScript", | ||
@@ -44,3 +44,3 @@ "main": "./build/cjs/index.js", | ||
"@types/mocha": "^9.1.1", | ||
"@types/node": "^18.0.0", | ||
"@types/node": "^18.6.1", | ||
"coveralls": "^3.1.0", | ||
@@ -50,5 +50,5 @@ "mocha": "^10.0.0", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^10.8.1", | ||
"ts-node": "^10.9.1", | ||
"tslint": "^6.1.3", | ||
"typedoc": "^0.22.17", | ||
"typedoc": "^0.23.9", | ||
"typescript": "^4.7.4" | ||
@@ -55,0 +55,0 @@ }, |
325237
7847