How to use the indy-sdk.createPairwise function in indy-sdk

To help you get started, we’ve selected a few indy-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / indy-agent / nodejs / indy / src / connections / index.js View on Github external
let theirVerKey = message.verkey;

        if (relationship.nonce !== message.nonce) {
            throw Error("NoncesDontMatch");
        } else {
            await sdk.storeTheirDid(await indy.wallet.get(), {
                did: theirDid,
                verkey: theirVerKey
            });

            let meta = JSON.stringify({
                name: relationship.name,
                alias: relationship.alias,
                theirEndpointDid: relationship.theirEndpointDid
            });
            await sdk.createPairwise(await indy.wallet.get(), theirDid, relationship.myNewDid, meta);

            // send acknowledge
            await exports.sendAcknowledgement(relationship.myNewDid, theirDid, relationship.theirEndpointDid);
            indy.store.pendingRelationships.delete(relationship.id);
        }
    }
};
github hyperledger / indy-agent / nodejs / indy / src / connections / index.js View on Github external
let [myDid, myVerkey] = await sdk.createAndStoreMyDid(await indy.wallet.get(), {});

    let theirVerkey = await sdk.keyForDid(await indy.pool.get(), await indy.wallet.get(), theirDid);

    // await sdk.storeTheirDid(await indy.wallet.get(), {
    //     did: theirDid,
    //     verkey: theirVerkey
    // });

    let meta = JSON.stringify({
        theirEndpointDid: theirEndpointDid,
        verified: false // Indicates that the owner of the agent has confirmed they want to stay connected with this person.
    });

    //FIXME: Check to see if pairwise exists
    await sdk.createPairwise(await indy.wallet.get(), theirDid, myDid, meta);

    // Send connections response
    let connectionResponse = {
        did: myDid,
        verkey: myVerkey,
        nonce: requestNonce
    };
    let message = {
        aud: theirDid,
        type: MESSAGE_TYPES.RESPONSE,
        message: await indy.crypto.anonCrypt(theirDid, JSON.stringify(connectionResponse))
    };
    return indy.crypto.sendAnonCryptedMessage(theirEndpointDid, message);
};