Encrypting Xpriv with BIP38 in Bitcore

I was wondering if anyone has a sample of encrypting a xprv with a password in Bitcore. It seems trivial to do with this BIP38 js library

but I was wondering if it is possible to do it simply with Bitcore

This should work:

var Bip38 = require('bip38');
var bitcore = require('bitcore');
var privateKey = bitcore.PrivateKey(bitcore.Networks.testnet) // new random key
var privateKeyWif = privateKey.toWIF();
var address = privateKey.toAddress().toString();
var bip38 = new Bip38({private: 0xef});
var encrypted = bip38.encrypt(privateKeyWif, "super-secret", address);