claim169 0.1.0-alpha
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/README.md +392 -0
- package/dist/index.d.ts +319 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +582 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +476 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +29 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -0
- package/wasm/README.md +264 -0
- package/wasm/claim169_wasm.d.ts +99 -0
- package/wasm/claim169_wasm.js +9 -0
- package/wasm/claim169_wasm_bg.js +822 -0
- package/wasm/claim169_wasm_bg.wasm +0 -0
- package/wasm/claim169_wasm_bg.wasm.d.ts +36 -0
- package/wasm/package.json +19 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MOSIP Claim 169 QR Code library for TypeScript/JavaScript.
|
|
3
|
+
*
|
|
4
|
+
* This library provides classes to encode and decode MOSIP Claim 169 identity
|
|
5
|
+
* credentials from QR codes. It uses WebAssembly for high-performance binary
|
|
6
|
+
* parsing and cryptographic operations.
|
|
7
|
+
*
|
|
8
|
+
* ## Installation
|
|
9
|
+
*
|
|
10
|
+
* ```bash
|
|
11
|
+
* npm install claim169
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* ## Decoding with Verification (Recommended)
|
|
15
|
+
*
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { Decoder } from 'claim169';
|
|
18
|
+
*
|
|
19
|
+
* // Decode with Ed25519 signature verification
|
|
20
|
+
* const result = new Decoder(qrText)
|
|
21
|
+
* .verifyWithEd25519(publicKey)
|
|
22
|
+
* .decode();
|
|
23
|
+
*
|
|
24
|
+
* // Access identity data
|
|
25
|
+
* console.log(result.claim169.fullName);
|
|
26
|
+
* console.log(result.claim169.dateOfBirth);
|
|
27
|
+
*
|
|
28
|
+
* // Access metadata
|
|
29
|
+
* console.log(result.cwtMeta.issuer);
|
|
30
|
+
* console.log(result.cwtMeta.expiresAt);
|
|
31
|
+
*
|
|
32
|
+
* // Check verification status
|
|
33
|
+
* console.log(result.verificationStatus); // "verified"
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* ## Decoding without Verification (Testing Only)
|
|
37
|
+
*
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const result = new Decoder(qrText)
|
|
40
|
+
* .allowUnverified() // Explicit opt-out required
|
|
41
|
+
* .decode();
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* ## Decoding Encrypted Credentials
|
|
45
|
+
*
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const result = new Decoder(qrText)
|
|
48
|
+
* .decryptWithAes256(aesKey)
|
|
49
|
+
* .verifyWithEd25519(publicKey)
|
|
50
|
+
* .decode();
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* ## Encoding Credentials
|
|
54
|
+
*
|
|
55
|
+
* ```typescript
|
|
56
|
+
* import { Encoder } from 'claim169';
|
|
57
|
+
*
|
|
58
|
+
* const qrData = new Encoder(claim169, cwtMeta)
|
|
59
|
+
* .signWithEd25519(privateKey)
|
|
60
|
+
* .encode();
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* ## Error Handling
|
|
64
|
+
*
|
|
65
|
+
* ```typescript
|
|
66
|
+
* import { Decoder, Claim169Error } from 'claim169';
|
|
67
|
+
*
|
|
68
|
+
* try {
|
|
69
|
+
* const result = new Decoder(qrText)
|
|
70
|
+
* .verifyWithEd25519(publicKey)
|
|
71
|
+
* .decode();
|
|
72
|
+
* } catch (error) {
|
|
73
|
+
* if (error instanceof Claim169Error) {
|
|
74
|
+
* console.error('Decoding failed:', error.message);
|
|
75
|
+
* }
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* ## Notes
|
|
80
|
+
*
|
|
81
|
+
* - **Timestamp validation**: Disabled by default because WASM doesn't have
|
|
82
|
+
* reliable access to system time. Enable with `.withTimestampValidation()`.
|
|
83
|
+
*
|
|
84
|
+
* @module claim169
|
|
85
|
+
*/
|
|
86
|
+
export { Claim169Error } from "./types.js";
|
|
87
|
+
import { Claim169Error } from "./types.js";
|
|
88
|
+
// Import WASM module (auto-initialized with bundler target)
|
|
89
|
+
import * as wasm from "../wasm/claim169_wasm.js";
|
|
90
|
+
/**
|
|
91
|
+
* Get the library version
|
|
92
|
+
*/
|
|
93
|
+
export function version() {
|
|
94
|
+
return wasm.version();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Check if the WASM module is loaded correctly
|
|
98
|
+
*/
|
|
99
|
+
export function isLoaded() {
|
|
100
|
+
return wasm.isLoaded();
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Convert a hex string to bytes.
|
|
104
|
+
*
|
|
105
|
+
* Accepts optional `0x` prefix and ignores whitespace.
|
|
106
|
+
*
|
|
107
|
+
* @throws {Claim169Error} If the input is not valid hex
|
|
108
|
+
*/
|
|
109
|
+
export function hexToBytes(hex) {
|
|
110
|
+
const normalized = hex.trim().replace(/^0x/i, "").replace(/\s+/g, "");
|
|
111
|
+
if (normalized.length === 0) {
|
|
112
|
+
return new Uint8Array();
|
|
113
|
+
}
|
|
114
|
+
if (normalized.length % 2 !== 0) {
|
|
115
|
+
throw new Claim169Error("hex string must have even length");
|
|
116
|
+
}
|
|
117
|
+
const out = new Uint8Array(normalized.length / 2);
|
|
118
|
+
for (let i = 0; i < out.length; i++) {
|
|
119
|
+
const byteStr = normalized.slice(i * 2, i * 2 + 2);
|
|
120
|
+
const value = Number.parseInt(byteStr, 16);
|
|
121
|
+
if (!Number.isFinite(value) || Number.isNaN(value)) {
|
|
122
|
+
throw new Claim169Error(`invalid hex byte: ${byteStr}`);
|
|
123
|
+
}
|
|
124
|
+
out[i] = value;
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Convert bytes to a lowercase hex string.
|
|
130
|
+
*/
|
|
131
|
+
export function bytesToHex(bytes) {
|
|
132
|
+
let out = "";
|
|
133
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
134
|
+
out += bytes[i].toString(16).padStart(2, "0");
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Transform raw WASM result to typed DecodeResult
|
|
140
|
+
*/
|
|
141
|
+
function transformResult(raw) {
|
|
142
|
+
const result = raw;
|
|
143
|
+
return {
|
|
144
|
+
claim169: transformClaim169(result.claim169),
|
|
145
|
+
cwtMeta: {
|
|
146
|
+
issuer: result.cwtMeta.issuer,
|
|
147
|
+
subject: result.cwtMeta.subject,
|
|
148
|
+
expiresAt: result.cwtMeta.expiresAt,
|
|
149
|
+
notBefore: result.cwtMeta.notBefore,
|
|
150
|
+
issuedAt: result.cwtMeta.issuedAt,
|
|
151
|
+
},
|
|
152
|
+
verificationStatus: result.verificationStatus,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Transform raw claim169 object to typed Claim169
|
|
157
|
+
*/
|
|
158
|
+
function transformClaim169(raw) {
|
|
159
|
+
return {
|
|
160
|
+
id: raw.id,
|
|
161
|
+
version: raw.version,
|
|
162
|
+
language: raw.language,
|
|
163
|
+
fullName: raw.fullName,
|
|
164
|
+
firstName: raw.firstName,
|
|
165
|
+
middleName: raw.middleName,
|
|
166
|
+
lastName: raw.lastName,
|
|
167
|
+
dateOfBirth: raw.dateOfBirth,
|
|
168
|
+
gender: raw.gender,
|
|
169
|
+
address: raw.address,
|
|
170
|
+
email: raw.email,
|
|
171
|
+
phone: raw.phone,
|
|
172
|
+
nationality: raw.nationality,
|
|
173
|
+
maritalStatus: raw.maritalStatus,
|
|
174
|
+
guardian: raw.guardian,
|
|
175
|
+
photo: raw.photo,
|
|
176
|
+
photoFormat: raw.photoFormat,
|
|
177
|
+
bestQualityFingers: raw.bestQualityFingers,
|
|
178
|
+
secondaryFullName: raw.secondaryFullName,
|
|
179
|
+
secondaryLanguage: raw.secondaryLanguage,
|
|
180
|
+
locationCode: raw.locationCode,
|
|
181
|
+
legalStatus: raw.legalStatus,
|
|
182
|
+
countryOfIssuance: raw.countryOfIssuance,
|
|
183
|
+
rightThumb: transformBiometrics(raw.rightThumb),
|
|
184
|
+
rightPointerFinger: transformBiometrics(raw.rightPointerFinger),
|
|
185
|
+
rightMiddleFinger: transformBiometrics(raw.rightMiddleFinger),
|
|
186
|
+
rightRingFinger: transformBiometrics(raw.rightRingFinger),
|
|
187
|
+
rightLittleFinger: transformBiometrics(raw.rightLittleFinger),
|
|
188
|
+
leftThumb: transformBiometrics(raw.leftThumb),
|
|
189
|
+
leftPointerFinger: transformBiometrics(raw.leftPointerFinger),
|
|
190
|
+
leftMiddleFinger: transformBiometrics(raw.leftMiddleFinger),
|
|
191
|
+
leftRingFinger: transformBiometrics(raw.leftRingFinger),
|
|
192
|
+
leftLittleFinger: transformBiometrics(raw.leftLittleFinger),
|
|
193
|
+
rightIris: transformBiometrics(raw.rightIris),
|
|
194
|
+
leftIris: transformBiometrics(raw.leftIris),
|
|
195
|
+
face: transformBiometrics(raw.face),
|
|
196
|
+
rightPalm: transformBiometrics(raw.rightPalm),
|
|
197
|
+
leftPalm: transformBiometrics(raw.leftPalm),
|
|
198
|
+
voice: transformBiometrics(raw.voice),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Transform raw biometrics array
|
|
203
|
+
*/
|
|
204
|
+
function transformBiometrics(raw) {
|
|
205
|
+
if (!raw || !Array.isArray(raw)) {
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
return raw.map((b) => ({
|
|
209
|
+
data: b.data,
|
|
210
|
+
format: b.format,
|
|
211
|
+
subFormat: b.subFormat,
|
|
212
|
+
issuer: b.issuer,
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Builder-pattern decoder for Claim 169 QR codes.
|
|
217
|
+
*
|
|
218
|
+
* Provides a fluent API for configuring decoding options and executing the decode.
|
|
219
|
+
* Supports signature verification with Ed25519 and ECDSA P-256, as well as
|
|
220
|
+
* AES-GCM decryption for encrypted credentials.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* // With verification (recommended for production)
|
|
225
|
+
* const result = new Decoder(qrText)
|
|
226
|
+
* .verifyWithEd25519(publicKey)
|
|
227
|
+
* .decode();
|
|
228
|
+
*
|
|
229
|
+
* // Without verification (testing only)
|
|
230
|
+
* const result = new Decoder(qrText)
|
|
231
|
+
* .allowUnverified()
|
|
232
|
+
* .skipBiometrics()
|
|
233
|
+
* .decode();
|
|
234
|
+
*
|
|
235
|
+
* // With decryption and verification
|
|
236
|
+
* const result = new Decoder(qrText)
|
|
237
|
+
* .decryptWithAes256(aesKey)
|
|
238
|
+
* .verifyWithEd25519(publicKey)
|
|
239
|
+
* .decode();
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export class Decoder {
|
|
243
|
+
/**
|
|
244
|
+
* Create a new Decoder instance.
|
|
245
|
+
* @param qrText - The QR code text content (Base45 encoded)
|
|
246
|
+
*/
|
|
247
|
+
constructor(qrText) {
|
|
248
|
+
this.wasmDecoder = new wasm.WasmDecoder(qrText);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Verify signature with Ed25519 public key.
|
|
252
|
+
* @param publicKey - 32-byte Ed25519 public key
|
|
253
|
+
* @returns The decoder instance for chaining
|
|
254
|
+
* @throws {Claim169Error} If the public key is invalid
|
|
255
|
+
*/
|
|
256
|
+
verifyWithEd25519(publicKey) {
|
|
257
|
+
try {
|
|
258
|
+
this.wasmDecoder = this.wasmDecoder.verifyWithEd25519(publicKey);
|
|
259
|
+
return this;
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
if (error instanceof Error) {
|
|
263
|
+
throw new Claim169Error(error.message);
|
|
264
|
+
}
|
|
265
|
+
throw new Claim169Error(String(error));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Verify signature with ECDSA P-256 public key.
|
|
270
|
+
* @param publicKey - SEC1-encoded P-256 public key (33 or 65 bytes)
|
|
271
|
+
* @returns The decoder instance for chaining
|
|
272
|
+
* @throws {Claim169Error} If the public key is invalid
|
|
273
|
+
*/
|
|
274
|
+
verifyWithEcdsaP256(publicKey) {
|
|
275
|
+
try {
|
|
276
|
+
this.wasmDecoder = this.wasmDecoder.verifyWithEcdsaP256(publicKey);
|
|
277
|
+
return this;
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
if (error instanceof Error) {
|
|
281
|
+
throw new Claim169Error(error.message);
|
|
282
|
+
}
|
|
283
|
+
throw new Claim169Error(String(error));
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Allow decoding without signature verification.
|
|
288
|
+
* WARNING: Unverified credentials cannot be trusted. Use for testing only.
|
|
289
|
+
* @returns The decoder instance for chaining
|
|
290
|
+
*/
|
|
291
|
+
allowUnverified() {
|
|
292
|
+
this.wasmDecoder = this.wasmDecoder.allowUnverified();
|
|
293
|
+
return this;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Decrypt with AES-256-GCM.
|
|
297
|
+
* @param key - 32-byte AES-256 key
|
|
298
|
+
* @returns The decoder instance for chaining
|
|
299
|
+
* @throws {Claim169Error} If the key is invalid
|
|
300
|
+
*/
|
|
301
|
+
decryptWithAes256(key) {
|
|
302
|
+
try {
|
|
303
|
+
this.wasmDecoder = this.wasmDecoder.decryptWithAes256(key);
|
|
304
|
+
return this;
|
|
305
|
+
}
|
|
306
|
+
catch (error) {
|
|
307
|
+
if (error instanceof Error) {
|
|
308
|
+
throw new Claim169Error(error.message);
|
|
309
|
+
}
|
|
310
|
+
throw new Claim169Error(String(error));
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Decrypt with AES-128-GCM.
|
|
315
|
+
* @param key - 16-byte AES-128 key
|
|
316
|
+
* @returns The decoder instance for chaining
|
|
317
|
+
* @throws {Claim169Error} If the key is invalid
|
|
318
|
+
*/
|
|
319
|
+
decryptWithAes128(key) {
|
|
320
|
+
try {
|
|
321
|
+
this.wasmDecoder = this.wasmDecoder.decryptWithAes128(key);
|
|
322
|
+
return this;
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
if (error instanceof Error) {
|
|
326
|
+
throw new Claim169Error(error.message);
|
|
327
|
+
}
|
|
328
|
+
throw new Claim169Error(String(error));
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Skip biometric data during decoding.
|
|
333
|
+
* Useful when only demographic data is needed for faster parsing.
|
|
334
|
+
* @returns The decoder instance for chaining
|
|
335
|
+
*/
|
|
336
|
+
skipBiometrics() {
|
|
337
|
+
this.wasmDecoder = this.wasmDecoder.skipBiometrics();
|
|
338
|
+
return this;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Enable timestamp validation.
|
|
342
|
+
* When enabled, expired or not-yet-valid credentials will throw an error.
|
|
343
|
+
* Disabled by default because WASM doesn't have reliable access to system time.
|
|
344
|
+
* @returns The decoder instance for chaining
|
|
345
|
+
*/
|
|
346
|
+
withTimestampValidation() {
|
|
347
|
+
this.wasmDecoder = this.wasmDecoder.withTimestampValidation();
|
|
348
|
+
return this;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Set clock skew tolerance in seconds.
|
|
352
|
+
* Allows credentials to be accepted when clocks are slightly out of sync.
|
|
353
|
+
* Only applies when timestamp validation is enabled.
|
|
354
|
+
* @param seconds - The tolerance in seconds
|
|
355
|
+
* @returns The decoder instance for chaining
|
|
356
|
+
*/
|
|
357
|
+
clockSkewTolerance(seconds) {
|
|
358
|
+
this.wasmDecoder = this.wasmDecoder.clockSkewTolerance(seconds);
|
|
359
|
+
return this;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Set maximum decompressed size in bytes.
|
|
363
|
+
* Protects against decompression bomb attacks.
|
|
364
|
+
* @param bytes - The maximum size in bytes (default: 65536)
|
|
365
|
+
* @returns The decoder instance for chaining
|
|
366
|
+
*/
|
|
367
|
+
maxDecompressedBytes(bytes) {
|
|
368
|
+
this.wasmDecoder = this.wasmDecoder.maxDecompressedBytes(bytes);
|
|
369
|
+
return this;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Decode the QR code with the configured options.
|
|
373
|
+
* Requires either a verifier (verifyWithEd25519/verifyWithEcdsaP256) or
|
|
374
|
+
* explicit allowUnverified() to be called first.
|
|
375
|
+
* @returns The decoded result
|
|
376
|
+
* @throws {Claim169Error} If decoding fails or no verification method specified
|
|
377
|
+
*/
|
|
378
|
+
decode() {
|
|
379
|
+
try {
|
|
380
|
+
const result = this.wasmDecoder.decode();
|
|
381
|
+
return transformResult(result);
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
if (error instanceof Error) {
|
|
385
|
+
throw new Claim169Error(error.message);
|
|
386
|
+
}
|
|
387
|
+
throw new Claim169Error(String(error));
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Decode a Claim 169 QR string.
|
|
393
|
+
*
|
|
394
|
+
* This is a convenience wrapper around the `Decoder` builder.
|
|
395
|
+
* Security:
|
|
396
|
+
* - If you do not pass a verification key, you must set `allowUnverified: true` (testing only).
|
|
397
|
+
*/
|
|
398
|
+
export function decode(qrText, options = {}) {
|
|
399
|
+
let decoder = new Decoder(qrText);
|
|
400
|
+
if (options.decryptWithAes256) {
|
|
401
|
+
decoder = decoder.decryptWithAes256(options.decryptWithAes256);
|
|
402
|
+
}
|
|
403
|
+
if (options.decryptWithAes128) {
|
|
404
|
+
decoder = decoder.decryptWithAes128(options.decryptWithAes128);
|
|
405
|
+
}
|
|
406
|
+
if (options.skipBiometrics) {
|
|
407
|
+
decoder = decoder.skipBiometrics();
|
|
408
|
+
}
|
|
409
|
+
if (options.validateTimestamps) {
|
|
410
|
+
decoder = decoder.withTimestampValidation();
|
|
411
|
+
}
|
|
412
|
+
if (options.clockSkewToleranceSeconds !== undefined) {
|
|
413
|
+
decoder = decoder.clockSkewTolerance(options.clockSkewToleranceSeconds);
|
|
414
|
+
}
|
|
415
|
+
if (options.maxDecompressedBytes !== undefined) {
|
|
416
|
+
decoder = decoder.maxDecompressedBytes(options.maxDecompressedBytes);
|
|
417
|
+
}
|
|
418
|
+
if (options.verifyWithEd25519) {
|
|
419
|
+
decoder = decoder.verifyWithEd25519(options.verifyWithEd25519);
|
|
420
|
+
}
|
|
421
|
+
else if (options.verifyWithEcdsaP256) {
|
|
422
|
+
decoder = decoder.verifyWithEcdsaP256(options.verifyWithEcdsaP256);
|
|
423
|
+
}
|
|
424
|
+
else if (options.allowUnverified === true) {
|
|
425
|
+
decoder = decoder.allowUnverified();
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
throw new Claim169Error("decode() requires a verification key or allowUnverified: true");
|
|
429
|
+
}
|
|
430
|
+
return decoder.decode();
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Builder-pattern encoder for Claim 169 QR codes.
|
|
434
|
+
*
|
|
435
|
+
* Provides a fluent API for configuring encoding options and generating QR data.
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
* ```typescript
|
|
439
|
+
* // Signed credential (recommended)
|
|
440
|
+
* const qrData = new Encoder(claim169, cwtMeta)
|
|
441
|
+
* .signWithEd25519(privateKey)
|
|
442
|
+
* .encode();
|
|
443
|
+
*
|
|
444
|
+
* // Signed and encrypted
|
|
445
|
+
* const qrData = new Encoder(claim169, cwtMeta)
|
|
446
|
+
* .signWithEd25519(privateKey)
|
|
447
|
+
* .encryptWithAes256(aesKey)
|
|
448
|
+
* .encode();
|
|
449
|
+
*
|
|
450
|
+
* // Unsigned (testing only)
|
|
451
|
+
* const qrData = new Encoder(claim169, cwtMeta)
|
|
452
|
+
* .allowUnsigned()
|
|
453
|
+
* .encode();
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
export class Encoder {
|
|
457
|
+
/**
|
|
458
|
+
* Create a new Encoder instance.
|
|
459
|
+
* @param claim169 - The identity claim data to encode
|
|
460
|
+
* @param cwtMeta - CWT metadata including issuer, expiration, etc.
|
|
461
|
+
*/
|
|
462
|
+
constructor(claim169, cwtMeta) {
|
|
463
|
+
try {
|
|
464
|
+
this.wasmEncoder = new wasm.WasmEncoder(claim169, cwtMeta);
|
|
465
|
+
}
|
|
466
|
+
catch (error) {
|
|
467
|
+
if (error instanceof Error) {
|
|
468
|
+
throw new Claim169Error(error.message);
|
|
469
|
+
}
|
|
470
|
+
throw new Claim169Error(String(error));
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Sign with Ed25519 private key.
|
|
475
|
+
* @param privateKey - 32-byte Ed25519 private key
|
|
476
|
+
* @returns The encoder instance for chaining
|
|
477
|
+
*/
|
|
478
|
+
signWithEd25519(privateKey) {
|
|
479
|
+
try {
|
|
480
|
+
this.wasmEncoder = this.wasmEncoder.signWithEd25519(privateKey);
|
|
481
|
+
return this;
|
|
482
|
+
}
|
|
483
|
+
catch (error) {
|
|
484
|
+
if (error instanceof Error) {
|
|
485
|
+
throw new Claim169Error(error.message);
|
|
486
|
+
}
|
|
487
|
+
throw new Claim169Error(String(error));
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Sign with ECDSA P-256 private key.
|
|
492
|
+
* @param privateKey - 32-byte ECDSA P-256 private key (scalar)
|
|
493
|
+
* @returns The encoder instance for chaining
|
|
494
|
+
*/
|
|
495
|
+
signWithEcdsaP256(privateKey) {
|
|
496
|
+
try {
|
|
497
|
+
this.wasmEncoder = this.wasmEncoder.signWithEcdsaP256(privateKey);
|
|
498
|
+
return this;
|
|
499
|
+
}
|
|
500
|
+
catch (error) {
|
|
501
|
+
if (error instanceof Error) {
|
|
502
|
+
throw new Claim169Error(error.message);
|
|
503
|
+
}
|
|
504
|
+
throw new Claim169Error(String(error));
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Encrypt with AES-256-GCM.
|
|
509
|
+
* @param key - 32-byte AES-256 key
|
|
510
|
+
* @returns The encoder instance for chaining
|
|
511
|
+
*/
|
|
512
|
+
encryptWithAes256(key) {
|
|
513
|
+
try {
|
|
514
|
+
this.wasmEncoder = this.wasmEncoder.encryptWithAes256(key);
|
|
515
|
+
return this;
|
|
516
|
+
}
|
|
517
|
+
catch (error) {
|
|
518
|
+
if (error instanceof Error) {
|
|
519
|
+
throw new Claim169Error(error.message);
|
|
520
|
+
}
|
|
521
|
+
throw new Claim169Error(String(error));
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Encrypt with AES-128-GCM.
|
|
526
|
+
* @param key - 16-byte AES-128 key
|
|
527
|
+
* @returns The encoder instance for chaining
|
|
528
|
+
*/
|
|
529
|
+
encryptWithAes128(key) {
|
|
530
|
+
try {
|
|
531
|
+
this.wasmEncoder = this.wasmEncoder.encryptWithAes128(key);
|
|
532
|
+
return this;
|
|
533
|
+
}
|
|
534
|
+
catch (error) {
|
|
535
|
+
if (error instanceof Error) {
|
|
536
|
+
throw new Claim169Error(error.message);
|
|
537
|
+
}
|
|
538
|
+
throw new Claim169Error(String(error));
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Allow encoding without a signature.
|
|
543
|
+
* WARNING: Unsigned credentials cannot be verified. Use for testing only.
|
|
544
|
+
* @returns The encoder instance for chaining
|
|
545
|
+
*/
|
|
546
|
+
allowUnsigned() {
|
|
547
|
+
this.wasmEncoder = this.wasmEncoder.allowUnsigned();
|
|
548
|
+
return this;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Skip biometric fields during encoding.
|
|
552
|
+
* @returns The encoder instance for chaining
|
|
553
|
+
*/
|
|
554
|
+
skipBiometrics() {
|
|
555
|
+
this.wasmEncoder = this.wasmEncoder.skipBiometrics();
|
|
556
|
+
return this;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Encode the credential to a Base45 QR string.
|
|
560
|
+
* @returns Base45-encoded string suitable for QR code generation
|
|
561
|
+
* @throws {Claim169Error} If encoding fails
|
|
562
|
+
*/
|
|
563
|
+
encode() {
|
|
564
|
+
try {
|
|
565
|
+
return this.wasmEncoder.encode();
|
|
566
|
+
}
|
|
567
|
+
catch (error) {
|
|
568
|
+
if (error instanceof Error) {
|
|
569
|
+
throw new Claim169Error(error.message);
|
|
570
|
+
}
|
|
571
|
+
throw new Claim169Error(String(error));
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Generate a random 12-byte nonce for AES-GCM encryption.
|
|
577
|
+
* @returns A 12-byte Uint8Array suitable for use as a nonce
|
|
578
|
+
*/
|
|
579
|
+
export function generateNonce() {
|
|
580
|
+
return new Uint8Array(wasm.generateNonce());
|
|
581
|
+
}
|
|
582
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AAcH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAS3C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,4DAA4D;AAC5D,OAAO,KAAK,IAAI,MAAM,0BAA0B,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,OAAO;IACrB,OAAO,IAAI,CAAC,OAA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