@did-btcr2/api 0.5.0 → 0.8.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/README.md +131 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser.js +22006 -35294
- package/dist/browser.mjs +22006 -35294
- package/dist/cjs/index.js +100 -29
- package/dist/esm/api.js +3 -2
- package/dist/esm/api.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{kms.js → key-manager.js} +21 -12
- package/dist/esm/key-manager.js.map +1 -0
- package/dist/esm/method.js +81 -20
- package/dist/esm/method.js.map +1 -1
- package/dist/types/api.d.ts +5 -3
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/crypto.d.ts +2 -2
- package/dist/types/crypto.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/{kms.d.ts → key-manager.d.ts} +19 -11
- package/dist/types/key-manager.d.ts.map +1 -0
- package/dist/types/method.d.ts +28 -12
- package/dist/types/method.d.ts.map +1 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +9 -12
- package/src/api.ts +6 -2
- package/src/crypto.ts +2 -2
- package/src/index.ts +1 -1
- package/src/{kms.ts → key-manager.ts} +25 -16
- package/src/method.ts +98 -22
- package/src/types.ts +1 -1
- package/dist/esm/kms.js.map +0 -1
- package/dist/types/kms.d.ts.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1242,14 +1242,14 @@ var CasApi = class {
|
|
|
1242
1242
|
}
|
|
1243
1243
|
};
|
|
1244
1244
|
|
|
1245
|
-
// src/
|
|
1246
|
-
var
|
|
1245
|
+
// src/key-manager.ts
|
|
1246
|
+
var import_key_manager = require("@did-btcr2/key-manager");
|
|
1247
1247
|
var KeyManagerApi = class {
|
|
1248
1248
|
/** The backing KeyManager instance. */
|
|
1249
1249
|
kms;
|
|
1250
1250
|
/** Create a new KeyManagerApi, optionally backed by a custom KeyManager. */
|
|
1251
1251
|
constructor(kms) {
|
|
1252
|
-
this.kms = kms ?? new
|
|
1252
|
+
this.kms = kms ?? new import_key_manager.LocalKeyManager();
|
|
1253
1253
|
}
|
|
1254
1254
|
/** Generate a new key directly in the KMS. */
|
|
1255
1255
|
generateKey(options) {
|
|
@@ -1269,13 +1269,17 @@ var KeyManagerApi = class {
|
|
|
1269
1269
|
}
|
|
1270
1270
|
/**
|
|
1271
1271
|
* Export a Schnorr keypair from the KMS.
|
|
1272
|
-
*
|
|
1273
|
-
*
|
|
1272
|
+
* Routes through the KeyManager's declared capability (`canExport`) rather
|
|
1273
|
+
* than an `instanceof LocalKeyManager` check, so third-party adapters can
|
|
1274
|
+
* opt in to export support without coupling to a specific implementation.
|
|
1275
|
+
* External adapters (AWS, Vault, HSM) typically advertise `canExport: false`.
|
|
1276
|
+
* @throws {Error} If the backing KeyManager does not advertise canExport=true,
|
|
1277
|
+
* or omits the optional `exportKey` method.
|
|
1274
1278
|
*/
|
|
1275
1279
|
export(id) {
|
|
1276
|
-
if (!
|
|
1280
|
+
if (!this.kms.canExport || !this.kms.exportKey) {
|
|
1277
1281
|
throw new Error(
|
|
1278
|
-
"Key export is not supported by the current KeyManager implementation.
|
|
1282
|
+
"Key export is not supported by the current KeyManager implementation. The adapter must advertise `canExport: true` and provide an `exportKey` method."
|
|
1279
1283
|
);
|
|
1280
1284
|
}
|
|
1281
1285
|
return this.kms.exportKey(id);
|
|
@@ -1292,13 +1296,13 @@ var KeyManagerApi = class {
|
|
|
1292
1296
|
* Sign data via the KMS.
|
|
1293
1297
|
* @param data The data to sign (must be non-empty).
|
|
1294
1298
|
* @param id Optional key identifier; uses the active key if omitted.
|
|
1295
|
-
* @param options Signing options
|
|
1299
|
+
* @param options Signing options. Defaults: `scheme: 'bip340'`.
|
|
1296
1300
|
*/
|
|
1297
1301
|
sign(data, id, options) {
|
|
1298
1302
|
assertBytes(data, "data");
|
|
1299
1303
|
return this.kms.sign(data, id, options);
|
|
1300
1304
|
}
|
|
1301
|
-
/** Verify a signature via the KMS. */
|
|
1305
|
+
/** Verify a signature via the KMS. Defaults: `scheme: 'bip340'`. */
|
|
1302
1306
|
verify(signature, data, id, options) {
|
|
1303
1307
|
return this.kms.verify(signature, data, id, options);
|
|
1304
1308
|
}
|
|
@@ -1892,8 +1896,16 @@ var DidMethodApi = class {
|
|
|
1892
1896
|
}
|
|
1893
1897
|
}
|
|
1894
1898
|
/**
|
|
1895
|
-
* Update an existing DID document
|
|
1896
|
-
*
|
|
1899
|
+
* Update an existing DID document by driving the sans-I/O {@link Updater} state
|
|
1900
|
+
* machine (from @did-btcr2/method). This method handles the I/O side:
|
|
1901
|
+
* - Signing: supplies the {@link Signer} to `NeedSigningKey`.
|
|
1902
|
+
* - Broadcast: establishes a beacon via {@link BeaconFactory} and calls
|
|
1903
|
+
* `broadcastSignal()` with the bitcoin connection configured on the API.
|
|
1904
|
+
*
|
|
1905
|
+
* For multi-party aggregation of SMT/CAS beacons, the caller should drive the
|
|
1906
|
+
* Updater directly and delegate `NeedBroadcast` to the aggregation runner
|
|
1907
|
+
* rather than using this high-level method.
|
|
1908
|
+
*
|
|
1897
1909
|
* @param params The update parameters.
|
|
1898
1910
|
* @returns The signed update.
|
|
1899
1911
|
*/
|
|
@@ -1903,19 +1915,64 @@ var DidMethodApi = class {
|
|
|
1903
1915
|
sourceVersionId,
|
|
1904
1916
|
verificationMethodId,
|
|
1905
1917
|
beaconId,
|
|
1906
|
-
|
|
1918
|
+
signer,
|
|
1907
1919
|
bitcoin
|
|
1908
1920
|
}) {
|
|
1909
|
-
const btcConnection = bitcoin ?? this.#btc?.connection
|
|
1910
|
-
|
|
1921
|
+
const btcConnection = bitcoin ?? this.#btc?.connection;
|
|
1922
|
+
if (!btcConnection) {
|
|
1923
|
+
throw new import_common3.UpdateError(
|
|
1924
|
+
"Bitcoin connection required for update. Pass a configured `bitcoin` parameter or configure a BitcoinApi on the DidBtcr2Api instance.",
|
|
1925
|
+
import_common3.INVALID_DID_UPDATE,
|
|
1926
|
+
{ beaconId }
|
|
1927
|
+
);
|
|
1928
|
+
}
|
|
1929
|
+
this.#log.debug("Updating DID", sourceDocument.id, { beaconId, verificationMethodId });
|
|
1930
|
+
const updater = import_method2.DidBtcr2.update({
|
|
1911
1931
|
sourceDocument,
|
|
1912
1932
|
patches,
|
|
1913
1933
|
sourceVersionId,
|
|
1914
1934
|
verificationMethodId,
|
|
1915
|
-
beaconId
|
|
1916
|
-
signingMaterial,
|
|
1917
|
-
bitcoin: btcConnection
|
|
1935
|
+
beaconId
|
|
1918
1936
|
});
|
|
1937
|
+
let state = updater.advance();
|
|
1938
|
+
while (state.status === "action-required") {
|
|
1939
|
+
for (const need of state.needs) {
|
|
1940
|
+
switch (need.kind) {
|
|
1941
|
+
case "NeedSigningKey": {
|
|
1942
|
+
this.#log.debug("Providing signer for", need.verificationMethodId);
|
|
1943
|
+
updater.provide(need, signer);
|
|
1944
|
+
break;
|
|
1945
|
+
}
|
|
1946
|
+
case "NeedFunding": {
|
|
1947
|
+
this.#log.debug("Checking funding for beacon address %s", need.beaconAddress);
|
|
1948
|
+
const utxos = await btcConnection.rest.address.getUtxos(need.beaconAddress);
|
|
1949
|
+
if (!utxos.length) {
|
|
1950
|
+
throw new import_common3.UpdateError(
|
|
1951
|
+
`Beacon address ${need.beaconAddress} is unfunded. Send BTC to this address before broadcasting the update.`,
|
|
1952
|
+
import_common3.INVALID_DID_UPDATE,
|
|
1953
|
+
{ beaconAddress: need.beaconAddress }
|
|
1954
|
+
);
|
|
1955
|
+
}
|
|
1956
|
+
this.#log.debug("Beacon address funded (%d UTXOs)", utxos.length);
|
|
1957
|
+
updater.provide(need);
|
|
1958
|
+
break;
|
|
1959
|
+
}
|
|
1960
|
+
case "NeedBroadcast": {
|
|
1961
|
+
this.#log.debug(
|
|
1962
|
+
"Broadcasting signed update via %s beacon",
|
|
1963
|
+
need.beaconService.type
|
|
1964
|
+
);
|
|
1965
|
+
const beacon = import_method2.BeaconFactory.establish(need.beaconService);
|
|
1966
|
+
await beacon.broadcastSignal(need.signedUpdate, signer, btcConnection);
|
|
1967
|
+
updater.provide(need);
|
|
1968
|
+
break;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
state = updater.advance();
|
|
1973
|
+
}
|
|
1974
|
+
this.#log.debug("DID update complete", sourceDocument.id);
|
|
1975
|
+
return state.result.signedUpdate;
|
|
1919
1976
|
}
|
|
1920
1977
|
/**
|
|
1921
1978
|
* Get the signing method from a DID document by method ID.
|
|
@@ -1937,8 +1994,9 @@ var DidMethodApi = class {
|
|
|
1937
1994
|
* .buildUpdate(currentDoc)
|
|
1938
1995
|
* .patch({ op: 'add', path: '/service/1', value: newService })
|
|
1939
1996
|
* .version(2)
|
|
1940
|
-
* .
|
|
1997
|
+
* .verificationMethodId('#initialKey')
|
|
1941
1998
|
* .beacon('#beacon-0')
|
|
1999
|
+
* .signer(new LocalSigner(secretKey))
|
|
1942
2000
|
* .execute();
|
|
1943
2001
|
* ```
|
|
1944
2002
|
*/
|
|
@@ -1963,7 +2021,7 @@ var UpdateBuilder = class {
|
|
|
1963
2021
|
#sourceVersionId;
|
|
1964
2022
|
#verificationMethodId;
|
|
1965
2023
|
#beaconId;
|
|
1966
|
-
#
|
|
2024
|
+
#signer;
|
|
1967
2025
|
#bitcoin;
|
|
1968
2026
|
/** @internal */
|
|
1969
2027
|
constructor(methodApi, sourceDocument) {
|
|
@@ -1985,8 +2043,8 @@ var UpdateBuilder = class {
|
|
|
1985
2043
|
this.#sourceVersionId = id;
|
|
1986
2044
|
return this;
|
|
1987
2045
|
}
|
|
1988
|
-
/** Set the verification method ID used for signing. */
|
|
1989
|
-
|
|
2046
|
+
/** Set the verification method ID used for signing the update. */
|
|
2047
|
+
verificationMethodId(methodId) {
|
|
1990
2048
|
this.#verificationMethodId = methodId;
|
|
1991
2049
|
return this;
|
|
1992
2050
|
}
|
|
@@ -1995,37 +2053,48 @@ var UpdateBuilder = class {
|
|
|
1995
2053
|
this.#beaconId = beaconId;
|
|
1996
2054
|
return this;
|
|
1997
2055
|
}
|
|
1998
|
-
/**
|
|
1999
|
-
|
|
2000
|
-
|
|
2056
|
+
/**
|
|
2057
|
+
* Set the {@link Signer} that produces the update's BIP-340 Schnorr proof
|
|
2058
|
+
* and the beacon transaction's ECDSA input signature. Use `LocalSigner`
|
|
2059
|
+
* for in-process secret keys, `KeyManagerSigner` for KMS-managed keys
|
|
2060
|
+
* (AWS, Vault, HSM, etc.), or any custom adapter implementing the `Signer`
|
|
2061
|
+
* interface.
|
|
2062
|
+
*/
|
|
2063
|
+
signer(s) {
|
|
2064
|
+
this.#signer = s;
|
|
2001
2065
|
return this;
|
|
2002
2066
|
}
|
|
2003
2067
|
/** Override the Bitcoin connection for this update. */
|
|
2004
|
-
|
|
2068
|
+
bitcoin(connection) {
|
|
2005
2069
|
this.#bitcoin = connection;
|
|
2006
2070
|
return this;
|
|
2007
2071
|
}
|
|
2008
2072
|
/**
|
|
2009
2073
|
* Execute the update.
|
|
2010
|
-
* @throws {Error} If required fields (version,
|
|
2074
|
+
* @throws {Error} If required fields (version, verificationMethodId, beacon, signer) are missing.
|
|
2011
2075
|
*/
|
|
2012
2076
|
async execute() {
|
|
2013
2077
|
if (this.#sourceVersionId === void 0) {
|
|
2014
2078
|
throw new Error("UpdateBuilder: sourceVersionId is required. Call .version(id) before .execute().");
|
|
2015
2079
|
}
|
|
2016
2080
|
if (!this.#verificationMethodId) {
|
|
2017
|
-
throw new Error(
|
|
2081
|
+
throw new Error(
|
|
2082
|
+
"UpdateBuilder: verificationMethodId is required. Call .verificationMethodId(id) before .execute()."
|
|
2083
|
+
);
|
|
2018
2084
|
}
|
|
2019
2085
|
if (!this.#beaconId) {
|
|
2020
2086
|
throw new Error("UpdateBuilder: beaconId is required. Call .beacon(id) before .execute().");
|
|
2021
2087
|
}
|
|
2088
|
+
if (!this.#signer) {
|
|
2089
|
+
throw new Error("UpdateBuilder: signer is required. Call .signer(s) before .execute().");
|
|
2090
|
+
}
|
|
2022
2091
|
return this.#methodApi.update({
|
|
2023
2092
|
sourceDocument: this.#sourceDocument,
|
|
2024
2093
|
patches: this.#patches,
|
|
2025
2094
|
sourceVersionId: this.#sourceVersionId,
|
|
2026
2095
|
verificationMethodId: this.#verificationMethodId,
|
|
2027
2096
|
beaconId: this.#beaconId,
|
|
2028
|
-
|
|
2097
|
+
signer: this.#signer,
|
|
2029
2098
|
bitcoin: this.#bitcoin
|
|
2030
2099
|
});
|
|
2031
2100
|
}
|
|
@@ -2198,6 +2267,7 @@ var DidBtcr2Api = class {
|
|
|
2198
2267
|
patches,
|
|
2199
2268
|
verificationMethodId,
|
|
2200
2269
|
beaconId,
|
|
2270
|
+
signer,
|
|
2201
2271
|
sourceDocument,
|
|
2202
2272
|
sourceVersionId
|
|
2203
2273
|
}) {
|
|
@@ -2238,7 +2308,8 @@ var DidBtcr2Api = class {
|
|
|
2238
2308
|
patches,
|
|
2239
2309
|
sourceVersionId: versionId,
|
|
2240
2310
|
verificationMethodId,
|
|
2241
|
-
beaconId
|
|
2311
|
+
beaconId,
|
|
2312
|
+
signer
|
|
2242
2313
|
});
|
|
2243
2314
|
}
|
|
2244
2315
|
/**
|
package/dist/esm/api.js
CHANGED
|
@@ -4,7 +4,7 @@ import { CasApi, DEFAULT_CAS_GATEWAY } from './cas.js';
|
|
|
4
4
|
import { CryptoApi } from './crypto.js';
|
|
5
5
|
import { DidApi } from './did.js';
|
|
6
6
|
import { assertString, NOOP_LOGGER } from './helpers.js';
|
|
7
|
-
import { KeyManagerApi } from './
|
|
7
|
+
import { KeyManagerApi } from './key-manager.js';
|
|
8
8
|
import { DidMethodApi } from './method.js';
|
|
9
9
|
/**
|
|
10
10
|
* Main DidBtcr2Api facade — the primary entry point for the SDK.
|
|
@@ -171,7 +171,7 @@ export class DidBtcr2Api {
|
|
|
171
171
|
* @param params The update parameters.
|
|
172
172
|
* @returns The signed update.
|
|
173
173
|
*/
|
|
174
|
-
async updateDid({ did, patches, verificationMethodId, beaconId, sourceDocument, sourceVersionId, }) {
|
|
174
|
+
async updateDid({ did, patches, verificationMethodId, beaconId, signer, sourceDocument, sourceVersionId, }) {
|
|
175
175
|
this.#assertNotDisposed();
|
|
176
176
|
assertString(did, 'did');
|
|
177
177
|
let doc = sourceDocument;
|
|
@@ -204,6 +204,7 @@ export class DidBtcr2Api {
|
|
|
204
204
|
sourceVersionId: versionId,
|
|
205
205
|
verificationMethodId,
|
|
206
206
|
beaconId,
|
|
207
|
+
signer,
|
|
207
208
|
});
|
|
208
209
|
}
|
|
209
210
|
/**
|
package/dist/esm/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAkB,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IACtB,wEAAwE;IAC/D,MAAM,CAAY;IAC3B,mEAAmE;IAC1D,GAAG,CAAS;IACrB,iCAAiC;IACxB,GAAG,CAAgB;IAE5B,UAAU,CAAoB;IAC9B,IAAI,CAAc;IAClB,UAAU,CAAa;IACvB,IA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AC7B,MAAM,IAAI,KAAK,CACb,qBAAqB,GAAG,sCAAsC,MAAM,CAAC,YAAY,CAAC,GAAG,CACtF,CAAC;gBACJ,CAAC;gBACD,SAAS,GAAG,MAAM,CAAC;YACrB,CAAC;QACH,CAAC;QAED,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;YAC7B,cAAc,EAAM,GAAG;YACvB,OAAO;YACP,eAAe,EAAK,SAAS;YAC7B,oBAAoB;YACpB,QAAQ;YACR,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,OAAO;QACL,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,kBAAkB;QAChB,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,MAAkB;IAC1C,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export * from './types.js';
|
|
|
6
6
|
export * from './helpers.js';
|
|
7
7
|
export * from './bitcoin.js';
|
|
8
8
|
export * from './cas.js';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './key-manager.js';
|
|
10
10
|
export * from './crypto.js';
|
|
11
11
|
export * from './did.js';
|
|
12
12
|
export * from './method.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAyBpD,gBAAgB;AAChB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAyBpD,gBAAgB;AAChB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LocalKeyManager, } from '@did-btcr2/key-manager';
|
|
2
2
|
import { assertBytes } from './helpers.js';
|
|
3
3
|
/**
|
|
4
4
|
* Key management operations sub-facade.
|
|
5
5
|
*
|
|
6
|
-
* Wraps
|
|
7
|
-
* {@link
|
|
8
|
-
*
|
|
6
|
+
* Wraps any {@link KeyManager} interface implementation. By default uses the
|
|
7
|
+
* bundled {@link LocalKeyManager} (in-process reference implementation); a
|
|
8
|
+
* custom implementation (AWS KMS, GCP KMS, HashiCorp Vault, HSM, etc.) can
|
|
9
|
+
* be injected via {@link ApiConfig}.
|
|
10
|
+
*
|
|
11
|
+
* The field is named `kms` because that's the category label callers use
|
|
12
|
+
* conversationally ("plug in your KMS"); the actual contract is the
|
|
13
|
+
* {@link KeyManager} interface.
|
|
9
14
|
* @public
|
|
10
15
|
*/
|
|
11
16
|
export class KeyManagerApi {
|
|
@@ -13,7 +18,7 @@ export class KeyManagerApi {
|
|
|
13
18
|
kms;
|
|
14
19
|
/** Create a new KeyManagerApi, optionally backed by a custom KeyManager. */
|
|
15
20
|
constructor(kms) {
|
|
16
|
-
this.kms = kms ?? new
|
|
21
|
+
this.kms = kms ?? new LocalKeyManager();
|
|
17
22
|
}
|
|
18
23
|
/** Generate a new key directly in the KMS. */
|
|
19
24
|
generateKey(options) {
|
|
@@ -33,13 +38,17 @@ export class KeyManagerApi {
|
|
|
33
38
|
}
|
|
34
39
|
/**
|
|
35
40
|
* Export a Schnorr keypair from the KMS.
|
|
36
|
-
*
|
|
37
|
-
*
|
|
41
|
+
* Routes through the KeyManager's declared capability (`canExport`) rather
|
|
42
|
+
* than an `instanceof LocalKeyManager` check, so third-party adapters can
|
|
43
|
+
* opt in to export support without coupling to a specific implementation.
|
|
44
|
+
* External adapters (AWS, Vault, HSM) typically advertise `canExport: false`.
|
|
45
|
+
* @throws {Error} If the backing KeyManager does not advertise canExport=true,
|
|
46
|
+
* or omits the optional `exportKey` method.
|
|
38
47
|
*/
|
|
39
48
|
export(id) {
|
|
40
|
-
if (!
|
|
49
|
+
if (!this.kms.canExport || !this.kms.exportKey) {
|
|
41
50
|
throw new Error('Key export is not supported by the current KeyManager implementation. '
|
|
42
|
-
+ '
|
|
51
|
+
+ 'The adapter must advertise `canExport: true` and provide an `exportKey` method.');
|
|
43
52
|
}
|
|
44
53
|
return this.kms.exportKey(id);
|
|
45
54
|
}
|
|
@@ -55,13 +64,13 @@ export class KeyManagerApi {
|
|
|
55
64
|
* Sign data via the KMS.
|
|
56
65
|
* @param data The data to sign (must be non-empty).
|
|
57
66
|
* @param id Optional key identifier; uses the active key if omitted.
|
|
58
|
-
* @param options Signing options
|
|
67
|
+
* @param options Signing options. Defaults: `scheme: 'bip340'`.
|
|
59
68
|
*/
|
|
60
69
|
sign(data, id, options) {
|
|
61
70
|
assertBytes(data, 'data');
|
|
62
71
|
return this.kms.sign(data, id, options);
|
|
63
72
|
}
|
|
64
|
-
/** Verify a signature via the KMS. */
|
|
73
|
+
/** Verify a signature via the KMS. Defaults: `scheme: 'bip340'`. */
|
|
65
74
|
verify(signature, data, id, options) {
|
|
66
75
|
return this.kms.verify(signature, data, id, options);
|
|
67
76
|
}
|
|
@@ -70,4 +79,4 @@ export class KeyManagerApi {
|
|
|
70
79
|
return this.kms.digest(data);
|
|
71
80
|
}
|
|
72
81
|
}
|
|
73
|
-
//# sourceMappingURL=
|
|
82
|
+
//# sourceMappingURL=key-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-manager.js","sourceRoot":"","sources":["../../src/key-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,eAAe,GAGhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,aAAa;IACxB,uCAAuC;IAC9B,GAAG,CAAa;IAEzB,4EAA4E;IAC5E,YAAY,GAAgB;QAC1B,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,IAAI,eAAe,EAAE,CAAC;IAC1C,CAAC;IAED,8CAA8C;IAC9C,WAAW,CAAC,OAA4B;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,4CAA4C;IAC5C,SAAS,CAAC,EAAiB;QACzB,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,qDAAqD;IACrD,YAAY,CAAC,EAAkB;QAC7B,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,6CAA6C;IAC7C,MAAM,CAAC,EAAkB,EAA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
|
-
import { decode as decodeHash, IdentifierTypes, NotImplementedError } from '@did-btcr2/common';
|
|
2
|
-
import { BeaconSignalDiscovery, DidBtcr2 } from '@did-btcr2/method';
|
|
1
|
+
import { decode as decodeHash, IdentifierTypes, INVALID_DID_UPDATE, NotImplementedError, UpdateError } from '@did-btcr2/common';
|
|
2
|
+
import { BeaconFactory, BeaconSignalDiscovery, DidBtcr2 } from '@did-btcr2/method';
|
|
3
3
|
import { assertBytes, assertCompressedPubkey, assertString, NOOP_LOGGER } from './helpers.js';
|
|
4
4
|
/**
|
|
5
5
|
* DID method operations sub-facade: create, resolve, update, deactivate.
|
|
@@ -125,22 +125,72 @@ export class DidMethodApi {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
* Update an existing DID document
|
|
129
|
-
*
|
|
128
|
+
* Update an existing DID document by driving the sans-I/O {@link Updater} state
|
|
129
|
+
* machine (from @did-btcr2/method). This method handles the I/O side:
|
|
130
|
+
* - Signing: supplies the {@link Signer} to `NeedSigningKey`.
|
|
131
|
+
* - Broadcast: establishes a beacon via {@link BeaconFactory} and calls
|
|
132
|
+
* `broadcastSignal()` with the bitcoin connection configured on the API.
|
|
133
|
+
*
|
|
134
|
+
* For multi-party aggregation of SMT/CAS beacons, the caller should drive the
|
|
135
|
+
* Updater directly and delegate `NeedBroadcast` to the aggregation runner
|
|
136
|
+
* rather than using this high-level method.
|
|
137
|
+
*
|
|
130
138
|
* @param params The update parameters.
|
|
131
139
|
* @returns The signed update.
|
|
132
140
|
*/
|
|
133
|
-
async update({ sourceDocument, patches, sourceVersionId, verificationMethodId, beaconId,
|
|
134
|
-
|
|
135
|
-
|
|
141
|
+
async update({ sourceDocument, patches, sourceVersionId, verificationMethodId, beaconId, signer, bitcoin, }) {
|
|
142
|
+
// Bitcoin connection resolution order: per-call `bitcoin` param wins over the
|
|
143
|
+
// BitcoinApi injected at DidBtcr2Api construction time. One of the two must
|
|
144
|
+
// be present; this can't be encoded in the type system, so it's a runtime check.
|
|
145
|
+
const btcConnection = bitcoin ?? this.#btc?.connection;
|
|
146
|
+
if (!btcConnection) {
|
|
147
|
+
throw new UpdateError('Bitcoin connection required for update. Pass a configured `bitcoin` parameter '
|
|
148
|
+
+ 'or configure a BitcoinApi on the DidBtcr2Api instance.', INVALID_DID_UPDATE, { beaconId });
|
|
149
|
+
}
|
|
150
|
+
this.#log.debug('Updating DID', sourceDocument.id, { beaconId, verificationMethodId });
|
|
151
|
+
// Factory validates and returns a sans-I/O state machine
|
|
152
|
+
const updater = DidBtcr2.update({
|
|
136
153
|
sourceDocument,
|
|
137
154
|
patches,
|
|
138
155
|
sourceVersionId,
|
|
139
156
|
verificationMethodId,
|
|
140
157
|
beaconId,
|
|
141
|
-
signingMaterial,
|
|
142
|
-
bitcoin: btcConnection,
|
|
143
158
|
});
|
|
159
|
+
// Drive the state machine. All I/O (signing delegation, Bitcoin broadcast)
|
|
160
|
+
// happens inside the need-handlers below — the Updater itself is pure.
|
|
161
|
+
let state = updater.advance();
|
|
162
|
+
while (state.status === 'action-required') {
|
|
163
|
+
for (const need of state.needs) {
|
|
164
|
+
switch (need.kind) {
|
|
165
|
+
case 'NeedSigningKey': {
|
|
166
|
+
this.#log.debug('Providing signer for', need.verificationMethodId);
|
|
167
|
+
updater.provide(need, signer);
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
case 'NeedFunding': {
|
|
171
|
+
this.#log.debug('Checking funding for beacon address %s', need.beaconAddress);
|
|
172
|
+
const utxos = await btcConnection.rest.address.getUtxos(need.beaconAddress);
|
|
173
|
+
if (!utxos.length) {
|
|
174
|
+
throw new UpdateError(`Beacon address ${need.beaconAddress} is unfunded. `
|
|
175
|
+
+ 'Send BTC to this address before broadcasting the update.', INVALID_DID_UPDATE, { beaconAddress: need.beaconAddress });
|
|
176
|
+
}
|
|
177
|
+
this.#log.debug('Beacon address funded (%d UTXOs)', utxos.length);
|
|
178
|
+
updater.provide(need);
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
case 'NeedBroadcast': {
|
|
182
|
+
this.#log.debug('Broadcasting signed update via %s beacon', need.beaconService.type);
|
|
183
|
+
const beacon = BeaconFactory.establish(need.beaconService);
|
|
184
|
+
await beacon.broadcastSignal(need.signedUpdate, signer, btcConnection);
|
|
185
|
+
updater.provide(need);
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
state = updater.advance();
|
|
191
|
+
}
|
|
192
|
+
this.#log.debug('DID update complete', sourceDocument.id);
|
|
193
|
+
return state.result.signedUpdate;
|
|
144
194
|
}
|
|
145
195
|
/**
|
|
146
196
|
* Get the signing method from a DID document by method ID.
|
|
@@ -162,8 +212,9 @@ export class DidMethodApi {
|
|
|
162
212
|
* .buildUpdate(currentDoc)
|
|
163
213
|
* .patch({ op: 'add', path: '/service/1', value: newService })
|
|
164
214
|
* .version(2)
|
|
165
|
-
* .
|
|
215
|
+
* .verificationMethodId('#initialKey')
|
|
166
216
|
* .beacon('#beacon-0')
|
|
217
|
+
* .signer(new LocalSigner(secretKey))
|
|
167
218
|
* .execute();
|
|
168
219
|
* ```
|
|
169
220
|
*/
|
|
@@ -192,7 +243,7 @@ export class UpdateBuilder {
|
|
|
192
243
|
#sourceVersionId;
|
|
193
244
|
#verificationMethodId;
|
|
194
245
|
#beaconId;
|
|
195
|
-
#
|
|
246
|
+
#signer;
|
|
196
247
|
#bitcoin;
|
|
197
248
|
/** @internal */
|
|
198
249
|
constructor(methodApi, sourceDocument) {
|
|
@@ -214,8 +265,8 @@ export class UpdateBuilder {
|
|
|
214
265
|
this.#sourceVersionId = id;
|
|
215
266
|
return this;
|
|
216
267
|
}
|
|
217
|
-
/** Set the verification method ID used for signing. */
|
|
218
|
-
|
|
268
|
+
/** Set the verification method ID used for signing the update. */
|
|
269
|
+
verificationMethodId(methodId) {
|
|
219
270
|
this.#verificationMethodId = methodId;
|
|
220
271
|
return this;
|
|
221
272
|
}
|
|
@@ -224,37 +275,47 @@ export class UpdateBuilder {
|
|
|
224
275
|
this.#beaconId = beaconId;
|
|
225
276
|
return this;
|
|
226
277
|
}
|
|
227
|
-
/**
|
|
228
|
-
|
|
229
|
-
|
|
278
|
+
/**
|
|
279
|
+
* Set the {@link Signer} that produces the update's BIP-340 Schnorr proof
|
|
280
|
+
* and the beacon transaction's ECDSA input signature. Use `LocalSigner`
|
|
281
|
+
* for in-process secret keys, `KeyManagerSigner` for KMS-managed keys
|
|
282
|
+
* (AWS, Vault, HSM, etc.), or any custom adapter implementing the `Signer`
|
|
283
|
+
* interface.
|
|
284
|
+
*/
|
|
285
|
+
signer(s) {
|
|
286
|
+
this.#signer = s;
|
|
230
287
|
return this;
|
|
231
288
|
}
|
|
232
289
|
/** Override the Bitcoin connection for this update. */
|
|
233
|
-
|
|
290
|
+
bitcoin(connection) {
|
|
234
291
|
this.#bitcoin = connection;
|
|
235
292
|
return this;
|
|
236
293
|
}
|
|
237
294
|
/**
|
|
238
295
|
* Execute the update.
|
|
239
|
-
* @throws {Error} If required fields (version,
|
|
296
|
+
* @throws {Error} If required fields (version, verificationMethodId, beacon, signer) are missing.
|
|
240
297
|
*/
|
|
241
298
|
async execute() {
|
|
242
299
|
if (this.#sourceVersionId === undefined) {
|
|
243
300
|
throw new Error('UpdateBuilder: sourceVersionId is required. Call .version(id) before .execute().');
|
|
244
301
|
}
|
|
245
302
|
if (!this.#verificationMethodId) {
|
|
246
|
-
throw new Error('UpdateBuilder: verificationMethodId is required.
|
|
303
|
+
throw new Error('UpdateBuilder: verificationMethodId is required. '
|
|
304
|
+
+ 'Call .verificationMethodId(id) before .execute().');
|
|
247
305
|
}
|
|
248
306
|
if (!this.#beaconId) {
|
|
249
307
|
throw new Error('UpdateBuilder: beaconId is required. Call .beacon(id) before .execute().');
|
|
250
308
|
}
|
|
309
|
+
if (!this.#signer) {
|
|
310
|
+
throw new Error('UpdateBuilder: signer is required. Call .signer(s) before .execute().');
|
|
311
|
+
}
|
|
251
312
|
return this.#methodApi.update({
|
|
252
313
|
sourceDocument: this.#sourceDocument,
|
|
253
314
|
patches: this.#patches,
|
|
254
315
|
sourceVersionId: this.#sourceVersionId,
|
|
255
316
|
verificationMethodId: this.#verificationMethodId,
|
|
256
317
|
beaconId: this.#beaconId,
|
|
257
|
-
|
|
318
|
+
signer: this.#signer,
|
|
258
319
|
bitcoin: this.#bitcoin,
|
|
259
320
|
});
|
|
260
321
|
}
|
package/dist/esm/method.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method.js","sourceRoot":"","sources":["../../src/method.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"method.js","sourceRoot":"","sources":["../../src/method.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhI,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAInF,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG9F;;;;;;GAMG;AACH,MAAM,OAAO,YAAY;IACvB,IAAI,CAAc;IAClB,IAAI,CAAU;IACd,IAAI,CAAS;IAEb,YAAY,GAAgB,EAAE,GAAY,EAAE,MAAe;QACzD,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,MAAM,IAAI,WAAW,CAAC;IACpC,CAAC;IAED;;;;;;OAMG;IACH,mBAAmB,CAAC,YAAsB,EAAE,UAA4C,EAAE;QACxF,sBAAsB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;Q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CAAC,qBAAqB;YACjD,QAAQ,EAAe,IAAI,CAAC,SAAS;YACrC,MAAM,EAAiB,IAAI,CAAC,OAAO;YACnC,OAAO,EAAgB,IAAI,CAAC,QAAQ;SACrC,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/types/api.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { NetworkName } from '@did-btcr2/bitcoin';
|
|
2
2
|
import type { DocumentBytes, KeyBytes, PatchOperation } from '@did-btcr2/common';
|
|
3
3
|
import type { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
4
|
-
import type {
|
|
4
|
+
import type { Signer } from '@did-btcr2/keypair';
|
|
5
|
+
import type { KeyIdentifier } from '@did-btcr2/key-manager';
|
|
5
6
|
import type { Btcr2DidDocument, DidCreateOptions, ResolutionOptions } from '@did-btcr2/method';
|
|
6
7
|
import type { DidResolutionResult } from '@web5/dids';
|
|
7
8
|
import { BitcoinApi } from './bitcoin.js';
|
|
8
9
|
import { CasApi } from './cas.js';
|
|
9
10
|
import { CryptoApi } from './crypto.js';
|
|
10
11
|
import { DidApi } from './did.js';
|
|
11
|
-
import { KeyManagerApi } from './
|
|
12
|
+
import { KeyManagerApi } from './key-manager.js';
|
|
12
13
|
import { DidMethodApi } from './method.js';
|
|
13
14
|
import type { ApiConfig, ResolutionResult } from './types.js';
|
|
14
15
|
/**
|
|
@@ -99,11 +100,12 @@ export declare class DidBtcr2Api {
|
|
|
99
100
|
* @param params The update parameters.
|
|
100
101
|
* @returns The signed update.
|
|
101
102
|
*/
|
|
102
|
-
updateDid({ did, patches, verificationMethodId, beaconId, sourceDocument, sourceVersionId, }: {
|
|
103
|
+
updateDid({ did, patches, verificationMethodId, beaconId, signer, sourceDocument, sourceVersionId, }: {
|
|
103
104
|
did: string;
|
|
104
105
|
patches: PatchOperation[];
|
|
105
106
|
verificationMethodId: string;
|
|
106
107
|
beaconId: string;
|
|
108
|
+
signer: Signer;
|
|
107
109
|
sourceDocument?: Btcr2DidDocument;
|
|
108
110
|
sourceVersionId?: number;
|
|
109
111
|
}): Promise<SignedBTCR2Update>;
|