@signature-kit/crypto
v0.2.1
Published
Shared cryptographic primitives for base64, PEM, PKCS#12, hashing, and cipher operations.
Readme
@signature-kit/crypto
Shared cryptographic primitives for base64, PEM, PKCS#12, hashing, and cipher operations.
Install
bun add @signature-kit/crypto effecteffect is a direct runtime dependency. This is a low-level support package; prefer higher-level SignatureKit packages unless you need the primitive directly.
Public surface
@signature-kit/crypto/base64—bytesToBase64andbase64ToBytes.@signature-kit/crypto/config—CryptoError,CryptoErrorCodeValue, operation schemas, message catalogs, andPkcs12ResultSchema.@signature-kit/crypto/pem—pemToDerandderToPem.@signature-kit/crypto/pkcs12—parsePkcs12.
Example
import { bytesToBase64 } from "@signature-kit/crypto/base64";
import { pemToDer } from "@signature-kit/crypto/pem";
import { Effect } from "effect";
declare const certificatePem: string;
const program = Effect.gen(function* () {
const der = yield* pemToDer(certificatePem);
return {
der,
contentBase64: bytesToBase64(der),
};
});Errors and i18n
Crypto failures use the CryptoError code catalog and cryptoErrorMessages. Applications can render localized copy through @signature-kit/i18n by passing that catalog to errorMessage.
Docs: https://signaturekit.dev/en-US/docs/concepts/document-formats.
License
MIT. See LICENSE.
