Cardano Example Dapp
Encrypter Demo
Encrypts data and exports a ready to use decrypter script
Try it online:
- Visit HTML+JS Dapp
- Visit HTML+React Dapp
- Visit Native HTML dapp
- Run Run in Wallet…Open in IDE…
Source code:
- dapp connection code: GCScript DSL
- frontend (using @gamechanger-finance/gc): HTML+JS dapp
- frontend (using @gamechanger-finance/gc): HTML+React dapp
- frontend (without official library): Native HTML dapp
Dapp code was autogenerated by Playground IDE in GameChanger Wallet
GCScript code (dapp connection):
{
"title": "Encrypter Demo",
"description": "Encrypts data and exports a ready to use decrypter script",
"type": "script",
"return": {
"mode": "last"
},
"exportAs": "DecrypterScript",
"run": {
"config": {
"type": "data",
"value": {
"useWeakPassword": true,
"defaultPassword": "1234"
}
},
"dataToEncrypt": {
"type": "data",
"value": {
"msg": "Hello world of encryption!"
}
},
"encrypt": {
"type": "encrypt",
"requirePassword": {
"kind": "modal",
"description": "A password is required to encrypt this data.\n Please override this password suggestion",
"weak": "{get('cache.config.useWeakPassword')}",
"default": "{get('cache.config.defaultPassword')}"
},
"messageHex": "{strToHex(objToJson(get('cache.dataToEncrypt')))}"
},
"scriptTemplate": {
"type": "data",
"value": {
"type": "script",
"return": {
"mode": "last"
},
"exportAs": "DecryptedData",
"run": {
"_decrypt": {
"type": "decrypt",
"requirePassword": {
"kind": "modal",
"description": "Use the previous password to decrypt the encrypted message",
"weak": "MISSING",
"default": "MISSING"
},
"encryptedMessageHex": "MISSING"
},
"decrypt": {
"type": "macro",
"run": "{jsonToObj(hexToStr(get('cache._decrypt')))}"
}
}
}
},
"finally": {
"type": "macro",
"run": "{\n set('temp',get('cache.scriptTemplate'));\n set('temp.run._decrypt.requirePassword.weak',get('cache.config.useWeakPassword'));\n set('temp.run._decrypt.requirePassword.default',get('cache.config.defaultPassword'));\n set('temp.run._decrypt.encryptedMessageHex',get('cache.encrypt'));\n return(get('global.temp'));\n }"
}
}
}
Run standalone QR dapp connection:
You can use Playground IDE in GameChanger Wallet in QR URL Transport mode to capture results
Resources
- How to connect?
- Docs and examples on Github
- GCScript documentation
- Playground IDE in GameChanger Wallet
- Tutorials on Youtube
- Support on Discord
- News on Twitter
- Website
License
MIT
