Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased (develop)

- added: Changelly swap provider
- added: NYM swap provider (`nymswap`)
- added: Optional Bridgeless swap referral id via the `BRIDGELESS_INIT` env config, passed through to the swap plugin.
- changed: Route maestro test builds to a dedicated Zealot channel so they no longer appear in the production release list.
Expand Down
16 changes: 16 additions & 0 deletions scripts/obfuscateString.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Generates the obfuscated char-code array to paste into env.json for
// fields cleaned by asObfuscatedString.
//
// Usage:
// node -r sucrase/register scripts/obfuscateString.ts <plaintext...>

import { wasObfuscatedString } from '../src/util/cleaners/asObfuscatedString'

const plaintext = process.argv.slice(2).join(' ')

if (plaintext === '') {
console.error('Usage: obfuscateString.ts <plaintext>')
process.exit(1)
}

console.log(JSON.stringify(wasObfuscatedString(plaintext)))
1 change: 1 addition & 0 deletions src/actions/CategoriesActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ export const pluginIdIcons: Record<string, string> = {
bridgeless: EDGE_CONTENT_SERVER_URI + '/bridgeless.png',
changenow: EDGE_CONTENT_SERVER_URI + '/changenow.png',
changehero: EDGE_CONTENT_SERVER_URI + '/changehero.png',
changelly: EDGE_CONTENT_SERVER_URI + '/changelly.png',
cosmosibc: EDGE_CONTENT_SERVER_URI + '/cosmosibc.png',
exolix: EDGE_CONTENT_SERVER_URI + '/exolix-logo.png',
fantomsonicupgrade: EDGE_CONTENT_SERVER_URI + '/fantomsonicupgrade.png',
Expand Down
5 changes: 5 additions & 0 deletions src/components/modals/SwapVerifyTermsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ const pluginData: Record<string, TermsUri> = {
privacyUri: 'https://changenow.io/privacy-policy',
kycUri: 'https://changenow.io/faq/kyc'
},
changelly: {
termsUri: 'https://changelly.com/terms-of-use',
privacyUri: 'https://changelly.com/privacy-policy',
kycUri: 'https://changelly.com/aml-kyc'
},
exolix: {
termsUri: 'https://exolix.com/terms',
privacyUri: 'https://exolix.com/privacy',
Expand Down
11 changes: 11 additions & 0 deletions src/envConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { asInitOptions as asPaybisInitOptions } from './plugins/ramps/paybis/pay
import { asInitOptions as asRevolutInitOptions } from './plugins/ramps/revolut/revolutRampTypes'
import { asInitOptions as asSimplexInitOptions } from './plugins/ramps/simplex/simplexRampTypes'
import { asBase16 } from './util/cleaners/asHex'
import { asObfuscatedString } from './util/cleaners/asObfuscatedString'

function asNullable<T>(cleaner: Cleaner<T>): Cleaner<T | null> {
return function asNullable(raw) {
Expand Down Expand Up @@ -274,6 +275,16 @@ export const asEnvConfig = asObject({
apiKey: asOptional(asString, '')
}).withRest
),
CHANGELLY_INIT: asCorePluginInit(
asObject({
// Arrays of XOR-masked char codes; see asObfuscatedString.
// No fallback values: the plugin itself refuses to load when either
// member is missing, so a partial entry disables Changelly instead of
// supplying placeholder credentials.
apiKey: asOptional(asObfuscatedString),
Comment thread
peachbits marked this conversation as resolved.
partnerId: asOptional(asString)
}).withRest
),
Comment thread
cursor[bot] marked this conversation as resolved.
COREUM_INIT: asCorePluginInit(asBoolean),
COSMOSHUB_INIT: asCorePluginInit(asBoolean),
DASH_INIT: asCorePluginInit(
Expand Down
19 changes: 19 additions & 0 deletions src/util/cleaners/asObfuscatedString.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { asArray, asCodec, asNumber, uncleaner } from 'cleaners'

// XOR mask applied to each char code. Not a secret.
const MASK = 0x5a

/**
* Decodes a string stored as an array of XOR-masked char codes,
* e.g. "hi" <-> [0x32, 0x33]. Use `wasObfuscatedString` or
* scripts/obfuscateString.ts to generate the array.
*/
export const asObfuscatedString = asCodec<string>(
raw =>
asArray(asNumber)(raw)
.map(code => String.fromCharCode(code ^ MASK))
.join(''),
clean => clean.split('').map(ch => ch.charCodeAt(0) ^ MASK)
)

export const wasObfuscatedString = uncleaner(asObfuscatedString)
1 change: 1 addition & 0 deletions src/util/corePlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const swapPlugins = {
// Centralized Swaps
changehero: ENV.CHANGEHERO_INIT,
changenow: ENV.CHANGE_NOW_INIT,
changelly: ENV.CHANGELLY_INIT,
Comment thread
peachbits marked this conversation as resolved.
Comment thread
peachbits marked this conversation as resolved.
exolix: ENV.EXOLIX_INIT,
godex: ENV.GODEX_INIT,
lifi: ENV.LIFI_INIT,
Expand Down
Loading