ixo KeySafe

Keysafe Browser Extension API

When the keysafe extension operates through the browser window object. This can be accessed as follows:
1
const IxoInpageProvider = window['ixoKs'];
2
let keysafe = new IxoInpageProvider();
Copied!

Information Functions

Get User Information

Returns a javascript object containing a user name and associated DID Document from the keysafe local store.
Request:
1
keysafe.getInfo().then((error, result) => {
2
if (result) {
3
console.log('User Info: ' + result)
4
} else {
5
console.log(error)
6
}
7
})
Copied!
Response:
1
{
2
name: "John",
3
didDoc: {
4
"did": "did.ixo.EvBFmtyRaBuMNMnwjHNVgn",
5
"pubKey": "8awT75ZgZttei45J52bcXC2q8isMRATLcdgbmx4FHyFf"
6
}
7
}
Copied!

Get User DID Doc

Returns a javascript object containing the user's DID Doc from the local store.
Request:
1
keysafe.getDidDoc().then((error, result) => {
2
if (result) {
3
console.log('User DID Doc: ' + result)
4
} else {
5
console.log(error)
6
}
7
})
Copied!
Response:
1
{
2
"did": "did:ixo:2HQrdvfjqZwRQCapLDPZzY",
3
"pubKey": "hZHiC5kPgiADRXnuiktvmsNSPH1D4c96NxMSjjNLVTY",
4
}
Copied!

Signing Functions

Request Signing

Request the user to sign some data using their keys in the keysafe wallet.
1
keysafe.requestSigning(JSON.stringify(data), (error, signature) => {
2
if (!error) {
3
console.log("Signature: " + signature);
4
} else {
5
console.log(error);
6
}
7
});
Copied!
Response:
A011D11A2D91A9CB03ECFFB7D9AFC1001DB56B3DABF42BDD0F4D00352A9B8E0E73E85F0B4586DA2934696C0A78602EEB047EA6B3D9096C1A0C3FB144E6A51C09
Last modified 2mo ago