Skip to main content

Cardano Example Dapp

Encrypter Demo​

Encrypts data and exports a ready to use decrypter script

Try it online:​

Source code:​

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

This GCScript/URL is too large! make it shorter uploading parts to GCFS. Unable to generate QR code

Resources​

License​

MIT