@celo/encrypted-backup › "schema"
Module: "schema"
Index
Variables
Functions
Variables
Const
BackupSchema
• BackupSchema: Type‹Backup, object› = t.intersection([ // Required fields t.type({ encryptedData: BufferFromBase64, nonce: BufferFromBase64, version: t.string, }), // Optional fields // https://github.com/gcanti/io-ts/blob/master/index.md#mixing-required-and-optional-props t.partial({ odisDomain: SequentialDelayDomainSchema, metadata: t.UnknownRecord, encryptedFuseKey: BufferFromBase64, computationalHardening: t.union([ t.type({ function: t.literal(ComputationalHardeningFunction.PBKDF), iterations: t.number, }), t.intersection([ t.type({ function: t.literal(ComputationalHardeningFunction.SCRYPT), cost: t.number, }), t.partial({ blockSize: t.number, parallelization: t.number, }), ]), ]), environment: t.partial({ odis: t.type({ odisUrl: t.string, odisPubKey: t.string, }), circuitBreaker: t.type({ url: t.string, publicKey: t.string, }), }), }), ])
Defined in packages/sdk/encrypted-backup/src/schema.ts:31
io-ts codec used to encode and decode backups from JSON objects
Const
BufferFromBase64
• BufferFromBase64: Type‹Buffer‹›, string, unknown› = new t.Type
Defined in packages/sdk/encrypted-backup/src/schema.ts:13
Utility type to leverage io-ts for encoding and decoding of buffers from base64 strings.
Functions
deserializeBackup
▸ deserializeBackup(data
: string): Result‹Backup, DecodeError›
Defined in packages/sdk/encrypted-backup/src/schema.ts:77
Parameters:
Name | Type |
---|---|
data |
string |
Returns: Result‹Backup, DecodeError›
serializeBackup
▸ serializeBackup(backup
: Backup): string
Defined in packages/sdk/encrypted-backup/src/schema.ts:73
Parameters:
Name | Type |
---|---|
backup |
Backup |
Returns: string