mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-21 16:51:59 -07:00
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
const assert = require("chai").assert
|
|
|
|
const BCHJS = require("../../../src/bch-js")
|
|
const bchjs = new BCHJS()
|
|
|
|
describe("#Encryption", () => {
|
|
describe("#getPubKey", () => {
|
|
it("should get a public key", async () => {
|
|
const addr = "bitcoincash:qpf8jv9hmqcda0502gjp7nm3g24y5h5s4unutghsxq"
|
|
|
|
const result = await bchjs.encryption.getPubKey(addr)
|
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
|
|
|
assert.property(result, "success")
|
|
assert.equal(result.success, true)
|
|
assert.property(result, "publicKey")
|
|
})
|
|
|
|
it("should report when public key can not be found", async () => {
|
|
const addr = "bitcoincash:qrgqqkky28jdkv3w0ctrah0mz3jcsnsklc34gtukrh"
|
|
|
|
const result = await bchjs.encryption.getPubKey(addr)
|
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
|
|
|
assert.property(result, "success")
|
|
assert.equal(result.success, false)
|
|
assert.property(result, "publicKey")
|
|
assert.equal(result.publicKey, "not found")
|
|
})
|
|
})
|
|
})
|