const SEA = require('gun/sea');
// 生成密钥对
SEA.pair().then((pair)=>{
// 输出提示信息
console.log('This is your secret app key pair.\nAdd this to your .dotenv file:');
// 将生成的密钥对转换为 JSON 格式并输出
console.log(`APP_KEY_PAIR='${JSON.stringify(pair)}'`);});
输出:
$ node ./generateAppKey.js
Hello wonderful person!:) Thanks for using GUN, please ask forhelp on http://chat.gun.eco if anything takes you longer than 5min to figure out!
This is your secret app key pair.
Add this to your .dotenv file:
APP_KEY_PAIR='{"pub":"B14-m6S3i1cgm9bJCsED0FsGbHiDlXJAiKK2OnrPSj0.axmMDTmbdAfU3SjJhgqOn6mH6jDUoazcQ_vHljstyuE","priv":"21kawgH1yBwDLSf4yh63A_AdAja4hh-Q5h_ob_LF-VE","epub":"Z-IWo4zkzXyEL5hWCmvQLY8aoxupbZmJZmKFMDhNJ0U.hoNigMrVpc2npPR17tjOyZchJKk1D8wlQKPCIKZNF_w","epriv":"UUO2sHWG1lrQLNr0t9ObSEHyiasCc_D2HdJS-Vw2FmI"}'
Done in0.77s.