( 물론 스팀커넥트 자체가 해킹당하면 뭐 어쩔 수 없지만 현재까진 그런적은 없으니 안심하셔도 될거에요.. )
/*
REF :
https://github.com/steemit/steem-js/issues/165
https://steemit.com/steem/@good-karma/steem-multi-authority-permissions-and-how-active-authority-works-part-2-f158813ec0ec1
https://steemit.com/piston/@xeroc/piston-how-to-use-it-for-multisignature-accounts
*/
const steem = require('steem');
const MY_ACCOUNT = 'my_account_name'; // 내 계정명
const MY_ACCOUNT_OWNER_KEY = '5xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // 내 계정의 OWNER 키
const ADD_ACCOUNT = 'add_account_name'; // 추가 하려는 계정명
steem.api.getAccounts([ MY_ACCOUNT ], function(err, response){
if (response) {
const account = response[0];
const MY_JSON_META = account.json_metadata;
const MY_MEMO_KEY = account.memo_key;
let ownerAuth = account.owner;
let activeAuth = account.active;
let postingAuth = account.posting;
// 계정 권한을 추가한다
ownerAuth.account_auths.push([ADD_ACCOUNT, ownerAuth.weight_threshold]);
activeAuth.account_auths.push([ADD_ACCOUNT, activeAuth.weight_threshold]);
postingAuth.account_auths.push([ADD_ACCOUNT, postingAuth.weight_threshold]);
/*
* - steem.broadcast.accountUpdate 는 기본적으로 ACTIVE 권한을 필요로 함. (POSTING 바꿔도 ...)
* - OWNER 권한을 변경하고자 하는 경우에는 OWNER_KEY 정보가 필요
* - 이미 추가된 권한 정보는 또 추가 할 수 없음.
* - ownerAuth, activeAuth, postingAuth 의 값을 undefined로 설정하면 그대로 유지 됨
* - ownerAuth 정보는 1시간에 1번만 변경 가능
*/
steem.broadcast.accountUpdate( MY_ACCOUNT_OWNER_KEY, MY_ACCOUNT, ownerAuth, activeAuth,
postingAuth, MY_MEMO_KEY, MY_JSON_META, function(err, result) {
console.log(err, result);
});
}
});
[그림] https://steemd.com 에서 확인한 계정 권한이 추가된 모습