Filtering keys with a regex (Scan with a regex)


1 min read

Filtering keys with a regex (Scan with a regex)

Introduction The scan verb in the atPlatform is used to get all the keys present in the secondary server.

Please check the ScanVerbHandler source code to learn more about the implementation of the scan verb.

The focus of this article is to demonstrate how to filter scan verb results using a regex. Description If the regex is not specified, the scan verb will return all of the keys applicable to the person running the scan. Let's assume that an app running on the atPlatform is interested in only a subset of the keys. A regex can then be passed as part of the scan verb. When a regex is passed, the atProtocol’s secondary server ensures that only keys matching the regex are returned.

Sample Request:

scan ^@bob

This request scans all the keys which match with the regex ‘^@bob

Sample Response:


If you are using the SDK, use the following method.

await AtClientImpl.createClient('@bob', '@persona', preference);
var atClient = await AtClientImpl.getClient('@bob’);
List<AtKey> atKeys = await atClient.getAtKeys({String regex, String sharedBy, String sharedWith})

You can find the actual implementation here .

Coming Soon

We are working to make the Internet better. Please come code with us! Follow us on github and join our developer community on Discord