@did-btcr2/api 0.2.2 → 0.3.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/dist/browser.js +56457 -104900
- package/dist/browser.mjs +56442 -104885
- package/dist/cjs/api.js +31 -934
- package/dist/cjs/api.js.map +1 -1
- package/dist/cjs/bitcoin.js +110 -0
- package/dist/cjs/bitcoin.js.map +1 -0
- package/dist/cjs/cas.js +90 -0
- package/dist/cjs/cas.js.map +1 -0
- package/dist/cjs/crypto.js +425 -0
- package/dist/cjs/crypto.js.map +1 -0
- package/dist/cjs/did.js +70 -0
- package/dist/cjs/did.js.map +1 -0
- package/dist/cjs/helpers.js +28 -0
- package/dist/cjs/helpers.js.map +1 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/kms.js +73 -0
- package/dist/cjs/kms.js.map +1 -0
- package/dist/cjs/method.js +262 -0
- package/dist/cjs/method.js.map +1 -0
- package/dist/cjs/types.js +2 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/api.js +31 -934
- package/dist/esm/api.js.map +1 -1
- package/dist/esm/bitcoin.js +110 -0
- package/dist/esm/bitcoin.js.map +1 -0
- package/dist/esm/cas.js +90 -0
- package/dist/esm/cas.js.map +1 -0
- package/dist/esm/crypto.js +425 -0
- package/dist/esm/crypto.js.map +1 -0
- package/dist/esm/did.js +70 -0
- package/dist/esm/did.js.map +1 -0
- package/dist/esm/helpers.js +28 -0
- package/dist/esm/helpers.js.map +1 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/kms.js +73 -0
- package/dist/esm/kms.js.map +1 -0
- package/dist/esm/method.js +262 -0
- package/dist/esm/method.js.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/types/api.d.ts +19 -693
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/bitcoin.d.ts +64 -0
- package/dist/types/bitcoin.d.ts.map +1 -0
- package/dist/types/cas.d.ts +70 -0
- package/dist/types/cas.d.ts.map +1 -0
- package/dist/types/crypto.d.ts +310 -0
- package/dist/types/crypto.d.ts.map +1 -0
- package/dist/types/did.d.ts +51 -0
- package/dist/types/did.d.ts.map +1 -0
- package/dist/types/helpers.d.ts +10 -0
- package/dist/types/helpers.d.ts.map +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/kms.d.ts +49 -0
- package/dist/types/kms.d.ts.map +1 -0
- package/dist/types/method.d.ts +117 -0
- package/dist/types/method.d.ts.map +1 -0
- package/dist/types/types.d.ts +128 -0
- package/dist/types/types.d.ts.map +1 -0
- package/package.json +7 -7
- package/src/api.ts +40 -1317
- package/src/bitcoin.ts +129 -0
- package/src/cas.ts +121 -0
- package/src/crypto.ts +525 -0
- package/src/did.ts +75 -0
- package/src/helpers.ts +35 -0
- package/src/index.ts +37 -1
- package/src/kms.ts +95 -0
- package/src/method.ts +331 -0
- package/src/types.ts +122 -0
package/dist/types/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,KAAK,EACL,eAAe,EACf,aAAa,EACb,OAAO,EACP,SAAS,EACT,GAAG,EACH,SAAS,EACT,UAAU,EACV,QAAQ,EACR,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO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AAE,WAAW,CAAA;KAAE,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,aAAa,CAAA;KAAE;IAQ5G;;;;;OAKG;IACG,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAKxF;;;;;;;;OAQG;IACG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAiCxF;;;;;;;;OAQG;IACG,SAAS,CAAC,EACd,GAAG,EACH,OAAO,EACP,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,eAAe,GAChB,EAAE;QACD,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,cAAc,EAAE,CAAC;QAC1B,oBAAoB,EAAE,MAAM,CAAC;QAC7B,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,CAAC,EAAE,gBAAgB,CAAC;QAClC,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA+C9B;;;;;;OAMG;IACH,OAAO,IAAI,IAAI;CAchB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,WAAW,CAEzD"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { BitcoinConnection, BitcoinCoreRpcClient, BitcoinRestClient, type RawTransactionRest } from '@did-btcr2/bitcoin';
|
|
2
|
+
import type { BitcoinApiConfig } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Bitcoin network operations sub-facade.
|
|
5
|
+
* Always backed by a {@link BitcoinConnection} so it can be passed to
|
|
6
|
+
* resolve/update without extra configuration.
|
|
7
|
+
*
|
|
8
|
+
* Lazily initialized by {@link DidBtcr2Api} to avoid connection overhead
|
|
9
|
+
* when Bitcoin features are not used.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class BitcoinApi {
|
|
13
|
+
/** The underlying BitcoinConnection used for all operations. */
|
|
14
|
+
readonly connection: BitcoinConnection;
|
|
15
|
+
/** REST client for the active network. */
|
|
16
|
+
get rest(): BitcoinRestClient;
|
|
17
|
+
/**
|
|
18
|
+
* RPC client for the active network, or `undefined` if not configured.
|
|
19
|
+
* Use {@link requireRpc} when RPC is expected to be available.
|
|
20
|
+
*/
|
|
21
|
+
get rpc(): BitcoinCoreRpcClient | undefined;
|
|
22
|
+
/** Whether an RPC client is available for this network. */
|
|
23
|
+
get hasRpc(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* RPC client for the active network.
|
|
26
|
+
* @throws {Error} If RPC was not configured for this network.
|
|
27
|
+
*/
|
|
28
|
+
requireRpc(): BitcoinCoreRpcClient;
|
|
29
|
+
/**
|
|
30
|
+
* Create a BitcoinApi for a specific network with optional endpoint overrides.
|
|
31
|
+
* Uses BitcoinConnection.forNetwork() — no env vars consulted.
|
|
32
|
+
* @param cfg The network and optional REST/RPC overrides.
|
|
33
|
+
*/
|
|
34
|
+
constructor(cfg: BitcoinApiConfig);
|
|
35
|
+
/**
|
|
36
|
+
* Fetch a transaction by txid via REST.
|
|
37
|
+
* @param txid The transaction ID (64-character hex string).
|
|
38
|
+
* @returns The fetched transaction.
|
|
39
|
+
*/
|
|
40
|
+
getTransaction(txid: string): Promise<RawTransactionRest>;
|
|
41
|
+
/**
|
|
42
|
+
* Broadcast a raw tx (hex) via REST.
|
|
43
|
+
* @param rawTxHex The raw transaction hex string.
|
|
44
|
+
*/
|
|
45
|
+
send(rawTxHex: string): Promise<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Get UTXOs for an address via REST.
|
|
48
|
+
* @param address The Bitcoin address.
|
|
49
|
+
*/
|
|
50
|
+
getUtxos(address: string): Promise<import("@did-btcr2/bitcoin").AddressUtxo[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Get a block by hash or height via REST.
|
|
53
|
+
* @param params Block identifier — at least one of `hash` or `height` is required.
|
|
54
|
+
*/
|
|
55
|
+
getBlock(params: {
|
|
56
|
+
hash?: string;
|
|
57
|
+
height?: number;
|
|
58
|
+
}): Promise<import("@did-btcr2/bitcoin").EsploraBlock | undefined>;
|
|
59
|
+
/** Convert BTC to satoshis (integer-safe string-split arithmetic). */
|
|
60
|
+
static btcToSats(btc: number): number;
|
|
61
|
+
/** Convert satoshis to BTC (integer-safe string-split arithmetic). */
|
|
62
|
+
static satsToBtc(sats: number): number;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=bitcoin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoin.d.ts","sourceRoot":"","sources":["../../src/bitcoin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;;;GAQG;AACH,qBAAa,UAAU;IACrB,gEAAgE;IAChE,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IAEvC,0CAA0C;IAC1C,IAAI,IAAI,IAAI,iBAAiB,CAE5B;IAED;;;OAGG;IACH,IAAI,GAAG,IAAI,oBAAoB,GAAG,SAAS,CAE1C;IAED,2DAA2D;IAC3D,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;;OAGG;IACH,UAAU,IAAI,oBAAoB;IAWlC;;;;OAIG;gBACS,GAAG,EAAE,gBAAgB;IAoBjC;;;;OAIG;IACG,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAK/D;;;OAGG;IACG,IAAI,CAAC,QAAQ,EAAE,MAAM;IAK3B;;;OAGG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM;IAK9B;;;OAGG;IACG,QAAQ,CAAC,MAAM,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAOzD,sEAAsE;IACtE,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAIrC,sEAAsE;IACtE,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGvC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Helia } from 'helia';
|
|
2
|
+
/**
|
|
3
|
+
* Executor interface for content-addressed storage.
|
|
4
|
+
*
|
|
5
|
+
* Implementations handle the actual I/O (IPFS, HTTP gateway, local store, etc.).
|
|
6
|
+
* All hashes are base64url-encoded SHA-256 digests (no padding).
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export interface CasExecutor {
|
|
10
|
+
/** Retrieve raw bytes by base64url SHA-256 hash. Returns null if not found. */
|
|
11
|
+
retrieve(hash: string): Promise<Uint8Array | null>;
|
|
12
|
+
/** Publish raw bytes and return the base64url SHA-256 hash. */
|
|
13
|
+
publish(data: Uint8Array): Promise<string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Default {@link CasExecutor} backed by IPFS via Helia.
|
|
17
|
+
*
|
|
18
|
+
* Stores/retrieves data as raw blocks (`0x55` codec) with SHA-256 hashing.
|
|
19
|
+
* The CID is deterministically derived from the content hash, so lookups
|
|
20
|
+
* by base64url SHA-256 hash translate directly to CID lookups.
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare class IpfsCasExecutor implements CasExecutor {
|
|
24
|
+
#private;
|
|
25
|
+
constructor(helia: Helia);
|
|
26
|
+
retrieve(hash: string): Promise<Uint8Array | null>;
|
|
27
|
+
publish(data: Uint8Array): Promise<string>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Configuration for the CAS (Content-Addressed Storage) driver.
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export type CasConfig = {
|
|
34
|
+
/** Custom executor implementation (overrides the default IPFS executor). */
|
|
35
|
+
executor?: CasExecutor;
|
|
36
|
+
/** Pre-existing Helia instance for the default IPFS executor. */
|
|
37
|
+
helia?: Helia;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Content-Addressed Storage API sub-facade.
|
|
41
|
+
*
|
|
42
|
+
* Provides `publish` and `retrieve` for JSON objects using their
|
|
43
|
+
* JCS-canonicalized SHA-256 hash as the content address.
|
|
44
|
+
*
|
|
45
|
+
* By default uses IPFS (via Helia). Inject a custom {@link CasExecutor}
|
|
46
|
+
* to use a different CAS backend.
|
|
47
|
+
*
|
|
48
|
+
* Lazily initialized by {@link DidBtcr2Api} to avoid startup overhead
|
|
49
|
+
* when CAS features are not used.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export declare class CasApi {
|
|
53
|
+
#private;
|
|
54
|
+
constructor(config: CasConfig);
|
|
55
|
+
/**
|
|
56
|
+
* Retrieve a JSON object from the CAS by its base64url SHA-256 hash.
|
|
57
|
+
* @param hash Base64url-encoded SHA-256 hash of the JCS-canonicalized object.
|
|
58
|
+
* @returns The parsed JSON object, or `null` if not found.
|
|
59
|
+
*/
|
|
60
|
+
retrieve(hash: string): Promise<object | null>;
|
|
61
|
+
/**
|
|
62
|
+
* Publish a JSON object to the CAS.
|
|
63
|
+
* The object is JCS-canonicalized before storage; the returned hash
|
|
64
|
+
* matches what {@link canonicalHash} would produce.
|
|
65
|
+
* @param object The JSON object to publish.
|
|
66
|
+
* @returns The base64url-encoded SHA-256 hash (content address).
|
|
67
|
+
*/
|
|
68
|
+
publish(object: object): Promise<string>;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=cas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cas.d.ts","sourceRoot":"","sources":["../../src/cas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAOnC;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACnD,+DAA+D;IAC/D,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5C;AAED;;;;;;;GAOG;AACH,qBAAa,eAAgB,YAAW,WAAW;;gBAGrC,KAAK,EAAE,KAAK;IAIlB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAUlD,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;CAQjD;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,iEAAiE;IACjE,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,qBAAa,MAAM;;gBAGL,MAAM,EAAE,SAAS;IAa7B;;;;OAIG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAOpD;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAI/C"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import type { Bytes, Entropy, HexString, KeyBytes, SchnorrKeyPairObject, SignatureBytes } from '@did-btcr2/common';
|
|
2
|
+
import { BIP340Cryptosuite, BIP340DataIntegrityProof, BTCR2Update, DataIntegrityConfig, DataIntegrityProofObject, type FromPublicKey, type Multikey, SchnorrMultikey, SignedBTCR2Update, UnsignedBTCR2Update, VerificationResult } from '@did-btcr2/cryptosuite';
|
|
3
|
+
import { CompressedSecp256k1PublicKey, SchnorrKeyPair, Secp256k1SecretKey } from '@did-btcr2/keypair';
|
|
4
|
+
import { KeyIdentifier } from '@did-btcr2/kms';
|
|
5
|
+
import type { DidVerificationMethod } from '@web5/dids';
|
|
6
|
+
import { KeyManagerApi } from './kms.js';
|
|
7
|
+
/**
|
|
8
|
+
* Schnorr keypair operations.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare class KeyPairApi {
|
|
12
|
+
/**
|
|
13
|
+
* Generate a new Schnorr keypair.
|
|
14
|
+
* @returns The generated Schnorr keypair.
|
|
15
|
+
*/
|
|
16
|
+
generate(): SchnorrKeyPair;
|
|
17
|
+
/**
|
|
18
|
+
* Create a Schnorr keypair from secret key bytes or hex string.
|
|
19
|
+
* @param data The secret key bytes or hex string.
|
|
20
|
+
* @returns The created Schnorr keypair.
|
|
21
|
+
*/
|
|
22
|
+
fromSecret(data: KeyBytes | HexString): SchnorrKeyPair;
|
|
23
|
+
/** Create a secret key from entropy (bytes or bigint). */
|
|
24
|
+
secretKeyFrom(ent: Entropy): Secp256k1SecretKey;
|
|
25
|
+
/** Create a compressed public key from bytes. */
|
|
26
|
+
publicKeyFrom(byt: Bytes): CompressedSecp256k1PublicKey;
|
|
27
|
+
/** Deserialize a keypair from a JSON object. */
|
|
28
|
+
fromJSON(obj: SchnorrKeyPairObject): SchnorrKeyPair;
|
|
29
|
+
/** Serialize a keypair to a JSON object. */
|
|
30
|
+
toJSON(kp: SchnorrKeyPair): SchnorrKeyPairObject;
|
|
31
|
+
/** Compare two keypairs for equality. */
|
|
32
|
+
equals(kp1: SchnorrKeyPair, kp2: SchnorrKeyPair): boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Schnorr cryptosuite operations.
|
|
36
|
+
*
|
|
37
|
+
* Optionally stateful: call {@link use} to set a current cryptosuite, then
|
|
38
|
+
* call {@link createProof}, {@link verifyProof}, or {@link toDataIntegrityProof}
|
|
39
|
+
* without passing an explicit instance. Pass an explicit instance to any
|
|
40
|
+
* method to override the current one for that call.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
export declare class CryptosuiteApi {
|
|
44
|
+
#private;
|
|
45
|
+
/** The currently active cryptosuite, or `undefined` if none is set. */
|
|
46
|
+
get current(): BIP340Cryptosuite | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Set the current cryptosuite for subsequent operations.
|
|
49
|
+
* @param cs The cryptosuite to activate.
|
|
50
|
+
* @returns `this` for chaining.
|
|
51
|
+
*/
|
|
52
|
+
use(cs: BIP340Cryptosuite): this;
|
|
53
|
+
/** Clear the current cryptosuite. */
|
|
54
|
+
clear(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Create a new Schnorr cryptosuite from a multikey.
|
|
57
|
+
* @param multikey The Schnorr multikey to use.
|
|
58
|
+
* @returns The created Schnorr cryptosuite.
|
|
59
|
+
*/
|
|
60
|
+
create(multikey: SchnorrMultikey): BIP340Cryptosuite;
|
|
61
|
+
/**
|
|
62
|
+
* Convenience: resolve a key from the KMS and create a cryptosuite in one step.
|
|
63
|
+
* @param id The multikey ID (e.g. '#initialKey').
|
|
64
|
+
* @param controller The DID that controls this key.
|
|
65
|
+
* @param keyId The KMS key identifier to resolve.
|
|
66
|
+
* @param kms The KeyManagerApi instance holding the key.
|
|
67
|
+
* @returns The created Schnorr cryptosuite.
|
|
68
|
+
*/
|
|
69
|
+
createFromKms(id: string, controller: string, keyId: KeyIdentifier, kms: KeyManagerApi): BIP340Cryptosuite;
|
|
70
|
+
/**
|
|
71
|
+
* Convert a cryptosuite to a Data Integrity Proof instance.
|
|
72
|
+
* Uses the current cryptosuite when `cryptosuite` is omitted.
|
|
73
|
+
* @param cryptosuite Optional explicit cryptosuite to convert.
|
|
74
|
+
* @returns The Data Integrity Proof instance.
|
|
75
|
+
*/
|
|
76
|
+
toDataIntegrityProof(cryptosuite?: BIP340Cryptosuite): BIP340DataIntegrityProof;
|
|
77
|
+
/**
|
|
78
|
+
* Create a proof for a document.
|
|
79
|
+
* Uses the current cryptosuite when `cryptosuite` is omitted.
|
|
80
|
+
* @param document The document to create the proof for.
|
|
81
|
+
* @param config Configuration for the proof creation.
|
|
82
|
+
* @param cryptosuite Optional explicit cryptosuite; defaults to current.
|
|
83
|
+
* @returns The created proof.
|
|
84
|
+
*/
|
|
85
|
+
createProof(document: BTCR2Update, config: DataIntegrityConfig, cryptosuite?: BIP340Cryptosuite): DataIntegrityProofObject;
|
|
86
|
+
/**
|
|
87
|
+
* Verify a proof for a document.
|
|
88
|
+
* Uses the current cryptosuite when `cryptosuite` is omitted.
|
|
89
|
+
* @param document The document to verify the proof for.
|
|
90
|
+
* @param cryptosuite Optional explicit cryptosuite; defaults to current.
|
|
91
|
+
* @returns The full verification result.
|
|
92
|
+
*/
|
|
93
|
+
verifyProof(document: SignedBTCR2Update, cryptosuite?: BIP340Cryptosuite): VerificationResult;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Data Integrity Proof operations.
|
|
97
|
+
*
|
|
98
|
+
* Optionally stateful: call {@link use} to set a current proof instance, then
|
|
99
|
+
* call {@link addProof} or {@link verifyProof} without passing an explicit
|
|
100
|
+
* instance. Pass an explicit instance to override for that call.
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
export declare class DataIntegrityProofApi {
|
|
104
|
+
#private;
|
|
105
|
+
/** The currently active proof instance, or `undefined` if none is set. */
|
|
106
|
+
get current(): BIP340DataIntegrityProof | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Set the current proof instance for subsequent operations.
|
|
109
|
+
* @param p The proof instance to activate.
|
|
110
|
+
* @returns `this` for chaining.
|
|
111
|
+
*/
|
|
112
|
+
use(p: BIP340DataIntegrityProof): this;
|
|
113
|
+
/** Clear the current proof instance. */
|
|
114
|
+
clear(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Create a BIP340DataIntegrityProof instance with the given cryptosuite.
|
|
117
|
+
* @param cryptosuite The cryptosuite to use for proof operations.
|
|
118
|
+
* @returns The created BIP340DataIntegrityProof instance.
|
|
119
|
+
*/
|
|
120
|
+
create(cryptosuite: BIP340Cryptosuite): BIP340DataIntegrityProof;
|
|
121
|
+
/**
|
|
122
|
+
* Add a proof to a document.
|
|
123
|
+
* Uses the current proof instance when `proof` is omitted.
|
|
124
|
+
* @param document The document to add the proof to.
|
|
125
|
+
* @param config Configuration for adding the proof.
|
|
126
|
+
* @param proof Optional explicit proof instance; defaults to current.
|
|
127
|
+
* @returns A document with a proof added.
|
|
128
|
+
*/
|
|
129
|
+
addProof(document: UnsignedBTCR2Update, config: DataIntegrityConfig, proof?: BIP340DataIntegrityProof): SignedBTCR2Update;
|
|
130
|
+
/**
|
|
131
|
+
* Convenience: create a cryptosuite, proof instance, and sign a document
|
|
132
|
+
* in one call. Requires a multikey with signing capability.
|
|
133
|
+
* @param multikey The Schnorr multikey (must include secret key).
|
|
134
|
+
* @param document The unsigned document to sign.
|
|
135
|
+
* @param config The Data Integrity proof configuration.
|
|
136
|
+
* @returns The signed document with proof attached.
|
|
137
|
+
*/
|
|
138
|
+
signDocument(multikey: SchnorrMultikey, document: UnsignedBTCR2Update, config: DataIntegrityConfig): SignedBTCR2Update;
|
|
139
|
+
/**
|
|
140
|
+
* Verify a proof using a BIP340DataIntegrityProof instance.
|
|
141
|
+
* Uses the current proof instance when `proof` is omitted.
|
|
142
|
+
* @param document The document to verify the proof for.
|
|
143
|
+
* @param expectedPurpose The expected proof purpose.
|
|
144
|
+
* @param mediaType The media type of the document.
|
|
145
|
+
* @param expectedDomain The expected domain for the proof.
|
|
146
|
+
* @param expectedChallenge The expected challenge for the proof.
|
|
147
|
+
* @param proof Optional explicit proof instance; defaults to current.
|
|
148
|
+
* @returns The result of verifying the proof.
|
|
149
|
+
*/
|
|
150
|
+
verifyProof(document: string, expectedPurpose: string, mediaType?: string, expectedDomain?: string, expectedChallenge?: string, proof?: BIP340DataIntegrityProof): VerificationResult;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Schnorr multikey operations.
|
|
154
|
+
*
|
|
155
|
+
* Optionally stateful: call {@link use} to set a current multikey, then
|
|
156
|
+
* call {@link sign}, {@link verify}, or {@link toVerificationMethod} without
|
|
157
|
+
* passing an explicit instance. Pass an explicit instance to any method to
|
|
158
|
+
* override the current one for that call.
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
export declare class MultikeyApi {
|
|
162
|
+
#private;
|
|
163
|
+
/** The currently active multikey, or `undefined` if none is set. */
|
|
164
|
+
get current(): SchnorrMultikey | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Set the current multikey for subsequent operations.
|
|
167
|
+
* @param mk The multikey to activate.
|
|
168
|
+
* @returns `this` for chaining.
|
|
169
|
+
*/
|
|
170
|
+
use(mk: SchnorrMultikey): this;
|
|
171
|
+
/** Clear the current multikey. */
|
|
172
|
+
clear(): void;
|
|
173
|
+
/**
|
|
174
|
+
* Create a new Schnorr multikey from a keypair.
|
|
175
|
+
* @param id The multikey ID.
|
|
176
|
+
* @param controller The multikey controller.
|
|
177
|
+
* @param keyPair The Schnorr keypair to use.
|
|
178
|
+
* @returns The created Schnorr multikey.
|
|
179
|
+
*/
|
|
180
|
+
create(id: string, controller: string, keyPair: SchnorrKeyPair): SchnorrMultikey;
|
|
181
|
+
/**
|
|
182
|
+
* Create a Schnorr multikey from raw secret key bytes.
|
|
183
|
+
* @param id The multikey ID.
|
|
184
|
+
* @param controller The multikey controller.
|
|
185
|
+
* @param secretKeyBytes The secret key bytes.
|
|
186
|
+
* @returns The created Schnorr multikey.
|
|
187
|
+
*/
|
|
188
|
+
fromSecretKey(id: string, controller: string, secretKeyBytes: Bytes): SchnorrMultikey;
|
|
189
|
+
/**
|
|
190
|
+
* Create a verification-only multikey from public key bytes.
|
|
191
|
+
* @param params The id, controller, and publicKeyBytes.
|
|
192
|
+
* @returns The created Multikey.
|
|
193
|
+
*/
|
|
194
|
+
fromPublicKey(params: FromPublicKey): Multikey;
|
|
195
|
+
/**
|
|
196
|
+
* Convenience: resolve a key from the KMS and create a multikey in one step.
|
|
197
|
+
* @param id The multikey ID.
|
|
198
|
+
* @param controller The multikey controller DID.
|
|
199
|
+
* @param keyId The KMS key identifier to resolve.
|
|
200
|
+
* @param kms The KeyManagerApi instance holding the key.
|
|
201
|
+
* @returns The created Multikey (verification-only; public key from KMS).
|
|
202
|
+
*/
|
|
203
|
+
fromKms(id: string, controller: string, keyId: KeyIdentifier, kms: KeyManagerApi): Multikey;
|
|
204
|
+
/**
|
|
205
|
+
* Reconstruct a multikey from a DID document's verification method.
|
|
206
|
+
* @param verificationMethod The verification method to convert.
|
|
207
|
+
* @returns The reconstructed multikey.
|
|
208
|
+
*/
|
|
209
|
+
fromVerificationMethod(verificationMethod: DidVerificationMethod): SchnorrMultikey;
|
|
210
|
+
/**
|
|
211
|
+
* Produce a DID Verification Method JSON from a multikey.
|
|
212
|
+
* Uses the current multikey when `mk` is omitted.
|
|
213
|
+
* @param mk Optional explicit multikey; defaults to current.
|
|
214
|
+
*/
|
|
215
|
+
toVerificationMethod(mk?: SchnorrMultikey): DidVerificationMethod;
|
|
216
|
+
/**
|
|
217
|
+
* Sign bytes via the multikey (requires secret).
|
|
218
|
+
* Uses the current multikey when `mk` is omitted.
|
|
219
|
+
* @param data The data to sign.
|
|
220
|
+
* @param mk Optional explicit multikey; defaults to current.
|
|
221
|
+
*/
|
|
222
|
+
sign(data: Bytes, mk?: SchnorrMultikey): SignatureBytes;
|
|
223
|
+
/**
|
|
224
|
+
* Verify signature via multikey.
|
|
225
|
+
* Uses the current multikey when `mk` is omitted.
|
|
226
|
+
* @param data The data that was signed.
|
|
227
|
+
* @param signature The signature to verify.
|
|
228
|
+
* @param mk Optional explicit multikey; defaults to current.
|
|
229
|
+
*/
|
|
230
|
+
verify(data: Bytes, signature: SignatureBytes, mk?: SchnorrMultikey): boolean;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Aggregated cryptographic operations sub-facade.
|
|
234
|
+
*
|
|
235
|
+
* Provides direct access to the four sub-facades ({@link keypair},
|
|
236
|
+
* {@link multikey}, {@link cryptosuite}, {@link proof}) plus top-level
|
|
237
|
+
* convenience methods that orchestrate the full signing/verification
|
|
238
|
+
* pipeline using their stateful defaults.
|
|
239
|
+
*
|
|
240
|
+
* @example Stateful pipeline
|
|
241
|
+
* ```ts
|
|
242
|
+
* const api = createApi();
|
|
243
|
+
* const kp = api.crypto.keypair.generate();
|
|
244
|
+
* const mk = api.crypto.multikey.create('#key-1', 'did:btcr2:test', kp);
|
|
245
|
+
*
|
|
246
|
+
* // Set the active multikey — flows through to cryptosuite and proof
|
|
247
|
+
* api.crypto.activate(mk);
|
|
248
|
+
*
|
|
249
|
+
* // Now sign without threading instances
|
|
250
|
+
* const signed = api.crypto.signDocument(unsignedDoc, proofConfig);
|
|
251
|
+
* ```
|
|
252
|
+
* @public
|
|
253
|
+
*/
|
|
254
|
+
export declare class CryptoApi {
|
|
255
|
+
/** Schnorr keypair operations. */
|
|
256
|
+
readonly keypair: KeyPairApi;
|
|
257
|
+
/** Schnorr Multikey operations (optionally stateful). */
|
|
258
|
+
readonly multikey: MultikeyApi;
|
|
259
|
+
/** Schnorr Cryptosuite operations (optionally stateful). */
|
|
260
|
+
readonly cryptosuite: CryptosuiteApi;
|
|
261
|
+
/** Data Integrity Proof operations (optionally stateful). */
|
|
262
|
+
readonly proof: DataIntegrityProofApi;
|
|
263
|
+
/**
|
|
264
|
+
* Activate a multikey and propagate through the full pipeline.
|
|
265
|
+
* Sets the current multikey, creates a cryptosuite from it, and creates
|
|
266
|
+
* a proof instance from the cryptosuite — all three sub-facades become
|
|
267
|
+
* ready for stateful operations.
|
|
268
|
+
* @param mk The multikey to activate (must include a secret key for signing).
|
|
269
|
+
* @returns `this` for chaining.
|
|
270
|
+
*/
|
|
271
|
+
activate(mk: SchnorrMultikey): this;
|
|
272
|
+
/**
|
|
273
|
+
* Clear stateful defaults from all sub-facades.
|
|
274
|
+
*/
|
|
275
|
+
deactivate(): void;
|
|
276
|
+
/**
|
|
277
|
+
* Sign data using the current multikey.
|
|
278
|
+
* Shorthand for `crypto.multikey.sign(data)`.
|
|
279
|
+
* @param data The data to sign.
|
|
280
|
+
* @returns The signature bytes.
|
|
281
|
+
*/
|
|
282
|
+
sign(data: Bytes): SignatureBytes;
|
|
283
|
+
/**
|
|
284
|
+
* Verify a signature using the current multikey.
|
|
285
|
+
* Shorthand for `crypto.multikey.verify(data, signature)`.
|
|
286
|
+
* @param data The data that was signed.
|
|
287
|
+
* @param signature The signature to verify.
|
|
288
|
+
* @returns `true` if the signature is valid.
|
|
289
|
+
*/
|
|
290
|
+
verify(data: Bytes, signature: SignatureBytes): boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Sign a BTCR2 update document using the current proof instance.
|
|
293
|
+
* Shorthand for `crypto.proof.addProof(document, config)`.
|
|
294
|
+
*
|
|
295
|
+
* Requires {@link activate} to have been called first, or the three
|
|
296
|
+
* sub-facades to have been configured individually.
|
|
297
|
+
* @param document The unsigned BTCR2 update document.
|
|
298
|
+
* @param config The Data Integrity proof configuration.
|
|
299
|
+
* @returns The signed document with proof attached.
|
|
300
|
+
*/
|
|
301
|
+
signDocument(document: UnsignedBTCR2Update, config: DataIntegrityConfig): SignedBTCR2Update;
|
|
302
|
+
/**
|
|
303
|
+
* Verify a signed BTCR2 update document using the current cryptosuite.
|
|
304
|
+
* Shorthand for `crypto.cryptosuite.verifyProof(document)`.
|
|
305
|
+
* @param document The signed document to verify.
|
|
306
|
+
* @returns The full verification result.
|
|
307
|
+
*/
|
|
308
|
+
verifyDocument(document: SignedBTCR2Update): VerificationResult;
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM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,QAAQ,CAAC,KAAK,wBAA+B;IAE7C;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,EAAE,eAAe,GAAG,IAAI;IASnC;;OAEG;IACH,UAAU,IAAI,IAAI;IAMlB;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,KAAK,GAAG,cAAc;IAIjC;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,GAAG,OAAO;IAIvD;;;;;;;;;OASG;IACH,YAAY,CAAC,QAAQ,EAAE,mBAAmB,EAAE,MAAM,EAAE,mBAAmB,GAAG,iBAAiB;IAI3F;;;;;OAKG;IACH,cAAc,CAAC,QAAQ,EAAE,iBAAiB,GAAG,kBAAkB;CAGhE"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { NetworkName } from '@did-btcr2/bitcoin';
|
|
2
|
+
import type { DocumentBytes } from '@did-btcr2/common';
|
|
3
|
+
import type { SchnorrKeyPairObject } from '@did-btcr2/common';
|
|
4
|
+
import type { DidCreateOptions } from '@did-btcr2/method';
|
|
5
|
+
import { IdentifierComponents } from '@did-btcr2/method';
|
|
6
|
+
import { Did } from '@web5/dids';
|
|
7
|
+
/**
|
|
8
|
+
* DID identifier operations sub-facade (encode, decode, generate, parse).
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare class DidApi {
|
|
12
|
+
/**
|
|
13
|
+
* Encode a DID from genesis bytes and options.
|
|
14
|
+
* @param genesisBytes The genesis document bytes.
|
|
15
|
+
* @param options The creation options.
|
|
16
|
+
* @returns The encoded DID string.
|
|
17
|
+
*/
|
|
18
|
+
encode(genesisBytes: DocumentBytes, options: DidCreateOptions): string;
|
|
19
|
+
/**
|
|
20
|
+
* Decode a DID into its components.
|
|
21
|
+
* @param did The DID string to decode.
|
|
22
|
+
* @returns The decoded identifier components.
|
|
23
|
+
*/
|
|
24
|
+
decode(did: string): IdentifierComponents;
|
|
25
|
+
/**
|
|
26
|
+
* Generate a new DID along with its keypair.
|
|
27
|
+
*
|
|
28
|
+
* When no `network` is given, defaults to `'regtest'` (upstream default).
|
|
29
|
+
* Pass an explicit network to generate DIDs for other networks.
|
|
30
|
+
*
|
|
31
|
+
* @param network Optional network to generate the DID for.
|
|
32
|
+
* @returns The generated keypair and DID string.
|
|
33
|
+
*/
|
|
34
|
+
generate(network?: NetworkName): {
|
|
35
|
+
keyPair: SchnorrKeyPairObject;
|
|
36
|
+
did: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Check if a DID string is valid.
|
|
40
|
+
* @param did The DID string to validate.
|
|
41
|
+
* @returns `true` if valid, `false` otherwise.
|
|
42
|
+
*/
|
|
43
|
+
isValid(did: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Parse a DID string into a Did instance.
|
|
46
|
+
* @param did The DID string to parse.
|
|
47
|
+
* @returns The parsed Did instance, or `null` if parsing failed.
|
|
48
|
+
*/
|
|
49
|
+
parse(did: string): Did | null;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=did.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did.d.ts","sourceRoot":"","sources":["../../src/did.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAc,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAGjC;;;GAGG;AACH,qBAAa,MAAM;IACjB;;;;;OAKG;IACH,MAAM,CAAC,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM;IAKtE;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB;IAKzC;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG;QAAE,OAAO,EAAE,oBAAoB,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;IAU/E;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAK7B;;;;OAIG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI;CAI/B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Logger } from './types.js';
|
|
2
|
+
/** @internal */
|
|
3
|
+
export declare const NOOP_LOGGER: Logger;
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare function assertString(value: unknown, name: string): asserts value is string;
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare function assertBytes(value: unknown, name: string): asserts value is Uint8Array;
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare function assertCompressedPubkey(value: unknown, name: string): asserts value is Uint8Array;
|
|
10
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAIzC,gBAAgB;AAChB,eAAO,MAAM,WAAW,EAAE,MAKzB,CAAC;AAEF,gBAAgB;AAChB,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAIlF;AAED,gBAAgB;AAChB,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAIrF;AAED,gBAAgB;AAChB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAOhG"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
+
export { DidDocument, DidDocumentBuilder, Identifier } from '@did-btcr2/method';
|
|
2
|
+
export { IdentifierTypes } from '@did-btcr2/common';
|
|
3
|
+
export type { BlockV3, HttpExecutor, NetworkName, RawTransactionV2, RestConfig, RpcConfig } from '@did-btcr2/bitcoin';
|
|
4
|
+
export type { Bytes, CryptosuiteName, DocumentBytes, HashBytes, Hex, JSONObject, KeyBytes, PatchOperation, ProofBytes, SchnorrKeyPairObject, SignatureBytes } from '@did-btcr2/common';
|
|
5
|
+
export type { MultikeyObject } from '@did-btcr2/cryptosuite';
|
|
6
|
+
export type { DidResolutionResult, DidService, DidVerificationMethod } from '@web5/dids';
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './helpers.js';
|
|
9
|
+
export * from './bitcoin.js';
|
|
10
|
+
export * from './cas.js';
|
|
11
|
+
export * from './kms.js';
|
|
12
|
+
export * from './crypto.js';
|
|
13
|
+
export * from './did.js';
|
|
14
|
+
export * from './method.js';
|
|
1
15
|
export * from './api.js';
|
|
2
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EACV,OAAO,EACP,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,SAAS,EACV,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,KAAK,EACL,eAAe,EACf,aAAa,EACb,SAAS,EACT,GAAG,EACH,UAAU,EACV,QAAQ,EACR,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGzF,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Bytes, HashBytes, SignatureBytes } from '@did-btcr2/common';
|
|
2
|
+
import { SchnorrKeyPair } from '@did-btcr2/keypair';
|
|
3
|
+
import { type GenerateKeyOptions, type ImportKeyOptions, KeyIdentifier, KeyManager, type SignOptions } from '@did-btcr2/kms';
|
|
4
|
+
/**
|
|
5
|
+
* Key management operations sub-facade.
|
|
6
|
+
*
|
|
7
|
+
* Wraps a {@link KeyManager} interface. By default uses the built-in
|
|
8
|
+
* {@link Kms} implementation; a custom implementation can be injected
|
|
9
|
+
* via {@link ApiConfig}.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class KeyManagerApi {
|
|
13
|
+
/** The backing KeyManager instance. */
|
|
14
|
+
readonly kms: KeyManager;
|
|
15
|
+
/** Create a new KeyManagerApi, optionally backed by a custom KeyManager. */
|
|
16
|
+
constructor(kms?: KeyManager);
|
|
17
|
+
/** Generate a new key directly in the KMS. */
|
|
18
|
+
generateKey(options?: GenerateKeyOptions): KeyIdentifier;
|
|
19
|
+
/** Set the active key by its identifier. */
|
|
20
|
+
setActive(id: KeyIdentifier): void;
|
|
21
|
+
/** Get the public key bytes for a key identifier. */
|
|
22
|
+
getPublicKey(id?: KeyIdentifier): Bytes;
|
|
23
|
+
/** Import a Schnorr keypair into the KMS. */
|
|
24
|
+
import(kp: SchnorrKeyPair, options?: ImportKeyOptions): KeyIdentifier;
|
|
25
|
+
/**
|
|
26
|
+
* Export a Schnorr keypair from the KMS.
|
|
27
|
+
* Only supported when the backing KMS is the built-in {@link Kms} class.
|
|
28
|
+
* @throws {Error} If the backing KMS does not support key export.
|
|
29
|
+
*/
|
|
30
|
+
export(id: KeyIdentifier): SchnorrKeyPair;
|
|
31
|
+
/** List all managed key identifiers. */
|
|
32
|
+
listKeys(): KeyIdentifier[];
|
|
33
|
+
/** Remove a key from the KMS. */
|
|
34
|
+
removeKey(id: KeyIdentifier, options?: {
|
|
35
|
+
force?: boolean;
|
|
36
|
+
}): void;
|
|
37
|
+
/**
|
|
38
|
+
* Sign data via the KMS.
|
|
39
|
+
* @param data The data to sign (must be non-empty).
|
|
40
|
+
* @param id Optional key identifier; uses the active key if omitted.
|
|
41
|
+
* @param options Signing options (scheme defaults to 'schnorr').
|
|
42
|
+
*/
|
|
43
|
+
sign(data: Bytes, id?: KeyIdentifier, options?: SignOptions): SignatureBytes;
|
|
44
|
+
/** Verify a signature via the KMS. */
|
|
45
|
+
verify(signature: SignatureBytes, data: Bytes, id?: KeyIdentifier, options?: SignOptions): boolean;
|
|
46
|
+
/** Compute a SHA-256 digest. */
|
|
47
|
+
digest(data: Uint8Array): HashBytes;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=kms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kms.d.ts","sourceRoot":"","sources":["../../src/kms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,KAAK,kBAAkB,EACv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