# retrieveDeviceBundle method

Future <Result<OmemoError, OmemoBundle>> retrieveDeviceBundle(

1. JID jid,
2. int deviceId

)

Retrieves a bundle from entity `jid` with the device id `deviceId`.

On success, returns the device bundle. On failure, returns an OmemoError.

## Implementation

    Future<Result<OmemoError, omemo.OmemoBundle>> retrieveDeviceBundle(
      JID jid,
      int deviceId,
    ) async {
      final pm = getAttributes().getManagerById<PubSubManager>(pubsubManager)!;
      final bareJid = jid.toBare();
      final item = await pm.getItem(bareJid, omemoBundlesXmlns, '$deviceId');
      if (item.isType<PubSubError>()) return Result(UnknownOmemoError());

      return Result(bundleFromXML(jid, deviceId, item.get<PubSubItem>().payload));
    }