micro509 0.17.1 → 0.18.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/CHANGELOG.md +78 -6
- package/dist/crypto/crypto.d.ts +2 -3
- package/dist/crypto.d.ts +6 -0
- package/dist/der/der.d.ts +14 -4
- package/dist/der/der.js +19 -19
- package/dist/der.d.ts +26 -2
- package/dist/der.js +4 -4
- package/dist/index.d.ts +82 -15
- package/dist/index.js +19 -19
- package/dist/internal/asn1/asn1.d.ts +1 -2
- package/dist/internal/asn1/der.d.ts +1 -2
- package/dist/internal/asn1/oids.js +71 -353
- package/dist/internal/asn1/oids.js.map +1 -1
- package/dist/internal/asn1/oids.json.js +357 -0
- package/dist/internal/asn1/oids.json.js.map +1 -0
- package/dist/internal/crypto/algorithm-names.js +1 -1
- package/dist/internal/crypto/pbes2.d.ts +1 -2
- package/dist/internal/crypto/pbes2.js +70 -70
- package/dist/internal/crypto/prime-ec.js +37 -0
- package/dist/internal/crypto/prime-ec.js.map +1 -0
- package/dist/internal/crypto/rsa-pss.js +50 -50
- package/dist/internal/crypto/sig-verify.d.ts +1 -2
- package/dist/internal/crypto/sig-verify.js +60 -60
- package/dist/internal/crypto/signing.d.ts +1 -2
- package/dist/internal/crypto/signing.js +26 -26
- package/dist/internal/jose/json-data.js +108 -0
- package/dist/internal/jose/json-data.js.map +1 -0
- package/dist/internal/jose/strict-json.d.ts +1 -2
- package/dist/internal/shared/dn.d.ts +1 -2
- package/dist/internal/shared/dn.js +1 -1
- package/dist/internal/shared/ip.d.ts +1 -2
- package/dist/internal/verify/name-constraints-engine.js +64 -64
- package/dist/internal/verify/policy-engine.js +1 -1
- package/dist/internal/verify/verify-path.d.ts +1 -2
- package/dist/internal/verify/verify-path.js +19 -19
- package/dist/internal/x509/directory-name.js +10 -10
- package/dist/internal/x509/extension-errors.d.ts +1 -2
- package/dist/internal/x509/extension-registry.js +18 -18
- package/dist/internal/x509/general-name-profile.js +9 -9
- package/dist/internal/x509/general-name.js +32 -32
- package/dist/internal/x509/name-fields.js +1 -1
- package/dist/jose/base64url.d.ts +4 -0
- package/dist/jose/base64url.js +14 -0
- package/dist/jose/base64url.js.map +1 -0
- package/dist/jose/errors.d.ts +9 -3
- package/dist/jose/errors.js.map +1 -1
- package/dist/jose/jwe.d.ts +64 -0
- package/dist/jose/jwe.js +188 -0
- package/dist/jose/jwe.js.map +1 -0
- package/dist/jose/jwks.d.ts +38 -10
- package/dist/jose/jwks.js +156 -96
- package/dist/jose/jwks.js.map +1 -1
- package/dist/jose/jws.d.ts +8 -6
- package/dist/jose/jws.js +216 -170
- package/dist/jose/jws.js.map +1 -1
- package/dist/jose/jwt.d.ts +8 -2
- package/dist/jose/jwt.js +98 -98
- package/dist/jose/remote-jwks.d.ts +1 -2
- package/dist/jose/remote-jwks.js +106 -108
- package/dist/jose/remote-jwks.js.map +1 -1
- package/dist/jose.d.ts +15 -4
- package/dist/jose.js +7 -5
- package/dist/kdf/argon2.d.ts +7 -2
- package/dist/kdf.d.ts +6 -0
- package/dist/keys/keys.d.ts +31 -6
- package/dist/keys/keys.js +315 -233
- package/dist/keys/keys.js.map +1 -1
- package/dist/keys.d.ts +11 -2
- package/dist/keys.js +2 -2
- package/dist/pem/pem.d.ts +1 -2
- package/dist/pem/pem.js +40 -25
- package/dist/pem/pem.js.map +1 -1
- package/dist/pem.d.ts +6 -0
- package/dist/pkcs/pfx.d.ts +2 -3
- package/dist/pkcs/pfx.js +142 -142
- package/dist/pkcs/pkcs12-mac.d.ts +1 -2
- package/dist/pkcs/pkcs12-mac.js +122 -122
- package/dist/pkcs/pkcs7.d.ts +14 -3
- package/dist/pkcs/pkcs7.js +268 -248
- package/dist/pkcs/pkcs7.js.map +1 -1
- package/dist/pkcs.d.ts +10 -1
- package/dist/pkcs.js +4 -4
- package/dist/result/result.d.ts +1 -2
- package/dist/result.d.ts +6 -0
- package/dist/revocation/chain.d.ts +2 -3
- package/dist/revocation/chain.js +52 -52
- package/dist/revocation/crl.d.ts +2 -3
- package/dist/revocation/crl.js +319 -319
- package/dist/revocation/crl.js.map +1 -1
- package/dist/revocation/ocsp.d.ts +2 -3
- package/dist/revocation/ocsp.js +395 -395
- package/dist/revocation/revocation.d.ts +2 -3
- package/dist/revocation/revocation.js +22 -22
- package/dist/revocation.d.ts +12 -3
- package/dist/revocation.js +4 -4
- package/dist/ssh/ssh.d.ts +2 -3
- package/dist/ssh/ssh.js +165 -170
- package/dist/ssh/ssh.js.map +1 -1
- package/dist/ssh/wire.d.ts +1 -2
- package/dist/ssh/wire.js +10 -10
- package/dist/ssh.d.ts +8 -0
- package/dist/verify/identity.d.ts +1 -2
- package/dist/verify/identity.js +31 -31
- package/dist/verify/name-constraints.d.ts +9 -2
- package/dist/verify/policy.d.ts +9 -2
- package/dist/verify/verify.d.ts +3 -4
- package/dist/verify/verify.js +121 -121
- package/dist/verify.d.ts +9 -0
- package/dist/x509/certificate.d.ts +4 -5
- package/dist/x509/certificate.js +40 -40
- package/dist/x509/csr.d.ts +3 -4
- package/dist/x509/csr.js +15 -15
- package/dist/x509/extensions.d.ts +1 -2
- package/dist/x509/extensions.js +165 -165
- package/dist/x509/extensions.js.map +1 -1
- package/dist/x509/fingerprint.d.ts +1 -2
- package/dist/x509/name-text.d.ts +1 -2
- package/dist/x509/name.d.ts +1 -2
- package/dist/x509/name.js +15 -15
- package/dist/x509/parse.d.ts +3 -4
- package/dist/x509/parse.js +423 -423
- package/dist/x509.d.ts +17 -4
- package/dist/x509.js +8 -8
- package/package.json +22 -23
- package/dist/internal/asn1/oids2.js +0 -75
- package/dist/internal/asn1/oids2.js.map +0 -1
package/dist/keys/keys.d.ts
CHANGED
|
@@ -121,8 +121,21 @@ export interface LegacyPemEncryptionOptions {
|
|
|
121
121
|
* or DER nested deeper than 64 levels.
|
|
122
122
|
*/
|
|
123
123
|
export type ImportKeyErrorCode = Exclude<DecodeFailureCode, "unsupported">;
|
|
124
|
+
/** Stage at which an ordinary key import refused input. */
|
|
125
|
+
export type ImportKeyStage = "container" | "pem" | "base64" | "asn1" | "algorithm" | "backend";
|
|
126
|
+
/** Stable diagnostic independent of human-readable messages and native backend errors. */
|
|
127
|
+
export type ImportKeyReason = "unsupported_container" | "multiple_blocks" | "encrypted_key" | "invalid_armor" | "invalid_base64" | "invalid_asn1" | "decode_limit" | "unsupported_algorithm" | "algorithm_mismatch" | "public_key_mismatch" | "backend_rejected";
|
|
128
|
+
/** Safe structured context: names only, never input bytes, passwords or backend prose. */
|
|
129
|
+
export interface ImportKeyErrorDetails {
|
|
130
|
+
/** Stage that refused the input. */
|
|
131
|
+
readonly stage: ImportKeyStage;
|
|
132
|
+
/** Stable refusal reason within the stage. */
|
|
133
|
+
readonly reason: ImportKeyReason;
|
|
134
|
+
/** Container selected by the importer, when known. */
|
|
135
|
+
readonly container?: "pkcs8" | "pkcs1" | "sec1" | "spki" | "jwk";
|
|
136
|
+
}
|
|
124
137
|
/** Structured failure payload for key import. */
|
|
125
|
-
export interface ImportKeyFailure extends Micro509Error<ImportKeyErrorCode> {
|
|
138
|
+
export interface ImportKeyFailure extends Micro509Error<ImportKeyErrorCode, ImportKeyErrorDetails> {
|
|
126
139
|
/** Always `false` for failures. */
|
|
127
140
|
readonly ok: false;
|
|
128
141
|
}
|
|
@@ -130,14 +143,14 @@ export interface ImportKeyFailure extends Micro509Error<ImportKeyErrorCode> {
|
|
|
130
143
|
* Success-or-failure result returned by the public `import*` key functions.
|
|
131
144
|
*
|
|
132
145
|
* On failure, `code` is `'malformed'` for structurally invalid input,
|
|
133
|
-
* algorithm mismatches
|
|
134
|
-
*
|
|
146
|
+
* algorithm mismatches and backend refusal. `details` provides a stable stage/reason
|
|
147
|
+
* through the Result and `*OrThrow`/`unwrap` forms, without backend messages. `'limit_exceeded'` is
|
|
135
148
|
* for an implementation limit.
|
|
136
149
|
*/
|
|
137
150
|
export type ImportKeyResult<T> = {
|
|
138
151
|
readonly ok: true;
|
|
139
152
|
readonly value: T;
|
|
140
|
-
} | ErrorResult<ImportKeyErrorCode,
|
|
153
|
+
} | ErrorResult<ImportKeyErrorCode, ImportKeyErrorDetails, ImportKeyFailure>;
|
|
141
154
|
/**
|
|
142
155
|
* Machine-readable failure reason for the `importEncrypted*` key functions.
|
|
143
156
|
*
|
|
@@ -469,6 +482,19 @@ export declare function importSpkiPemOrThrow(pem: string, algorithm?: PublicKeyI
|
|
|
469
482
|
* @see `importSpkiPemOrThrow` for the throwing variant
|
|
470
483
|
*/
|
|
471
484
|
export declare function importSpkiPem(pem: string, algorithm?: PublicKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
|
|
485
|
+
/**
|
|
486
|
+
* Imports exactly one unencrypted private-key PEM block by its label: PKCS#8 `PRIVATE KEY`,
|
|
487
|
+
* PKCS#1 `RSA PRIVATE KEY`, or SEC1 `EC PRIVATE KEY`. Bundles (including a certificate plus key)
|
|
488
|
+
* are refused rather than selecting an arbitrary block. Non-PEM surrounding text follows the
|
|
489
|
+
* shared PEM scanner's behavior. Encrypted PKCS#8 and traditional encrypted PEM require the
|
|
490
|
+
* explicit password-taking import functions. No format guessing or decryption is attempted.
|
|
491
|
+
*
|
|
492
|
+
* Without `algorithm`, existing inference applies (RSA defaults to PKCS#1v1.5/SHA-256).
|
|
493
|
+
* An explicit descriptor additionally asserts key family/curve and selects RSA padding/hash.
|
|
494
|
+
*/
|
|
495
|
+
export declare function importPrivateKeyPemOrThrow(pem: string, algorithm?: PrivateKeyImportInput): Promise<CryptoKey>;
|
|
496
|
+
/** Result-returning counterpart of {@linkcode importPrivateKeyPemOrThrow}. */
|
|
497
|
+
export declare function importPrivateKeyPem(pem: string, algorithm?: PrivateKeyImportInput): Promise<ImportKeyResult<CryptoKey>>;
|
|
472
498
|
/**
|
|
473
499
|
* Import a public key from base64-encoded SubjectPublicKeyInfo (no PEM headers).
|
|
474
500
|
*
|
|
@@ -834,5 +860,4 @@ export declare function decryptRsaOaepOrThrow(privateKey: CryptoKey, ciphertext:
|
|
|
834
860
|
* @see `decryptRsaOaepOrThrow` for the throwing variant
|
|
835
861
|
*/
|
|
836
862
|
export declare function decryptRsaOaep(privateKey: CryptoKey, ciphertext: Uint8Array, options?: RsaOaepOptions): Promise<DecryptRsaOaepResult>;
|
|
837
|
-
export { type KdfLimitOptions, type Pbes2EncryptionOptions, type Pbes2EncryptionScheme, type Pbes2Parameters, type Pbes2Prf, parsePbes2AlgorithmIdentifier };
|
|
838
|
-
//# sourceMappingURL=keys.d.ts.map
|
|
863
|
+
export { type KdfLimitOptions, type Pbes2EncryptionOptions, type Pbes2EncryptionScheme, type Pbes2Parameters, type Pbes2Prf, parsePbes2AlgorithmIdentifier };
|