@shard-auth/client
Version:
Next-generation API authentication without secret keys - MPC-based authentication with FROST threshold signatures
28 lines • 795 B
JavaScript
;
/**
* シェア管理クラス
* グローバル変数の代わりに、インスタンスベースでシェアを管理
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ShareManager = void 0;
class ShareManager {
shares = new Map();
addShare(share) {
const shareValue = BigInt('0x' + share.share.toString('hex'));
this.shares.set(share.index, shareValue);
}
getShare(index) {
return this.shares.get(index);
}
getAllShares() {
return Array.from(this.shares.values());
}
hasAllShares(expectedCount = 2) {
return this.shares.size >= expectedCount;
}
clear() {
this.shares.clear();
}
}
exports.ShareManager = ShareManager;
//# sourceMappingURL=share-manager.js.map