コード例 #1
0
def testPKFromToDict():
    pk = PublicKey(N=cmod.integer(11),
                   Rms=cmod.integer(12),
                   Rctxt=cmod.integer(13),
                   R={'a': cmod.integer(1), 'b': cmod.integer(2)},
                   S=cmod.integer(14),
                   Z=cmod.integer(15))
    assert pk == PublicKey.fromStrDict(pk.toStrDict())
コード例 #2
0
 async def getPublicKey(self, id: ID, signatureType='CL') -> PublicKey:
     op = {
         TXN_TYPE: GET_CLAIM_DEF,
         REF: id.schemaId,
         ORIGIN: id.schemaKey.issuerId,
         SIGNATURE_TYPE: signatureType
     }
     data, seqNo = await self._sendGetReq(op)
     data = data[DATA][PRIMARY]
     pk = PublicKey.fromStrDict(data)._replace(seqId=seqNo)
     return pk
コード例 #3
0
    async def getPublicKey(self, id: ID) -> PublicKey:
        op = {
            TXN_TYPE: GET_ISSUER_KEY,
            REF: id.schemaId,
            ORIGIN: id.schemaKey.issuerId
        }

        data, seqNo = await self._sendGetReq(op)

        data = data[DATA][PRIMARY]
        pk = PublicKey.fromStrDict(data)._replace(seqId=seqNo)
        return pk
コード例 #4
0
    async def getPublicKey(self, id: ID) -> PublicKey:
        op = {
            TXN_TYPE: GET_ISSUER_KEY,
            REF: id.schemaId,
            ORIGIN: id.schemaKey.issuerId
        }

        try:
            data, seqNo = await self._sendGetReq(op)
        except TimeoutError:
            logger.error('Operation timed out {}'.format(op))
            return None

        if not data:
            return None

        data = data[DATA][PRIMARY]
        pk = PublicKey.fromStrDict(data)._replace(seqId=seqNo)
        return pk