@celo/identity › "offchain/utils"
Module: "offchain/utils"
Index
Functions
- buildEIP712TypedData
- deserialize
- readEncrypted
- resolvePath
- signBuffer
- writeEncrypted
- writeSymmetricKeys
Functions
Const
buildEIP712TypedData
▸ buildEIP712TypedData<DataType>(wrapper
: OffchainDataWrapper, path
: string, data
: DataType | Buffer, type?
: t.Type‹DataType›): Promise‹EIP712TypedData›
Defined in packages/sdk/identity/src/offchain/utils.ts:296
Type parameters:
▪ DataType
Parameters:
Name | Type |
---|---|
wrapper |
OffchainDataWrapper |
path |
string |
data |
DataType | Buffer |
type? |
t.Type‹DataType› |
Returns: Promise‹EIP712TypedData›
Const
deserialize
▸ deserialize<DataType>(type
: Type‹DataType›, buf
: Buffer): Result‹DataType, SchemaErrors›
Defined in packages/sdk/identity/src/offchain/utils.ts:279
Type parameters:
▪ DataType
Parameters:
Name | Type |
---|---|
type |
Type‹DataType› |
buf |
Buffer |
Returns: Result‹DataType, SchemaErrors›
Const
readEncrypted
▸ readEncrypted(wrapper
: OffchainDataWrapper, dataPath
: string, senderAddress
: Address): Promise‹Result‹Buffer, SchemaErrors››
Defined in packages/sdk/identity/src/offchain/utils.ts:249
Reads and decrypts a payload that has been encrypted to your data encryption key. Will resolve the symmetric key used to encrypt the payload.
Parameters:
Name | Type | Description |
---|---|---|
wrapper |
OffchainDataWrapper | the offchain data wrapper |
dataPath |
string | path to where the encrypted data is stored. Used to derive the key location |
senderAddress |
Address | the address that encrypted this key to you |
Returns: Promise‹Result‹Buffer, SchemaErrors››
resolvePath
▸ resolvePath(base
: string, path
: string): string
Defined in packages/sdk/identity/src/offchain/utils.ts:404
We want users to be able to specify a root + path as their base storage url, https://example.com/store-under/path, for example. Constructing a URL doesn't respect these paths if the appended path is absolute, so we ensure it's not and ensure the base is
Parameters:
Name | Type | Description |
---|---|---|
base |
string | root or base of the domain |
path |
string | the path to append |
Returns: string
Const
signBuffer
▸ signBuffer(wrapper
: OffchainDataWrapper, dataPath
: string, buf
: Buffer): Promise‹string›
Defined in packages/sdk/identity/src/offchain/utils.ts:353
Parameters:
Name | Type |
---|---|
wrapper |
OffchainDataWrapper |
dataPath |
string |
buf |
Buffer |
Returns: Promise‹string›
Const
writeEncrypted
▸ writeEncrypted(wrapper
: OffchainDataWrapper, dataPath
: string, data
: Buffer, toAddresses
: Address[], symmetricKey?
: Buffer): Promise‹SchemaErrors | void›
Defined in packages/sdk/identity/src/offchain/utils.ts:135
Handles encrypting the data with a symmetric key, then distributing said key to each address
in the toAddresses
array.
Parameters:
Name | Type | Description |
---|---|---|
wrapper |
OffchainDataWrapper | the offchain data wrapper |
dataPath |
string | path to where the encrypted data is stored. Used to derive the key location |
data |
Buffer | the data to encrypt |
toAddresses |
Address[] | the addresses to distribute the symmetric key to |
symmetricKey? |
Buffer | the symmetric key to use to encrypt the data. One will be found or generated if not provided |
Returns: Promise‹SchemaErrors | void›
Const
writeSymmetricKeys
▸ writeSymmetricKeys(wrapper
: OffchainDataWrapper, dataPath
: string, toAddresses
: Address[], symmetricKey?
: Buffer): Promise‹SchemaErrors | void›
Defined in packages/sdk/identity/src/offchain/utils.ts:171
Parameters:
Name | Type |
---|---|
wrapper |
OffchainDataWrapper |
dataPath |
string |
toAddresses |
Address[] |
symmetricKey? |
Buffer |
Returns: Promise‹SchemaErrors | void›