@@ -4,8 +4,9 @@ exports.TrustedMetadataStore = void 0;
44const models_1 = require ( "@tufjs/models" ) ;
55const error_1 = require ( "./error" ) ;
66class TrustedMetadataStore {
7+ trustedSet = { } ;
8+ referenceTime ;
79 constructor ( rootData ) {
8- this . trustedSet = { } ;
910 // Client workflow 5.1: record fixed update start time
1011 this . referenceTime = new Date ( ) ;
1112 // Client workflow 5.2: load trusted root metadata
@@ -30,7 +31,9 @@ class TrustedMetadataStore {
3031 return this . trustedSet [ name ] ;
3132 }
3233 updateRoot ( bytesBuffer ) {
34+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
3335 const data = JSON . parse ( bytesBuffer . toString ( 'utf8' ) ) ;
36+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
3437 const newRoot = models_1 . Metadata . fromJSON ( models_1 . MetadataKind . Root , data ) ;
3538 if ( newRoot . signed . type != models_1 . MetadataKind . Root ) {
3639 throw new error_1 . RepositoryError ( `Expected 'root', got ${ newRoot . signed . type } ` ) ;
@@ -54,7 +57,9 @@ class TrustedMetadataStore {
5457 if ( this . root . signed . isExpired ( this . referenceTime ) ) {
5558 throw new error_1 . ExpiredMetadataError ( 'Final root.json is expired' ) ;
5659 }
60+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
5761 const data = JSON . parse ( bytesBuffer . toString ( 'utf8' ) ) ;
62+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
5863 const newTimestamp = models_1 . Metadata . fromJSON ( models_1 . MetadataKind . Timestamp , data ) ;
5964 if ( newTimestamp . signed . type != models_1 . MetadataKind . Timestamp ) {
6065 throw new error_1 . RepositoryError ( `Expected 'timestamp', got ${ newTimestamp . signed . type } ` ) ;
@@ -102,7 +107,9 @@ class TrustedMetadataStore {
102107 if ( ! trusted ) {
103108 snapshotMeta . verify ( bytesBuffer ) ;
104109 }
110+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
105111 const data = JSON . parse ( bytesBuffer . toString ( 'utf8' ) ) ;
112+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
106113 const newSnapshot = models_1 . Metadata . fromJSON ( models_1 . MetadataKind . Snapshot , data ) ;
107114 if ( newSnapshot . signed . type != models_1 . MetadataKind . Snapshot ) {
108115 throw new error_1 . RepositoryError ( `Expected 'snapshot', got ${ newSnapshot . signed . type } ` ) ;
@@ -147,7 +154,9 @@ class TrustedMetadataStore {
147154 }
148155 // Client workflow 5.6.2: check against snapshot role's targets hash
149156 meta . verify ( bytesBuffer ) ;
157+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
150158 const data = JSON . parse ( bytesBuffer . toString ( 'utf8' ) ) ;
159+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
151160 const newDelegate = models_1 . Metadata . fromJSON ( models_1 . MetadataKind . Targets , data ) ;
152161 if ( newDelegate . signed . type != models_1 . MetadataKind . Targets ) {
153162 throw new error_1 . RepositoryError ( `Expected 'targets', got ${ newDelegate . signed . type } ` ) ;
@@ -168,7 +177,9 @@ class TrustedMetadataStore {
168177 // Verifies and loads data as trusted root metadata.
169178 // Note that an expired initial root is still considered valid.
170179 loadTrustedRoot ( bytesBuffer ) {
180+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
171181 const data = JSON . parse ( bytesBuffer . toString ( 'utf8' ) ) ;
182+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
172183 const root = models_1 . Metadata . fromJSON ( models_1 . MetadataKind . Root , data ) ;
173184 if ( root . signed . type != models_1 . MetadataKind . Root ) {
174185 throw new error_1 . RepositoryError ( `Expected 'root', got ${ root . signed . type } ` ) ;
0 commit comments