···25 newPds: '',
26 newEmail: '',
27 newHandle: '',
28+ inviteCode: null,
29 twoFactorCode: null,
30 confirmation: false,
31 showTwoFactorCodeInput: false,
···178179 <div class="form-group">
180 <label for="invite-code">Invite Code:</label>
181+ <input type="text" id="invite-code" name="invite-code" placeholder="Invite code from your new PDS (Leave blank if you don't have one)"
182+ x-model="inviteCode">
183 </div>
184 </div>
185 <div class="form-group">
+12-8
src/pdsmoover.js
···54 * @param {string} newPdsUrl - The new URL for your pds. Like https://coolnewpds.com
55 * @param {string} newEmail - The email you want to use on the new pds (can be the same as the previous one as long as it's not already being used on the new pds)
56 * @param {string} newHandle - The new handle you want, like alice.bsky.social, or if you already have a domain name set as a handle can use it myname.com.
57- * @param {string} inviteCode - The invite code you got from the PDS you are migrating to
58 * @param {function|null} statusUpdateHandler - a function that takes a string used to update the UI. Like (status) => console.log(status)
59 * @param {string|null} twoFactorCode - Optional, but needed if it fails with 2fa required
60 */
···114 });
115 const serviceJwt = createAuthResp.data.token;
116117- const createNewAccount = await newAgent.com.atproto.server.createAccount({
118 did: usersDid,
119 handle: newHandle,
120 email: newEmail,
121 password: password,
122- inviteCode: inviteCode,
123- },
124- {
125- headers: {authorization: `Bearer ${serviceJwt}`},
126- encoding: 'application/json',
127- });
0000128129 if (createNewAccount.data.did !== usersDid.toString()) {
130 throw new Error('Did not create the new account with the same did as the old account');
···54 * @param {string} newPdsUrl - The new URL for your pds. Like https://coolnewpds.com
55 * @param {string} newEmail - The email you want to use on the new pds (can be the same as the previous one as long as it's not already being used on the new pds)
56 * @param {string} newHandle - The new handle you want, like alice.bsky.social, or if you already have a domain name set as a handle can use it myname.com.
57+ * @param {string|null} inviteCode - The invite code you got from the PDS you are migrating to. If null does not include one
58 * @param {function|null} statusUpdateHandler - a function that takes a string used to update the UI. Like (status) => console.log(status)
59 * @param {string|null} twoFactorCode - Optional, but needed if it fails with 2fa required
60 */
···114 });
115 const serviceJwt = createAuthResp.data.token;
116117+ let createAccountRequest = {
118 did: usersDid,
119 handle: newHandle,
120 email: newEmail,
121 password: password,
122+ };
123+ if (inviteCode) {
124+ createAccountRequest.inviteCode = inviteCode;
125+ }
126+ const createNewAccount = await newAgent.com.atproto.server.createAccount(
127+ createAccountRequest,
128+ {
129+ headers: {authorization: `Bearer ${serviceJwt}`},
130+ encoding: 'application/json',
131+ });
132133 if (createNewAccount.data.did !== usersDid.toString()) {
134 throw new Error('Did not create the new account with the same did as the old account');