@yielded/crypto 0.1.0-beta.20 → 0.1.0-beta.21
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.mjs","names":[],"sources":["../../src/internal/node.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"node.mjs","names":[],"sources":["../../src/internal/node.ts"],"sourcesContent":["// @effect-diagnostics-next-line nodeBuiltinImport:off -- This platform adapter needs native Argon2 and WebCrypto, which Effect Crypto does not expose.\nimport * as crypto from \"node:crypto\";\n\nimport { Effect, Result } from \"effect\";\n\nimport { CryptoUnavailable, UnsupportedAlgorithm } from \"../Errors\";\nimport type { Limits } from \"../Kdf\";\nimport type { Argon2, Argon2Parameters } from \"./kdf\";\nimport { makeLayer } from \"./layer\";\nimport { xchacha } from \"./xchacha\";\n\nconst argon2: Argon2 = Effect.fnUntraced(function* (input: Argon2Parameters) {\n // Namespace import keeps this module loadable on Node versions without Argon2.\n if (typeof crypto.argon2 !== \"function\") return yield* UnsupportedAlgorithm.make({});\n\n // Node cannot cancel this work. Keep borrowed buffers and admission until the\n // callback completes, including when its caller has requested interruption.\n return yield* Effect.callback<Uint8Array, CryptoUnavailable>((resume) => {\n const registration = Result.try({\n try: () =>\n crypto.argon2(\n \"argon2id\",\n {\n message: input.password,\n nonce: input.salt,\n parallelism: input.parallelism,\n memory: input.memoryKiB,\n passes: input.passes,\n tagLength: input.length,\n secret: input.secret,\n associatedData: input.associatedData,\n },\n (error, key) =>\n resume(error === null ? Effect.succeed(key) : Effect.fail(CryptoUnavailable.make({}))),\n ),\n catch: () => CryptoUnavailable.make({}),\n });\n\n if (Result.isFailure(registration)) resume(Effect.fail(registration.failure));\n }).pipe(Effect.uninterruptible);\n});\n\n/** Node-compatible WebCrypto/Argon2id with the portable XChaCha20-Poly1305 extension. */\nexport const layer = (limits: Partial<Limits> = {}) =>\n // Node's declarations include additional key usages absent from lib.dom. The\n // standard operations used here share the WebCrypto ABI; no payload is cast.\n makeLayer(crypto.webcrypto.subtle as SubtleCrypto, limits, { argon2, xchacha });\n"],"mappings":";;;;;;AAWA,MAAM,SAAiB,OAAO,WAAW,WAAW,OAAyB;CAE3E,IAAI,OAAO,OAAO,WAAW,YAAY,OAAO,OAAO,qBAAqB,KAAK,CAAC,CAAC;CAInF,OAAO,OAAO,OAAO,UAAyC,WAAW;EACvE,MAAM,eAAe,OAAO,IAAI;GAC9B,WACE,OAAO,OACL,YACA;IACE,SAAS,MAAM;IACf,OAAO,MAAM;IACb,aAAa,MAAM;IACnB,QAAQ,MAAM;IACd,QAAQ,MAAM;IACd,WAAW,MAAM;IACjB,QAAQ,MAAM;IACd,gBAAgB,MAAM;GACxB,IACC,OAAO,QACN,OAAO,UAAU,OAAO,OAAO,QAAQ,GAAG,IAAI,OAAO,KAAK,kBAAkB,KAAK,CAAC,CAAC,CAAC,CAAC,CACzF;GACF,aAAa,kBAAkB,KAAK,CAAC,CAAC;EACxC,CAAC;EAED,IAAI,OAAO,UAAU,YAAY,GAAG,OAAO,OAAO,KAAK,aAAa,OAAO,CAAC;CAC9E,CAAC,CAAC,CAAC,KAAK,OAAO,eAAe;AAChC,CAAC;;AAGD,MAAa,SAAS,SAA0B,CAAC,MAG/C,UAAU,OAAO,UAAU,QAAwB,QAAQ;CAAE;CAAQ;AAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@yielded/crypto","version":"0.1.0-beta.
|
|
1
|
+
{"name":"@yielded/crypto","version":"0.1.0-beta.21","devDependencies":{"@effect/vitest":"4.0.0","@types/node":"26.1.2","effect":"4.0.0","typescript":"7.0.2","vite-plus":"0.3.3"},"peerDependencies":{"effect":"^4.0.0"},"exports":{".":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"./Aead":{"types":"./dist/Aead.d.mts","default":"./dist/Aead.mjs"},"./Errors":{"types":"./dist/Errors.d.mts","default":"./dist/Errors.mjs"},"./Hmac":{"types":"./dist/Hmac.d.mts","default":"./dist/Hmac.mjs"},"./Kdf":{"types":"./dist/Kdf.d.mts","default":"./dist/Kdf.mjs"},"./KdfAdmission":{"types":"./dist/KdfAdmission.d.mts","default":"./dist/KdfAdmission.mjs"},"./Signature":{"types":"./dist/Signature.d.mts","default":"./dist/Signature.mjs"},"./WebCrypto":{"types":"./dist/WebCrypto.d.mts","default":"./dist/WebCrypto.mjs"},"./platform-node":{"types":"./dist/platform-node.d.mts","default":"./dist/platform-node.mjs"},"./platform-bun":{"types":"./dist/platform-bun.d.mts","default":"./dist/platform-bun.mjs"},"./Portable":{"types":"./dist/Portable.d.mts","default":"./dist/Portable.mjs"}},"description":"Effect cryptography services with explicit native and portable backends.","homepage":"https://yielded.dev/auth/","bugs":{"url":"https://github.com/yielded-dev/auth/issues"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/yielded-dev/auth.git","directory":"packages/crypto"},"files":["dist","src","THIRD_PARTY_NOTICES.md"],"type":"module","sideEffects":[],"publishConfig":{"access":"public"},"scripts":{"build":"vp pack","check":"tsc --noEmit -p tsconfig.json","test":"vp test"}}
|
package/src/internal/node.ts
CHANGED