Skip to content

Commit

Permalink
add a test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Feb 2, 2024
1 parent 8f6737b commit dee03d0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions example/src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ test('canMessage', async () => {
return canMessage
})

test('fetch a public key bundle and sign a digest', async () => {
const bob = await Client.createRandom({ env: 'local' })
const bytes = new Uint8Array([1, 2, 3])
const signature = await bob.sign(bytes, { kind: 'identity' })
if (signature.length === 0) {
throw new Error('signature was not returned')
}
const keyBundle = await bob.exportPublicKeyBundle()
if (keyBundle.length === 0) {
throw new Error('key bundle was not returned')
}
return true
})

test('createFromKeyBundle throws error for non string value', async () => {
try {
const bytes = [1, 2, 3]
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export async function sign(
clientAddress: string,
digest: Uint8Array,
keyType: string,
preKeyIndex?: number | 0
preKeyIndex: number = 0
): Promise<Uint8Array> {
const signatureArray = await XMTPModule.sign(
clientAddress,
Expand Down

0 comments on commit dee03d0

Please sign in to comment.