@relaycorp/relaynet-core
Advanced tools
Comparing version 1.4.2 to 1.4.3
@@ -133,6 +133,3 @@ "use strict"; | ||
const curveParams = pkijsCrypto.getAlgorithmByOID(curveOid); | ||
const publicKey = await keys_1.derDeserializeECDHPublicKey(Buffer.from(publicKeyDer), { | ||
name: 'ECDH', | ||
namedCurve: curveParams.name, | ||
}); | ||
const publicKey = await keys_1.derDeserializeECDHPublicKey(Buffer.from(publicKeyDer), curveParams.name); | ||
return { keyId, publicKey }; | ||
@@ -139,0 +136,0 @@ } |
@@ -18,4 +18,4 @@ /// <reference types="node" /> | ||
export declare function derDeserializeRSAPublicKey(publicKeyDer: Buffer, algorithmOptions: RsaHashedImportParams): Promise<CryptoKey>; | ||
export declare function derDeserializeECDHPublicKey(publicKeyDer: Buffer, algorithmOptions: EcKeyImportParams): Promise<CryptoKey>; | ||
export declare function derDeserializeRSAPrivateKey(publicKeyDer: Buffer, algorithmOptions: RsaHashedImportParams): Promise<CryptoKey>; | ||
export declare function derDeserializeECDHPrivateKey(publicKeyDer: Buffer, algorithmOptions: EcKeyImportParams): Promise<CryptoKey>; | ||
export declare function derDeserializeECDHPublicKey(publicKeyDer: Buffer, curveName?: NamedCurve): Promise<CryptoKey>; | ||
export declare function derDeserializeRSAPrivateKey(privateKeyDer: Buffer, algorithmOptions: RsaHashedImportParams): Promise<CryptoKey>; | ||
export declare function derDeserializeECDHPrivateKey(privateKeyDer: Buffer, curveName?: NamedCurve): Promise<CryptoKey>; |
@@ -61,8 +61,8 @@ "use strict"; | ||
exports.derDeserializeRSAPublicKey = derDeserializeRSAPublicKey; | ||
async function derDeserializeECDHPublicKey(publicKeyDer, algorithmOptions) { | ||
return cryptoEngine.importKey('spki', buffer_to_arraybuffer_1.default(publicKeyDer), algorithmOptions, true, []); | ||
async function derDeserializeECDHPublicKey(publicKeyDer, curveName = 'P-256') { | ||
return cryptoEngine.importKey('spki', buffer_to_arraybuffer_1.default(publicKeyDer), { name: 'ECDH', namedCurve: curveName }, true, []); | ||
} | ||
exports.derDeserializeECDHPublicKey = derDeserializeECDHPublicKey; | ||
async function derDeserializeRSAPrivateKey(publicKeyDer, algorithmOptions) { | ||
return cryptoEngine.importKey('pkcs8', buffer_to_arraybuffer_1.default(publicKeyDer), algorithmOptions, true, [ | ||
async function derDeserializeRSAPrivateKey(privateKeyDer, algorithmOptions) { | ||
return cryptoEngine.importKey('pkcs8', buffer_to_arraybuffer_1.default(privateKeyDer), algorithmOptions, true, [ | ||
'sign', | ||
@@ -72,7 +72,4 @@ ]); | ||
exports.derDeserializeRSAPrivateKey = derDeserializeRSAPrivateKey; | ||
async function derDeserializeECDHPrivateKey(publicKeyDer, algorithmOptions) { | ||
return cryptoEngine.importKey('pkcs8', buffer_to_arraybuffer_1.default(publicKeyDer), algorithmOptions, true, [ | ||
'deriveBits', | ||
'deriveKey', | ||
]); | ||
async function derDeserializeECDHPrivateKey(privateKeyDer, curveName = 'P-256') { | ||
return cryptoEngine.importKey('pkcs8', buffer_to_arraybuffer_1.default(privateKeyDer), { name: 'ECDH', namedCurve: curveName }, true, ['deriveBits', 'deriveKey']); | ||
} | ||
@@ -79,0 +76,0 @@ exports.derDeserializeECDHPrivateKey = derDeserializeECDHPrivateKey; |
@@ -5,4 +5,4 @@ /** | ||
export interface SessionStore { | ||
readonly getPrivateKey: (dhPrivateKeyId: number, recipientPublicKey: CryptoKey) => Promise<CryptoKey>; | ||
readonly savePrivateKey: (dhPrivateKey: CryptoKey, dhPrivateKeyId: number, recipientPublicKey: CryptoKey) => Promise<void>; | ||
readonly getPrivateKey: (dhKeyPairId: number, recipientPublicKey: CryptoKey) => Promise<CryptoKey>; | ||
readonly savePrivateKey: (dhPrivateKey: CryptoKey, dhKeyPairId: number, recipientPublicKey: CryptoKey) => Promise<void>; | ||
} |
@@ -119,6 +119,3 @@ // tslint:disable:no-object-mutation max-classes-per-file | ||
const curveParams = pkijsCrypto.getAlgorithmByOID(curveOid); | ||
const publicKey = await derDeserializeECDHPublicKey(Buffer.from(publicKeyDer), { | ||
name: 'ECDH', | ||
namedCurve: curveParams.name, | ||
}); | ||
const publicKey = await derDeserializeECDHPublicKey(Buffer.from(publicKeyDer), curveParams.name); | ||
return { keyId, publicKey }; | ||
@@ -125,0 +122,0 @@ } |
@@ -18,4 +18,4 @@ /// <reference types="node" /> | ||
export declare function derDeserializeRSAPublicKey(publicKeyDer: Buffer, algorithmOptions: RsaHashedImportParams): Promise<CryptoKey>; | ||
export declare function derDeserializeECDHPublicKey(publicKeyDer: Buffer, algorithmOptions: EcKeyImportParams): Promise<CryptoKey>; | ||
export declare function derDeserializeRSAPrivateKey(publicKeyDer: Buffer, algorithmOptions: RsaHashedImportParams): Promise<CryptoKey>; | ||
export declare function derDeserializeECDHPrivateKey(publicKeyDer: Buffer, algorithmOptions: EcKeyImportParams): Promise<CryptoKey>; | ||
export declare function derDeserializeECDHPublicKey(publicKeyDer: Buffer, curveName?: NamedCurve): Promise<CryptoKey>; | ||
export declare function derDeserializeRSAPrivateKey(privateKeyDer: Buffer, algorithmOptions: RsaHashedImportParams): Promise<CryptoKey>; | ||
export declare function derDeserializeECDHPrivateKey(privateKeyDer: Buffer, curveName?: NamedCurve): Promise<CryptoKey>; |
@@ -51,17 +51,14 @@ import bufferToArray from 'buffer-to-arraybuffer'; | ||
} | ||
export async function derDeserializeECDHPublicKey(publicKeyDer, algorithmOptions) { | ||
return cryptoEngine.importKey('spki', bufferToArray(publicKeyDer), algorithmOptions, true, []); | ||
export async function derDeserializeECDHPublicKey(publicKeyDer, curveName = 'P-256') { | ||
return cryptoEngine.importKey('spki', bufferToArray(publicKeyDer), { name: 'ECDH', namedCurve: curveName }, true, []); | ||
} | ||
export async function derDeserializeRSAPrivateKey(publicKeyDer, algorithmOptions) { | ||
return cryptoEngine.importKey('pkcs8', bufferToArray(publicKeyDer), algorithmOptions, true, [ | ||
export async function derDeserializeRSAPrivateKey(privateKeyDer, algorithmOptions) { | ||
return cryptoEngine.importKey('pkcs8', bufferToArray(privateKeyDer), algorithmOptions, true, [ | ||
'sign', | ||
]); | ||
} | ||
export async function derDeserializeECDHPrivateKey(publicKeyDer, algorithmOptions) { | ||
return cryptoEngine.importKey('pkcs8', bufferToArray(publicKeyDer), algorithmOptions, true, [ | ||
'deriveBits', | ||
'deriveKey', | ||
]); | ||
export async function derDeserializeECDHPrivateKey(privateKeyDer, curveName = 'P-256') { | ||
return cryptoEngine.importKey('pkcs8', bufferToArray(privateKeyDer), { name: 'ECDH', namedCurve: curveName }, true, ['deriveBits', 'deriveKey']); | ||
} | ||
//endregion | ||
//# sourceMappingURL=keys.js.map |
@@ -5,4 +5,4 @@ /** | ||
export interface SessionStore { | ||
readonly getPrivateKey: (dhPrivateKeyId: number, recipientPublicKey: CryptoKey) => Promise<CryptoKey>; | ||
readonly savePrivateKey: (dhPrivateKey: CryptoKey, dhPrivateKeyId: number, recipientPublicKey: CryptoKey) => Promise<void>; | ||
readonly getPrivateKey: (dhKeyPairId: number, recipientPublicKey: CryptoKey) => Promise<CryptoKey>; | ||
readonly savePrivateKey: (dhPrivateKey: CryptoKey, dhKeyPairId: number, recipientPublicKey: CryptoKey) => Promise<void>; | ||
} |
{ | ||
"name": "@relaycorp/relaynet-core", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "email": "no-reply@relaycorp.tech", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
190311
2699