Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encrypt method signature does not match documentation #32

Open
lekoala opened this issue Sep 28, 2020 · 2 comments
Open

encrypt method signature does not match documentation #32

lekoala opened this issue Sep 28, 2020 · 2 comments

Comments

@lekoala
Copy link

lekoala commented Sep 28, 2020

in the documentation i have the following snippet

$cipherText = $pure->encrypt($userId, $dataId, $plainText)

as seen in https://developer.virgilsecurity.com/docs/purekit/data-encryption/per-user-encryption/

however the method in the current release is

 public function encrypt(string $userId, string $dataId, array $otherUserIds, array $roleNames,
                            VirgilPublicKeyCollection $publicKeys, string $plainText): string

i can pass empty arrays to otherUserIds and roleNames but i'm not sure how to properly initialize the publicKeys variable. We already specify the userId, aren't the public keys already known to virgil at that point for a given userid?

@PetrenkoAnton
Copy link
Contributor

@lekoala

Sorry for delay!

How to properly initialize the publicKeys variable:

$publicKeys = new VirgilPublicKeyCollection();
$cipherText = $pure->encrypt($userId, $dataId, [], [], $publicKeys, $plainText);

Feel free to contact me if you have any problems

@lekoala
Copy link
Author

lekoala commented Oct 5, 2020

@PetrenkoAnton i will try ! i think it would be wortwhile to have some kind of easier method that doesn't require passing empty objects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants