UNPKG

@trust/keyto

Version:

A utility for translating cryptographic keys between representations

45 lines (37 loc) 628 B
'use strict' /** * Dependencies * @ignore */ const asn = require('asn1.js') /** * SupportedAsnTypes * @ignore */ class SupportedAsnTypes { /** * constructor * * @class SupportedAsnTypes * * @description * A registry for supported asn complex field types */ constructor () { Object.defineProperty(this, '_registry', { value: {} }) } get registry () { return this._registry } define (name, fn) { this._registry[name] = asn.define(name, fn(this)) } normalize (name) { return this.registry[name] } } /** * Export * @ignore */ module.exports = SupportedAsnTypes