@smartledger/bsv 7.5.0 → 7.5.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 +72 -0
- package/README.md +38 -38
- package/bsv-gdaf.min.js +33 -33
- package/bsv-ltp.min.js +33 -33
- package/bsv-smartcontract.min.js +1 -1
- package/bsv.bundle.js +33 -33
- package/bsv.d.ts +45 -11
- package/bsv.min.js +33 -33
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/getting-started/INSTALLATION.md +23 -23
- package/docs/getting-started/QUICK_START.md +7 -7
- package/docs/migration/FROM_BSV_1_5_6.md +5 -5
- package/lib/gdaf/index.js +29 -6
- package/lib/gdaf/smartledger-anchor.js +31 -1
- package/lib/privatekey.js +59 -10
- package/package.json +1 -1
- package/test/gdaf/anchor_no_key_leak.js +88 -0
- package/test/privatekey.js +79 -2
- package/version.js +1 -1
package/bsv.d.ts
CHANGED
|
@@ -176,19 +176,30 @@ declare module '@smartledger/bsv' {
|
|
|
176
176
|
toAddress(): Address;
|
|
177
177
|
toPublicKey(): PublicKey;
|
|
178
178
|
toString(): string;
|
|
179
|
-
|
|
180
|
-
|
|
179
|
+
/** Deliberate export, INCLUDING the secret scalar. Round-trips with fromObject(). */
|
|
180
|
+
toObject(): { bn: string; compressed: boolean; network: string };
|
|
181
|
+
/**
|
|
182
|
+
* What JSON.stringify() calls — the scalar is REDACTED. Use toObject() or toWIF()
|
|
183
|
+
* when you actually intend to export the secret.
|
|
184
|
+
*/
|
|
185
|
+
toJSON(): { bn: '[REDACTED]'; compressed: boolean; network: string };
|
|
181
186
|
toWIF(): string;
|
|
182
187
|
toHex(): string;
|
|
183
188
|
toBigNumber(): any; //BN;
|
|
184
189
|
toBuffer(): Buffer;
|
|
185
190
|
inspect(): string;
|
|
186
191
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
static
|
|
192
|
+
/**
|
|
193
|
+
* From a WIF string, or a hex-encoded scalar. `network` is honoured; for a WIF,
|
|
194
|
+
* which encodes its own network, a conflicting value throws.
|
|
195
|
+
*/
|
|
196
|
+
static fromString(str: string, network?: string | Networks.Network): PrivateKey;
|
|
197
|
+
static fromWIF(str: string, network?: string | Networks.Network): PrivateKey;
|
|
198
|
+
static fromRandom(network?: string): PrivateKey;
|
|
199
|
+
/** `compressed` defaults to true, matching every other constructor path. */
|
|
200
|
+
static fromBuffer(buf: Buffer, network?: string | Networks.Network, compressed?: boolean): PrivateKey;
|
|
201
|
+
/** `compressed` defaults to true, matching every other constructor path. */
|
|
202
|
+
static fromHex(hex: string, network?: string | Networks.Network, compressed?: boolean): PrivateKey;
|
|
192
203
|
static getValidationError(data: string): any | null;
|
|
193
204
|
static isValid(data: string): boolean;
|
|
194
205
|
}
|
|
@@ -712,6 +723,24 @@ declare module '@smartledger/bsv' {
|
|
|
712
723
|
|
|
713
724
|
// -------- GDAF (Global Digital Attestation Framework) ---------------
|
|
714
725
|
|
|
726
|
+
/** A spendable output supplied to the anchoring helpers. */
|
|
727
|
+
export interface Utxo {
|
|
728
|
+
txId: string;
|
|
729
|
+
outputIndex: number;
|
|
730
|
+
script: string;
|
|
731
|
+
satoshis: number;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
export interface AnchorOptions {
|
|
735
|
+
/** UTXOs funding the anchor transaction. */
|
|
736
|
+
utxos?: Utxo[];
|
|
737
|
+
/**
|
|
738
|
+
* Serialised into the OP_RETURN: PUBLIC AND PERMANENT. Anchoring a PrivateKey, or
|
|
739
|
+
* any key-shaped field (`bn`, `wif`, `privateJwk`, `seed`, `xprv`, ...), throws.
|
|
740
|
+
*/
|
|
741
|
+
metadata?: object;
|
|
742
|
+
}
|
|
743
|
+
|
|
715
744
|
export class GDAF {
|
|
716
745
|
constructor(options?: {
|
|
717
746
|
attestationSigner?: object;
|
|
@@ -747,10 +776,15 @@ declare module '@smartledger/bsv' {
|
|
|
747
776
|
verifyMembershipProof(proof: object, validSet: string[]): boolean;
|
|
748
777
|
|
|
749
778
|
// Anchoring
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
779
|
+
/**
|
|
780
|
+
* Anchor options. `metadata` is JSON-serialised into the OP_RETURN and is therefore
|
|
781
|
+
* PUBLIC AND PERMANENT — anchoring anything key-shaped throws. A bare UTXO array is
|
|
782
|
+
* also accepted in place of this object.
|
|
783
|
+
*/
|
|
784
|
+
anchorCredential(credentialHash: string | Buffer, privateKey: PrivateKey, options?: AnchorOptions | Utxo[]): Promise<object>;
|
|
785
|
+
anchorBatch(credentialHashes: Array<string | Buffer>, privateKey: PrivateKey, options?: AnchorOptions | Utxo[]): Promise<object>;
|
|
786
|
+
registerDID(did: string, didDocument: object, privateKey: PrivateKey, options?: AnchorOptions | Utxo[]): Promise<object>;
|
|
787
|
+
revokeCredential(credentialId: string, reason: string, privateKey: PrivateKey, options?: AnchorOptions | Utxo[]): Promise<object>;
|
|
754
788
|
queryAnchoredData(hash: string): object;
|
|
755
789
|
|
|
756
790
|
// Schemas
|