2020-09-17 11:38:53 +02:00
|
|
|
/*
|
|
|
|
Copyright 2020 The Matrix.org Foundation C.I.C.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
export class KeyDescription {
|
2021-10-29 15:48:28 +02:00
|
|
|
constructor(id, keyDescription) {
|
2020-09-17 11:38:53 +02:00
|
|
|
this._id = id;
|
2021-10-29 15:48:28 +02:00
|
|
|
this._keyDescription = keyDescription;
|
2020-09-17 11:38:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
get id() {
|
|
|
|
return this._id;
|
|
|
|
}
|
|
|
|
|
|
|
|
get passphraseParams() {
|
2021-10-29 15:48:28 +02:00
|
|
|
return this._keyDescription?.passphrase;
|
2020-09-17 11:38:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
get algorithm() {
|
2021-10-29 15:48:28 +02:00
|
|
|
return this._keyDescription?.algorithm;
|
2020-09-17 11:38:53 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Key {
|
|
|
|
constructor(keyDescription, binaryKey) {
|
|
|
|
this._keyDescription = keyDescription;
|
|
|
|
this._binaryKey = binaryKey;
|
|
|
|
}
|
|
|
|
|
2021-10-29 15:48:28 +02:00
|
|
|
get description() {
|
|
|
|
return this._keyDescription;
|
|
|
|
}
|
|
|
|
|
2020-09-17 11:38:53 +02:00
|
|
|
get id() {
|
|
|
|
return this._keyDescription.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
get binaryKey() {
|
|
|
|
return this._binaryKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
get algorithm() {
|
|
|
|
return this._keyDescription.algorithm;
|
|
|
|
}
|
|
|
|
}
|