Skip to content

Commit

Permalink
CU-86a0gevc3 - Change WalletConnectSDK to use neon-dappkit - added Pr…
Browse files Browse the repository at this point in the history
…omise to type return on methods encrypt, descrypt and decryptFromArray
  • Loading branch information
endkeyCoder committed Aug 28, 2023
1 parent cebbd59 commit 728fa54
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/neon-dappkit-types/src/Neo3Signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export interface EncryptedPayload {
ephemPublicKey: string
}

export interface DecryptFromArrayResult { message: string, keyIndex: number }

/**
* A simple interface that defines the Signing and Verifying methods
*/
Expand Down Expand Up @@ -77,20 +79,20 @@ export interface Neo3Signer {
* @param publicKeys a list of public keys to encrypt the message with
* @returns an array with the same lenght as the array of public keys, each element is an EncryptedPayload
*/
encrypt(message: string, publicKeys: string[]) : EncryptedPayload[]
encrypt(message: string, publicKeys: string[]) : Promise<EncryptedPayload[]>

/**
* Decrypts a message encrypted using the Elliptic Curve Integrated Encryption Scheme with the secp256r1 curve
* @param payload an object that was encrypted with the public key corresponding to the account
* @returns the decrypted message
*/
decrypt(payload: EncryptedPayload) : string
decrypt(payload: EncryptedPayload) : Promise<string>

/**
* Tries to find the first payload that can be decrypted from an array of objects that were encrypted using the Elliptic Curve Integrated Encryption Scheme with the secp256r1 curve
* @param payloads an array of objects that were encrypted with the public keys
* @returns an object with the decrypted message of the first payload that could be decrypted and the index indicating which encrypted message from the array was decrypt
* @throws an error if none of the public keys used to encrypt correspond to the account
*/
decryptFromArray(payloads: EncryptedPayload[]) : { message: string, keyIndex: number }
decryptFromArray(payloads: EncryptedPayload[]) : Promise<DecryptFromArrayResult>
}

0 comments on commit 728fa54

Please sign in to comment.