mirror of
https://github.com/danbulant/jose
synced 2026-05-20 04:48:52 +00:00
10 lines
495 B
JavaScript
10 lines
495 B
JavaScript
const { generateKeyPairSync, createSecretKey } = require('crypto')
|
|
|
|
// TODO: keep an eye out for utils.isCryptoKeyObject() for verifying inputs are already KeyObjects
|
|
const { publicKey, privateKey } = generateKeyPairSync('ec', { namedCurve: 'P-256' })
|
|
|
|
const PrivateKeyObject = privateKey.constructor
|
|
const PublicKeyObject = publicKey.constructor
|
|
const SecretKeyObject = createSecretKey(Buffer.allocUnsafe(1)).constructor
|
|
|
|
module.exports = { PrivateKeyObject, PublicKeyObject, SecretKeyObject }
|