nostr-double-ratchet 0.0.14 → 0.0.15
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/Session.d.ts +13 -6
- package/dist/Session.d.ts.map +1 -1
- package/dist/nostr-double-ratchet.es.js +575 -554
- package/dist/nostr-double-ratchet.umd.js +1 -1
- package/dist/types.d.ts +12 -16
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Session.ts +48 -11
- package/src/types.ts +14 -18
- package/src/utils.ts +8 -8
package/dist/Session.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VerifiedEvent } from "nostr-tools";
|
|
2
|
-
import { SessionState, Unsubscribe, NostrSubscribe,
|
|
1
|
+
import { VerifiedEvent, UnsignedEvent } from "nostr-tools";
|
|
2
|
+
import { SessionState, Unsubscribe, NostrSubscribe, EventCallback } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* Double ratchet secure communication session over Nostr
|
|
5
5
|
*
|
|
@@ -27,18 +27,25 @@ export declare class Session {
|
|
|
27
27
|
*/
|
|
28
28
|
static init(nostrSubscribe: NostrSubscribe, theirNextNostrPublicKey: string, ourCurrentPrivateKey: Uint8Array, isInitiator: boolean, sharedSecret: Uint8Array, name?: string): Session;
|
|
29
29
|
/**
|
|
30
|
-
* Sends
|
|
31
|
-
* @param
|
|
30
|
+
* Sends a text message through the encrypted session
|
|
31
|
+
* @param text The plaintext message to send
|
|
32
32
|
* @returns A verified Nostr event containing the encrypted message
|
|
33
33
|
* @throws Error if we are not the initiator and trying to send the first message
|
|
34
34
|
*/
|
|
35
|
-
send(
|
|
35
|
+
send(text: string): VerifiedEvent;
|
|
36
|
+
/**
|
|
37
|
+
* Send a Nostr event through the encrypted session
|
|
38
|
+
* @param event Partial Nostr event to send. Must be unsigned. Id and will be generated if not provided.
|
|
39
|
+
* @returns A verified Nostr event containing the encrypted message
|
|
40
|
+
* @throws Error if we are not the initiator and trying to send the first message
|
|
41
|
+
*/
|
|
42
|
+
sendEvent(event: Partial<UnsignedEvent>): VerifiedEvent;
|
|
36
43
|
/**
|
|
37
44
|
* Subscribes to incoming messages on this session
|
|
38
45
|
* @param callback Function to be called when a message is received
|
|
39
46
|
* @returns Unsubscribe function to stop receiving messages
|
|
40
47
|
*/
|
|
41
|
-
|
|
48
|
+
onEvent(callback: EventCallback): Unsubscribe;
|
|
42
49
|
/**
|
|
43
50
|
* Stop listening to incoming messages
|
|
44
51
|
*/
|
package/dist/Session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../src/Session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyD,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../src/Session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyD,aAAa,EAAE,aAAa,EAAgB,MAAM,aAAa,CAAC;AAEhI,OAAO,EACL,YAAY,EAEZ,WAAW,EACX,cAAc,EACd,aAAa,EAId,MAAM,SAAS,CAAC;AAQjB;;;;;GAKG;AACH,qBAAa,OAAO;IAQN,OAAO,CAAC,cAAc;IAAyB,KAAK,EAAE,YAAY;IAP9E,OAAO,CAAC,gBAAgB,CAAC,CAAc;IACvC,OAAO,CAAC,oBAAoB,CAAC,CAAc;IAC3C,OAAO,CAAC,qBAAqB,CAAoC;IACjE,OAAO,CAAC,6BAA6B,CAAK;IACnC,IAAI,EAAE,MAAM,CAAC;gBAGA,cAAc,EAAE,cAAc,EAAS,KAAK,EAAE,YAAY;IAI9E;;;;;;;;;OASG;IACH,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,EAAE,oBAAoB,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EA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