-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow using any user id of the key's user ids as committer identity. F…
…ixes #156
- Loading branch information
Showing
5 changed files
with
73 additions
and
33 deletions.
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
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 |
---|---|---|
|
@@ -17,8 +17,16 @@ const userInfos = [ | |
encoding: 'utf8', | ||
flag: 'r' | ||
}), | ||
name: 'Joe Tester', | ||
email: '[email protected]', | ||
primaryUserId: { | ||
name: 'Joe Tester', | ||
email: '[email protected]' | ||
}, | ||
userIds: [ | ||
{ | ||
name: 'Joe Tester', | ||
email: '[email protected]' | ||
} | ||
], | ||
keyID: '7D851EB72D73BDA0', | ||
fingerprint: '27571A53B86AF0C799B38BA77D851EB72D73BDA0', | ||
keygrip: '3E2D1142AA59E08E16B7E2C64BA6DDC773B1A627' | ||
|
@@ -37,8 +45,16 @@ const userInfos = [ | |
encoding: 'utf8', | ||
flag: 'r' | ||
}), | ||
name: 'Joe Bar', | ||
email: '[email protected]', | ||
primaryUserId: { | ||
name: 'Joe Bar', | ||
email: '[email protected]' | ||
}, | ||
userIds: [ | ||
{ | ||
name: 'Joe Bar', | ||
email: '[email protected]' | ||
} | ||
], | ||
keyID: '6071D218380FDCC8', | ||
fingerprint: '87F257B89CE462100BEC0FFE6071D218380FDCC8', | ||
keygrips: ['F5C3ABFAAB36B427FD98C4EDD0387E08EA1E8092', 'DEE0FC98F441519CA5DE5D79773CB29009695FEB'] | ||
|
@@ -52,24 +68,30 @@ for (const userInfo of userInfos) { | |
it('returns a PGP private key from an armored string', async () => { | ||
await openpgp.readPrivateKey(userInfo.pgp).then(privateKey => { | ||
expect(privateKey.keyID).toEqual(userInfo.keyID); | ||
expect(privateKey.name).toEqual(userInfo.name); | ||
expect(privateKey.email).toEqual(userInfo.email); | ||
expect(privateKey.primaryUserId.name).toEqual(userInfo.primaryUserId.name); | ||
expect(privateKey.primaryUserId.email).toEqual(userInfo.primaryUserId.email); | ||
expect(privateKey.allUserIds).toHaveLength(userInfo.userIds.length); | ||
expect(privateKey.allUserIds[0].name).toEqual(userInfo.userIds[0].name); | ||
expect(privateKey.allUserIds[0].email).toEqual(userInfo.userIds[0].email); | ||
expect(privateKey.fingerprint).toEqual(userInfo.fingerprint); | ||
}); | ||
}); | ||
it('returns a PGP private key from a base64 armored string', async () => { | ||
await openpgp.readPrivateKey(userInfo.pgp_base64).then(privateKey => { | ||
expect(privateKey.keyID).toEqual(userInfo.keyID); | ||
expect(privateKey.name).toEqual(userInfo.name); | ||
expect(privateKey.email).toEqual(userInfo.email); | ||
expect(privateKey.primaryUserId.name).toEqual(userInfo.primaryUserId.name); | ||
expect(privateKey.primaryUserId.email).toEqual(userInfo.primaryUserId.email); | ||
expect(privateKey.allUserIds).toHaveLength(userInfo.userIds.length); | ||
expect(privateKey.allUserIds[0].name).toEqual(userInfo.userIds[0].name); | ||
expect(privateKey.allUserIds[0].email).toEqual(userInfo.userIds[0].email); | ||
expect(privateKey.fingerprint).toEqual(userInfo.fingerprint); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('generateKeyPair', () => { | ||
it('generates a PGP key pair', async () => { | ||
await openpgp.generateKeyPair(userInfo.name, userInfo.email, userInfo.passphrase).then(keyPair => { | ||
await openpgp.generateKeyPair(userInfo.primaryUserId.name, userInfo.primaryUserId.email, userInfo.passphrase).then(keyPair => { | ||
expect(keyPair).not.toBeUndefined(); | ||
expect(keyPair.publicKey).not.toBeUndefined(); | ||
expect(keyPair.privateKey).not.toBeUndefined(); | ||
|
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
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
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