-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration test for rotating single-sig delegate identifier #160
Closed
psteniusubi
wants to merge
3
commits into
WebOfTrust:development
from
psteniusubi:feat-integration-test-singlesig-drt
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { | ||
CreateIdentiferArgs, | ||
RotateIdentifierArgs, | ||
SignifyClient, | ||
} from 'signify-ts'; | ||
import { | ||
getOrCreateClients, | ||
getOrCreateContact, | ||
getOrCreateIdentifier, | ||
} from './utils/test-setup'; | ||
import { waitOperation } from './utils/test-util'; | ||
|
||
let client1: SignifyClient, client2: SignifyClient; | ||
let name1_id: string, name1_oobi: string; | ||
let contact1_id: string; | ||
|
||
beforeAll(async () => { | ||
[client1, client2] = await getOrCreateClients(2); | ||
}); | ||
beforeAll(async () => { | ||
[name1_id, name1_oobi] = await getOrCreateIdentifier(client1, 'name1'); | ||
}); | ||
beforeAll(async () => { | ||
contact1_id = await getOrCreateContact(client2, 'contact1', name1_oobi); | ||
}); | ||
|
||
describe('singlesig-drt', () => { | ||
test('delegate1a', async () => { | ||
// delegate creates identifier without witnesses | ||
// TODO: should have witness config | ||
let kargs: CreateIdentiferArgs = { | ||
delpre: name1_id, | ||
}; | ||
let result = await client2.identifiers().create('delegate1', kargs); | ||
let op = await result.op(); | ||
let delegate1 = await client2.identifiers().get('delegate1'); | ||
expect(op.name).toEqual(`delegation.${delegate1.prefix}`); | ||
}); | ||
test('delegator1', async () => { | ||
// delegator approves delegate | ||
let delegate1 = await client2.identifiers().get('delegate1'); | ||
let seal = { | ||
i: delegate1.prefix, | ||
s: '0', | ||
d: delegate1.prefix, | ||
}; | ||
let result = await client1.identifiers().interact('name1', seal); | ||
let op = waitOperation(client1, await result.op()); | ||
}); | ||
test('delegate1b', async () => { | ||
// delegate waits for completion | ||
let delegate1 = await client2.identifiers().get('delegate1'); | ||
let op: any = { name: `delegation.${delegate1.prefix}` }; | ||
op = await waitOperation(client2, op); | ||
expect(delegate1.prefix).toEqual(op.response.i); | ||
}); | ||
// https://github.com/WebOfTrust/signify-ts/issues/159 | ||
// TODO: identifiers.rotate fails with 500 server error | ||
test('delegate1c', async () => { | ||
// delegate rotates identifier | ||
let kargs: RotateIdentifierArgs = {}; | ||
let result = await client2.identifiers().rotate('delegate1', kargs); | ||
let op = await result.op(); | ||
let delegate1 = await client2.identifiers().get('delegate1'); | ||
expect(op.name).toEqual(`delegation.${delegate1.prefix}`); | ||
op = await waitOperation(client2, op); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
rotate
method does not supportdrt
event types for delegated identifiers. It will need to be enhanced to support delegated AIDs