feat: NIP-24
This commit is contained in:
@ -19,6 +19,7 @@ export * from "./event-builder";
|
||||
export * from "./nostr-link";
|
||||
export * from "./profile-cache";
|
||||
export * from "./zaps";
|
||||
export * from "./signer";
|
||||
|
||||
export * from "./impl/nip4";
|
||||
export * from "./impl/nip44";
|
||||
@ -52,8 +53,19 @@ export interface SystemSnapshot {
|
||||
}>;
|
||||
}
|
||||
|
||||
export const enum MessageEncryptorVersion {
|
||||
Nip4 = 0,
|
||||
XChaCha20 = 1,
|
||||
}
|
||||
|
||||
export interface MessageEncryptorPayload {
|
||||
ciphertext: Uint8Array,
|
||||
nonce: Uint8Array,
|
||||
v: MessageEncryptorVersion
|
||||
}
|
||||
|
||||
export interface MessageEncryptor {
|
||||
getSharedSecret(privateKey: string, publicKey: string): Promise<Uint8Array> | Uint8Array;
|
||||
encryptData(plaintext: string, sharedSecet: Uint8Array): Promise<string> | string;
|
||||
decryptData(cyphertext: string, sharedSecet: Uint8Array): Promise<string> | string;
|
||||
encryptData(plaintext: string, sharedSecet: Uint8Array): Promise<MessageEncryptorPayload> | MessageEncryptorPayload;
|
||||
decryptData(payload: MessageEncryptorPayload, sharedSecet: Uint8Array): Promise<string> | string;
|
||||
}
|
||||
|
Reference in New Issue
Block a user