@gjsify/crypto 0.52.0 → 0.54.0
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/lib/esm/asn1.js +2 -2
- package/lib/esm/crypto-utils.js +1 -1
- package/lib/esm/curve25519.js +1 -0
- package/lib/esm/dh-stateless.js +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/key-object.js +2 -1
- package/lib/esm/keygen.js +1 -0
- package/lib/esm/sign.js +1 -1
- package/lib/types/asn1.d.ts +20 -0
- package/lib/types/crypto-utils.d.ts +4 -0
- package/lib/types/curve25519.d.ts +28 -0
- package/lib/types/curve25519.spec.d.ts +2 -0
- package/lib/types/dh-stateless.d.ts +12 -0
- package/lib/types/fixtures/ed25519-sign-input.d.ts +2 -0
- package/lib/types/fixtures/wpt-ed25519-small-order.d.ts +2 -0
- package/lib/types/fixtures/wycheproof-x25519.d.ts +2 -0
- package/lib/types/index.d.ts +11 -2
- package/lib/types/key-object.d.ts +27 -1
- package/lib/types/keygen.d.ts +21 -0
- package/lib/types/sign.d.ts +14 -0
- package/package.json +10 -8
package/lib/esm/asn1.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{Buffer as e}from"node:buffer";function pemToDer(t){let n=t.trim().split(/\r?\n/),r=n.findIndex(e=>e.startsWith(`-----BEGIN `));if(r===-1)throw Error(`Invalid PEM: no BEGIN line found`);let i=n[r].match(/^-----BEGIN (.+)-----$/);if(!i)throw Error(`Invalid PEM header format`);let a=i[1],o=n.findIndex((e,t)=>t>r&&e.startsWith(`-----END `));if(o===-1)throw Error(`Invalid PEM: no END line found`);let s=n.slice(r+1,o).join(``),c=e.from(s,`base64`);return{type:a,der:new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}}function parseTlv(e,t){if(t>=e.length)throw Error(`ASN.1 parse error: unexpected end of data`);let n=e[t++],r,i=e[t++];if(i<128)r=i;else{let n=i&127;if(n===0)throw Error(`ASN.1 parse error: indefinite length not supported`);r=0;for(let i=0;i<n;i++)r=r<<8|e[t++]}let a=e.slice(t,t+r),o=t+r,s={tag:n,data:a};return n===48&&(s.children=parseSequenceChildren(a)),{value:s,next:o}}function parseSequenceChildren(e){let t=[],n=0;for(;n<e.length;){let{value:r,next:i}=parseTlv(e,n);t.push(r),n=i}return t}function parseDer(e){let{value:t}=parseTlv(e,0);return t}function integerToBigInt(e){let t=0;for(;t<e.length-1&&e[t]===0;)t++;let n=0n;for(let r=t;r<e.length;r++)n=n<<8n|BigInt(e[r]);return n}const t=new Uint8Array([42,134,72,134,247,13,1,1,1]);function oidsEqual(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function parseRsaPublicKeyPkcs1(e){let t=e.children;if(!t||t.length<2)throw Error(`Invalid PKCS#1 RSAPublicKey structure`);return{n:integerToBigInt(t[0].data),e:integerToBigInt(t[1].data)}}function parseRsaPrivateKeyPkcs1(e){let t=e.children;if(!t||t.length<6)throw Error(`Invalid PKCS#1 RSAPrivateKey structure`);return{n:integerToBigInt(t[1].data),e:integerToBigInt(t[2].data),d:integerToBigInt(t[3].data),p:integerToBigInt(t[4].data),q:integerToBigInt(t[5].data)}}function
|
|
2
|
-
`)}function modInverse(e,t){let[n,r]=[e%t,t],[i,a]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,a]=[a,i-e*a]}return(i%t+t)%t}function parseX509(e){let{der:t}=pemToDer(e);return parseX509Der(t)}function parseX509Der(e){let n=parseDer(e);if(n.tag!==48||!n.children||n.children.length<3)throw Error(`Invalid X.509 certificate structure`);let r=n.children[0],i=n.children[1],a=n.children[2];if(!r.children||r.children.length<6)throw Error(`Invalid TBSCertificate structure`);let o=0;r.children[0].tag===160&&o++;let s=integerToBigInt(r.children[o].data);o++,o++;let c=parseDN(r.children[o]);o++;let l=r.children[o],u=parseAsn1Time(l.children[0]),d=parseAsn1Time(l.children[1]);o++;let f=parseDN(r.children[o]);o++;let p=null,m=`unknown`;if(o<r.children.length){let e=r.children[o];try{if(e.children&&e.children.length>=2){let n=e.children[0];if(n.children&&n.children.length>=1){let r=n.children[0];r.tag===6&&oidsEqual(r.data,t)&&(m=`rsa`,p=parseSubjectPublicKeyInfo(e))}}}catch{}o++}let h,g;for(let e=o;e<r.children.length;e++){let t=r.children[e];if(t.tag===163&&t.data.length>0){let e=parseDer(t.data);if(e.children){g=e.children;let t=new Uint8Array([85,29,17]);for(let n of e.children)if(n.children&&n.children.length>=2){let e=n.children[0];if(e.tag===6&&oidsEqual(e.data,t)){let e=n.children[n.children.length-1];h=parseSAN(e.data)}}}}}let _=`unknown`;i.children&&i.children.length>=1&&(_=oidToName(i.children[0].data));let v=a.tag===3?a.data.slice(1):a.data;return{raw:e,tbsCertificate:r.data,serialNumber:s,issuer:c,subject:f,validFrom:u,validTo:d,publicKey:p,publicKeyAlgorithm:m,signatureAlgorithm:_,signature:v,subjectAltName:h,extensions:g}}const
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{Buffer as e}from"node:buffer";function pemToDer(t){let n=t.trim().split(/\r?\n/),r=n.findIndex(e=>e.startsWith(`-----BEGIN `));if(r===-1)throw Error(`Invalid PEM: no BEGIN line found`);let i=n[r].match(/^-----BEGIN (.+)-----$/);if(!i)throw Error(`Invalid PEM header format`);let a=i[1],o=n.findIndex((e,t)=>t>r&&e.startsWith(`-----END `));if(o===-1)throw Error(`Invalid PEM: no END line found`);let s=n.slice(r+1,o).join(``),c=e.from(s,`base64`);return{type:a,der:new Uint8Array(c.buffer,c.byteOffset,c.byteLength)}}function parseTlv(e,t){if(t>=e.length)throw Error(`ASN.1 parse error: unexpected end of data`);let n=e[t++],r,i=e[t++];if(i<128)r=i;else{let n=i&127;if(n===0)throw Error(`ASN.1 parse error: indefinite length not supported`);r=0;for(let i=0;i<n;i++)r=r<<8|e[t++]}let a=e.slice(t,t+r),o=t+r,s={tag:n,data:a};return n===48&&(s.children=parseSequenceChildren(a)),{value:s,next:o}}function parseSequenceChildren(e){let t=[],n=0;for(;n<e.length;){let{value:r,next:i}=parseTlv(e,n);t.push(r),n=i}return t}function parseDer(e){let{value:t}=parseTlv(e,0);return t}function integerToBigInt(e){let t=0;for(;t<e.length-1&&e[t]===0;)t++;let n=0n;for(let r=t;r<e.length;r++)n=n<<8n|BigInt(e[r]);return n}const t=new Uint8Array([42,134,72,134,247,13,1,1,1]),n=new Uint8Array([43,101,110]),r=new Uint8Array([43,101,112]);function okpCurveForOid(e){if(oidsEqual(e,r))return`ed25519`;if(oidsEqual(e,n))return`x25519`}function oidForOkpCurve(e){return e===`ed25519`?r:n}function oidsEqual(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function parseRsaPublicKeyPkcs1(e){let t=e.children;if(!t||t.length<2)throw Error(`Invalid PKCS#1 RSAPublicKey structure`);return{n:integerToBigInt(t[0].data),e:integerToBigInt(t[1].data)}}function parseRsaPrivateKeyPkcs1(e){let t=e.children;if(!t||t.length<6)throw Error(`Invalid PKCS#1 RSAPrivateKey structure`);return{n:integerToBigInt(t[1].data),e:integerToBigInt(t[2].data),d:integerToBigInt(t[3].data),p:integerToBigInt(t[4].data),q:integerToBigInt(t[5].data)}}function algorithmOid(e){let t=e?.children?.[0];if(!t||t.tag!==6)throw Error(`Invalid AlgorithmIdentifier`);if(okpCurveForOid(t.data)&&(e?.children?.length??0)!==1)throw Error(`Invalid AlgorithmIdentifier: parameters must be absent (RFC 8410)`);return t.data}function parseSubjectPublicKeyInfo(e){let n=e.children;if(!n||n.length<2)throw Error(`Invalid SubjectPublicKeyInfo structure`);let r=algorithmOid(n[0]),i=n[1];if(i.tag!==3||i.data[0]!==0)throw Error(`Expected BIT STRING for public key data`);let a=i.data.slice(1),o=okpCurveForOid(r);if(o){if(a.length!==32)throw Error(`Invalid ${o} public key length: ${a.length}`);return{type:`okp-public`,curve:o,pub:a}}if(!oidsEqual(r,t))throw Error(`Unsupported key algorithm`);return{type:`rsa-public`,components:parseRsaPublicKeyPkcs1(parseDer(a))}}function parsePrivateKeyInfo(e){let n=e.children;if(!n||n.length<3)throw Error(`Invalid PrivateKeyInfo structure`);let r=algorithmOid(n[1]),i=n[2];if(i.tag!==4)throw Error(`Expected OCTET STRING for private key data`);let a=okpCurveForOid(r);if(a){let e=parseDer(i.data);if(e.tag!==4||e.data.length!==32)throw Error(`Invalid ${a} private key`);return{type:`okp-private`,curve:a,priv:e.data}}if(!oidsEqual(r,t))throw Error(`Unsupported key algorithm`);return{type:`rsa-private`,components:parseRsaPrivateKeyPkcs1(parseDer(i.data))}}function encodeLength(e){if(e<128)return new Uint8Array([e]);let t=[],n=e;for(;n>0;)t.unshift(n&255),n>>=8;return new Uint8Array([128|t.length,...t])}function encodeTlv(e,t){let n=encodeLength(t.length),r=new Uint8Array(1+n.length+t.length);return r[0]=e,r.set(n,1),r.set(t,1+n.length),r}function bigintToAsn1Integer(e){if(e===0n)return encodeTlv(2,new Uint8Array([0]));let t=e.toString(16),n=t.length%2?`0`+t:t,r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return r[0]&128&&r.unshift(0),encodeTlv(2,new Uint8Array(r))}function encodeSequence(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return encodeTlv(48,n)}function encodeBitString(e){let t=new Uint8Array(1+e.length);return t[0]=0,t.set(e,1),encodeTlv(3,t)}function encodeOctetString(e){return encodeTlv(4,e)}function encodeOid(e){return encodeTlv(6,e)}function encodeNull(){return new Uint8Array([5,0])}function encodeRsaPublicKeyPkcs1(e){return encodeSequence([bigintToAsn1Integer(e.n),bigintToAsn1Integer(e.e)])}function encodeSubjectPublicKeyInfo(e){return encodeSequence([encodeSequence([encodeOid(t),encodeNull()]),encodeBitString(encodeRsaPublicKeyPkcs1(e))])}function encodeRsaPrivateKeyPkcs1(e){let t=e.d%(e.p-1n),n=e.d%(e.q-1n),r=modInverse(e.q,e.p);return encodeSequence([bigintToAsn1Integer(0n),bigintToAsn1Integer(e.n),bigintToAsn1Integer(e.e),bigintToAsn1Integer(e.d),bigintToAsn1Integer(e.p),bigintToAsn1Integer(e.q),bigintToAsn1Integer(t),bigintToAsn1Integer(n),bigintToAsn1Integer(r)])}function encodePrivateKeyInfo(e){let n=encodeSequence([encodeOid(t),encodeNull()]),r=encodeOctetString(encodeRsaPrivateKeyPkcs1(e));return encodeSequence([bigintToAsn1Integer(0n),n,r])}function encodeOkpSubjectPublicKeyInfo(e,t){return encodeSequence([encodeSequence([encodeOid(oidForOkpCurve(e))]),encodeBitString(t)])}function encodeOkpPrivateKeyInfo(e,t){return encodeSequence([bigintToAsn1Integer(0n),encodeSequence([encodeOid(oidForOkpCurve(e))]),encodeOctetString(encodeOctetString(t))])}function derToPem(t,n){let r=e.from(t).toString(`base64`),i=[`-----BEGIN ${n}-----`];for(let e=0;e<r.length;e+=64)i.push(r.substring(e,e+64));return i.push(`-----END ${n}-----`),i.join(`
|
|
2
|
+
`)}function modInverse(e,t){let[n,r]=[e%t,t],[i,a]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,a]=[a,i-e*a]}return(i%t+t)%t}function parseX509(e){let{der:t}=pemToDer(e);return parseX509Der(t)}function parseX509Der(e){let n=parseDer(e);if(n.tag!==48||!n.children||n.children.length<3)throw Error(`Invalid X.509 certificate structure`);let r=n.children[0],i=n.children[1],a=n.children[2];if(!r.children||r.children.length<6)throw Error(`Invalid TBSCertificate structure`);let o=0;r.children[0].tag===160&&o++;let s=integerToBigInt(r.children[o].data);o++,o++;let c=parseDN(r.children[o]);o++;let l=r.children[o],u=parseAsn1Time(l.children[0]),d=parseAsn1Time(l.children[1]);o++;let f=parseDN(r.children[o]);o++;let p=null,m=`unknown`;if(o<r.children.length){let e=r.children[o];try{if(e.children&&e.children.length>=2){let n=e.children[0];if(n.children&&n.children.length>=1){let r=n.children[0];r.tag===6&&oidsEqual(r.data,t)&&(m=`rsa`,p=parseSubjectPublicKeyInfo(e).components)}}}catch{}o++}let h,g;for(let e=o;e<r.children.length;e++){let t=r.children[e];if(t.tag===163&&t.data.length>0){let e=parseDer(t.data);if(e.children){g=e.children;let t=new Uint8Array([85,29,17]);for(let n of e.children)if(n.children&&n.children.length>=2){let e=n.children[0];if(e.tag===6&&oidsEqual(e.data,t)){let e=n.children[n.children.length-1];h=parseSAN(e.data)}}}}}let _=`unknown`;i.children&&i.children.length>=1&&(_=oidToName(i.children[0].data));let v=a.tag===3?a.data.slice(1):a.data;return{raw:e,tbsCertificate:r.data,serialNumber:s,issuer:c,subject:f,validFrom:u,validTo:d,publicKey:p,publicKeyAlgorithm:m,signatureAlgorithm:_,signature:v,subjectAltName:h,extensions:g}}const i={"2.5.4.3":`CN`,"2.5.4.6":`C`,"2.5.4.7":`L`,"2.5.4.8":`ST`,"2.5.4.10":`O`,"2.5.4.11":`OU`,"1.2.840.113549.1.9.1":`emailAddress`},a={"1.2.840.113549.1.1.1":`rsaEncryption`,"1.2.840.113549.1.1.5":`sha1WithRSAEncryption`,"1.2.840.113549.1.1.11":`sha256WithRSAEncryption`,"1.2.840.113549.1.1.12":`sha384WithRSAEncryption`,"1.2.840.113549.1.1.13":`sha512WithRSAEncryption`};function decodeOidString(e){if(e.length===0)return``;let t=[];t.push(Math.floor(e[0]/40)),t.push(e[0]%40);let n=0;for(let r=1;r<e.length;r++)n=n<<7|e[r]&127,e[r]&128||(t.push(n),n=0);return t.join(`.`)}function oidToName(e){let t=decodeOidString(e);return a[t]||t}function parseDN(e){if(!e.children)return``;let t=[];for(let n of e.children){let e=n.tag===49?parseSequenceChildren(n.data):n.children||[];for(let n of e)if(n.children&&n.children.length>=2){let e=n.children[0].data,r=decodeOidString(e),a=i[r]||r,o=n.children[1].data,s=new TextDecoder().decode(o);t.push(`${a}=${s}`)}}return t.join(`, `)}function parseAsn1Time(e){let t=new TextDecoder().decode(e.data);if(e.tag===23){let e=parseInt(t.substring(0,2),10);e=e>=50?1900+e:2e3+e;let n=parseInt(t.substring(2,4),10)-1,r=parseInt(t.substring(4,6),10),i=parseInt(t.substring(6,8),10),a=parseInt(t.substring(8,10),10),o=parseInt(t.substring(10,12),10);return new Date(Date.UTC(e,n,r,i,a,o))}if(e.tag===24){let e=parseInt(t.substring(0,4),10),n=parseInt(t.substring(4,6),10)-1,r=parseInt(t.substring(6,8),10),i=parseInt(t.substring(8,10),10),a=parseInt(t.substring(10,12),10),o=parseInt(t.substring(12,14),10);return new Date(Date.UTC(e,n,r,i,a,o))}throw Error(`Unsupported time tag: 0x${e.tag.toString(16)}`)}function parseSAN(e){let t=[];try{let n=parseDer(e);if(n.tag===48&&n.children){for(let e of n.children)if(e.tag===130)t.push(`DNS:`+new TextDecoder().decode(e.data));else if(e.tag===135){if(e.data.length===4)t.push(`IP Address:`+e.data.join(`.`));else if(e.data.length===16){let n=[];for(let t=0;t<16;t+=2)n.push((e.data[t]<<8|e.data[t+1]).toString(16));t.push(`IP Address:`+n.join(`:`))}}}}catch{}return t}function parsePemKey(e){let{type:t,der:n}=pemToDer(e);switch(t){case`RSA PUBLIC KEY`:return parseDerKey(n,`pkcs1`,`public`);case`PUBLIC KEY`:return parseDerKey(n,`spki`);case`RSA PRIVATE KEY`:return parseDerKey(n,`pkcs1`,`private`);case`PRIVATE KEY`:return parseDerKey(n,`pkcs8`);default:throw Error(`Unsupported PEM type: ${t}`)}}function parseDerKey(e,t,n){let r=parseDer(e);if(r.tag!==48)throw Error(`Invalid key format: expected top-level SEQUENCE`);switch(t){case`spki`:return parseSubjectPublicKeyInfo(r);case`pkcs8`:return parsePrivateKeyInfo(r);case`pkcs1`:return n===`public`?{type:`rsa-public`,components:parseRsaPublicKeyPkcs1(r)}:{type:`rsa-private`,components:parseRsaPrivateKeyPkcs1(r)}}}function rsaKeySize(e){let t=0,n=e;for(;n>0n;)t++,n>>=1n;return Math.ceil(t/8)}export{bigintToAsn1Integer,derToPem,encodeOkpPrivateKeyInfo,encodeOkpSubjectPublicKeyInfo,encodePrivateKeyInfo,encodeRsaPrivateKeyPkcs1,encodeRsaPublicKeyPkcs1,encodeSequence,encodeSubjectPublicKeyInfo,parseDerKey,parsePemKey,parseX509,parseX509Der,rsaKeySize};
|
package/lib/esm/crypto-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{Buffer as e}from"node:buffer";function normalizeAlgorithm(e){return e.toLowerCase().replace(/-/g,``)}const t={md5:16,sha1:20,sha256:32,sha384:48,sha512:64},n={md5:64,sha1:64,sha256:64,sha384:128,sha512:128},r=new Set([`md5`,`sha1`,`sha256`,`sha384`,`sha512`]);function hashSize(e){let n=normalizeAlgorithm(e),r=t[n];if(r===void 0)throw Error(`Unknown hash algorithm: ${e}`);return r}function toBuffer(t,n){return typeof t==`string`?e.from(t,n||`utf8`):t instanceof DataView?e.from(t.buffer,t.byteOffset,t.byteLength):(t instanceof ArrayBuffer,e.from(t))}export{n as BLOCK_SIZES,t as DIGEST_SIZES,r as SUPPORTED_ALGORITHMS,hashSize,normalizeAlgorithm,toBuffer};
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{Buffer as e}from"node:buffer";function normalizeAlgorithm(e){return e.toLowerCase().replace(/-/g,``)}const t={md5:16,sha1:20,sha256:32,sha384:48,sha512:64},n={md5:64,sha1:64,sha256:64,sha384:128,sha512:128},r=new Set([`md5`,`sha1`,`sha256`,`sha384`,`sha512`]);function hashSize(e){let n=normalizeAlgorithm(e),r=t[n];if(r===void 0)throw Error(`Unknown hash algorithm: ${e}`);return r}function toBuffer(t,n){return typeof t==`string`?e.from(t,n||`utf8`):t instanceof DataView?e.from(t.buffer,t.byteOffset,t.byteLength):(t instanceof ArrayBuffer,e.from(t))}function codedError(e,t,n=Error){let r=new n(t);return r.code=e,r}export{n as BLOCK_SIZES,t as DIGEST_SIZES,r as SUPPORTED_ALGORITHMS,codedError,hashSize,normalizeAlgorithm,toBuffer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{codedError as e}from"./crypto-utils.js";import{ed25519 as t,ed25519ctx as n,x25519 as r}from"@noble/curves/ed25519.js";import{sha512 as i}from"@noble/hashes/sha2.js";import{fillRandomBytes as a,isSecureRandomSource as o}from"@gjsify/webcrypto/random";const s=32,c=64,l=t.Point,u=l.Fn.ORDER;function clampX25519(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function generateOkpPrivateKey(t,n=a){let r=new Uint8Array(32),i=n(r);if(!o(i))throw r.fill(0),e(`ERR_CRYPTO_INSECURE_RANDOM`,`Refusing to generate a ${t} key: no cryptographically secure random source (got "${i}"; expected WebCrypto or /dev/urandom)`);return t===`x25519`?clampX25519(r):r}function okpPublicFromPrivate(e,n){return e===`ed25519`?t.getPublicKey(n):r.getPublicKey(n)}function ed25519Sign(e,r,i){return i&&i.length>0?n.sign(r,e,{context:i}):t.sign(r,e)}function dom2(e){if(!e||e.length===0)return new Uint8Array;let t=new TextEncoder().encode(`SigEd25519 no Ed25519 collisions`),n=new Uint8Array(t.length+2+e.length);return n.set(t,0),n[t.length]=0,n[t.length+1]=e.length,n.set(e,t.length+2),n}function leToBigInt(e){let t=0n;for(let n=e.length-1;n>=0;n--)t=t<<8n|BigInt(e[n]);return t}function ed25519Verify(e,t,n,r){if(e.length!==32||n.length!==64||r&&r.length>255)return!1;let a=n.subarray(0,32),o=leToBigInt(n.subarray(32));if(o>=u)return!1;let s,c;try{s=l.fromBytes(e,!1),c=l.fromBytes(a,!1)}catch{return!1}if(s.isSmallOrder()||c.isSmallOrder())return!1;let d=dom2(r),f=new Uint8Array(d.length+64+t.length);f.set(d,0),f.set(a,d.length),f.set(e,d.length+32),f.set(t,d.length+64);let p=leToBigInt(i(f))%u,m=l.BASE.multiplyUnsafe(o).subtract(s.multiplyUnsafe(p)).toBytes(),h=0;for(let e=0;e<32;e++)h|=m[e]^a[e];return h===0}function x25519SharedSecret(e,t){return r.getSharedSecret(e,t)}export{c as ED25519_SIGNATURE_BYTES,s as OKP_KEY_BYTES,ed25519Sign,ed25519Verify,generateOkpPrivateKey,okpPublicFromPrivate,x25519SharedSecret};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{codedError as e}from"./crypto-utils.js";import{x25519SharedSecret as t}from"./curve25519.js";import{okpKeyMaterial as n,toKeyObject as r}from"./key-object.js";import{Buffer as i}from"node:buffer";function describe(e){return e===null?`null`:Array.isArray(e)?`an instance of Array`:typeof e}function compute(a){let o=r(a.privateKey,`private`),s=r(a.publicKey,`public`),c=n(o),l=n(s);if(!c||c.curve!==`x25519`){let t=o.asymmetricKeyType;throw e(t===`ed25519`?`ERR_OSSL_EVP_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE`:`ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`,t===`ed25519`?`error:03000096:digital envelope routines::operation not supported for this keytype`:`diffieHellman() with a '${t}' key is not implemented on GJS yet (supported: 'x25519')`)}if(!l||l.curve!==c.curve)throw e(`ERR_OSSL_EVP_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE`,`error:03000096:digital envelope routines::operation not supported for this keytype`);let u;try{u=t(c.priv,l.pub)}catch{throw e(`ERR_OSSL_FAILED_DURING_DERIVATION`,`Deriving bits failed`)}return i.from(u)}function diffieHellman(t,n){if(typeof t!=`object`||!t||Array.isArray(t))throw e(`ERR_INVALID_ARG_TYPE`,`The "options" argument must be of type object. Received ${describe(t)}`,TypeError);if(n===void 0)return compute(t);if(typeof n!=`function`)throw e(`ERR_INVALID_ARG_TYPE`,`The "callback" argument must be of type function. Received ${describe(n)}`,TypeError);let r;try{r=compute(t)}catch(e){setTimeout(()=>n(e),0);return}setTimeout(()=>n(null,r),0)}export{diffieHellman};
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{constants as e}from"./constants.js";import{timingSafeEqual as t}from"./timing-safe-equal.js";import{createCipher as n,createCipheriv as r,createDecipher as i,createDecipheriv as a,getCiphers as o}from"./cipher.js";import{
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{constants as e}from"./constants.js";import{timingSafeEqual as t}from"./timing-safe-equal.js";import{createCipher as n,createCipheriv as r,createDecipher as i,createDecipheriv as a,getCiphers as o}from"./cipher.js";import{KeyObject as s,createPrivateKey as c,createPublicKey as l,createSecretKey as u}from"./key-object.js";import{diffieHellman as d}from"./dh-stateless.js";import{randomBytes as f,randomFill as p,randomFillSync as m,randomInt as h,randomUUID as g}from"./random.js";import{DiffieHellman as _,DiffieHellmanGroup as v,createDiffieHellman as y,createDiffieHellmanGroup as b,getDiffieHellman as x}from"./dh.js";import{createECDH as S,getCurves as C}from"./ecdh.js";import{Hash as w,getHashes as T,hash as E}from"./hash.js";import{Hmac as D}from"./hmac.js";import{ecdsaSign as O,ecdsaVerify as k}from"./ecdsa.js";import{hkdf as A,hkdfSync as j}from"./hkdf.js";import{pbkdf2 as M,pbkdf2Sync as N}from"./pbkdf2.js";import{scrypt as P,scryptSync as F}from"./scrypt.js";import{Sign as I,Verify as L,createSign as R,createVerify as z,sign as B,verify as V}from"./sign.js";import{generateKeyPair as H,generateKeyPairSync as U}from"./keygen.js";import{privateDecrypt as W,privateEncrypt as G,publicDecrypt as K,publicEncrypt as q}from"./public-encrypt.js";import{mgf1 as J}from"./mgf1.js";import{rsaPssSign as Y,rsaPssVerify as X}from"./rsa-pss.js";import{rsaOaepDecrypt as Z,rsaOaepEncrypt as Q}from"./rsa-oaep.js";import{X509Certificate as $}from"./x509.js";function createHash(e){return new w(e)}function createHmac(e,t){return new D(e,t)}var ee={Hash:w,getHashes:T,hash:E,Hmac:D,randomBytes:f,randomFill:p,randomFillSync:m,randomUUID:g,randomInt:h,timingSafeEqual:t,constants:e,pbkdf2:M,pbkdf2Sync:N,hkdf:A,hkdfSync:j,scrypt:P,scryptSync:F,createHash,createHmac,createCipher:n,createCipheriv:r,createDecipher:i,createDecipheriv:a,getCiphers:o,Sign:I,Verify:L,createSign:R,createVerify:z,sign:B,verify:V,generateKeyPair:H,generateKeyPairSync:U,diffieHellman:d,createDiffieHellman:y,getDiffieHellman:x,DiffieHellman:_,DiffieHellmanGroup:v,createDiffieHellmanGroup:b,createECDH:S,getCurves:C,ecdsaSign:O,ecdsaVerify:k,publicEncrypt:q,privateDecrypt:W,privateEncrypt:G,publicDecrypt:K,rsaPssSign:Y,rsaPssVerify:X,rsaOaepEncrypt:Q,rsaOaepDecrypt:Z,mgf1:J,KeyObject:s,createSecretKey:u,createPublicKey:l,createPrivateKey:c,X509Certificate:$};export{_ as DiffieHellman,v as DiffieHellmanGroup,w as Hash,D as Hmac,s as KeyObject,I as Sign,L as Verify,$ as X509Certificate,e as constants,n as createCipher,r as createCipheriv,i as createDecipher,a as createDecipheriv,y as createDiffieHellman,b as createDiffieHellmanGroup,S as createECDH,createHash,createHmac,c as createPrivateKey,l as createPublicKey,u as createSecretKey,R as createSign,z as createVerify,ee as default,d as diffieHellman,O as ecdsaSign,k as ecdsaVerify,H as generateKeyPair,U as generateKeyPairSync,o as getCiphers,C as getCurves,x as getDiffieHellman,T as getHashes,E as hash,A as hkdf,j as hkdfSync,J as mgf1,M as pbkdf2,N as pbkdf2Sync,W as privateDecrypt,G as privateEncrypt,K as publicDecrypt,q as publicEncrypt,f as randomBytes,p as randomFill,m as randomFillSync,h as randomInt,g as randomUUID,Z as rsaOaepDecrypt,Q as rsaOaepEncrypt,Y as rsaPssSign,X as rsaPssVerify,P as scrypt,F as scryptSync,B as sign,t as timingSafeEqual,V as verify};
|
package/lib/esm/key-object.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{derToPem as e,
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{derToPem as e,encodeOkpPrivateKeyInfo as t,encodeOkpSubjectPublicKeyInfo as n,encodePrivateKeyInfo as r,encodeRsaPrivateKeyPkcs1 as i,encodeRsaPublicKeyPkcs1 as a,encodeSubjectPublicKeyInfo as o,parseDerKey as s,parsePemKey as c,rsaKeySize as l}from"./asn1.js";import{codedError as u}from"./crypto-utils.js";import{okpPublicFromPrivate as d}from"./curve25519.js";import{Buffer as f}from"node:buffer";const p={ed25519:`Ed25519`,x25519:`X25519`};function bigintToBase64url(e){if(e===0n)return`AA`;let t=e.toString(16),n=t.length%2?`0`+t:t,r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return f.from(r).toString(`base64url`)}function base64urlToBigint(e){let t=f.from(e,`base64url`),n=0n;for(let e=0;e<t.length;e++)n=n<<8n|BigInt(t[e]);return n}var m=class KeyObject{type;_handle;constructor(e,t){if(e!==`secret`&&e!==`public`&&e!==`private`)throw TypeError(`Invalid KeyObject type: ${e}`);this.type=e,this._handle=t}get symmetricKeySize(){if(this.type===`secret`)return this._handle.byteLength}get asymmetricKeyType(){if(this.type===`secret`)return;let e=this._handle;return e.parsed.type===`rsa-public`||e.parsed.type===`rsa-private`?`rsa`:e.parsed.curve}get asymmetricKeyDetails(){if(this.type===`secret`)return;let e=this._handle.parsed;return e.type===`rsa-public`||e.type===`rsa-private`?{modulusLength:l(e.components.n)*8,publicExponent:e.components.e}:{}}get asymmetricKeySize(){if(this.type===`secret`)return;let e=this._handle;if(e.parsed.type===`rsa-public`||e.parsed.type===`rsa-private`)return l(e.parsed.components.n)/8}equals(e){if(!(e instanceof KeyObject)||this.type!==e.type)return!1;if(this.type===`secret`){let t=this._handle,n=e._handle;if(t.byteLength!==n.byteLength)return!1;for(let e=0;e<t.byteLength;e++)if(t[e]!==n[e])return!1;return!0}let t=this._handle,n=e._handle;return t.pem===n.pem}export(e){if(this.type===`secret`){let t=this._handle;return e?.format===`jwk`?{kty:`oct`,k:f.from(t).toString(`base64url`)}:f.from(t)}let t=this._handle,n=e?.format??`pem`,r=e?.type;if(t.parsed.type===`okp-public`||t.parsed.type===`okp-private`)return exportOkp(t,this.type,n,r,e);if(n===`jwk`)return exportJwk(t.parsed,this.type);if(n===`pem`)return t.pem&&!t.pem.startsWith(`[`)?t.pem:generatePem(t.parsed,this.type,r);if(n===`der`){if(t.pem&&!t.pem.startsWith(`[`)){let e=t.pem.trim().split(/\r?\n/),n=e.findIndex(e=>e.startsWith(`-----BEGIN `)),r=e.findIndex((e,t)=>t>n&&e.startsWith(`-----END `)),i=e.slice(n+1,r).join(``);return f.from(i,`base64`)}return generateDer(t.parsed,this.type,r)}throw TypeError(`Unsupported export format: ${n}`)}get[Symbol.toStringTag](){return`KeyObject`}};function exportOkp(r,i,a,o,s){let c=r.parsed,l=r.okpPub;if(a===`jwk`){let e={crv:p[c.curve]};return i===`private`&&(e.d=f.from(c.priv).toString(`base64url`)),e.x=f.from(l).toString(`base64url`),e.kty=`OKP`,e}if(a!==`pem`&&a!==`der`)throw u(`ERR_INVALID_ARG_VALUE`,`The property 'options.format' is invalid. Received '${a}'`,TypeError);if(o!==void 0&&o!==(i===`public`?`spki`:`pkcs8`))throw u(`ERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONS`,o===`pkcs1`||o===`sec1`?`The selected key encoding ${o} can only be used for ${o===`pkcs1`?`RSA`:`EC`} keys.`:`The property 'options.type' is invalid. Received '${o}'`);if(s?.cipher!==void 0||s?.passphrase!==void 0)throw u(`ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`,`Encrypted private key export is not supported`);let d=i===`public`?n(c.curve,l):t(c.curve,c.priv);return a===`der`?f.from(d):e(d,i===`public`?`PUBLIC KEY`:`PRIVATE KEY`)+`
|
|
2
|
+
`}function asymmetricKeyObject(r,i,a){if(r.type===`okp-private`){let n=d(r.curve,r.priv);return i===`public`?asymmetricKeyObject({type:`okp-public`,curve:r.curve,pub:n},`public`):new m(`private`,{parsed:r,pem:e(t(r.curve,r.priv),`PRIVATE KEY`),okpPub:n})}if(r.type===`okp-public`){if(i===`private`)throw TypeError(`Key is not a private key`);return new m(`public`,{parsed:r,pem:e(n(r.curve,r.pub),`PUBLIC KEY`),okpPub:r.pub})}if(r.type===`rsa-private`&&i===`public`){let t={n:r.components.n,e:r.components.e},n=o(t);return new m(`public`,{parsed:{type:`rsa-public`,components:t},pem:e(n,`PUBLIC KEY`)})}if(r.type===`rsa-public`&&i===`private`)throw TypeError(`Key is not a private key`);return new m(i,{parsed:r,pem:a??generatePem(r,i)})}function parseJwkOkp(e,t){let n=Object.keys(p).find(t=>p[t]===e.crv);if(!n)throw u(`ERR_INVALID_ARG_VALUE`,`The property 'key.crv' must be one of: 'Ed25519', 'X25519'. Received ${JSON.stringify(e.crv)}`,TypeError);let r=t===`private`?e.d:e.x;if(typeof e.x!=`string`||typeof r!=`string`)throw u(`ERR_CRYPTO_INVALID_JWK`,`Invalid JWK OKP key`);let i=new Uint8Array(f.from(r,`base64url`));if(i.length!==32)throw u(`ERR_CRYPTO_INVALID_JWK`,`Invalid JWK OKP key`);return t===`private`?{type:`okp-private`,curve:n,priv:i}:{type:`okp-public`,curve:n,pub:i}}function parseJwk(e,t){if(typeof e!=`object`||!e)throw u(`ERR_INVALID_ARG_TYPE`,`The "key.key" property must be of type object`,TypeError);if(e.kty===`OKP`)return{parsed:parseJwkOkp(e,t)};if(e.kty===`RSA`){if(t===`private`&&!e.d)throw Error(`JWK does not contain a private key`);return importJwkRsa(t===`private`?e:{n:e.n,e:e.e})}throw u(`ERR_INVALID_ARG_VALUE`,`The property 'key.kty' must be one of: 'RSA', 'EC', 'OKP'. Received ${JSON.stringify(e.kty)}`,TypeError)}function exportJwk(e,t){if(e.type===`rsa-public`)return{kty:`RSA`,n:bigintToBase64url(e.components.n),e:bigintToBase64url(e.components.e)};if(e.type===`rsa-private`){if(t===`public`)return{kty:`RSA`,n:bigintToBase64url(e.components.n),e:bigintToBase64url(e.components.e)};let{n,e:r,d:i,p:a,q:o}=e.components,s=i%(a-1n),c=i%(o-1n),l=modInverse(o,a);return{kty:`RSA`,n:bigintToBase64url(n),e:bigintToBase64url(r),d:bigintToBase64url(i),p:bigintToBase64url(a),q:bigintToBase64url(o),dp:bigintToBase64url(s),dq:bigintToBase64url(c),qi:bigintToBase64url(l)}}throw Error(`Unsupported key type for JWK export`)}function importJwkRsa(t){if(t.d){let n={n:base64urlToBigint(t.n),e:base64urlToBigint(t.e),d:base64urlToBigint(t.d),p:base64urlToBigint(t.p),q:base64urlToBigint(t.q)};return{parsed:{type:`rsa-private`,components:n},pem:e(i(n),`RSA PRIVATE KEY`)}}let n={n:base64urlToBigint(t.n),e:base64urlToBigint(t.e)};return{parsed:{type:`rsa-public`,components:n},pem:e(o(n),`PUBLIC KEY`)}}function generatePem(t,n,s){if(t.type===`rsa-public`)return s===`pkcs1`?e(a(t.components),`RSA PUBLIC KEY`):e(o(t.components),`PUBLIC KEY`);if(t.type===`rsa-private`&&n===`public`){let n={n:t.components.n,e:t.components.e};return s===`pkcs1`?e(a(n),`RSA PUBLIC KEY`):e(o(n),`PUBLIC KEY`)}if(t.type===`rsa-private`)return s===`pkcs8`?e(r(t.components),`PRIVATE KEY`):e(i(t.components),`RSA PRIVATE KEY`);throw Error(`Cannot generate PEM for this key type`)}function generateDer(e,t,n){if(e.type===`rsa-public`)return n===`pkcs1`?f.from(a(e.components)):f.from(o(e.components));if(e.type===`rsa-private`&&t===`public`){let t={n:e.components.n,e:e.components.e};return n===`pkcs1`?f.from(a(t)):f.from(o(t))}if(e.type===`rsa-private`)return n===`pkcs8`?f.from(r(e.components)):f.from(i(e.components));throw Error(`Cannot generate DER for this key type`)}function modInverse(e,t){let[n,r]=[e%t,t],[i,a]=[1n,0n];for(;r!==0n;){let e=n/r;[n,r]=[r,n-e*r],[i,a]=[a,i-e*a]}return(i%t+t)%t}function createSecretKey(e,t){let n;return n=typeof e==`string`?f.from(e,t??`utf8`):new Uint8Array(e),new m(`secret`,n)}function parseKeyInput(e,t){if(typeof e==`object`&&e&&!f.isBuffer(e)&&!(e instanceof Uint8Array)&&`key`in e){let n=e;if(n.format===`jwk`)return parseJwk(n.key,t);if(n.format===`der`){if(n.type!==`spki`&&n.type!==`pkcs8`&&n.type!==`pkcs1`)throw u(`ERR_INVALID_ARG_VALUE`,`The property 'key.type' is invalid. Received ${JSON.stringify(n.type)}`,TypeError);let e=typeof n.key==`string`?f.from(n.key,n.encoding??`utf8`):n.key;return{parsed:s(new Uint8Array(e),n.type,t)}}}let n=normalizePem(e);return{parsed:c(n),pem:n}}function createPublicKey(e){if(e instanceof m){if(e.type===`public`)return e;if(e.type===`private`)return asymmetricKeyObject(e._handle.parsed,`public`);throw TypeError(`Cannot create public key from secret key`)}if(typeof e==`object`&&e&&`key`in e&&e.key instanceof m)return createPublicKey(e.key);let{parsed:t,pem:n}=parseKeyInput(e,jwkKind(e));return asymmetricKeyObject(t,`public`,t.type===`rsa-private`||t.type===`okp-private`?void 0:n)}function jwkKind(e){return typeof e==`object`&&e&&`format`in e&&e.format===`jwk`?e.key?.d===void 0?`public`:`private`:`public`}function createPrivateKey(e){if(typeof e==`object`&&e&&`key`in e&&e.key instanceof m){if(e.key.type!==`private`)throw u(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE`,`Invalid key object type ${e.key.type}, expected private.`,TypeError);return e.key}let{parsed:t,pem:n}=parseKeyInput(e,`private`);if(t.type!==`rsa-private`&&t.type!==`okp-private`)throw TypeError(`Key is not a private key`);return asymmetricKeyObject(t,`private`,n)}function toKeyObject(e,t){if(e instanceof m){if(t===`private`&&e.type!==`private`)throw u(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE`,`Invalid key object type ${e.type}, expected private.`,TypeError);if(t===`public`&&e.type===`secret`)throw u(`ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE`,`Invalid key object type secret, expected private or public.`,TypeError);return e}if(typeof e==`object`&&e&&`key`in e&&e.key instanceof m)return toKeyObject(e.key,t);if(t===`private`)return createPrivateKey(e);let n=e,{parsed:r}=parseKeyInput(n,jwkKind(n));return asymmetricKeyObject(r,r.type===`rsa-private`||r.type===`okp-private`?`private`:`public`)}function okpKeyMaterial(e){if(e.type===`secret`)return;let t=e._handle,n=t.parsed;if(n.type===`okp-private`)return{curve:n.curve,pub:t.okpPub,priv:n.priv};if(n.type===`okp-public`)return{curve:n.curve,pub:n.pub}}function okpKeyPair(e,t){let n=asymmetricKeyObject({type:`okp-private`,curve:e,priv:t},`private`);return{publicKey:createPublicKey(n),privateKey:n}}function normalizePem(e){if(typeof e==`string`)return e;if(f.isBuffer(e)||e instanceof Uint8Array)return f.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e;if(typeof t.key==`string`)return t.key;if(f.isBuffer(t.key)||t.key instanceof Uint8Array)return f.from(t.key).toString(t.encoding??`utf8`);if(t.key instanceof m)return t.key.export({format:`pem`})}throw TypeError(`Invalid key input`)}export{m as KeyObject,createPrivateKey,createPublicKey,createSecretKey,okpKeyMaterial,okpKeyPair,toKeyObject};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{codedError as e}from"./crypto-utils.js";import{generateOkpPrivateKey as t}from"./curve25519.js";import{okpKeyPair as n}from"./key-object.js";const r=[`rsa`,`rsa-pss`,`dsa`,`ec`,`ed25519`,`ed448`,`x25519`,`x448`,`dh`];function encode(e,t){return t===void 0?e:e.export(t)}function generateKeyPairSync(i,a){if(typeof i!=`string`)throw e(`ERR_INVALID_ARG_TYPE`,`The "type" argument must be of type string. Received ${typeof i}`,TypeError);if(i!==`ed25519`&&i!==`x25519`)throw r.includes(i)?e(`ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`,`generateKeyPair('${i}') is not implemented on GJS yet (supported: 'ed25519', 'x25519')`):e(`ERR_INVALID_ARG_VALUE`,`The argument 'type' must be a supported key type. Received '${i}'`,TypeError);let{publicKey:o,privateKey:s}=n(i,t(i));return{publicKey:encode(o,a?.publicKeyEncoding),privateKey:encode(s,a?.privateKeyEncoding)}}function generateKeyPair(t,n,r){let i=typeof n==`function`?n:r,a=typeof n==`function`?void 0:n;if(typeof i!=`function`)throw e(`ERR_INVALID_ARG_TYPE`,`The "callback" argument must be of type function`,TypeError);let o=generateKeyPairSync(t,a);setTimeout(()=>i(null,o.publicKey,o.privateKey),0)}Object.defineProperty(generateKeyPair,Symbol.for(`nodejs.util.promisify.custom`),{value:(e,t)=>new Promise(n=>n(generateKeyPairSync(e,t)))});export{generateKeyPair,generateKeyPairSync};
|
package/lib/esm/sign.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{parsePemKey as e,rsaKeySize as t}from"./asn1.js";import{bigIntToBytes as n,bytesToBigInt as r,modPow as i}from"./bigint-math.js";import{
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{parsePemKey as e,rsaKeySize as t}from"./asn1.js";import{bigIntToBytes as n,bytesToBigInt as r,modPow as i}from"./bigint-math.js";import{codedError as a}from"./crypto-utils.js";import{ed25519Sign as o,ed25519Verify as s}from"./curve25519.js";import{KeyObject as c,okpKeyMaterial as l,toKeyObject as u}from"./key-object.js";import{Hash as d}from"./hash.js";import{Buffer as f}from"node:buffer";function rejectOkpKey(e){if(!(e.type!==`okp-public`&&e.type!==`okp-private`))throw e.curve===`ed25519`?a(`ERR_CRYPTO_UNSUPPORTED_OPERATION`,`Unsupported crypto operation`):a(`ERR_OSSL_EVP_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE`,`error:03000096:digital envelope routines::operation not supported for this keytype`)}const p={sha1:new Uint8Array([48,33,48,9,6,5,43,14,3,2,26,5,0,4,20]),sha256:new Uint8Array([48,49,48,13,6,9,96,134,72,1,101,3,4,2,1,5,0,4,32]),sha512:new Uint8Array([48,81,48,13,6,9,96,134,72,1,101,3,4,2,3,5,0,4,64])};function normalizeSignAlgorithm(e){let t=e.toLowerCase().replace(/-/g,``);if(t.startsWith(`rsa`)&&(t=t.slice(3)),!p[t])throw Error(`Unsupported algorithm: ${e}. Supported: RSA-SHA1, RSA-SHA256, RSA-SHA512`);return t}function extractPem(e){if(typeof e==`string`)return e;if(f.isBuffer(e)||e instanceof Uint8Array)return f.from(e).toString(`utf8`);if(e&&typeof e==`object`&&`key`in e){let t=e.key;if(typeof t==`string`)return t;if(f.isBuffer(t)||t instanceof Uint8Array)return f.from(t).toString(`utf8`)}throw TypeError(`Invalid key argument`)}var Sign=class{_algorithm;_hash;_finalized=!1;constructor(e){this._algorithm=normalizeSignAlgorithm(e),this._hash=new d(this._algorithm)}update(e,t){if(this._finalized)throw Error(`Sign was already finalized`);return this._hash.update(e,t),this}sign(a,o){if(this._finalized)throw Error(`Sign was already finalized`);this._finalized=!0;let s=this._hash.digest(),c=e(extractPem(a));if(rejectOkpKey(c),c.type!==`rsa-private`)throw Error(`privateKey must be an RSA private key`);let{n:l,d:u}=c.components,d=t(l),m=p[this._algorithm],h=new Uint8Array(m.length+s.length);h.set(m,0),h.set(s,m.length);let g=d-h.length-3;if(g<8)throw Error(`Key is too short for the specified hash algorithm`);let _=new Uint8Array(d);_[0]=0,_[1]=1;for(let e=2;e<2+g;e++)_[e]=255;_[2+g]=0,_.set(h,3+g);let v=n(i(r(_),u,l),d),y=f.from(v);return o?y.toString(o):y}},Verify=class{_algorithm;_hash;_finalized=!1;constructor(e){this._algorithm=normalizeSignAlgorithm(e),this._hash=new d(this._algorithm)}update(e,t){if(this._finalized)throw Error(`Verify was already finalized`);return this._hash.update(e,t),this}verify(a,o,s){if(this._finalized)throw Error(`Verify was already finalized`);this._finalized=!0;let c=this._hash.digest(),l=e(extractPem(a));rejectOkpKey(l);let u,d;if(l.type===`rsa-public`)u=l.components.n,d=l.components.e;else if(l.type===`rsa-private`)u=l.components.n,d=l.components.e;else throw Error(`publicKey must be an RSA public or private key`);let m=t(u),h;if(h=typeof o==`string`?f.from(o,s||`base64`):o instanceof Uint8Array?o:f.from(o),h.length!==m)return!1;let g=r(h);if(g>=u)return!1;let _=n(i(g,d,u),m);if(_[0]!==0||_[1]!==1)return!1;let v=2;for(;v<_.length&&_[v]===255;)v++;if(v>=_.length||_[v]!==0||v-2<8)return!1;v++;let y=_.slice(v),b=p[this._algorithm],x=new Uint8Array(b.length+c.length);if(x.set(b,0),x.set(c,b.length),y.length!==x.length)return!1;let S=0;for(let e=0;e<y.length;e++)S|=y[e]^x[e];return S===0}};function createSign(e){return new Sign(e)}function createVerify(e){return new Verify(e)}function contextOf(e){if(typeof e!=`object`||!e||e instanceof c||f.isBuffer(e))return;let t=e.context;return t===void 0?void 0:new Uint8Array(t)}function toBytes(e,t){if(typeof e==`string`)return f.from(e,`utf8`);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw a(`ERR_INVALID_ARG_TYPE`,`The "${t}" argument must be an instance of Buffer, TypedArray, or DataView.`,TypeError)}function rsaPem(e){return e.export({format:`pem`,type:e.type===`private`?`pkcs1`:`spki`})}function rejectDigestForEdDSA(e){if(e!=null)throw a(`ERR_OSSL_INVALID_DIGEST`,`error:1C80007A:Provider routines::invalid digest`)}function oneShotSign(e,t,n){let r=u(n,`private`),i=l(r);if(i)return i.curve!==`ed25519`&&rejectOkpKey({type:`okp-private`,curve:i.curve,priv:i.priv}),rejectDigestForEdDSA(e),f.from(o(i.priv,t,contextOf(n)));let a=new Sign(e??`sha256`);return a.update(f.from(t)),a.sign(rsaPem(r))}function oneShotVerify(e,t,n,r){let i=u(n,`public`),a=l(i);if(a)return a.curve!==`ed25519`&&rejectOkpKey({type:`okp-public`,curve:a.curve,pub:a.pub}),rejectDigestForEdDSA(e),s(a.pub,t,r,contextOf(n));let o=new Verify(e??`sha256`);return o.update(f.from(t)),o.verify(rsaPem(i),r)}function sign(e,t,n,r){let i=toBytes(t,`data`);if(r===void 0)return oneShotSign(e,i,n);let a;try{a=oneShotSign(e,i,n)}catch(e){setTimeout(()=>r(e),0);return}setTimeout(()=>r(null,a),0)}function verify(e,t,n,r,i){let a=toBytes(t,`data`),o=toBytes(r,`signature`);if(i===void 0)return oneShotVerify(e,a,n,o);let s;try{s=oneShotVerify(e,a,n,o)}catch(e){setTimeout(()=>i(e),0);return}setTimeout(()=>i(null,s),0)}export{Sign,Verify,createSign,createVerify,sign,verify};
|
package/lib/types/asn1.d.ts
CHANGED
|
@@ -14,12 +14,22 @@ export interface RsaPrivateComponents {
|
|
|
14
14
|
p: bigint;
|
|
15
15
|
q: bigint;
|
|
16
16
|
}
|
|
17
|
+
/** RFC 8410 key types — the raw 32-byte key, no further structure. */
|
|
18
|
+
export type OkpCurve = 'ed25519' | 'x25519';
|
|
17
19
|
export type ParsedKey = {
|
|
18
20
|
type: 'rsa-public';
|
|
19
21
|
components: RsaPublicComponents;
|
|
20
22
|
} | {
|
|
21
23
|
type: 'rsa-private';
|
|
22
24
|
components: RsaPrivateComponents;
|
|
25
|
+
} | {
|
|
26
|
+
type: 'okp-public';
|
|
27
|
+
curve: OkpCurve;
|
|
28
|
+
pub: Uint8Array;
|
|
29
|
+
} | {
|
|
30
|
+
type: 'okp-private';
|
|
31
|
+
curve: OkpCurve;
|
|
32
|
+
priv: Uint8Array;
|
|
23
33
|
};
|
|
24
34
|
/**
|
|
25
35
|
* Encode a BigInt as an ASN.1 INTEGER.
|
|
@@ -45,6 +55,10 @@ export declare function encodeRsaPrivateKeyPkcs1(components: RsaPrivateComponent
|
|
|
45
55
|
* Encode RSA private key as PKCS#8 PrivateKeyInfo DER.
|
|
46
56
|
*/
|
|
47
57
|
export declare function encodePrivateKeyInfo(components: RsaPrivateComponents): Uint8Array;
|
|
58
|
+
/** RFC 8410 SubjectPublicKeyInfo — AlgorithmIdentifier carries no parameters. */
|
|
59
|
+
export declare function encodeOkpSubjectPublicKeyInfo(curve: OkpCurve, pub: Uint8Array): Uint8Array;
|
|
60
|
+
/** RFC 8410 § 7 PrivateKeyInfo (version 0, no public key attached — what OpenSSL emits). */
|
|
61
|
+
export declare function encodeOkpPrivateKeyInfo(curve: OkpCurve, priv: Uint8Array): Uint8Array;
|
|
48
62
|
/**
|
|
49
63
|
* Convert DER bytes to PEM string.
|
|
50
64
|
*/
|
|
@@ -80,6 +94,12 @@ export declare function parseX509Der(der: Uint8Array): X509Components;
|
|
|
80
94
|
* - PRIVATE KEY (PKCS#8 PrivateKeyInfo)
|
|
81
95
|
*/
|
|
82
96
|
export declare function parsePemKey(pem: string): ParsedKey;
|
|
97
|
+
/**
|
|
98
|
+
* Parse a DER-encoded key in the given container — the `format: 'der'` path of
|
|
99
|
+
* createPublicKey / createPrivateKey. `pkcs1` needs the key kind, since
|
|
100
|
+
* RSAPublicKey and RSAPrivateKey share no tag that tells them apart.
|
|
101
|
+
*/
|
|
102
|
+
export declare function parseDerKey(der: Uint8Array, type: 'spki' | 'pkcs8' | 'pkcs1', kind?: 'public' | 'private'): ParsedKey;
|
|
83
103
|
/**
|
|
84
104
|
* Get the key size in bytes (byte length of modulus n).
|
|
85
105
|
*/
|
|
@@ -20,3 +20,7 @@ export declare function hashSize(algo: string): number;
|
|
|
20
20
|
* Handles string, Buffer, Uint8Array, DataView, and ArrayBuffer.
|
|
21
21
|
*/
|
|
22
22
|
export declare function toBuffer(input: string | Buffer | Uint8Array | DataView | ArrayBuffer, encoding?: string): Buffer;
|
|
23
|
+
/** An error carrying a Node `code` (`ERR_*`), thrown where Node throws the same code. */
|
|
24
|
+
export declare function codedError(code: string, message: string, Ctor?: ErrorConstructor): Error & {
|
|
25
|
+
code: string;
|
|
26
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type RandomSource } from '@gjsify/webcrypto/random';
|
|
2
|
+
export type OkpCurve = 'ed25519' | 'x25519';
|
|
3
|
+
export declare const OKP_KEY_BYTES = 32;
|
|
4
|
+
export declare const ED25519_SIGNATURE_BYTES = 64;
|
|
5
|
+
/**
|
|
6
|
+
* A fresh private key: the Ed25519 seed, or the (clamped) X25519 scalar.
|
|
7
|
+
*
|
|
8
|
+
* Long-term keys refuse the non-cryptographic tail of the entropy chain
|
|
9
|
+
* (GLib.Random, Math.random) that `randomBytes` falls back to with only a
|
|
10
|
+
* warning: a key from those is guessable, and nothing downstream could tell.
|
|
11
|
+
* `fill` is the seam the spec uses to exercise that refusal.
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateOkpPrivateKey(curve: OkpCurve, fill?: (view: Uint8Array) => RandomSource): Uint8Array;
|
|
14
|
+
export declare function okpPublicFromPrivate(curve: OkpCurve, priv: Uint8Array): Uint8Array;
|
|
15
|
+
/** Ed25519 (empty context) or Ed25519ctx (non-empty context), RFC 8032 § 5.1.6. */
|
|
16
|
+
export declare function ed25519Sign(seed: Uint8Array, message: Uint8Array, context?: Uint8Array): Uint8Array;
|
|
17
|
+
/**
|
|
18
|
+
* RFC 8032 § 5.1.7 with the cofactorless equation (see file header), strict
|
|
19
|
+
* point decoding, S < L, and small-order A / R rejected. Every input is
|
|
20
|
+
* public, so the variable-time multiplications are fine here.
|
|
21
|
+
*/
|
|
22
|
+
export declare function ed25519Verify(pub: Uint8Array, message: Uint8Array, signature: Uint8Array, context?: Uint8Array): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* X25519 shared secret. Throws for a low-order peer key, the inputs that
|
|
25
|
+
* yield the all-zero secret RFC 7748 § 6.1 tells implementations to reject —
|
|
26
|
+
* @noble/curves rejects them BEFORE running the ladder on the private scalar.
|
|
27
|
+
*/
|
|
28
|
+
export declare function x25519SharedSecret(priv: Uint8Array, peerPub: Uint8Array): Uint8Array;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
|
2
|
+
interface DiffieHellmanOptions {
|
|
3
|
+
privateKey: unknown;
|
|
4
|
+
publicKey: unknown;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The shared secret of an X25519 key pair. Node also accepts EC and DH keys
|
|
8
|
+
* here; those key types have no KeyObject support on GJS yet.
|
|
9
|
+
*/
|
|
10
|
+
export declare function diffieHellman(options: DiffieHellmanOptions): Buffer;
|
|
11
|
+
export declare function diffieHellman(options: DiffieHellmanOptions, callback: (err: Error | null, secret?: Buffer) => void): void;
|
|
12
|
+
export {};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -13,7 +13,9 @@ export declare function createHash(algorithm: string): Hash;
|
|
|
13
13
|
/** Create an Hmac object for the given algorithm and key. */
|
|
14
14
|
export declare function createHmac(algorithm: string, key: string | Buffer | Uint8Array): Hmac;
|
|
15
15
|
export { createCipher, createCipheriv, createDecipher, createDecipheriv, getCiphers } from './cipher.js';
|
|
16
|
-
export { Sign, Verify, createSign, createVerify } from './sign.js';
|
|
16
|
+
export { Sign, Verify, createSign, createVerify, sign, verify } from './sign.js';
|
|
17
|
+
export { generateKeyPair, generateKeyPairSync } from './keygen.js';
|
|
18
|
+
export { diffieHellman } from './dh-stateless.js';
|
|
17
19
|
export { createDiffieHellman, getDiffieHellman, DiffieHellman, DiffieHellmanGroup, createDiffieHellmanGroup, } from './dh.js';
|
|
18
20
|
export { createECDH, getCurves } from './ecdh.js';
|
|
19
21
|
export { ecdsaSign, ecdsaVerify } from './ecdsa.js';
|
|
@@ -30,7 +32,9 @@ import { pbkdf2, pbkdf2Sync } from './pbkdf2.js';
|
|
|
30
32
|
import { hkdf, hkdfSync } from './hkdf.js';
|
|
31
33
|
import { scrypt, scryptSync } from './scrypt.js';
|
|
32
34
|
import { createCipher, createCipheriv, createDecipher, createDecipheriv, getCiphers } from './cipher.js';
|
|
33
|
-
import { Sign, Verify, createSign, createVerify } from './sign.js';
|
|
35
|
+
import { Sign, Verify, createSign, createVerify, sign, verify } from './sign.js';
|
|
36
|
+
import { generateKeyPair, generateKeyPairSync } from './keygen.js';
|
|
37
|
+
import { diffieHellman } from './dh-stateless.js';
|
|
34
38
|
import { createDiffieHellman, getDiffieHellman, DiffieHellman } from './dh.js';
|
|
35
39
|
import { createECDH, getCurves } from './ecdh.js';
|
|
36
40
|
import { ecdsaSign, ecdsaVerify } from './ecdsa.js';
|
|
@@ -78,6 +82,11 @@ declare const _default: {
|
|
|
78
82
|
Verify: typeof Verify;
|
|
79
83
|
createSign: typeof createSign;
|
|
80
84
|
createVerify: typeof createVerify;
|
|
85
|
+
sign: typeof sign;
|
|
86
|
+
verify: typeof verify;
|
|
87
|
+
generateKeyPair: typeof generateKeyPair;
|
|
88
|
+
generateKeyPairSync: typeof generateKeyPairSync;
|
|
89
|
+
diffieHellman: typeof diffieHellman;
|
|
81
90
|
createDiffieHellman: typeof createDiffieHellman;
|
|
82
91
|
getDiffieHellman: typeof getDiffieHellman;
|
|
83
92
|
DiffieHellman: typeof DiffieHellman;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
|
+
import type { OkpCurve } from './asn1.js';
|
|
2
3
|
export declare class KeyObject {
|
|
3
4
|
readonly type: 'secret' | 'public' | 'private';
|
|
4
5
|
/** @internal */
|
|
@@ -6,11 +7,18 @@ export declare class KeyObject {
|
|
|
6
7
|
constructor(type: 'secret' | 'public' | 'private', handle: unknown);
|
|
7
8
|
get symmetricKeySize(): number | undefined;
|
|
8
9
|
get asymmetricKeyType(): string | undefined;
|
|
10
|
+
/** Node: `{ modulusLength, publicExponent }` for RSA, `{}` for the RFC 8410 curves. */
|
|
11
|
+
get asymmetricKeyDetails(): {
|
|
12
|
+
modulusLength?: number;
|
|
13
|
+
publicExponent?: bigint;
|
|
14
|
+
} | undefined;
|
|
9
15
|
get asymmetricKeySize(): number | undefined;
|
|
10
16
|
equals(otherKeyObject: KeyObject): boolean;
|
|
11
17
|
export(options?: {
|
|
12
18
|
type?: string;
|
|
13
19
|
format?: string;
|
|
20
|
+
cipher?: string;
|
|
21
|
+
passphrase?: unknown;
|
|
14
22
|
}): Buffer | string | object;
|
|
15
23
|
get [Symbol.toStringTag](): string;
|
|
16
24
|
}
|
|
@@ -26,11 +34,29 @@ interface KeyInput {
|
|
|
26
34
|
*/
|
|
27
35
|
export declare function createSecretKey(key: Buffer | Uint8Array | string, encoding?: BufferEncoding): KeyObject;
|
|
28
36
|
/**
|
|
29
|
-
* Create a public key from PEM, DER, JWK, or another KeyObject.
|
|
37
|
+
* Create a public key from PEM, DER, JWK, or another KeyObject. A private key
|
|
38
|
+
* input yields its public half, as in Node.
|
|
30
39
|
*/
|
|
31
40
|
export declare function createPublicKey(key: string | Buffer | KeyInput | KeyObject): KeyObject;
|
|
32
41
|
/**
|
|
33
42
|
* Create a private key from PEM, DER, JWK, or KeyInput.
|
|
34
43
|
*/
|
|
35
44
|
export declare function createPrivateKey(key: string | Buffer | KeyInput): KeyObject;
|
|
45
|
+
/**
|
|
46
|
+
* Resolve any key argument Node's one-shot APIs accept (KeyObject, PEM,
|
|
47
|
+
* `{ key, format, type }`, JWK) to a KeyObject of the wanted kind. A private
|
|
48
|
+
* key where a public one is wanted yields its public half, as in Node.
|
|
49
|
+
*/
|
|
50
|
+
export declare function toKeyObject(key: unknown, kind: 'public' | 'private'): KeyObject;
|
|
51
|
+
/** The RFC 8410 view of a KeyObject, or undefined for any other key type. */
|
|
52
|
+
export declare function okpKeyMaterial(key: KeyObject): {
|
|
53
|
+
curve: OkpCurve;
|
|
54
|
+
pub: Uint8Array;
|
|
55
|
+
priv?: Uint8Array;
|
|
56
|
+
} | undefined;
|
|
57
|
+
/** @internal Build a KeyObject pair straight from a raw RFC 8410 private key. */
|
|
58
|
+
export declare function okpKeyPair(curve: OkpCurve, priv: Uint8Array): {
|
|
59
|
+
publicKey: KeyObject;
|
|
60
|
+
privateKey: KeyObject;
|
|
61
|
+
};
|
|
36
62
|
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Buffer } from 'node:buffer';
|
|
2
|
+
import { type KeyObject } from './key-object.js';
|
|
3
|
+
interface KeyEncoding {
|
|
4
|
+
type?: string;
|
|
5
|
+
format?: string;
|
|
6
|
+
cipher?: string;
|
|
7
|
+
passphrase?: unknown;
|
|
8
|
+
}
|
|
9
|
+
interface KeyPairOptions {
|
|
10
|
+
publicKeyEncoding?: KeyEncoding;
|
|
11
|
+
privateKeyEncoding?: KeyEncoding;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
type EncodedKey = KeyObject | Buffer | string | object;
|
|
15
|
+
export declare function generateKeyPairSync(type: string, options?: KeyPairOptions): {
|
|
16
|
+
publicKey: EncodedKey;
|
|
17
|
+
privateKey: EncodedKey;
|
|
18
|
+
};
|
|
19
|
+
type KeyPairCallback = (err: Error | null, publicKey?: EncodedKey, privateKey?: EncodedKey) => void;
|
|
20
|
+
export declare function generateKeyPair(type: string, options: KeyPairOptions | KeyPairCallback | undefined, callback?: KeyPairCallback): void;
|
|
21
|
+
export {};
|
package/lib/types/sign.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
|
+
import { KeyObject } from './key-object.js';
|
|
2
3
|
interface KeyInput {
|
|
3
4
|
key: string;
|
|
4
5
|
passphrase?: string;
|
|
@@ -58,4 +59,17 @@ export declare function createSign(algorithm: string): Sign;
|
|
|
58
59
|
* Create and return a Verify object for the given algorithm.
|
|
59
60
|
*/
|
|
60
61
|
export declare function createVerify(algorithm: string): Verify;
|
|
62
|
+
type SignKeyInput = KeyObject | string | Buffer | {
|
|
63
|
+
key: unknown;
|
|
64
|
+
context?: Uint8Array;
|
|
65
|
+
[k: string]: unknown;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* crypto.sign(algorithm, data, key[, callback]). For Ed25519 `algorithm` is
|
|
69
|
+
* null/undefined (EdDSA fixes its own hash); a `{ key, context }` input selects
|
|
70
|
+
* Ed25519ctx, an empty context is plain Ed25519 — both as in Node.
|
|
71
|
+
*/
|
|
72
|
+
export declare function sign(algorithm: string | null | undefined, data: string | ArrayBufferView, key: SignKeyInput, callback?: (err: Error | null, signature?: Buffer) => void): Buffer | void;
|
|
73
|
+
/** crypto.verify(algorithm, data, key, signature[, callback]). */
|
|
74
|
+
export declare function verify(algorithm: string | null | undefined, data: string | ArrayBufferView, key: SignKeyInput, signature: ArrayBufferView, callback?: (err: Error | null, result?: boolean) => void): boolean | void;
|
|
61
75
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/crypto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.0",
|
|
4
4
|
"description": "Node.js crypto module for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"clear": "gjsify clear lib tsconfig.tsbuildinfo tsconfig.types.tsbuildinfo test.gjs.mjs test.node.mjs",
|
|
59
59
|
"check": "gjsify tsc --noEmit",
|
|
60
60
|
"build": "gjsify run build:gjsify && gjsify run build:types",
|
|
61
|
-
"build:gjsify": "gjsify build --library 'src/**/*.{ts,js}' --exclude 'src/**/*.spec.{mts,ts}' 'src/test.{mts,ts}'",
|
|
61
|
+
"build:gjsify": "gjsify build --library 'src/**/*.{ts,js}' --exclude 'src/**/*.spec.{mts,ts}' 'src/test.{mts,ts}' 'src/fixtures/**'",
|
|
62
62
|
"build:types": "gjsify tsc",
|
|
63
63
|
"build:test": "gjsify run build:test:gjs && gjsify run build:test:node && gjsify run build:test:browser",
|
|
64
64
|
"build:test:gjs": "gjsify build src/test.mts --app gjs --outfile test.gjs.mjs",
|
|
@@ -74,18 +74,20 @@
|
|
|
74
74
|
"crypto"
|
|
75
75
|
],
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@gjsify/cli": "^0.
|
|
78
|
-
"@gjsify/unit": "^0.
|
|
77
|
+
"@gjsify/cli": "^0.54.0",
|
|
78
|
+
"@gjsify/unit": "^0.54.0",
|
|
79
|
+
"@gjsify/util": "^0.54.0",
|
|
79
80
|
"@types/diffie-hellman": "^5.0.3",
|
|
80
81
|
"@types/node": "^25.9.2",
|
|
81
82
|
"typescript": "^6.0.3"
|
|
82
83
|
},
|
|
83
84
|
"dependencies": {
|
|
84
85
|
"@girs/glib-2.0": "5.4.0",
|
|
85
|
-
"@gjsify/buffer": "^0.
|
|
86
|
-
"@gjsify/stream": "^0.
|
|
87
|
-
"@gjsify/webcrypto": "^0.
|
|
88
|
-
"@noble/
|
|
86
|
+
"@gjsify/buffer": "^0.54.0",
|
|
87
|
+
"@gjsify/stream": "^0.54.0",
|
|
88
|
+
"@gjsify/webcrypto": "^0.54.0",
|
|
89
|
+
"@noble/curves": "^2.4.0",
|
|
90
|
+
"@noble/hashes": "^2.4.0"
|
|
89
91
|
},
|
|
90
92
|
"gjsify": {
|
|
91
93
|
"runtimes": {
|