@le-space/orbitdb-identity-provider-webauthn-did 0.11.0 → 0.12.1
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 +65 -0
- package/README.md +22 -1
- package/docs/API.md +113 -12
- package/package.json +6 -2
- package/src/errors.js +7 -0
- package/src/index.js +6 -0
- package/src/keystore/vault-keeper.js +555 -0
- package/src/keystore/vault.js +15 -1
- package/src/standalone/index.js +5 -0
- package/src/standalone/webauthn/signers.js +15 -13
- package/src/varsig/identity.js +35 -1
- package/src/vault/index.js +28 -0
- package/types/index.d.ts +114 -11
- package/types/standalone.d.ts +113 -2
- package/types/vault.d.ts +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,70 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 0.12.1
|
|
4
|
+
|
|
5
|
+
A peer loads another peer's varsig identity from IPFS again, with Helia 7.
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **`createIpfsIdentityStorage(ipfs).get` returns the block's bytes.** It returned whatever
|
|
10
|
+
`blockstore.get` gave, and Helia 7's blockstore (interface-blockstore 7) gives a generator of
|
|
11
|
+
chunks. Both callers decoded that as bytes, `getIdentity` in `createWebAuthnVarsigIdentities` and
|
|
12
|
+
the IPFS fallback in `wrapWithVarsigVerification`. The decode threw, their catch swallowed it, and
|
|
13
|
+
a peer that had not cached a varsig identity never loaded it from IPFS. `get` now joins the
|
|
14
|
+
chunks, still takes a blockstore that resolves to bytes, and waits at most 30 seconds for a block
|
|
15
|
+
the node does not have, as OrbitDB's own block storage does. The declaration says
|
|
16
|
+
`Promise<Uint8Array | undefined>` again.
|
|
17
|
+
|
|
18
|
+
Tested with two Helia 7 peers over libp2p and bitswap: the one without the identity loads it from
|
|
19
|
+
the other and verifies it, through either caller.
|
|
20
|
+
|
|
21
|
+
## 0.12.0
|
|
22
|
+
|
|
23
|
+
The vault's keeper, once for every application, and the vault on its own entry.
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- **`createVaultKeeper({ storage, key, slotInfo })`** (main entry, `./standalone` and `./vault`):
|
|
28
|
+
where an application keeps its vaults — anything with `getItem` and `setItem` — and what every
|
|
29
|
+
unlock does with them. `open` opens the vault this authenticator has a slot in, else one `find`
|
|
30
|
+
returns from elsewhere (a backup, an index), else makes one holding `create()`; `addPasskey`,
|
|
31
|
+
`removePasskey` (by slot id, so a key not at hand can go), `renew` (new vault key and id, every key
|
|
32
|
+
that stays answers and is checked against its slot, so none is left out by mistake),
|
|
33
|
+
`replacePayload`, `status`, `records`. A key removed here is refused (`VAULT_SLOT_REMOVED`)
|
|
34
|
+
instead of being given new, empty books; one key opens one vault per store; an unreadable store
|
|
35
|
+
is refused (`VAULT_STORE_UNREADABLE`) and never overwritten. Le-Space/belege and Le-Space/invoice
|
|
36
|
+
each built this around the vault for themselves; the store's format is Belege's (#406 there), and
|
|
37
|
+
a record Belege's own code wrote opens unchanged.
|
|
38
|
+
- **`rootPayload(root)`** and **`rootOf(payload)`**: one 32-byte root as vault payload,
|
|
39
|
+
`{"version":1,"root":"<hex>"}`, every other key derived from it with `deriveSubkey` — the bytes
|
|
40
|
+
Belege's vaults hold.
|
|
41
|
+
- **The `./vault` entry**: `readPrfOutput`, `deriveSubkey`, `deriveAesKey`, the vault functions,
|
|
42
|
+
the keeper, `rootPayload`, `rootOf`, `PrfUnavailableError` and `VaultError`, with no package in
|
|
43
|
+
its import graph (`tests/vault-entry.test.js`). For applications without OrbitDB (#93, its first
|
|
44
|
+
step).
|
|
45
|
+
- `VaultError` codes `VAULT_STORE_UNREADABLE`, `VAULT_SLOT_REMOVED` and `VAULT_SLOT_IN_USE`.
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- **The production audit passes again.** Four `fast-uri` advisories published after 0.11.0
|
|
50
|
+
(GHSA-w74x-v6f9-j3xg and GHSA-wjr9-j795-jxcr moderate, GHSA-xhq7-xmqj-769h and
|
|
51
|
+
GHSA-333x-w4r6-6crp low) affect `fast-uri` below 3.1.9 on `iso-web > iso-kv > conf > ajv`. The
|
|
52
|
+
override `ajv>fast-uri` goes from `^3.1.8` to `^3.1.9`, still on the 3 line ajv 8 asks for. It
|
|
53
|
+
steers this repository's own install; an application resolves `fast-uri` for itself.
|
|
54
|
+
- **Declarations that said what the code does not.** Behaviour is unchanged.
|
|
55
|
+
- `WebAuthnVarsigProvider` had no `static createCredential`, though `docs/API.md` calls it, no
|
|
56
|
+
`isSupported` or `signPayload`, and no options for the constructor or `sign` (#95).
|
|
57
|
+
- `createWebAuthnEd25519Credential` was declared, and documented, to resolve to `null` when the
|
|
58
|
+
registration fails. It has always rejected, and now says so (#95).
|
|
59
|
+
- The varsig identity helpers: `encodeIdentityValue` resolves to `{ hash, bytes }` and was
|
|
60
|
+
declared to return bytes; `createWebAuthnVarsigIdentities` is synchronous and takes
|
|
61
|
+
`(identity, domainLabels?, storage?, fallbackIdentities?)`; `wrapWithVarsigVerification` takes
|
|
62
|
+
`(defaultIdentities, ipfs?, domainLabels?)`; `decodeVarsigIdentityFromBytes` and
|
|
63
|
+
`verifyVarsigIdentity` take `domainLabels`; `createIpfsIdentityStorage` takes the IPFS
|
|
64
|
+
instance, which the declared `Record<string, unknown>` refused for a typed Helia.
|
|
65
|
+
- The README and `docs/API.md` dated the varsig registration's authenticator fix to 0.9.1. It
|
|
66
|
+
shipped in 0.10.0 (#95).
|
|
67
|
+
|
|
3
68
|
## 0.11.0
|
|
4
69
|
|
|
5
70
|
Another session of the same passkey may still write: OrbitDB's verified-identity cache, worked
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ This package provides:
|
|
|
19
19
|
- Authentication/assertion requests omit `allowCredentials` by default, so the browser/authenticator can resolve the credential discoverably.
|
|
20
20
|
- You can switch this centrally with `configureWebAuthn({ discoverableCredentials: true|false })`.
|
|
21
21
|
- Registration is still the point where this package extracts the credential public key from attestation.
|
|
22
|
-
- Registration offers every kind of authenticator — the device's own, a security key such as a YubiKey, a phone — unless `authenticatorType: 'platform' | 'cross-platform'` narrows it
|
|
22
|
+
- Registration offers every kind of authenticator — the device's own, a security key such as a YubiKey, a phone — unless `authenticatorType: 'platform' | 'cross-platform'` narrows it — honoured by `createCredential` since 0.9.1, and by the varsig registration and the standalone signers since 0.10.0. It always requires user verification.
|
|
23
23
|
- Later `navigator.credentials.get()` assertions do not reliably return the public key again, so identity reconstruction still needs metadata from somewhere else.
|
|
24
24
|
|
|
25
25
|
Since **0.6.0** the passkey alone is enough, and stored metadata is a convenience rather than a requirement:
|
|
@@ -252,6 +252,27 @@ const withSecondKey = await addSlot(vault, vaultKey, secondKeysSlot);
|
|
|
252
252
|
|
|
253
253
|
How it works, and what a vault does not do: [docs/API.md](docs/API.md#prf-keys-and-vaults).
|
|
254
254
|
|
|
255
|
+
Since **0.12.0**, `createVaultKeeper({ storage, key, slotInfo })` keeps an application's vaults and does what every unlock needs: open this key's vault or make one, give a second key a slot, take one out, renew the vault key. A key taken out is refused rather than given new, empty books, and an unreadable store is never overwritten. `rootPayload(root)` holds one random root, every other key derived from it with `deriveSubkey`. The `./vault` entry offers all of this with no package in its import graph, for applications without OrbitDB. See [docs/API.md](docs/API.md#keeping-vaults-createvaultkeeper-storage-key-slotinfo-).
|
|
256
|
+
|
|
257
|
+
```javascript
|
|
258
|
+
import {
|
|
259
|
+
createVaultKeeper,
|
|
260
|
+
readPrfOutput,
|
|
261
|
+
rootPayload,
|
|
262
|
+
} from '@le-space/orbitdb-identity-provider-webauthn-did/vault';
|
|
263
|
+
|
|
264
|
+
const keeper = createVaultKeeper({
|
|
265
|
+
storage: localStorage,
|
|
266
|
+
key: 'myapp.vaults.v1',
|
|
267
|
+
slotInfo: 'myapp/vault-slot/v1',
|
|
268
|
+
});
|
|
269
|
+
const opened = await keeper.open({
|
|
270
|
+
prfOutput: await readPrfOutput(credential),
|
|
271
|
+
rawCredentialId: credential.rawCredentialId,
|
|
272
|
+
create: () => rootPayload(crypto.getRandomValues(new Uint8Array(32))),
|
|
273
|
+
});
|
|
274
|
+
```
|
|
275
|
+
|
|
255
276
|
Since **0.10.0**, a secret kept in that vault can be an identity of its own: `createSecretSigner(secret, { info })` turns it into an Ed25519 signer for the provider's `signer` option, so every key that opens the vault writes as the same identity — the root of a database's access controller, which a single passkey's identity would hold for good. See [docs/API.md](docs/API.md#an-identity-that-is-nobodys-passkey-createsecretsignersecret--info-).
|
|
256
277
|
|
|
257
278
|
### Keystore-based DID (WebAuthn + OrbitDB keystore)
|
package/docs/API.md
CHANGED
|
@@ -6,6 +6,7 @@ public API surface:
|
|
|
6
6
|
- root export: `@le-space/orbitdb-identity-provider-webauthn-did`
|
|
7
7
|
- standalone export: `@le-space/orbitdb-identity-provider-webauthn-did/standalone`
|
|
8
8
|
- keystore export: `@le-space/orbitdb-identity-provider-webauthn-did/keystore`
|
|
9
|
+
- vault export: `@le-space/orbitdb-identity-provider-webauthn-did/vault`
|
|
9
10
|
- verification export: `@le-space/orbitdb-identity-provider-webauthn-did/verification`
|
|
10
11
|
|
|
11
12
|
## Root Export
|
|
@@ -386,6 +387,83 @@ What a vault does not do:
|
|
|
386
387
|
`tests/vault-two-authenticators.test.js` runs this in Chromium with two virtual
|
|
387
388
|
authenticators, each with its own PRF secret as two YubiKeys have.
|
|
388
389
|
|
|
390
|
+
#### Keeping vaults: `createVaultKeeper({ storage, key, slotInfo })`
|
|
391
|
+
|
|
392
|
+
Since 0.12.0. Where an application keeps its vaults, and what every unlock
|
|
393
|
+
does with them. Le-Space/belege and Le-Space/invoice each wrote this for
|
|
394
|
+
themselves around the same vault; the keeper is that code once, with the
|
|
395
|
+
rules each of them had to learn:
|
|
396
|
+
|
|
397
|
+
```js
|
|
398
|
+
const keeper = createVaultKeeper({
|
|
399
|
+
storage: localStorage, // anything with getItem and setItem
|
|
400
|
+
key: 'myapp.vaults.v1',
|
|
401
|
+
slotInfo: 'myapp/vault-slot/v1',
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
const prfOutput = await readPrfOutput(credential);
|
|
405
|
+
const opened = await keeper.open({
|
|
406
|
+
prfOutput,
|
|
407
|
+
rawCredentialId: credential.rawCredentialId,
|
|
408
|
+
label: 'YubiKey 5C',
|
|
409
|
+
create: () => rootPayload(crypto.getRandomValues(new Uint8Array(32))),
|
|
410
|
+
});
|
|
411
|
+
const root = rootOf(opened.payload);
|
|
412
|
+
const listKey = await deriveSubkey(root, 'myapp/list-key/v1');
|
|
413
|
+
|
|
414
|
+
// With the vault open, touch the second key and give it a slot of its own.
|
|
415
|
+
await keeper.addPasskey(opened, {
|
|
416
|
+
prfOutput: secondPrfOutput,
|
|
417
|
+
rawCredentialId,
|
|
418
|
+
label,
|
|
419
|
+
});
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
- `open({ prfOutput, rawCredentialId, label?, create?, find? })` opens the
|
|
423
|
+
vault this authenticator has a slot in. Without one it asks `find(kid)` for
|
|
424
|
+
a record kept elsewhere — a backup, an index — and keeps it here once it has
|
|
425
|
+
opened; without that it makes a new vault holding `create()`, with this
|
|
426
|
+
authenticator's slot. It returns `{ record, payload, vaultKey, kid, created,
|
|
427
|
+
found }`; keep that in memory while the vault is open, it holds the vault key.
|
|
428
|
+
- Pass `find` on every unlock where the vault may be kept elsewhere, not only
|
|
429
|
+
on a restore path. A synced passkey on a new device otherwise makes a vault
|
|
430
|
+
of its own, and from then on `open` finds that one here and never asks
|
|
431
|
+
`find` again (Le-Space/belege#524).
|
|
432
|
+
- An authenticator removed here is refused (`VAULT_SLOT_REMOVED`), never given
|
|
433
|
+
a new vault: for an application whose books existed before the vault, that
|
|
434
|
+
would be a stale copy that looks like the real books.
|
|
435
|
+
- `addPasskey(opened, { prfOutput, rawCredentialId, label? })` gives one more
|
|
436
|
+
authenticator a slot. One key opens one vault per store: a key that already
|
|
437
|
+
opens another vault here is refused (`VAULT_SLOT_EXISTS`).
|
|
438
|
+
- `removePasskey(opened, kid)` takes a slot out by its id, so a key that is not
|
|
439
|
+
at hand can go too. It revokes nothing already opened.
|
|
440
|
+
- `renew(opened, { answers, removed?, payload? })` makes a new vault key and
|
|
441
|
+
vault id, with a slot for every authenticator that stays. Every one of them
|
|
442
|
+
answers with its PRF output, checked against its slot, so none is left out
|
|
443
|
+
by mistake; the ones in `removed` are taken out. A new `payload` replaces
|
|
444
|
+
keys a removed authenticator must not know.
|
|
445
|
+
- `replacePayload(opened, payload)`, `status(rawCredentialId)` (is there a
|
|
446
|
+
vault here for this key, without asking it?) and `records()`.
|
|
447
|
+
|
|
448
|
+
The store holds a JSON array under `key`, one record per vault:
|
|
449
|
+
`{ vault, slots: [{ kid, label, credentialId, addedAt }], removed: [kid] }`.
|
|
450
|
+
`slots` names in public which authenticator each slot belongs to; `removed`
|
|
451
|
+
remembers the keys taken out here; fields the keeper does not know are kept.
|
|
452
|
+
It is the format Belege has kept since Le-Space/belege#406, and
|
|
453
|
+
`tests/vault-keeper.test.js` opens a record Belege's own code wrote. An
|
|
454
|
+
unreadable store is refused (`VAULT_STORE_UNREADABLE`) and never overwritten:
|
|
455
|
+
it may hold the only copy of a vault. The keeper holds no secret, and two pages
|
|
456
|
+
writing one store at once means the last write wins.
|
|
457
|
+
|
|
458
|
+
`rootPayload(root)` and `rootOf(payload)` write and read the simplest payload,
|
|
459
|
+
`{"version":1,"root":"<hex>"}`: one 32-byte root, every other key derived from
|
|
460
|
+
it with `deriveSubkey(root, info)`, so the vault never changes when the
|
|
461
|
+
application needs one more key. Belege's vaults hold exactly that.
|
|
462
|
+
|
|
463
|
+
More refusals from the keeper, as `VaultError` codes: `VAULT_STORE_UNREADABLE`,
|
|
464
|
+
`VAULT_SLOT_REMOVED`, and `VAULT_SLOT_IN_USE` — the authenticator that opened
|
|
465
|
+
the vault cannot remove itself, or be left out of a renewal.
|
|
466
|
+
|
|
389
467
|
#### An identity that is nobody's passkey: `createSecretSigner(secret, { info })`
|
|
390
468
|
|
|
391
469
|
Since 0.10.0. A database whose access controller is rooted at one passkey's
|
|
@@ -523,12 +601,13 @@ Key exports:
|
|
|
523
601
|
|
|
524
602
|
- `WebAuthnVarsigProvider`
|
|
525
603
|
- `createWebAuthnVarsigIdentity(options)`
|
|
526
|
-
- `createWebAuthnVarsigIdentities(
|
|
527
|
-
|
|
528
|
-
- `
|
|
529
|
-
- `
|
|
530
|
-
- `
|
|
531
|
-
- `
|
|
604
|
+
- `createWebAuthnVarsigIdentities(identity, domainLabels?, storage?, fallbackIdentities?)`
|
|
605
|
+
— synchronous
|
|
606
|
+
- `encodeIdentityValue(value)` — resolves to `{ hash, bytes }`
|
|
607
|
+
- `decodeVarsigIdentityFromBytes(bytes, domainLabels?)`
|
|
608
|
+
- `verifyVarsigIdentity(identity, domainLabels?)`
|
|
609
|
+
- `createIpfsIdentityStorage(ipfs)`
|
|
610
|
+
- `wrapWithVarsigVerification(defaultIdentities, ipfs?, domainLabels?)`
|
|
532
611
|
- `DEFAULT_DOMAIN_LABELS`
|
|
533
612
|
- `storeWebAuthnVarsigCredential(credential, key?)`
|
|
534
613
|
- `loadWebAuthnVarsigCredential(key?)`
|
|
@@ -549,8 +628,8 @@ const identity = await createWebAuthnVarsigIdentity({ credential });
|
|
|
549
628
|
`WebAuthnVarsigProvider.createCredential(options)` takes `userId`,
|
|
550
629
|
`displayName`, `domain`, `discoverableCredentials`, `forceP256` (offer only
|
|
551
630
|
P-256), and `authenticatorType` / `authenticatorAttachment` as
|
|
552
|
-
`WebAuthnDIDProvider.createCredential` does. Before 0.
|
|
553
|
-
of authenticator the same way and offered every kind.
|
|
631
|
+
`WebAuthnDIDProvider.createCredential` does. Before 0.10.0 it dropped the
|
|
632
|
+
choice of authenticator the same way and offered every kind.
|
|
554
633
|
|
|
555
634
|
It always requires user verification, whatever the options say. A varsig
|
|
556
635
|
signature without the UV flag is refused, when it is made and when it is
|
|
@@ -582,7 +661,9 @@ import {
|
|
|
582
661
|
|
|
583
662
|
The `create…Signer` functions register as
|
|
584
663
|
`WebAuthnVarsigProvider.createCredential` does and take its options;
|
|
585
|
-
`createWebAuthnEd25519Credential` passes on `options.authenticatorType` alone
|
|
664
|
+
`createWebAuthnEd25519Credential` passes on `options.authenticatorType` alone,
|
|
665
|
+
and rejects when the registration fails — it never resolved to `null`, though
|
|
666
|
+
its JSDoc and types said so.
|
|
586
667
|
|
|
587
668
|
```js
|
|
588
669
|
const signer = await createWebAuthnSigner({
|
|
@@ -621,9 +702,9 @@ const ucanSigner = signer.toUcantoSigner({
|
|
|
621
702
|
|
|
622
703
|
The same functions as the root export, without OrbitDB: `readPrfOutput`,
|
|
623
704
|
`deriveSubkey`, `deriveAesKey`, `createVault`, `openVault`, `addSlot`,
|
|
624
|
-
`removeSlot`, `replacePayload`, `slotIdFor`, `
|
|
625
|
-
`
|
|
626
|
-
[PRF Keys and Vaults](#prf-keys-and-vaults).
|
|
705
|
+
`removeSlot`, `replacePayload`, `slotIdFor`, `createVaultKeeper`,
|
|
706
|
+
`rootPayload`, `rootOf`, `createSecretSigner`, `PrfUnavailableError` and
|
|
707
|
+
`VaultError`. See [PRF Keys and Vaults](#prf-keys-and-vaults).
|
|
627
708
|
|
|
628
709
|
### P-256 Wallet Primitives
|
|
629
710
|
|
|
@@ -668,6 +749,25 @@ const { did, publicKey, archive } = await client.generateEd25519Identity();
|
|
|
668
749
|
const signature = await client.sign(new TextEncoder().encode('entry'));
|
|
669
750
|
```
|
|
670
751
|
|
|
752
|
+
## Vault Export
|
|
753
|
+
|
|
754
|
+
Since 0.12.0. The passkey vault on its own, for an application that keeps its
|
|
755
|
+
data outside OrbitDB: `readPrfOutput`, `deriveSubkey`, `deriveAesKey`,
|
|
756
|
+
`createVault`, `openVault`, `addSlot`, `removeSlot`, `replacePayload`,
|
|
757
|
+
`slotIdFor`, `createVaultKeeper`, `rootPayload`, `rootOf`,
|
|
758
|
+
`PrfUnavailableError` and `VaultError`. Its import graph holds no package at
|
|
759
|
+
all — WebCrypto and `navigator.credentials` are all it needs, and
|
|
760
|
+
`tests/vault-entry.test.js` keeps it that way. `createSecretSigner` is not in
|
|
761
|
+
it: it needs `@libp2p/crypto`.
|
|
762
|
+
|
|
763
|
+
```js
|
|
764
|
+
import {
|
|
765
|
+
createVaultKeeper,
|
|
766
|
+
readPrfOutput,
|
|
767
|
+
rootPayload,
|
|
768
|
+
} from '@le-space/orbitdb-identity-provider-webauthn-did/vault';
|
|
769
|
+
```
|
|
770
|
+
|
|
671
771
|
## Verification Export
|
|
672
772
|
|
|
673
773
|
```js
|
|
@@ -699,6 +799,7 @@ The package publishes declaration files:
|
|
|
699
799
|
- `types/index.d.ts`
|
|
700
800
|
- `types/keystore.d.ts`
|
|
701
801
|
- `types/standalone.d.ts`
|
|
802
|
+
- `types/vault.d.ts`
|
|
702
803
|
- `types/verification.d.ts`
|
|
703
804
|
|
|
704
805
|
They are connected through `package.json` `exports.types`, so TypeScript
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/orbitdb-identity-provider-webauthn-did",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "WebAuthn-based DID identity provider for OrbitDB for hardware-secured wallets and biometric Passkey authentication",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"./keystore": {
|
|
22
22
|
"types": "./types/keystore.d.ts",
|
|
23
23
|
"import": "./src/keystore/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./vault": {
|
|
26
|
+
"types": "./types/vault.d.ts",
|
|
27
|
+
"import": "./src/vault/index.js"
|
|
24
28
|
}
|
|
25
29
|
},
|
|
26
30
|
"scripts": {
|
|
@@ -147,7 +151,7 @@
|
|
|
147
151
|
"iso-web": "^3.1.2",
|
|
148
152
|
"iso-webauthn-varsig": "npm:@le-space/iso-webauthn-varsig@^0.3.0",
|
|
149
153
|
"conf>ajv": "^8.18.0",
|
|
150
|
-
"ajv>fast-uri": "^3.1.
|
|
154
|
+
"ajv>fast-uri": "^3.1.9"
|
|
151
155
|
},
|
|
152
156
|
"onlyBuiltDependencies": [
|
|
153
157
|
"@ipshipyard/node-datachannel",
|
package/src/errors.js
CHANGED
|
@@ -11,6 +11,9 @@ export const ERROR_CODES = Object.freeze({
|
|
|
11
11
|
VAULT_LOCKED: 'VAULT_LOCKED',
|
|
12
12
|
VAULT_SLOT_EXISTS: 'VAULT_SLOT_EXISTS',
|
|
13
13
|
VAULT_LAST_SLOT: 'VAULT_LAST_SLOT',
|
|
14
|
+
VAULT_STORE_UNREADABLE: 'VAULT_STORE_UNREADABLE',
|
|
15
|
+
VAULT_SLOT_REMOVED: 'VAULT_SLOT_REMOVED',
|
|
16
|
+
VAULT_SLOT_IN_USE: 'VAULT_SLOT_IN_USE',
|
|
14
17
|
});
|
|
15
18
|
|
|
16
19
|
export class WebAuthnIdentityError extends Error {
|
|
@@ -96,6 +99,10 @@ export class PrfUnavailableError extends KeystoreEncryptionError {
|
|
|
96
99
|
* has no slot in it (`VAULT_NO_SLOT`), the key does not open it or it was
|
|
97
100
|
* altered (`VAULT_LOCKED`), the authenticator already has a slot
|
|
98
101
|
* (`VAULT_SLOT_EXISTS`), or the slot is the last one (`VAULT_LAST_SLOT`).
|
|
102
|
+
* From the vault keeper also: the vaults kept in a store cannot be read
|
|
103
|
+
* (`VAULT_STORE_UNREADABLE`), the authenticator was removed from the vault
|
|
104
|
+
* kept there (`VAULT_SLOT_REMOVED`), or it is the one that opened the vault
|
|
105
|
+
* and so cannot remove itself (`VAULT_SLOT_IN_USE`).
|
|
99
106
|
*/
|
|
100
107
|
export class VaultError extends KeystoreEncryptionError {
|
|
101
108
|
constructor(message, options = {}) {
|
package/src/index.js
CHANGED
|
@@ -335,6 +335,12 @@ export {
|
|
|
335
335
|
replacePayload,
|
|
336
336
|
slotIdFor,
|
|
337
337
|
} from './keystore/vault.js';
|
|
338
|
+
// Where the vaults are kept, and what every unlock does with them.
|
|
339
|
+
export {
|
|
340
|
+
createVaultKeeper,
|
|
341
|
+
rootPayload,
|
|
342
|
+
rootOf,
|
|
343
|
+
} from './keystore/vault-keeper.js';
|
|
338
344
|
// An identity that is nobody's passkey — the books every key of their owner
|
|
339
345
|
// writes as, its secret kept in a vault.
|
|
340
346
|
export { createSecretSigner } from './keystore/secret-signer.js';
|