volter 0.0.172 → 0.0.174

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ The Modlin Distributable License (MDL)
2
+
3
+ Copyright (c) 2025 Modlin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the “Software”), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ Any use, distribution, modification, integration, or implementation of the
16
+ Software in another project must include clear and visible credit to the
17
+ Software and to its original author. This credit must be placed in all public
18
+ distributions, documentation, and any “About” or “Credits” section of the
19
+ implementing project.
20
+
21
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
+ THE SOFTWARE.
package/dist/crypto.js ADDED
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ var c=Object.create;var{getPrototypeOf:s,defineProperty:o,getOwnPropertyNames:p}=Object;var u=Object.prototype.hasOwnProperty;var A=(e,t,r)=>{r=e!=null?c(s(e)):{};let n=t||!e||!e.__esModule?o(r,"default",{value:e,enumerable:!0}):r;for(let a of p(e))if(!u.call(n,a))o(n,a,{get:()=>e[a],enumerable:!0});return n};var d=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var m=(e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0,configurable:!0,set:(n)=>t[r]=()=>n})};var x=import.meta.require;function f(e,t){return new Bun.CryptoHasher("sha256",t).update(e).digest("hex")}async function i(e){if(e){if(e instanceof CryptoKey)return e;if(e instanceof Uint8Array){if(e.length===32)return await crypto.subtle.importKey("raw",e,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);return await crypto.subtle.importKey("raw",e,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}if(e.length===64)return await crypto.subtle.importKey("raw",Uint8Array.fromHex(e),{name:"AES-GCM",length:256},!0,["encrypt","decrypt"]);else return await crypto.subtle.importKey("raw",Uint8Array.fromHex(f(e)),{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}else return await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"])}async function C(e,t){let r=await crypto.subtle.exportKey(t,e);return new Uint8Array(r).toBase64()}async function K(){return await crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!0,["sign","verify"])}async function l(e){return await crypto.subtle.exportKey("jwk",e)}async function w(e,t){return await crypto.subtle.importKey("jwk",e,{name:"ECDSA",namedCurve:"P-256"},!0,t)}async function b(e,t){let r=new TextEncoder().encode(e),n=await crypto.subtle.sign({name:"ECDSA",hash:{name:"SHA-256"}},t,r);return new Uint8Array(n)}async function h(e,t,r){let n=new TextEncoder().encode(e);return await crypto.subtle.verify({name:"ECDSA",hash:{name:"SHA-256"}},r,t,n)}async function E(e,t){let n=new TextEncoder().encode(e),a=crypto.getRandomValues(new Uint8Array(12)),y=await crypto.subtle.encrypt({name:"AES-GCM",iv:a},await i(t),n);return{text:new Uint8Array(y).toHex(),iv:a,buffer:y}}async function S(e,t){let r=new TextDecoder,n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e.iv},await i(t),Uint8Array.fromHex(e.text));return r.decode(n)}async function P(){return await crypto.subtle.generateKey({name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["encrypt","decrypt"])}async function U(e,t){let r=new TextEncoder().encode(e),n=await crypto.subtle.encrypt({name:"RSA-OAEP"},t,r);return new Uint8Array(n)}async function v(e,t){let r=await crypto.subtle.decrypt({name:"RSA-OAEP"},t,e);return new TextDecoder().decode(r)}export{h as verifySign,b as sign,P as keypair,w as importJWK,f as hash,K as generateECDSAKeyPair,C as exportKey,l as exportJWK,U as encrypt,v as decrypt,S as decipher,i as cryptoKey,E as cipher};