@bsv/overlay-discovery-services 2.0.1 → 2.0.2
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/cjs/package.json +4 -4
- package/dist/cjs/src/LegacyNinjaAdvertiser.js +235 -0
- package/dist/cjs/src/LegacyNinjaAdvertiser.js.map +1 -0
- package/dist/cjs/src/utils/generateDocs.js +81 -0
- package/dist/cjs/src/utils/generateDocs.js.map +1 -0
- package/dist/cjs/src/utils/getDocumentation.js +22 -0
- package/dist/cjs/src/utils/getDocumentation.js.map +1 -0
- package/dist/cjs/src/utils/isValidDomain.js +15 -0
- package/dist/cjs/src/utils/isValidDomain.js.map +1 -0
- package/dist/cjs/src/utils/isValidServiceName.js +14 -0
- package/dist/cjs/src/utils/isValidServiceName.js.map +1 -0
- package/dist/cjs/src/utils/verifyToken.js +22 -0
- package/dist/cjs/src/utils/verifyToken.js.map +1 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/LegacyNinjaAdvertiser.js +233 -0
- package/dist/esm/src/LegacyNinjaAdvertiser.js.map +1 -0
- package/dist/esm/src/utils/generateDocs.js +46 -0
- package/dist/esm/src/utils/generateDocs.js.map +1 -0
- package/dist/esm/src/utils/getDocumentation.js +20 -0
- package/dist/esm/src/utils/getDocumentation.js.map +1 -0
- package/dist/esm/src/utils/isValidDomain.js +11 -0
- package/dist/esm/src/utils/isValidDomain.js.map +1 -0
- package/dist/esm/src/utils/isValidServiceName.js +10 -0
- package/dist/esm/src/utils/isValidServiceName.js.map +1 -0
- package/dist/esm/src/utils/verifyToken.js +18 -0
- package/dist/esm/src/utils/verifyToken.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/LegacyNinjaAdvertiser.d.ts +60 -0
- package/dist/types/src/LegacyNinjaAdvertiser.d.ts.map +1 -0
- package/dist/types/src/utils/generateDocs.d.ts +2 -0
- package/dist/types/src/utils/generateDocs.d.ts.map +1 -0
- package/dist/types/src/utils/getDocumentation.d.ts +8 -0
- package/dist/types/src/utils/getDocumentation.d.ts.map +1 -0
- package/dist/types/src/utils/isValidDomain.d.ts +7 -0
- package/dist/types/src/utils/isValidDomain.d.ts.map +1 -0
- package/dist/types/src/utils/isValidServiceName.d.ts +7 -0
- package/dist/types/src/utils/isValidServiceName.d.ts.map +1 -0
- package/dist/types/src/utils/verifyToken.d.ts +12 -0
- package/dist/types/src/utils/verifyToken.d.ts.map +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TaggedBEEF } from '@bsv/overlay';
|
|
2
|
+
import { Script } from '@bsv/sdk';
|
|
3
|
+
import { AdvertisementData } from '@bsv/overlay';
|
|
4
|
+
import { Advertisement, Engine } from '@bsv/overlay';
|
|
5
|
+
/**
|
|
6
|
+
* Implements the Advertiser interface for managing SHIP and SLAP advertisements using a Ninja.
|
|
7
|
+
*/
|
|
8
|
+
export declare class LegacyNinjaAdvertiser {
|
|
9
|
+
privateKey: string;
|
|
10
|
+
dojoURL: string;
|
|
11
|
+
hostingDomain: string;
|
|
12
|
+
private readonly ninja;
|
|
13
|
+
private engine;
|
|
14
|
+
/**
|
|
15
|
+
* Constructs a new NinjaAdvertiser instance.
|
|
16
|
+
* @param privateKey - The private key used for signing transactions.
|
|
17
|
+
* @param dojoURL - The URL of the dojo server for the Ninja.
|
|
18
|
+
* @param hostingDomain - The base server URL for the NinjaAdvertiser.
|
|
19
|
+
*/
|
|
20
|
+
constructor(privateKey: string, dojoURL: string, hostingDomain: string);
|
|
21
|
+
/**
|
|
22
|
+
* Sets the Engine instance to be used by this NinjaAdvertiser. This method allows for late
|
|
23
|
+
* binding of the Engine, thus avoiding circular dependencies during instantiation. The Engine
|
|
24
|
+
* provides necessary context with the relevant topic managers and lookup services,
|
|
25
|
+
* as well as the lookup function used for querying advertisements.
|
|
26
|
+
*
|
|
27
|
+
* @param engine The Engine instance to be associated with this NinjaAdvertiser. The Engine should
|
|
28
|
+
* be fully initialized before being passed to this method to ensure all functionalities are available.
|
|
29
|
+
*/
|
|
30
|
+
setLookupEngine(engine: Engine): void;
|
|
31
|
+
/**
|
|
32
|
+
* Utility function to create multiple advertisements in a single transaction.
|
|
33
|
+
* @param privateKey The private key used to sign the transaction.
|
|
34
|
+
* @param adsData Array of advertisement details.
|
|
35
|
+
* @param ninja Ninja instance for transaction processing.
|
|
36
|
+
* @param note A note attached to the transaction.
|
|
37
|
+
* @returns A promise that resolves to an array of TaggedBEEF objects.
|
|
38
|
+
* @throws Will throw an error if the locking key is invalid.
|
|
39
|
+
*/
|
|
40
|
+
createAdvertisements(adsData: AdvertisementData[]): Promise<TaggedBEEF>;
|
|
41
|
+
/**
|
|
42
|
+
* Finds all SHIP advertisements for a given topic.
|
|
43
|
+
* @param topic - The topic name to search for.
|
|
44
|
+
* @returns A promise that resolves to an array of SHIP advertisements.
|
|
45
|
+
*/
|
|
46
|
+
findAllAdvertisements(protocol: 'SHIP' | 'SLAP'): Promise<Advertisement[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Revokes an existing advertisement.
|
|
49
|
+
* @param advertisements - The advertisements to revoke, either SHIP or SLAP.
|
|
50
|
+
* @returns A promise that resolves to the revoked advertisement as TaggedBEEF.
|
|
51
|
+
*/
|
|
52
|
+
revokeAdvertisements(advertisements: Advertisement[]): Promise<TaggedBEEF>;
|
|
53
|
+
/**
|
|
54
|
+
* Parses an advertisement from the provided output script.
|
|
55
|
+
* @param outputScript - The output script to parse.
|
|
56
|
+
* @returns An Advertisement object if the script matches the expected format, otherwise throws an error.
|
|
57
|
+
*/
|
|
58
|
+
parseAdvertisement(outputScript: Script): Advertisement;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=LegacyNinjaAdvertiser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LegacyNinjaAdvertiser.d.ts","sourceRoot":"","sources":["../../../src/LegacyNinjaAdvertiser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIzC,OAAO,EAAe,MAAM,EAAyB,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAOpD;;GAEG;AACH,qBAAa,qBAAqB;IAWvB,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,MAAM;IAZ9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;IAC7B,OAAO,CAAC,MAAM,CAAoB;IAElC;;;;;OAKG;gBAEM,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM;IAU9B;;;;;;;;OAQG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIrC;;;;;;;;OAQG;IACG,oBAAoB,CACxB,OAAO,EAAE,iBAAiB,EAAE,GAC3B,OAAO,CAAC,UAAU,CAAC;IA8CtB;;;;OAIG;IACG,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAiChF;;;;OAIG;IACG,oBAAoB,CAAC,cAAc,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;IAqEhF;;;;OAIG;IACH,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa;CAgCxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateDocs.d.ts","sourceRoot":"","sources":["../../../../src/utils/generateDocs.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns documentation specific to the provided filename
|
|
3
|
+
* @param {string} filePath - The path of the markdown file
|
|
4
|
+
* @returns A promise that resolves to the documentation string
|
|
5
|
+
*/
|
|
6
|
+
declare function getDocumentation(filePath: string): Promise<string>;
|
|
7
|
+
export { getDocumentation };
|
|
8
|
+
//# sourceMappingURL=getDocumentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDocumentation.d.ts","sourceRoot":"","sources":["../../../../src/utils/getDocumentation.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,iBAAe,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CASjE;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates if the provided domain name is valid.
|
|
3
|
+
* @param domain - The domain name to validate.
|
|
4
|
+
* @returns True if the domain name is valid, false otherwise.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isValidDomain: (domain: string) => boolean;
|
|
7
|
+
//# sourceMappingURL=isValidDomain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidDomain.d.ts","sourceRoot":"","sources":["../../../../src/utils/isValidDomain.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,aAAa,WAAY,MAAM,KAAG,OAI9C,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates if the provided service name is valid based on BRC-87 guidelines.
|
|
3
|
+
* @param service - The service name to validate.
|
|
4
|
+
* @returns True if the service name is valid, false otherwise.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isValidServiceName: (service: string) => boolean;
|
|
7
|
+
//# sourceMappingURL=isValidServiceName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidServiceName.d.ts","sourceRoot":"","sources":["../../../../src/utils/isValidServiceName.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,YAAa,MAAM,KAAG,OAGpD,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verifies the BRC-48 locking key and the signature.
|
|
3
|
+
* @private
|
|
4
|
+
* @param identityKey - The BRC-31 identity key of the advertiser.
|
|
5
|
+
* @param lockingPublicKey - The public key used in the output's locking script.
|
|
6
|
+
* @param fields - The fields of the token.
|
|
7
|
+
* @param signature - The signature over the token fields.
|
|
8
|
+
* @param protocolId - The protocol ID (e.g., 'SHIP' or 'SLAP').
|
|
9
|
+
* @throws Will throw an error if the locking key or signature is invalid.
|
|
10
|
+
*/
|
|
11
|
+
export declare const verifyToken: (identityKey: string, lockingPublicKey: string, fields: Buffer[], signature: string) => void;
|
|
12
|
+
//# sourceMappingURL=verifyToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyToken.d.ts","sourceRoot":"","sources":["../../../../src/utils/verifyToken.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,gBACT,MAAM,oBACD,MAAM,UAChB,MAAM,EAAE,aACL,MAAM,KAChB,IAQF,CAAA"}
|