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:
- 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": "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
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
