@@ -24,13 +24,6 @@ a copy of this software and associated documentation files (the "Software"),
2424
2525package com .pusher .client .crypto .nacl ;
2626
27- import com .goterl .lazycode .lazysodium .LazySodiumJava ;
28- import com .goterl .lazycode .lazysodium .SodiumJava ;
29- import com .goterl .lazycode .lazysodium .exceptions .SodiumException ;
30- import com .goterl .lazycode .lazysodium .interfaces .Helpers ;
31- import com .goterl .lazycode .lazysodium .interfaces .SecretBox ;
32- import com .goterl .lazycode .lazysodium .utils .Key ;
33-
3427import static com .pusher .client .util .internal .Preconditions .checkArgument ;
3528import static com .pusher .client .util .internal .Preconditions .checkNotNull ;
3629import static java .util .Arrays .fill ;
@@ -52,14 +45,11 @@ public String open(byte[] cypher, byte[] nonce) throws AuthenticityException {
5245 checkNotNull (key , "key has been cleared, create new instance" );
5346 checkArgument (nonce .length == 24 , "nonce length must be 24 bytes, but is " +
5447 key .length + " bytes" );
55-
56-
57- SecretBox .Lazy secretBoxLazy = (SecretBox .Lazy ) Sodium .getInstance ();
58-
5948 try {
60- return secretBoxLazy .cryptoSecretBoxOpenEasy (
61- Sodium .getInstance ().sodiumBin2Hex (cypher ), nonce , Key .fromBytes (key ));
62- } catch (SodiumException e ) {
49+ TweetNaclFast .SecretBox secretBox = new TweetNaclFast .SecretBox (key );
50+ byte [] result = secretBox .open (cypher , nonce );
51+ return new String (result );
52+ } catch (Exception e ) {
6353 throw new AuthenticityException ();
6454 }
6555 }
0 commit comments