crypto-conditions
Version:
Implementation of crypto-conditions in JavaScript
37 lines (26 loc) • 1.46 kB
JavaScript
;
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.Simple256Condition = exports.Condition = exports.Compound256Condition = void 0;
var _asn = _interopRequireDefault(require("asn1.js"));
var Simple256Condition = _asn.default.define('Simple256Condition', function () {
this.seq().obj(this.key('fingerprint').implicit(0).octstr(), this.key('cost').implicit(1).int());
});
exports.Simple256Condition = Simple256Condition;
var Compound256Condition = _asn.default.define('Compound256Condition', function () {
this.seq().obj(this.key('fingerprint').implicit(0).octstr(), this.key('cost').implicit(1).int(), this.key('subtypes').implicit(2).bitstr());
});
exports.Compound256Condition = Compound256Condition;
var Condition = _asn.default.define('Condition', function () {
this.choice({
preimageSha256Condition: this.implicit(0).use(exports.Simple256Condition),
prefixSha256Condition: this.implicit(1).use(exports.Compound256Condition),
thresholdSha256Condition: this.implicit(2).use(exports.Compound256Condition),
rsaSha256Condition: this.implicit(3).use(exports.Simple256Condition),
ed25519Sha256Condition: this.implicit(4).use(exports.Simple256Condition)
});
});
exports.Condition = Condition;