The Ownera sdk provides an easy to use set of APIs to work with Ownera FinP2P node for various use cases, the sdk handles most of the heavy lifting for executing operations on the FinP2P network, such as signature templates generation and signing, asset managements, escrow interface and more, creating a user with the sdk is simple as :
{
"codes": [
{
"code": "import {Sdk} from \"@owneraio/finp2p-sdk-js\";\nimport * as secp256k1 from 'secp256k1'; // this sample is using version \"^3.7.1\"\nimport * as crypto from 'crypto';\n\n\nconst sdk = new Sdk({ orgId: \"ownera\", owneraAPIAddress: \"https://example.com/\", owneraRASAddress: \"\" });\n\nexport const sign = (privKey: Buffer, hash: Buffer) => {\n const sigObj = secp256k1.sign(hash, privKey);\n return sigObj.signature.toString('hex');\n}\n\nconst {private: privateKey, public: publicKey} = createCrypto();\nexport const signingMethod = (privateKey: Buffer) => (hash: string) => Promise.resolve(sign(privateKey, Buffer.from(hash, 'hex')));\n\n(async function() {\n try {\n const user = await sdk.createUser({ withSignatureProvider: {\n publicKey: publicKey.toString('hex'),\n signingMethod: signingMethod(privateKey),\n }});\n const userData = await user.getData();\n console.log(userData);\n }catch (e) {\n console.error(e);\n }\n\n\n})();\n\nfunction createCrypto() {\n // generate private key\n let privKey;\n do {\n privKey = crypto.randomBytes(32);\n } while (!secp256k1.privateKeyVerify(privKey))\n\n // get the public key in a compressed format\n const pubKey = secp256k1.publicKeyCreate(privKey, true);\n return {private: privKey, public: pubKey};\n};",
"language": "javascript"
}
]
}
{
"title": "Create owner profile (SDK)",
"emoji": "",
"backgroundColor": "#01d7f4",
"slug": "create-owner-profile-sdk",
"_id": "689c8363862c4425037f3234",
"id": "689c8363862c4425037f3234",
"link": "https://finp2p-docs.ownera.io/v0-master/recipes/create-owner-profile-sdk",
"align": "center"
}
Get started with the Owner JavaScript sdk now:
{
"html": false,
"url": "https://www.npmjs.com/package/@owneraio/finp2p-sdk-js",
"title": "@owneraio/finp2p-sdk-js",
"favicon": "https://static.npmjs.com/da3ab40fb0861d15c83854c29f5f2962.png",
"image": "https://static.npmjs.com/338e4905a2684ca96e08c7780fc68412.png"
}
{
"type": "info",
"title": "Language support",
"body": "Currently the sdk is provided only for JavaScript, additional programming languages support is expected in the future."
}