static fromSharedAccessSignature()

in src/registry.ts [1637:1652]


  static fromSharedAccessSignature(value: string): Registry {
    /*Codes_SRS_NODE_IOTHUB_REGISTRY_05_011: [The `fromSharedAccessSignature` method shall throw ReferenceError if the value argument is falsy.]*/
    if (!value) throw new ReferenceError('value is \'' + value + '\'');

    /*Codes_SRS_NODE_IOTHUB_REGISTRY_05_012: [The `fromSharedAccessSignature` method shall derive and transform the needed parts from the shared access signature in order to create a `config` object for the constructor (see `SRS_NODE_IOTHUB_REGISTRY_05_001`).]*/
    const sas = SharedAccessSignature.parse(value);

    const config: Registry.TransportConfig = {
      host: sas.sr,
      sharedAccessSignature: sas.toString(),
      tokenCredential: undefined
    };

    /*Codes_SRS_NODE_IOTHUB_REGISTRY_05_013: [The fromSharedAccessSignature method shall return a new instance of the `Registry` object.]*/
    return new Registry(config);
  }