github.com/decred/dcrlnd@v0.7.6/lnrpc/walletunlocker.proto (about) 1 syntax = "proto3"; 2 3 import "lightning.proto"; 4 5 package lnrpc; 6 7 option go_package = "github.com/decred/dcrlnd/lnrpc"; 8 9 /* 10 * Comments in this file will be directly parsed into the API 11 * Documentation as descriptions of the associated method, message, or field. 12 * These descriptions should go right above the definition of the object, and 13 * can be in either block or // comment format. 14 * 15 * An RPC method can be matched to an lncli command by placing a line in the 16 * beginning of the description in exactly the following format: 17 * lncli: `methodname` 18 * 19 * Failure to specify the exact name of the command will cause documentation 20 * generation to fail. 21 * 22 * More information on how exactly the gRPC documentation is generated from 23 * this proto file can be found here: 24 * https://github.com/lightninglabs/lightning-api 25 */ 26 27 // WalletUnlocker is a service that is used to set up a wallet password for 28 // lnd at first startup, and unlock a previously set up wallet. 29 service WalletUnlocker { 30 /* 31 GenSeed is the first method that should be used to instantiate a new lnd 32 instance. This method allows a caller to generate a new aezeed cipher seed 33 given an optional passphrase. If provided, the passphrase will be necessary 34 to decrypt the cipherseed to expose the internal wallet seed. 35 36 Once the cipherseed is obtained and verified by the user, the InitWallet 37 method should be used to commit the newly generated seed, and create the 38 wallet. 39 */ 40 rpc GenSeed (GenSeedRequest) returns (GenSeedResponse); 41 42 /* 43 InitWallet is used when lnd is starting up for the first time to fully 44 initialize the daemon and its internal wallet. At the very least a wallet 45 password must be provided. This will be used to encrypt sensitive material 46 on disk. 47 48 In the case of a recovery scenario, the user can also specify their aezeed 49 mnemonic and passphrase. If set, then the daemon will use this prior state 50 to initialize its internal wallet. 51 52 Alternatively, this can be used along with the GenSeed RPC to obtain a 53 seed, then present it to the user. Once it has been verified by the user, 54 the seed can be fed into this RPC in order to commit the new wallet. 55 */ 56 rpc InitWallet (InitWalletRequest) returns (InitWalletResponse); 57 58 /* lncli: `unlock` 59 UnlockWallet is used at startup of lnd to provide a password to unlock 60 the wallet database. 61 */ 62 rpc UnlockWallet (UnlockWalletRequest) returns (UnlockWalletResponse); 63 64 /* lncli: `changepassword` 65 ChangePassword changes the password of the encrypted wallet. This will 66 automatically unlock the wallet database if successful. 67 */ 68 rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse); 69 } 70 71 message GenSeedRequest { 72 /* 73 aezeed_passphrase is an optional user provided passphrase that will be used 74 to encrypt the generated aezeed cipher seed. When using REST, this field 75 must be encoded as base64. 76 */ 77 bytes aezeed_passphrase = 1; 78 79 /* 80 seed_entropy is an optional 16-bytes generated via CSPRNG. If not 81 specified, then a fresh set of randomness will be used to create the seed. 82 When using REST, this field must be encoded as base64. 83 */ 84 bytes seed_entropy = 2; 85 } 86 message GenSeedResponse { 87 /* 88 cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed 89 cipher seed obtained by the user. This field is optional, as if not 90 provided, then the daemon will generate a new cipher seed for the user. 91 Otherwise, then the daemon will attempt to recover the wallet state linked 92 to this cipher seed. 93 */ 94 repeated string cipher_seed_mnemonic = 1; 95 96 /* 97 enciphered_seed are the raw aezeed cipher seed bytes. This is the raw 98 cipher text before run through our mnemonic encoding scheme. 99 */ 100 bytes enciphered_seed = 2; 101 } 102 103 message InitWalletRequest { 104 /* 105 wallet_password is the passphrase that should be used to encrypt the 106 wallet. This MUST be at least 8 chars in length. After creation, this 107 password is required to unlock the daemon. When using REST, this field 108 must be encoded as base64. 109 */ 110 bytes wallet_password = 1; 111 112 /* 113 cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed 114 cipher seed obtained by the user. This may have been generated by the 115 GenSeed method, or be an existing seed. 116 */ 117 repeated string cipher_seed_mnemonic = 2; 118 119 /* 120 aezeed_passphrase is an optional user provided passphrase that will be used 121 to encrypt the generated aezeed cipher seed. When using REST, this field 122 must be encoded as base64. 123 */ 124 bytes aezeed_passphrase = 3; 125 126 /* 127 recovery_window is an optional argument specifying the address lookahead 128 when restoring a wallet seed. The recovery window applies to each 129 individual branch of the BIP44 derivation paths. Supplying a recovery 130 window of zero indicates that no addresses should be recovered, such after 131 the first initialization of the wallet. 132 */ 133 int32 recovery_window = 4; 134 135 /* 136 channel_backups is an optional argument that allows clients to recover the 137 settled funds within a set of channels. This should be populated if the 138 user was unable to close out all channels and sweep funds before partial or 139 total data loss occurred. If specified, then after on-chain recovery of 140 funds, lnd begin to carry out the data loss recovery protocol in order to 141 recover the funds in each channel from a remote force closed transaction. 142 */ 143 ChanBackupSnapshot channel_backups = 5; 144 145 /* 146 stateless_init is an optional argument instructing the daemon NOT to create 147 any *.macaroon files in its filesystem. If this parameter is set, then the 148 admin macaroon returned in the response MUST be stored by the caller of the 149 RPC as otherwise all access to the daemon will be lost! 150 */ 151 bool stateless_init = 6; 152 153 /* 154 extended_master_key is an alternative to specifying cipher_seed_mnemonic and 155 aezeed_passphrase. Instead of deriving the master root key from the entropy 156 of an aezeed cipher seed, the given extended master root key is used 157 directly as the wallet's master key. This allows users to import/use a 158 master key from another wallet. When doing so, lnd still uses its default 159 SegWit only (BIP49/84) derivation paths and funds from custom/non-default 160 derivation paths will not automatically appear in the on-chain wallet. Using 161 an 'xprv' instead of an aezeed also has the disadvantage that the wallet's 162 birthday is not known as that is an information that's only encoded in the 163 aezeed, not the xprv. Therefore a birthday needs to be specified in 164 extended_master_key_birthday_timestamp or a "safe" default value will be 165 used. 166 */ 167 string extended_master_key = 7; 168 169 /* 170 extended_master_key_birthday_timestamp is the optional unix timestamp in 171 seconds to use as the wallet's birthday when using an extended master key 172 to restore the wallet. lnd will only start scanning for funds in blocks that 173 are after the birthday which can speed up the process significantly. If the 174 birthday is not known, this should be left at its default value of 0 in 175 which case lnd will start scanning from the first SegWit block (481824 on 176 mainnet). 177 */ 178 uint64 extended_master_key_birthday_timestamp = 8; 179 180 /* 181 watch_only is the third option of initializing a wallet: by importing 182 account xpubs only and therefore creating a watch-only wallet that does not 183 contain any private keys. That means the wallet won't be able to sign for 184 any of the keys and _needs_ to be run with a remote signer that has the 185 corresponding private keys and can serve signing RPC requests. 186 */ 187 WatchOnly watch_only = 9; 188 } 189 message InitWalletResponse { 190 /* 191 The binary serialized admin macaroon that can be used to access the daemon 192 after creating the wallet. If the stateless_init parameter was set to true, 193 this is the ONLY copy of the macaroon and MUST be stored safely by the 194 caller. Otherwise a copy of this macaroon is also persisted on disk by the 195 daemon, together with other macaroon files. 196 */ 197 bytes admin_macaroon = 1; 198 } 199 200 message WatchOnly { 201 /* 202 The unix timestamp in seconds of when the master key was created. lnd will 203 only start scanning for funds in blocks that are after the birthday which 204 can speed up the process significantly. If the birthday is not known, this 205 should be left at its default value of 0 in which case lnd will start 206 scanning from the first SegWit block (481824 on mainnet). 207 */ 208 uint64 master_key_birthday_timestamp = 1; 209 210 /* 211 The fingerprint of the root key (also known as the key with derivation path 212 m/) from which the account public keys were derived from. This may be 213 required by some hardware wallets for proper identification and signing. The 214 bytes must be in big-endian order. 215 */ 216 bytes master_key_fingerprint = 2; 217 218 /* 219 The list of accounts to import. There _must_ be an account for all of lnd's 220 main key scopes: BIP49/BIP84 (m/49'/0'/0', m/84'/0'/0', note that the 221 coin type is always 0, even for testnet/regtest) and lnd's internal key 222 scope (m/1017'/<coin_type>'/<account>'), where account is the key family as 223 defined in `keychain/derivation.go` (currently indices 0 to 9). 224 */ 225 repeated WatchOnlyAccount accounts = 3; 226 } 227 228 message WatchOnlyAccount { 229 /* 230 Purpose is the first number in the derivation path, must be either 49, 84 231 or 1017. 232 */ 233 uint32 purpose = 1; 234 235 /* 236 Coin type is the second number in the derivation path, this is _always_ 0 237 for purposes 49 and 84. It only needs to be set to 1 for purpose 1017 on 238 testnet or regtest. 239 */ 240 uint32 coin_type = 2; 241 242 /* 243 Account is the third number in the derivation path. For purposes 49 and 84 244 at least the default account (index 0) needs to be created but optional 245 additional accounts are allowed. For purpose 1017 there needs to be exactly 246 one account for each of the key families defined in `keychain/derivation.go` 247 (currently indices 0 to 9) 248 */ 249 uint32 account = 3; 250 251 /* 252 The extended public key at depth 3 for the given account. 253 */ 254 string xpub = 4; 255 } 256 257 message UnlockWalletRequest { 258 /* 259 wallet_password should be the current valid passphrase for the daemon. This 260 will be required to decrypt on-disk material that the daemon requires to 261 function properly. When using REST, this field must be encoded as base64. 262 */ 263 bytes wallet_password = 1; 264 265 /* 266 recovery_window is an optional argument specifying the address lookahead 267 when restoring a wallet seed. The recovery window applies to each 268 individual branch of the BIP44 derivation paths. Supplying a recovery 269 window of zero indicates that no addresses should be recovered, such after 270 the first initialization of the wallet. 271 */ 272 int32 recovery_window = 2; 273 274 /* 275 channel_backups is an optional argument that allows clients to recover the 276 settled funds within a set of channels. This should be populated if the 277 user was unable to close out all channels and sweep funds before partial or 278 total data loss occurred. If specified, then after on-chain recovery of 279 funds, lnd begin to carry out the data loss recovery protocol in order to 280 recover the funds in each channel from a remote force closed transaction. 281 */ 282 ChanBackupSnapshot channel_backups = 3; 283 284 /* 285 dcrw_client_key_cert is a key and cert blob generated by dcrwallet used to 286 authenticate grpc connections to it. 287 */ 288 bytes dcrw_client_key_cert = 901; 289 290 /* 291 stateless_init is an optional argument instructing the daemon NOT to create 292 any *.macaroon files in its file system. 293 */ 294 bool stateless_init = 4; 295 } 296 message UnlockWalletResponse { 297 /* 298 The binary serialized admin macaroon that can be used to access the daemon 299 after rotating the macaroon root key. If both the stateless_init and 300 new_macaroon_root_key parameter were set to true, this is the ONLY copy of 301 the macaroon that was created from the new root key and MUST be stored 302 safely by the caller. Otherwise a copy of this macaroon is also persisted on 303 disk by the daemon, together with other macaroon files. 304 */ 305 bytes admin_macaroon = 901; 306 } 307 308 message ChangePasswordRequest { 309 /* 310 current_password should be the current valid passphrase used to unlock the 311 daemon. When using REST, this field must be encoded as base64. 312 */ 313 bytes current_password = 1; 314 315 /* 316 new_password should be the new passphrase that will be needed to unlock the 317 daemon. When using REST, this field must be encoded as base64. 318 */ 319 bytes new_password = 2; 320 321 /* 322 stateless_init is an optional argument instructing the daemon NOT to create 323 any *.macaroon files in its filesystem. If this parameter is set, then the 324 admin macaroon returned in the response MUST be stored by the caller of the 325 RPC as otherwise all access to the daemon will be lost! 326 */ 327 bool stateless_init = 3; 328 329 /* 330 new_macaroon_root_key is an optional argument instructing the daemon to 331 rotate the macaroon root key when set to true. This will invalidate all 332 previously generated macaroons. 333 */ 334 bool new_macaroon_root_key = 4; 335 } 336 message ChangePasswordResponse { 337 /* 338 The binary serialized admin macaroon that can be used to access the daemon 339 after rotating the macaroon root key. If both the stateless_init and 340 new_macaroon_root_key parameter were set to true, this is the ONLY copy of 341 the macaroon that was created from the new root key and MUST be stored 342 safely by the caller. Otherwise a copy of this macaroon is also persisted on 343 disk by the daemon, together with other macaroon files. 344 */ 345 bytes admin_macaroon = 1; 346 }