1. Docs

Search

The IronWeb SDK search namespace provides methods to create and manage encrypted blind search indexes. This provides the ability to index and search over encrypted data without having to decrypt the data first. Indexes are encrypted to a specific group so that every member of the group has the ability to initialize the search index and query against it.

Note: The SDK must be initialized before these methods can be called.

search.createBlindSearchIndex()

IronWeb.search.createBlindSearchIndex(groupId)

Creates a new encrypted blind search index that is accessible to members of the provided group.

Parameters

Parameter Name Value Description
groupID string The ID of the group to which the search index is encrypted. Only members of this group can utilize this search index.

Response

Returns a Promise which resolves with the newly created search index. The two fields of this search index must be stored and made available to users later, as they will need them to initialize and use the index.

JSON
{ "searchIndexEncryptedSalt": Uint8Array, "searchIndexEdeks": Uint8Array }

search.initializeBlindSearchIndex()

IronWeb.search.initializeBlindSearchIndex(index)

Initialize an existing blind search index. Takes the result of the createBlindSearchIndex() call and returns an InitializedSearchIndex instance that can be used for indexing or querying data.

Parameters

Parameter Name Value Description
index.searchIndexEncryptedSalt Uint8Array Encrypted search index salt that was returned from createBlindSearchIndex() call.
index.searchIndexEdeks Uint8Array EDEKs that can decrypt the encrypted search index salt - also returned from createBlindSearchIndex() call.

Response

Returns a Promise which resolves with an InitializedSearchIndex instance which has methods for tokenization shown below.

InitializedSearchIndex.tokenizeData()

InitializedSearchIndex.tokenizeData(data, partitionId)

Generate the list of tokens that are the entry in the search index that represents the provided data. This function will also return some random values in the result, which will make it harder for someone to determine what the input was. Because of this, calling this function with a string will not be return the same list of tokens as calling tokenizeQuery() with the same string, but tokenizeQuery() will always return a subset of the values returned by tokenizeData().

Parameters

Parameter Name Value Description
data string The string you want to tokenize
partitionId string An extra string used to segregate the data into different partitions. The partition is used when generating the tokens, so that the same string indexed in two different partitions produces a different set of tokens.

Response

Returns a Promise which resolves with an Uint32Array which is a list of tokens for the provided data input. This function will also return some random values in the result, which will make it harder for someone to know what the input was.

InitializedSearchIndex.tokenizeQuery()

InitializedSearchIndex.tokenizeQuery(query, partitionId)

Generate the list of tokens to use to find entries that match the search query, given the specified partitionId.

Parameters

Parameter Name Value Description
query string The string you want to tokenize
partitionId string An extra string used to segregate the data into different partitions. The partition is used when generating the tokens, so that the same string indexed in two different partitions produces a different set of tokens.

Response

Returns a Promise which resolves with an Uint32Array which is a list of tokens for the provided query input.

Was this page helpful?