claim169 0.1.0-alpha.3 → 0.3.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/dist/index.d.ts +58 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +293 -168
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +281 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +98 -9
- package/dist/types.js.map +1 -1
- package/package.json +8 -4
- package/wasm/claim169_wasm.d.ts +27 -2
- package/wasm/claim169_wasm.js +1 -1
- package/wasm/claim169_wasm_bg.js +153 -95
- package/wasm/claim169_wasm_bg.wasm +0 -0
- package/wasm/claim169_wasm_bg.wasm.d.ts +6 -1
- package/wasm/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
*
|
|
84
84
|
* @module claim169
|
|
85
85
|
*/
|
|
86
|
-
export type { Algorithm, AlgorithmName, Biometric, Claim169, Claim169Input, CwtMeta, CwtMetaInput, DecodeResult, DecryptorCallback, EncryptorCallback, IDecoder, IEncoder, SignerCallback, VerificationStatus, VerifierCallback, } from "./types.js";
|
|
87
|
-
export { Claim169Error } from "./types.js";
|
|
88
|
-
import type { Claim169Input, CwtMetaInput, DecodeResult, DecryptorCallback, EncryptorCallback, IDecoder, IEncoder, SignerCallback, VerifierCallback } from "./types.js";
|
|
86
|
+
export type { Algorithm, AlgorithmName, Biometric, CertificateHash, Claim169, Claim169ErrorCode, Claim169Input, CompressionMode, CoseType, CwtMeta, CwtMetaInput, DecodeResult, DetectedCompression, DecryptorCallback, EncodeResult, EncodeWarning, EncryptorCallback, IDecoder, IEncoder, InspectResult, SignerCallback, VerificationStatus, VerifierCallback, X509Headers, } from "./types.js";
|
|
87
|
+
export { BiometricFormat, Claim169Error, Gender, MaritalStatus, PhotoFormat, } from "./types.js";
|
|
88
|
+
import type { Claim169Input, CompressionMode, CwtMetaInput, DecodeResult, DecryptorCallback, EncodeResult, EncryptorCallback, IDecoder, IEncoder, InspectResult, SignerCallback, VerifierCallback } from "./types.js";
|
|
89
89
|
/**
|
|
90
90
|
* Get the library version
|
|
91
91
|
*/
|
|
@@ -156,9 +156,26 @@ export declare class Decoder implements IDecoder {
|
|
|
156
156
|
* @throws {Claim169Error} If the public key is invalid
|
|
157
157
|
*/
|
|
158
158
|
verifyWithEcdsaP256(publicKey: Uint8Array): Decoder;
|
|
159
|
+
/**
|
|
160
|
+
* Verify signature with Ed25519 public key in PEM format.
|
|
161
|
+
* Supports SPKI format with "BEGIN PUBLIC KEY" headers.
|
|
162
|
+
* @param pem - PEM-encoded Ed25519 public key
|
|
163
|
+
* @returns The decoder instance for chaining
|
|
164
|
+
* @throws {Claim169Error} If the PEM is invalid
|
|
165
|
+
*/
|
|
166
|
+
verifyWithEd25519Pem(pem: string): Decoder;
|
|
167
|
+
/**
|
|
168
|
+
* Verify signature with ECDSA P-256 public key in PEM format.
|
|
169
|
+
* Supports SPKI format with "BEGIN PUBLIC KEY" headers.
|
|
170
|
+
* @param pem - PEM-encoded P-256 public key
|
|
171
|
+
* @returns The decoder instance for chaining
|
|
172
|
+
* @throws {Claim169Error} If the PEM is invalid
|
|
173
|
+
*/
|
|
174
|
+
verifyWithEcdsaP256Pem(pem: string): Decoder;
|
|
159
175
|
/**
|
|
160
176
|
* Allow decoding without signature verification.
|
|
161
|
-
* WARNING:
|
|
177
|
+
* WARNING: Credentials decoded with verification skipped (`verificationStatus === "skipped"`)
|
|
178
|
+
* cannot be trusted. Use for testing only.
|
|
162
179
|
* @returns The decoder instance for chaining
|
|
163
180
|
*/
|
|
164
181
|
allowUnverified(): Decoder;
|
|
@@ -183,7 +200,7 @@ export declare class Decoder implements IDecoder {
|
|
|
183
200
|
*/
|
|
184
201
|
skipBiometrics(): Decoder;
|
|
185
202
|
/**
|
|
186
|
-
*
|
|
203
|
+
* Re-enable timestamp validation (enabled by default).
|
|
187
204
|
* When enabled, expired or not-yet-valid credentials will throw an error.
|
|
188
205
|
* Implemented in the host (JavaScript) to avoid WASM runtime time limitations.
|
|
189
206
|
* @returns The decoder instance for chaining
|
|
@@ -260,6 +277,8 @@ export declare class Decoder implements IDecoder {
|
|
|
260
277
|
* Notes:
|
|
261
278
|
* - If you don't provide a verification key, you must explicitly set `allowUnverified: true` (testing only).
|
|
262
279
|
* - Timestamp validation is enabled by default in JS (host-side). Set `validateTimestamps: false` to disable.
|
|
280
|
+
* - PEM keys and custom verifier/decryptor callbacks are not supported here.
|
|
281
|
+
* Use the `Decoder` builder class directly for those features.
|
|
263
282
|
*/
|
|
264
283
|
export interface DecodeOptions {
|
|
265
284
|
verifyWithEd25519?: Uint8Array;
|
|
@@ -386,15 +405,46 @@ export declare class Encoder implements IEncoder {
|
|
|
386
405
|
*/
|
|
387
406
|
encryptWith(encryptor: EncryptorCallback, algorithm: "A256GCM" | "A128GCM"): Encoder;
|
|
388
407
|
/**
|
|
389
|
-
*
|
|
390
|
-
* @
|
|
408
|
+
* Set compression mode for encoding.
|
|
409
|
+
* @param mode - Compression mode: "zlib", "none", "adaptive", "brotli:N" (0-11), or "adaptive-brotli:N"
|
|
410
|
+
* @returns The encoder instance for chaining
|
|
411
|
+
* @throws {Claim169Error} If the mode is invalid or unsupported by the WASM build
|
|
412
|
+
*/
|
|
413
|
+
compression(mode: CompressionMode): Encoder;
|
|
414
|
+
/**
|
|
415
|
+
* Encode the credential to a QR-ready result object.
|
|
416
|
+
* @returns Encode result with QR data, compression info, and warnings
|
|
391
417
|
* @throws {Claim169Error} If encoding fails
|
|
392
418
|
*/
|
|
393
|
-
encode():
|
|
419
|
+
encode(): EncodeResult;
|
|
394
420
|
}
|
|
395
421
|
/**
|
|
396
422
|
* Generate a random 12-byte nonce for AES-GCM encryption.
|
|
397
423
|
* @returns A 12-byte Uint8Array suitable for use as a nonce
|
|
398
424
|
*/
|
|
399
425
|
export declare function generateNonce(): Uint8Array;
|
|
426
|
+
/**
|
|
427
|
+
* Inspect credential metadata without full decoding or verification.
|
|
428
|
+
*
|
|
429
|
+
* Extracts metadata (issuer, key ID, algorithm, expiration) from a QR code
|
|
430
|
+
* without verifying the signature. Useful for multi-issuer key lookup.
|
|
431
|
+
*
|
|
432
|
+
* For encrypted credentials (COSE_Encrypt0), only COSE-level headers are
|
|
433
|
+
* available; CWT-level fields (issuer, subject, expiresAt) will be `undefined`.
|
|
434
|
+
*
|
|
435
|
+
* @param qrText - The Base45-encoded QR code content
|
|
436
|
+
* @returns Metadata extracted from the credential
|
|
437
|
+
* @throws {Claim169Error} On parse errors
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* ```typescript
|
|
441
|
+
* import { inspect } from 'claim169';
|
|
442
|
+
*
|
|
443
|
+
* const meta = inspect(qrText);
|
|
444
|
+
* console.log(meta.issuer); // "https://issuer.example.com"
|
|
445
|
+
* console.log(meta.algorithm); // "EdDSA"
|
|
446
|
+
* console.log(meta.coseType); // "Sign1"
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
449
|
+
export declare function inspect(qrText: string): InspectResult;
|
|
400
450
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AAEH,YAAY,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,QAAQ,EACR,aAAa,EACb,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,kBAAkB,EAClB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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