verida-js
verida-js copied to clipboard
"RangeError: Maximum call stack size exceeded" error when an object with a null value is saved.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://saadibrah.im/schema/wallet.json",
"title": "Verida Wallet",
"titlePlural": "Wallets",
"description": "A record of a wallet",
"type": "object",
"database": {
"name": "user_wallet"
},
"allOf": [
{ "$ref": "https://core.schemas.verida.io/base/v0.1.0/schema.json" },
{
"properties": {
"mnemonic": {
"title": "Mnemonic",
"type": "string"
},
"walletType": {
"title": "Type",
"description": "Either 'multi' for standard multi chain HD wallet or 'single' for imported single chain wallet",
"type": "string"
},
"label": {
"title": "Label",
"type": "string"
},
"chain": {
"title": "Chain",
"description": "In case of a imported single chain wallet, null otherwise",
"type": "string"
},
"privateKey": {
"title": "Private Key",
"description": "In case of a single wallet is imported using privateKey",
"type": "string"
}
},
"required": ["walletType", "label"]
}
]
}
Schema in question ^
example of object being saved:
const wallet = {
walletType: 'multi',
mnemonic: '...',
privateKey: null
}
The privateKey being null crashes it, this is despite the said field not being a required field in the schema.
I have a feeling this may have to do with the type in the schema being string, and null for being a string it errors out, it works fine if you remove the key privateKey altogether