blob: 4c6dd911e2a417040c630a4c5bcc0f340db197ff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
const CryptographyKey = require('../cryptography-key');
class Ed25519PublicKey extends CryptographyKey {
constructor(buf) {
if (buf.length !== 32) {
throw new Error('Ed25519 public keys must be 32 bytes long');
}
super(buf);
this.keyType = 'ed25519';
this.publicKey = true;
}
/**
* @return {Ed25519PublicKey}
*/
static from() {
return new Ed25519PublicKey(Buffer.from(...arguments));
}
isEd25519Key() {
return true;
}
isPublicKey() {
return true;
}
}
module.exports = Ed25519PublicKey;
|