Added license

This commit is contained in:
Dave
2014-12-21 00:13:27 +02:00
parent 335b20ac69
commit bce0155abe
31 changed files with 746 additions and 59 deletions

View File

@@ -1,3 +1,22 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* NoAction is an abstract class to allow for the inheritance of actions which
* users can queue before confirmation (user-to-user and user-to-server).
*/
package nodash.models;
import java.io.Serializable;

View File

@@ -1,3 +1,22 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* NoByteSet stores an AES key which has been RSA-4096 encrypted and a data
* stream which has been encrypted by this key.
*/
package nodash.models;
public final class NoByteSet {

View File

@@ -1,3 +1,26 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* NoInfluence is an abstract class allowing for the subclassing of user
* influences, generated by both actions and the server. Upon login, the user
* consumes NoByteSets (generated by .getByteSet()) into the primary NoInfluence,
* which is then applied to the user with .applyTo(NoUser).
*
* Examples include incoming messages, financial changes or charges or updates.
*/
package nodash.models;
import java.io.ByteArrayInputStream;

View File

@@ -12,7 +12,7 @@ import nodash.core.NoUtil;
import nodash.core.spheres.NoHashSphere;
import nodash.exceptions.NoByteSetBadDecryptionException;
import nodash.exceptions.NoDashFatalException;
import nodash.exceptions.NoDashSessionBadUUID;
import nodash.exceptions.NoDashSessionBadUUIDException;
import nodash.exceptions.NoSessionConfirmedException;
import nodash.exceptions.NoSessionExpiredException;
import nodash.exceptions.NoSessionNotAwaitingConfirmationException;
@@ -200,13 +200,13 @@ public final class NoSession implements Serializable {
}
}
public static UUID decryptUUID(byte[] data) throws NoDashSessionBadUUID {
public static UUID decryptUUID(byte[] data) throws NoDashSessionBadUUIDException {
try {
return UUID.fromString(new String(NoUtil.decrypt(data)));
} catch (IllegalBlockSizeException e) {
throw new NoDashSessionBadUUID();
throw new NoDashSessionBadUUIDException();
} catch (BadPaddingException e) {
throw new NoDashSessionBadUUID();
throw new NoDashSessionBadUUIDException();
}
}

View File

@@ -1,3 +1,23 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* NoUser allows the subclassing of custom user objects whilst keeping the
* core requirements of a NoUser: the public and private keys. It also supports
* the serialization, decryption and NoByteSet consumption.
*/
package nodash.models;
import java.io.ByteArrayInputStream;

View File

@@ -1,3 +1,27 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* NoErrorableAction is a subclassing of NoTargetedAction for user-server
* interactions that require an error to be returned if a
* NoCannotGetInfluenceException is thrown. The target is not a destination user,
* but is instead treated as the source.
*
* As with all sourced actions it is advised to avoid their use unless the logic
* demands it, as it establishes a connection between a server action and a user address.
*/
package nodash.models.noactiontypes;
import java.security.PublicKey;
@@ -10,8 +34,9 @@ import nodash.models.NoInfluence;
public abstract class NoErrorableAction extends NoTargetedAction {
private static final long serialVersionUID = -6077150774349400823L;
public NoErrorableAction(PublicKey target) {
super(target);
public NoErrorableAction(PublicKey source) {
// Note that
super(source);
}
public void execute() {

View File

@@ -1,3 +1,27 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* NoHandshakeAction is a subclass of the NoSourcedAction with logic to
* generate an applying influence as well as a returned influence, whilst
* also being capable of returned an error influence if the
* NoCannotGetInfluenceException is thrown.
*
* As with all two-way or sourced actions, their use should be sparing as
* it establishes a connection between two user addresses.
*/
package nodash.models.noactiontypes;
import java.security.PublicKey;

View File

@@ -1,3 +1,26 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* NoSourcedAction is a subclassing of NoTargetedAction which additionally
* has a source, allowing for errors to be returned if a NoCannotGetInfluenceException
* is thrown.
*
* It is not advised to make a habit of using these for all user-user interactions
* as they provide a clear link between two users.
*/
package nodash.models.noactiontypes;
import java.security.PublicKey;

View File

@@ -1,3 +1,22 @@
/*
* Copyright 2014 David Horscroft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* NoTargetedAction is an abstract subclassing of NoAction aimed at providing the
* basis for an action that has a user target in mind.
*/
package nodash.models.noactiontypes;
import java.security.PublicKey;