shared static method

SharedKeyBuilder shared(
  1. String key, {
  2. String? namespace,
  3. String sharedBy = '',
})

Shared Keys are shared with other atSign. The owner can see the keys on authenticated scan. The sharedWith atSign can lookup the value of the key.

Builds a sharedWith key and returns a SharedKeyBuilder. Optionally the key can be cached on the AtKey.sharedWith atSign.

Example: @bob:phone.wavi@alice.

AtKey sharedKey = (AtKey.shared('phone', 'wavi')
    ..sharedWith('@bob')).build();

To cache a key on the @bob atSign.

AtKey atKey = (AtKey.shared('phone', namespace: 'wavi', sharedBy: '@alice')
 ..sharedWith('@bob')
 ..cache(1000, true))
 .build();

Implementation

static SharedKeyBuilder shared(String key,
    {String? namespace, String sharedBy = ''}) {
  assertStartsWithAtIfNotEmpty(sharedBy);
  return SharedKeyBuilder()
    ..key(key)
    ..namespace(namespace)
    ..sharedBy(sharedBy);
}