@iden3/js-iden3-auth
Version:
iden3-auth implementation in JavaScript
17 lines (16 loc) • 823 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.IDOwnershipPubSignals = void 0;
const js_iden3_core_1 = require("@iden3/js-iden3-core");
class IDOwnershipPubSignals {
async verifyIdOwnership(sender, challenge) {
const senderId = js_iden3_core_1.DID.idFromDID(js_iden3_core_1.DID.parse(sender));
if (senderId.string() !== this.userId.string()) {
throw new Error(`sender id is not used for proof creation, expected ${senderId}, user from public signals: ${this.userId.string()}`);
}
if (challenge !== this.challenge) {
throw new Error(`challenge is not used for proof creation, expected ${challenge}, challenge from public signals: ${this.challenge} `);
}
}
}
exports.IDOwnershipPubSignals = IDOwnershipPubSignals;
;