@dsnp/graph-sdk
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -23,6 +23,11 @@ "use strict"; | ||
connectionType: config_1.ConnectionType.Follow, | ||
privacyType: config_1.PrivacyType.Private, | ||
privacyType: config_1.PrivacyType.Public, | ||
}, | ||
3: { | ||
dsnpVersion: config_1.DsnpVersion.Version1_0, | ||
connectionType: config_1.ConnectionType.Follow, | ||
privacyType: config_1.PrivacyType.Private, | ||
}, | ||
4: { | ||
dsnpVersion: config_1.DsnpVersion.Version1_0, | ||
connectionType: config_1.ConnectionType.Friendship, | ||
@@ -67,5 +72,5 @@ privacyType: config_1.PrivacyType.Private, | ||
expect(config).toBeDefined(); | ||
expect(config.graphPublicKeySchemaId).toEqual(5); | ||
expect(config.graphPublicKeySchemaId).toEqual(7); | ||
const schema_id = graph.getSchemaIdFromConfig(environment, config_1.ConnectionType.Follow, config_1.PrivacyType.Public); | ||
expect(schema_id).toEqual(1); | ||
expect(schema_id).toEqual(8); | ||
graph.freeGraphState(); | ||
@@ -385,3 +390,46 @@ }); | ||
}); | ||
test("Private Graph: Import bundle without schema id and empty pages should import keys", async () => { | ||
const dsnpUserId = "1000"; | ||
const keyPair = { | ||
publicKey: Uint8Array.from(Buffer.from("e3b18e1aa5c84175ec0c516838fb89dd9c947dd348fa38fe2082764bbc82a86f", "hex")), | ||
secretKey: Uint8Array.from(Buffer.from("a55688dc2ffcf0f2b7e819029ad686a3c896c585725f5ac38dddace7de703451", "hex")), | ||
keyType: models_1.GraphKeyType.X25519, | ||
}; | ||
const keyPairs = [keyPair]; | ||
const dsnpKeys = { | ||
dsnpUserId, | ||
keysHash: 100, | ||
keys: [ | ||
{ | ||
index: 0, | ||
content: Uint8Array.from(Buffer.from('40e3b18e1aa5c84175ec0c516838fb89dd9c947dd348fa38fe2082764bbc82a86f', 'hex')), | ||
}, | ||
], | ||
}; | ||
const importBundle = { | ||
dsnpUserId, | ||
schemaId: 0, | ||
keyPairs, | ||
dsnpKeys, | ||
pages: [], | ||
}; | ||
const imported = graph.importUserData([importBundle]); | ||
expect(imported).toEqual(true); | ||
let connectionPrivate = { | ||
dsnpUserId: "1000", | ||
schemaId: 3, | ||
}; | ||
let privateConnectAction = { | ||
type: "Connect", | ||
ownerDsnpUserId: "1000", | ||
dsnpKeys, | ||
connection: connectionPrivate, | ||
}; | ||
const appliedAction = await graph.applyActions([privateConnectAction]); | ||
expect(appliedAction).toEqual(true); | ||
const exported = graph.exportUpdates(); | ||
expect(exported).toBeDefined(); | ||
expect(exported.length).toEqual(1); | ||
}); | ||
}); | ||
//# sourceMappingURL=graph.test.js.map |
{ | ||
"name": "@dsnp/graph-sdk", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"author": "Amplica Labs", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6627848
985