-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #951 from filipocelka/feature/BATM-6710-tr-features
BATM-6710 TR features
- Loading branch information
Showing
7 changed files
with
274 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...pi/src/main/java/com/generalbytes/batm/server/extensions/travelrule/CryptoWalletType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/************************************************************************************* | ||
* Copyright (C) 2014-2024 GENERAL BYTES s.r.o. All rights reserved. | ||
* | ||
* This software may be distributed and modified under the terms of the GNU | ||
* General Public License version 2 (GPL2) as published by the Free Software | ||
* Foundation and appearing in the file GPL2.TXT included in the packaging of | ||
* this file. Please note that GPL2 Section 2[b] requires that all works based | ||
* on this software must also be made publicly available under the terms of | ||
* the GPL2 ("Copyleft"). | ||
* | ||
* Contact information | ||
* ------------------- | ||
* | ||
* GENERAL BYTES s.r.o. | ||
* Web : http://www.generalbytes.com | ||
* | ||
************************************************************************************/ | ||
|
||
package com.generalbytes.batm.server.extensions.travelrule; | ||
|
||
/** | ||
* Represents the possible types of wallets. | ||
*/ | ||
public enum CryptoWalletType { | ||
/** | ||
* Owned and managed by a third party, such as a centralized exchange like Binance. | ||
* The third party controls the private keys, and the user interacts with their funds through the service provider. | ||
*/ | ||
CUSTODIAL, | ||
/** | ||
* Also known as a noncustodial wallet, where the user has full control over their private keys. | ||
* Examples include hardware wallets, software wallets, and paper wallets. The user is solely responsible | ||
* for securing their funds. | ||
*/ | ||
UNHOSTED, | ||
|
||
UNKNOWN | ||
} |
34 changes: 34 additions & 0 deletions
34
...src/main/java/com/generalbytes/batm/server/extensions/travelrule/ITravelRuleProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/************************************************************************************* | ||
* Copyright (C) 2014-2024 GENERAL BYTES s.r.o. All rights reserved. | ||
* | ||
* This software may be distributed and modified under the terms of the GNU | ||
* General Public License version 2 (GPL2) as published by the Free Software | ||
* Foundation and appearing in the file GPL2.TXT included in the packaging of | ||
* this file. Please note that GPL2 Section 2[b] requires that all works based | ||
* on this software must also be made publicly available under the terms of | ||
* the GPL2 ("Copyleft"). | ||
* | ||
* Contact information | ||
* ------------------- | ||
* | ||
* GENERAL BYTES s.r.o. | ||
* Web : http://www.generalbytes.com | ||
* | ||
************************************************************************************/ | ||
package com.generalbytes.batm.server.extensions.travelrule; | ||
|
||
/** | ||
* A Travel Rule Provider definition that makes it possible to connect to an external provider using its API. | ||
* Provider is responsible for implementing compliance checks and procedures necessary to ensure adherence to the Travel Rule regulations. | ||
*/ | ||
public interface ITravelRuleProvider { | ||
|
||
/** | ||
* This is used as the provider identifier that is displayed in CAS. | ||
* @return Name of Travel Rule Provider. | ||
*/ | ||
String getName(); | ||
|
||
// TODO: implement methods | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
..._api/src/main/java/com/generalbytes/batm/server/extensions/travelrule/IWalletContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/************************************************************************************* | ||
* Copyright (C) 2014-2024 GENERAL BYTES s.r.o. All rights reserved. | ||
* | ||
* This software may be distributed and modified under the terms of the GNU | ||
* General Public License version 2 (GPL2) as published by the Free Software | ||
* Foundation and appearing in the file GPL2.TXT included in the packaging of | ||
* this file. Please note that GPL2 Section 2[b] requires that all works based | ||
* on this software must also be made publicly available under the terms of | ||
* the GPL2 ("Copyleft"). | ||
* | ||
* Contact information | ||
* ------------------- | ||
* | ||
* GENERAL BYTES s.r.o. | ||
* Web : http://www.generalbytes.com | ||
* | ||
************************************************************************************/ | ||
|
||
package com.generalbytes.batm.server.extensions.travelrule; | ||
|
||
import com.generalbytes.batm.server.extensions.IIdentity; | ||
|
||
/** | ||
* This class holds basic information required to identify a wallet. | ||
*/ | ||
public interface IWalletContext { | ||
|
||
/** | ||
* Get the public id of the identity that the wallet belongs to (if any.) | ||
* | ||
* @return The identity public id or null. | ||
* @see IIdentity | ||
*/ | ||
String getIdentityPublicId(); | ||
|
||
/** | ||
* Get the external id of the identity that the wallet belongs to (if any.) | ||
* | ||
* @return The identity external id or null. | ||
* @see IIdentity | ||
*/ | ||
String getIdentityExternalId(); | ||
|
||
/** | ||
* Get the crypto address of the wallet. | ||
* | ||
* @return The crypto address of the wallet. | ||
*/ | ||
String getCryptoAddress(); | ||
|
||
/** | ||
* Get the cryptocurrency of the wallet. | ||
* | ||
* @return The cryptocurrency of the wallet. | ||
*/ | ||
String getCryptocurrency(); | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
...ava/com/generalbytes/batm/server/extensions/travelrule/IWalletTypeEvaluationProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/************************************************************************************* | ||
* Copyright (C) 2014-2024 GENERAL BYTES s.r.o. All rights reserved. | ||
* | ||
* This software may be distributed and modified under the terms of the GNU | ||
* General Public License version 2 (GPL2) as published by the Free Software | ||
* Foundation and appearing in the file GPL2.TXT included in the packaging of | ||
* this file. Please note that GPL2 Section 2[b] requires that all works based | ||
* on this software must also be made publicly available under the terms of | ||
* the GPL2 ("Copyleft"). | ||
* | ||
* Contact information | ||
* ------------------- | ||
* | ||
* GENERAL BYTES s.r.o. | ||
* Web : http://www.generalbytes.com | ||
* | ||
************************************************************************************/ | ||
|
||
package com.generalbytes.batm.server.extensions.travelrule; | ||
|
||
/** | ||
* This provider is used to evaluate the type of wallet based on its characteristics. | ||
* | ||
* @see CryptoWalletType | ||
*/ | ||
public interface IWalletTypeEvaluationProvider { | ||
|
||
/** | ||
* Attempt to evaluate the type of wallet based on the provided {@link IWalletContext}. | ||
* <p> | ||
* This method should either return {@link WalletTypeEvaluationResult#evaluated(CryptoWalletType, boolean)}, | ||
* with the respective {@link CryptoWalletType} if the wallet was successfully evaluated. | ||
* If the wallet type cannot be evaluated, it returns {@link WalletTypeEvaluationResult#unknown()}. | ||
* </p> | ||
* | ||
* @param walletContext The context containing information needed to identify the wallet type. | ||
* @return A {@link WalletTypeEvaluationResult} indicating success with the wallet type, or failure if not evaluated. | ||
*/ | ||
WalletTypeEvaluationResult evaluateWalletType(IWalletContext walletContext); | ||
|
||
} |
78 changes: 78 additions & 0 deletions
78
...n/java/com/generalbytes/batm/server/extensions/travelrule/WalletTypeEvaluationResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/************************************************************************************* | ||
* Copyright (C) 2014-2024 GENERAL BYTES s.r.o. All rights reserved. | ||
* | ||
* This software may be distributed and modified under the terms of the GNU | ||
* General Public License version 2 (GPL2) as published by the Free Software | ||
* Foundation and appearing in the file GPL2.TXT included in the packaging of | ||
* this file. Please note that GPL2 Section 2[b] requires that all works based | ||
* on this software must also be made publicly available under the terms of | ||
* the GPL2 ("Copyleft"). | ||
* | ||
* Contact information | ||
* ------------------- | ||
* | ||
* GENERAL BYTES s.r.o. | ||
* Web : http://www.generalbytes.com | ||
* | ||
************************************************************************************/ | ||
|
||
package com.generalbytes.batm.server.extensions.travelrule; | ||
|
||
/** | ||
* Represents the result of an attempt on identifying a wallet type. | ||
* | ||
* @see IWalletTypeEvaluationProvider | ||
*/ | ||
public class WalletTypeEvaluationResult { | ||
|
||
private final CryptoWalletType walletType; | ||
private final boolean belongsToIdentity; | ||
|
||
private WalletTypeEvaluationResult(CryptoWalletType walletType, boolean belongsToIdentity) { | ||
this.walletType = walletType; | ||
this.belongsToIdentity = belongsToIdentity; | ||
} | ||
|
||
/** | ||
* Get the {@link CryptoWalletType} of the identified wallet. | ||
* | ||
* @return The {@link CryptoWalletType}. | ||
*/ | ||
public CryptoWalletType getWalletType() { | ||
return walletType; | ||
} | ||
|
||
/** | ||
* @return True if the wallet belongs to the provided identity, false otherwise. | ||
*/ | ||
public boolean isBelongsToIdentity() { | ||
return belongsToIdentity; | ||
} | ||
|
||
/** | ||
* Create a {@link WalletTypeEvaluationResult} for cases where a wallet type | ||
* is successfully evaluated. | ||
* | ||
* @param walletType The {@link CryptoWalletType} of the evaluated wallet. | ||
* @param belongsToIdentity True if the wallet belongs to the provided identity, false otherwise. | ||
* @return The new {@link WalletTypeEvaluationResult}. | ||
* @throws IllegalArgumentException If the walletType is null. | ||
*/ | ||
public static WalletTypeEvaluationResult evaluated(CryptoWalletType walletType, boolean belongsToIdentity) { | ||
if (walletType == null) { | ||
throw new IllegalArgumentException("walletType cannot be null"); | ||
} | ||
return new WalletTypeEvaluationResult(walletType, belongsToIdentity); | ||
} | ||
|
||
/** | ||
* Create a {@link WalletTypeEvaluationResult} for cases where a wallet type | ||
* could not be identified and remains unknown. | ||
* | ||
* @return The new {@link WalletTypeEvaluationResult}. | ||
*/ | ||
public static WalletTypeEvaluationResult unknown() { | ||
return new WalletTypeEvaluationResult(CryptoWalletType.UNKNOWN, false); | ||
} | ||
|
||
} |