Skip to main content

Cardano Example Dapp

Password Provider Demo​

Script that will use password providers to encrypt and decrypt data using by default password a CIP8 signature with current wallet address

Try it online:​

Source code:​

Dapp code was autogenerated by Playground IDE in GameChanger Wallet

GCScript code (dapp connection):​

{
"title": "Password Provider Demo",
"description": "Script that will use password providers to encrypt and decrypt data using by default password a CIP8 signature with current wallet address",
"type": "script",
"return": {
"mode": "some",
"keys": [
"modal"
]
},
"exportAs": "PasswordProviderDemo",
"returnURLPattern": "http://localhost:3000/demo/api/dapp",
"run": {
"sealToSign": {
"type": "data",
"value": "PasswordProviderDemo"
},
"dataToEncrypt": {
"type": "data",
"value": "Hello world of encryption!"
},
"address": {
"type": "getCurrentAddress"
},
"sign": {
"type": "signDataWithAddress",
"address": "{get('cache.address')}",
"dataHex": "{strToHex(get('cache.sealToSign'))}"
},
"modal": {
"type": "script",
"return": {
"mode": "some",
"keys": [
"encrypt",
"decrypt"
]
},
"run": {
"encrypt": {
"type": "encrypt",
"requirePassword": {
"kind": "modal",
"description": "A password is required to encrypt this data.\n By default your password is a CIP8 signature\n using your current address to sign.\n\n It's recomended to accept the suggested password.",
"weak": true,
"default": "{get('cache.sign.signature')}"
},
"messageHex": "{strToHex(get('cache.dataToEncrypt'))}"
},
"_decrypt": {
"type": "decrypt",
"requirePassword": {
"kind": "modal",
"description": "Use the previous password to decrypt the encrypted message",
"weak": true,
"default": "{get('cache.sign.signature')}"
},
"encryptedMessageHex": "{get('cache.modal.encrypt')}"
},
"decrypt": {
"type": "macro",
"run": "{hexToStr(get('cache.modal._decrypt'))}"
}
}
}
}
}

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