Skip to main content

ChangePassword

ChangePassword changes the password of the encrypted wallet. This will automatically unlock the wallet database if successful.

Source: walletunlocker.proto

gRPC

rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse);

REST

HTTP MethodPath
POST /v1/changepassword

Code Samples

const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_HOST = 'localhost:10009'
const TLS_PATH = 'LND_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync(['lightning.proto', 'walletunlocker.proto'], loaderOptions);
const lnrpc = grpc.loadPackageDefinition(packageDefinition).lnrpc;
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
const tlsCert = fs.readFileSync(TLS_PATH);
const sslCreds = grpc.credentials.createSsl(tlsCert);
let client = new lnrpc.WalletUnlocker(GRPC_HOST, sslCreds);
let request = {
current_password: <bytes>,
new_password: <bytes>,
stateless_init: <bool>,
new_macaroon_root_key: <bool>,
};
client.changePassword(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "admin_macaroon": <bytes>,
// }

Messages

lnrpc.ChangePasswordRequest

Source: walletunlocker.proto

FieldgRPC TypeREST TypeREST Placement
current_password
bytesstringbody
new_password
bytesstringbody
stateless_init
boolbooleanbody
new_macaroon_root_key
boolbooleanbody

lnrpc.ChangePasswordResponse

Source: walletunlocker.proto

FieldgRPC TypeREST Type
admin_macaroon
bytesstring