Skip to content

Adding a new UserID to existing key pair is apparently impossible. #1740

Closed Answered by larabr
Mihara asked this question in Q&A
Discussion options

You must be logged in to vote

The simplest way is to call reformatKey with the UserID you want to add.
Reformatting creates a new key object, but it will also potentially change e.g. the algo preferences, to match the values you'd get using generateKey.

If you need to preserve the original key preferences and signatures, you can take the reformatted key, and copy the new user info from there, e.g.:

const { publicKey: temporaryKeyWithNewUsers } = await reformatKey({
            privateKey: originalKey,
            userIDs: [...],
            date: originalKey.getCreationTime(),
            format: 'object',
});
originalKey.users = originalKey.users.concat(temporaryKeyWithNewUsers.users.map((newUser) => {
            const

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Mihara
Comment options

You must be logged in to vote
2 replies
@larabr
Comment options

@Mihara
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants