UNPKG

@nfen/webcrypto-ts

Version:
27 lines 844 B
/** * Code related to proxying CryptoKey and CryptoKeyPair * @module */ export function proxifyKey(handler) { return function _proxifyKey(key) { return new Proxy(key, handler); }; } export function proxifyKeyPair({ privHandler, pubHandler }) { return function _proxifyKeyPair(keyPair) { return new Proxy(keyPair, { get(target, prop) { switch (prop) { case "self": return target; case "privateKey": return proxifyKey(privHandler)(target.privateKey); case "publicKey": return proxifyKey(pubHandler)(target.publicKey); } return Reflect.get(target, prop); }, }); }; } //# sourceMappingURL=proxy.js.map