Example #1
0
def idr_cache():
    cache = IdrCache("Cache", KeyValueStorageInMemory())
    cache.set("trustee_identifier",
              1,
              int(time.time()),
              role=TRUSTEE,
              verkey="trustee_identifier_verkey",
              isCommitted=False)
    cache.set("steward_identifier",
              2,
              int(time.time()),
              role=STEWARD,
              verkey="steward_identifier_verkey",
              isCommitted=False)
    cache.set("trust_anchor_identifier",
              3,
              int(time.time()),
              role=TRUST_ANCHOR,
              verkey="trust_anchor_identifier_verkey",
              isCommitted=False)
    cache.set("network_monitor_identifier",
              4,
              int(time.time()),
              role=NETWORK_MONITOR,
              verkey="network_monitor_identifier_verkey",
              isCommitted=False)
    cache.set(OTHER_IDENTIFIER,
              5,
              int(time.time()),
              role='OtherRole',
              verkey="other_verkey",
              isCommitted=False)
    return cache
Example #2
0
def idr_cache_none_role(req_auth):
    cache = IdrCache("Cache", KeyValueStorageInMemory())
    cache.set(req_auth.identifier,
              1,
              int(time.time()),
              verkey="SomeVerkey",
              isCommitted=False)
    return cache
Example #3
0
def idr_cache(identity_owners, trustees):
    cache = IdrCache("Cache",
                     KeyValueStorageInMemory())
    seq_no = 1
    for identifier in identity_owners:
        cache.set(identifier, seq_no, int(time.time()), role="",
                  verkey="owner_identifier_verkey", isCommitted=False)

    for identifier in trustees:
        cache.set(identifier, seq_no, int(time.time()), role=TRUSTEE,
                  verkey="owner_identifier_verkey", isCommitted=False)
    return cache
Example #4
0
def idr_cache(req_auth):
    cache = IdrCache("Cache", KeyValueStorageInMemory())
    cache.set(req_auth.identifier,
              1,
              int(time.time()),
              role=STEWARD,
              verkey="SomeVerkey",
              isCommitted=False),
    cache.set("some_identifier2",
              1,
              int(time.time()),
              role=STEWARD,
              verkey="SomeVerkey2",
              isCommitted=False)
    return cache
Example #5
0
def idr_cache():
    cache = IdrCache("Cache", KeyValueStorageInMemory())
    i = 0

    for id in IDENTIFIERS[TRUSTEE]:
        i += 1
        cache.set(id,
                  i,
                  int(time.time()),
                  role=TRUSTEE,
                  verkey="trustee_identifier_verkey",
                  isCommitted=False)

    for id in IDENTIFIERS[STEWARD]:
        i += 1
        cache.set(id,
                  i,
                  int(time.time()),
                  role=STEWARD,
                  verkey="steward_identifier_verkey",
                  isCommitted=False)

    for id in IDENTIFIERS[ENDORSER]:
        i += 1
        cache.set(id,
                  i,
                  int(time.time()),
                  role=ENDORSER,
                  verkey="endorser_identifier_verkey",
                  isCommitted=False)

    for id in IDENTIFIERS[NETWORK_MONITOR]:
        i += 1
        cache.set(id,
                  i,
                  int(time.time()),
                  role=NETWORK_MONITOR,
                  verkey="network_monitor_identifier_verkey",
                  isCommitted=False)

    for id in IDENTIFIERS["OtherRole"]:
        i += 1
        cache.set(id,
                  i,
                  int(time.time()),
                  role='OtherRole',
                  verkey="other_verkey",
                  isCommitted=False)

    for id in IDENTIFIERS[None]:
        i += 1
        cache.set(id,
                  i,
                  int(time.time()),
                  role=None,
                  verkey="identity_owner_verkey",
                  isCommitted=False)

    return cache
def idr_cache():
    cache = IdrCache("Cache", KeyValueStorageInMemory())
    # authors
    cache.set("author_did_no_role",
              1,
              int(time.time()),
              role=IDENTITY_OWNER,
              verkey="SomeVerkey",
              isCommitted=False)
    cache.set("author_did_trustee",
              1,
              int(time.time()),
              role=TRUSTEE,
              verkey="SomeVerkey1",
              isCommitted=False)
    cache.set("author_did_steward",
              1,
              int(time.time()),
              role=STEWARD,
              verkey="SomeVerkey2",
              isCommitted=False)
    cache.set("author_did_endorser",
              1,
              int(time.time()),
              role=ENDORSER,
              verkey="SomeVerkey3",
              isCommitted=False)
    cache.set("author_did_network_monitor",
              1,
              int(time.time()),
              role=NETWORK_MONITOR,
              verkey="SomeVerkey5",
              isCommitted=False)

    # endorsers
    cache.set("endorser_did_no_role",
              1,
              int(time.time()),
              role=IDENTITY_OWNER,
              verkey="SomeVerkey4",
              isCommitted=False)
    cache.set("endorser_did_trustee",
              1,
              int(time.time()),
              role=TRUSTEE,
              verkey="SomeVerkey1",
              isCommitted=False)
    cache.set("endorser_did_steward",
              1,
              int(time.time()),
              role=STEWARD,
              verkey="SomeVerkey2",
              isCommitted=False)
    cache.set("endorser_did_endorser",
              1,
              int(time.time()),
              role=ENDORSER,
              verkey="SomeVerkey3",
              isCommitted=False)
    cache.set("endorser_did_network_monitor",
              1,
              int(time.time()),
              role=NETWORK_MONITOR,
              verkey="SomeVerkey5",
              isCommitted=False)

    return cache