Free javascript Hosting


bcl-slim.js

Uploaded on Feb 01 2022 07:19 by sotaxes688

var BCl;(()=>{"use strict";var e={114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Asymmetric_init=void 0,t.Asymmetric_init=function(e,t){const{Secret:r,Public:n,Plain:s,Cipher:i}=t;return class{static secret(){return new r(e.random(32))}static public(t){return new n(e.scalarmultBase(t))}static encrypt(t,r){return new i(e.boxSeal(r,t))}static decrypt(t,r,n){return new s(e.boxSealOpen(r,null!=n?n:this.public(t),t))}}}},634:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Sodium_init=void 0,t.Sodium_init=function(e){var t;return(t=class{static random(t){return e.randombytes_buf(t)}static to_hex(t){return e.to_hex(t)}static from_hex(t){return e.from_hex(t)}static to_base64(t){return e.to_base64(t,1)}static from_base64(t){return e.from_base64(t,1)}static to_string(t){return e.to_string(t)}static from_string(t){return e.from_string(t)}static compare(t,r){return e.compare(t,r)}static randombytes_uniform(t){return e.randombytes_uniform(t)}}).boxSeal=(t,r)=>e.crypto_box_seal(t,r),t.boxSealOpen=(t,r,n)=>e.crypto_box_seal_open(t,r,n),t.secretbox=(t,r,n)=>e.crypto_secretbox_easy(t,r,n),t.secretboxOpen=(t,r,n)=>e.crypto_secretbox_open_easy(t,r,n),t.scalarmultBase=t=>e.crypto_scalarmult_base(t),t.ready=new Promise((t=>{e.ready.then((()=>{t()}))})),t}},929:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Symmetric_init=void 0,t.Symmetric_init=function(e,t){const{Secret:r,Plain:n,Cipher:s}=t;return class{static secret(){return new r(e.random(32))}static encrypt(t,r){const n=e.random(24),i=e.secretbox(r,n,t);return new s(new Uint8Array([...n,...i]))}static decrypt(t,r){const s=r.slice(0,24),i=e.secretboxOpen(r.slice(24),s,t);return new n(i)}}}},699:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Types_init=void 0,t.Types_init=function(e){class t extends Uint8Array{constructor(e){super(e)}static from_base64(r){return new t(e.from_base64(r))}to_base64(){return e.to_base64(this)}static from_hex(r){return new t(e.from_hex(r))}to_hex(){return e.to_hex(this)}static from_string(r){return new t(e.from_string(r))}to_string(){return e.to_string(this)}}class r extends t{constructor(e){super(e)}}return{Secret:class extends r{constructor(e){super(new r(new t(e)))}},Public:class extends r{constructor(e){super(new r(new t(e)))}},Plain:class extends t{constructor(e){super(e)}},Cipher:class extends t{constructor(e){super(e)}}}}}},t={};function r(n){var s=t[n];if(void 0!==s)return s.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}var n={};(()=>{var e=n;e.BClSlim=void 0;const t=r(634),s=r(699),i=r(929),o=r(114);e.BClSlim=function(e){var r;const n=t.Sodium_init(e),c=s.Types_init(n),a=i.Symmetric_init(n,c),u=o.Asymmetric_init(n,c);return(r=class{}).Sodium=n,r.Utility={random:n.randombytes_uniform},r.Symmetric=a,r.Asymmetric=u,r.Secret=c.Secret,r.Public=c.Public,r.Plain=c.Plain,r.Cipher=c.Cipher,r.ready=n.ready,r}})(),BCl=n.BClSlim})();

Back to list