kentucky-signer-viem 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/README.md +37 -26
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -270,32 +270,39 @@ Set up trusted guardians for account recovery:
270
270
  ```typescript
271
271
  const client = new KentuckySignerClient({ baseUrl })
272
272
 
273
- // Add a guardian
274
- await client.addGuardian(accountId, {
275
- guardian_account_id: 'guardian_hex_id',
273
+ // Add a guardian (requires WebAuthn attestation from guardian's device)
274
+ const { guardian_index, guardian_count } = await client.addGuardian({
275
+ attestation_object: guardianAttestationBase64url,
276
276
  label: 'My Friend',
277
277
  }, token)
278
278
 
279
279
  // List guardians
280
- const { guardians } = await client.getGuardians(accountId, token)
280
+ const { guardians } = await client.getGuardians(token)
281
+ // guardians: [{ index: 1, label: 'My Friend' }, ...]
282
+
283
+ // Initiate recovery (when locked out - register new passkey first)
284
+ const recovery = await client.initiateRecovery(
285
+ accountId,
286
+ newPasskeyAttestationObject,
287
+ 'New Owner Passkey'
288
+ )
289
+ // Returns: { challenges, guardian_count, threshold, timelock_seconds }
281
290
 
282
- // Initiate recovery (when locked out)
283
- const recovery = await client.initiateRecovery({
291
+ // Guardian signs their challenge with their passkey
292
+ await client.verifyGuardian({
284
293
  account_id: accountId,
285
- new_password: 'new-secure-password',
294
+ guardian_index: 1,
295
+ authenticator_data: authDataBase64url,
296
+ client_data_json: clientDataBase64url,
297
+ signature: signatureBase64url,
286
298
  })
287
299
 
288
- // Guardian approves recovery
289
- await client.verifyGuardianRecovery({
290
- recovery_id: recovery.recovery_id,
291
- guardian_account_id: guardianId,
292
- signature: guardianSignature,
293
- }, guardianToken)
300
+ // Check recovery status
301
+ const status = await client.getRecoveryStatus(accountId)
302
+ // { verified_count, threshold, can_complete, timelock_remaining }
294
303
 
295
- // Complete recovery after threshold met
296
- await client.completeRecovery({
297
- recovery_id: recovery.recovery_id,
298
- }, token)
304
+ // Complete recovery after threshold met and timelock expired
305
+ await client.completeRecovery(accountId)
299
306
  ```
300
307
 
301
308
  ## API Reference
@@ -328,8 +335,9 @@ await client.completeRecovery({
328
335
 
329
336
  #### Authentication
330
337
  - `getChallenge(accountId)` - Get WebAuthn challenge
331
- - `authenticatePasskey(accountId, credential)` - Authenticate with passkey
332
- - `authenticatePassword(accountId, password)` - Authenticate with password
338
+ - `authenticatePasskey(accountId, credential, ephemeralPublicKey?)` - Authenticate with passkey
339
+ - `authenticatePassword(request)` - Authenticate with password (`{ account_id, password }`)
340
+ - `refreshToken(token)` - Refresh JWT token
333
341
  - `logout(token)` - Invalidate session
334
342
 
335
343
  #### Signing
@@ -338,9 +346,10 @@ await client.completeRecovery({
338
346
 
339
347
  #### Account Management
340
348
  - `getAccountInfo(accountId, token)` - Get account info
349
+ - `getAccountInfoExtended(accountId, token)` - Get account info with auth config
341
350
  - `addPassword(accountId, request, token)` - Add password auth
342
351
  - `addPasskey(accountId, request, token)` - Add passkey
343
- - `removePasskey(accountId, credentialId, token)` - Remove passkey
352
+ - `removePasskey(accountId, passkeyIndex, token)` - Remove passkey by index
344
353
 
345
354
  #### Two-Factor Authentication
346
355
  - `get2FAStatus(token)` - Get 2FA status
@@ -351,12 +360,14 @@ await client.completeRecovery({
351
360
  - `disablePIN(pin, token)` - Disable PIN
352
361
 
353
362
  #### Guardian Recovery
354
- - `addGuardian(accountId, request, token)` - Add guardian
355
- - `removeGuardian(accountId, guardianId, token)` - Remove guardian
356
- - `getGuardians(accountId, token)` - List guardians
357
- - `initiateRecovery(request)` - Start recovery
358
- - `verifyGuardianRecovery(request, token)` - Guardian approval
359
- - `completeRecovery(request, token)` - Complete recovery
363
+ - `addGuardian(request, token)` - Add guardian passkey
364
+ - `removeGuardian(guardianIndex, token)` - Remove guardian
365
+ - `getGuardians(token)` - List guardians
366
+ - `initiateRecovery(accountId, attestationObject, label?)` - Start recovery
367
+ - `verifyGuardian(request)` - Submit guardian signature
368
+ - `getRecoveryStatus(accountId)` - Check recovery status
369
+ - `completeRecovery(accountId)` - Complete recovery
370
+ - `cancelRecovery(token)` - Cancel recovery (owner only)
360
371
 
361
372
  ## Error Handling
362
373
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kentucky-signer-viem",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Custom Viem account integration for Kentucky Signer with passkey authentication",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",