@@ -264,28 +264,6 @@ export default class RoktManager {
264264 }
265265 }
266266
267- /**
268- * Hashes a single value using SHA-256
269- * Accepts the same types as IRoktPartnerAttributes values
270- *
271- * @param {string | number | boolean | undefined | null } attribute - The value to hash
272- * @returns {Promise<string> } The SHA-256 hex digest of the normalized value
273- *
274- */
275- public async hashSha256 ( attribute : string | number | boolean | undefined | null ) : Promise < string > {
276- try {
277- if ( attribute === undefined || attribute === null ) {
278- return Promise . reject ( new Error ( 'Value cannot be null or undefined' ) ) ;
279- }
280- const normalizedValue = String ( attribute ) . trim ( ) . toLocaleLowerCase ( ) ;
281- return await this . sha256Hex ( normalizedValue ) ;
282- } catch ( error ) {
283- const errorMessage = error instanceof Error ? error . message : String ( error ) ;
284- this . logger . error ( 'Failed hashSha256: ' + errorMessage ) ;
285- return Promise . reject ( new Error ( String ( error ) ) ) ;
286- }
287- }
288-
289267 public setExtensionData < T > ( extensionData : IRoktPartnerExtensionData < T > ) : void {
290268 if ( ! this . isReady ( ) ) {
291269 this . deferredCall < void > ( 'setExtensionData' , extensionData ) ;
@@ -312,6 +290,28 @@ export default class RoktManager {
312290 }
313291 }
314292
293+ /**
294+ * Hashes an attribute using SHA-256
295+ *
296+ * @param {string | number | boolean | undefined | null } attribute - The value to hash
297+ * @returns {Promise<string> } The SHA-256 hex digest of the normalized value
298+ *
299+ */
300+ public async hashSha256 ( attribute : string | number | boolean | undefined | null ) : Promise < string > {
301+ if ( attribute === undefined || attribute === null ) {
302+ throw new Error ( 'Value cannot be null or undefined' ) ;
303+ }
304+
305+ try {
306+ const normalizedValue = String ( attribute ) . trim ( ) . toLocaleLowerCase ( ) ;
307+ return await this . sha256Hex ( normalizedValue ) ;
308+ } catch ( error ) {
309+ const errorMessage = error instanceof Error ? error . message : String ( error ) ;
310+ this . logger . error ( 'Failed hashSha256: ' + errorMessage ) ;
311+ throw error ;
312+ }
313+ }
314+
315315 public getLocalSessionAttributes ( ) : LocalSessionAttributes {
316316 return this . store . getLocalSessionAttributes ( ) ;
317317 }
0 commit comments