@dsnp/graph-sdk
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -15,2 +15,3 @@ import { GraphKeyType, GraphKeyPair, DsnpKeys, ImportBundle, PageData } from "./models"; | ||
withGraphKeyPair(keyType: GraphKeyType, publicKey: Uint8Array, secretKey: Uint8Array): ImportBundleBuilder; | ||
withGraphKeyPairs(keys: GraphKeyPair[]): ImportBundleBuilder; | ||
withDsnpKeys(dsnpKeys: DsnpKeys): ImportBundleBuilder; | ||
@@ -17,0 +18,0 @@ withPageData(pageId: number, content: Uint8Array, contentHash: number): ImportBundleBuilder; |
@@ -22,2 +22,7 @@ "use strict"; | ||
} | ||
withGraphKeyPairs(keys) { | ||
const keyPairs = this.values.keyPairs ? [...this.values.keyPairs] : []; | ||
keyPairs.push(...keys); | ||
return new ImportBundleBuilder({ ...this.values, keyPairs }); | ||
} | ||
withDsnpKeys(dsnpKeys) { | ||
@@ -24,0 +29,0 @@ return new ImportBundleBuilder({ ...this.values, dsnpKeys }); |
@@ -32,3 +32,3 @@ "use strict"; | ||
.withSchemaId(schemaId) | ||
.withGraphKeyPair(models_1.GraphKeyType.X25519, new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])) | ||
.withGraphKeyPairs([{ keyType: models_1.GraphKeyType.X25519, publicKey: new Uint8Array([1, 2, 3]), secretKey: new Uint8Array([4, 5, 6]) }]) | ||
.withDsnpKeys(dsnpKeys) | ||
@@ -45,3 +45,20 @@ .withPageData(1, new Uint8Array([10, 11, 12]), 789); | ||
}); | ||
it('should build the import bundle correctly with withGraphKeyPair', () => { | ||
const dsnpUserId = "111"; | ||
const schemaId = 123; | ||
const importBundleBuilder = new import_bundle_builder_1.ImportBundleBuilder() | ||
.withDsnpUserId(dsnpUserId) | ||
.withSchemaId(schemaId) | ||
.withGraphKeyPair(models_1.GraphKeyType.X25519, new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])) | ||
.withDsnpKeys({ dsnpUserId: "111", keysHash: 456, keys: [{ index: 0, content: new Uint8Array([7, 8, 9]) }] }) | ||
.withPageData(1, new Uint8Array([10, 11, 12]), 789); | ||
(0, globals_1.expect)(importBundleBuilder.build()).toEqual({ | ||
dsnpUserId, | ||
schemaId, | ||
keyPairs: [{ keyType: models_1.GraphKeyType.X25519, publicKey: new Uint8Array([1, 2, 3]), secretKey: new Uint8Array([4, 5, 6]) }], | ||
dsnpKeys: { dsnpUserId: "111", keysHash: 456, keys: [{ index: 0, content: new Uint8Array([7, 8, 9]) }] }, | ||
pages: [{ pageId: 1, content: new Uint8Array([10, 11, 12]), contentHash: 789 }], | ||
}); | ||
}); | ||
}); | ||
//# sourceMappingURL=import-bundle-builder.spec.js.map |
{ | ||
"name": "@dsnp/graph-sdk", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"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
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
6392311
856