Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Core
import * as webcrypto from "webcrypto-core";
const WebCryptoError = webcrypto.WebCryptoError;
const Base64Url = webcrypto.Base64Url;
import { IAlgorithm, ITemplate, KeyGenMechanism, KeyType, ObjectClass, SecretKey, Session } from "graphene-pk11";
import * as graphene from "graphene-pk11";
import { BaseCrypto } from "../base";
import { CryptoKey } from "../key";
import * as utils from "../utils";
export function create_template(session: Session, alg: AesKeyGenParams, extractable: boolean, keyUsages: string[]): ITemplate {
const id = utils.GUID(session);
return {
token: !!process.env.WEBCRYPTO_PKCS11_TOKEN,
sensitive: !!process.env.WEBCRYPTO_PKCS11_SENSITIVE,
class: ObjectClass.SECRET_KEY,
keyType: KeyType.AES,
// Core
import * as webcrypto from "webcrypto-core";
const WebCryptoError = webcrypto.WebCryptoError;
const AlgorithmError = webcrypto.AlgorithmError;
const Base64Url = webcrypto.Base64Url;
import {
IAlgorithm,
ITemplate,
KeyGenMechanism,
KeyType,
MechanismEnum,
ObjectClass,
PrivateKey,
PublicKey,
RsaMgf,
Session,
} from "graphene-pk11";
import * as graphene from "graphene-pk11";
import { BaseCrypto } from "../base";
// Core
import * as webcrypto from "webcrypto-core";
const AlgorithmError = webcrypto.AlgorithmError;
const Base64Url = webcrypto.Base64Url;
import {
EcKdf,
IAlgorithm,
INamedCurve,
ITemplate,
KeyGenMechanism,
KeyType,
NamedCurve,
ObjectClass,
Session,
} from "graphene-pk11";
import * as graphene from "graphene-pk11";
import * as aes from "./aes";
import { BaseCrypto } from "../base";
function b64_decode(b64url: string): Buffer {
return Buffer.from(Core.Base64Url.decode(b64url));
}